PageSourceSearch

https://tenwells.web.app/assets/index-CAJVd7jG.js

js tenwells.web.app collected 2026-10-03 12:37:34 UTC 827,999 bytes, 3,764 lines download raw bytes

vendor: 5,323 bytes, lines 1-9
1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();function KT(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yv={exports:{}},yc={},Xv={exports:{}},de={};/**
2 * @license React
3 * react.production.min.js
4 *
5 * Copyright (c) Facebook, Inc. and its affiliates.
6 *
7 * This source code is licensed under the MIT license found in the
8 * LICENSE file in the root directory of this source tree.
9 */var Ua=Symbol.for("react.element"),QT=Symbol.for("react.portal"),YT=Symbol.for("react.fragment"),XT=Symbol.for("react.strict_mode"),JT=Symbol.for("react.profiler"),ZT=Symbol.for("react.provider"),eI=Symbol.for("react.context"),tI=Symbol.for("react.forward_ref"),nI=Symbol.for("react.suspense"),rI=Symbol.for("react.memo"),sI=Symbol.for("react.lazy"),Hg=Symbol.iterator;function iI(t){return t===null||typeof t!="object"?null:(t=Hg&&t[Hg]||t["@@iterator"],typeof t=="function"?t:null)}var Jv={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Zv=Object.assign,e_={};function qi(t,e,n){this.props=t,this.context=e,this.refs=e_,this.updater=n||Jv}qi.prototype.isReactComponent={};qi.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")};qi.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function t_(){}t_.prototype=qi.prototype;function zf(t,e,n){this.props=t,this.context=e,this.refs=e_,this.updater=n||Jv}var Hf=zf.prototype=new t_;Hf.constructor=zf;Zv(Hf,qi.prototype);Hf.isPureReactComponent=!0;var Wg=Array.isArray,n_=Object.prototype.hasOwnProperty,Wf={current:null},r_={key:!0,ref:!0,__self:!0,__source:!0};function s_(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)n_.call(e,r)&&!r_.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var u=Array(l),h=0;h<l;h++)u[h]=arguments[h+2];s.children=u}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:Ua,type:t,key:i,ref:o,props:s,_owner:Wf.current}}function oI(t,e){return{$$typeof:Ua,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function qf(t){return typeof t=="object"&&t!==null&&t.$$typeof===Ua}function aI(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var qg=/\/+/g;function Nh(t,e){return typeof t=="object"&&t!==null&&t.key!=null?aI(""+t.key):e.toString(36)}function Xl(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case Ua:case QT:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+Nh(o,0):r,Wg(s)?(n="",t!=null&&(n=t.replace(qg,"$&/")+"/"),Xl(s,e,n,"",function(h){return h})):s!=null&&(qf(s)&&(s=oI(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(qg,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",Wg(t))for(var l=0;l<t.length;l++){i=t[l];var u=r+Nh(i,l);o+=Xl(i,e,n,u,s)}else if(u=iI(t),typeof u=="function")for(t=u.call(t),l=0;!(i=t.next()).done;)i=i.value,u=r+Nh(i,l++),o+=Xl(i,e,n,u,s);else if(i==="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 El(t,e,n){if(t==null)return t;var r=[],s=0;return Xl(t,r,"","",function(i){return e.call(n,i,s++)}),r}function lI(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 Ct={current:null},Jl={transition:null},uI={ReactCurrentDispatcher:Ct,ReactCurrentBatchConfig:Jl,ReactCurrentOwner:Wf};function i_(){throw Error("act(...) is not supported in production builds of React.")}de.Children={map:El,forEach:function(t,e,n){El(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return El(t,function(){e++}),e},toArray:function(t){return El(t,function(e){return e})||[]},only:function(t){if(!qf(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};de.Component=qi;de.Fragment=YT;de.Profiler=JT;de.PureComponent=zf;de.StrictMode=XT;de.Suspense=nI;
vendor: 9,010 bytes, lines 9-33
9de.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=uI;de.act=i_;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=Zv({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=Wf.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(u in e)n_.call(e,u)&&!r_.hasOwnProperty(u)&&(r[u]=e[u]===void 0&&l!==void 0?l[u]:e[u])}var u=arguments.length-2;if(u===1)r.children=n;else if(1<u){l=Array(u);for(var h=0;h<u;h++)l[h]=arguments[h+2];r.children=l}return{$$typeof:Ua,type:t.type,key:s,ref:i,props:r,_owner:o}};de.createContext=function(t){return t={$$typeof:eI,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:ZT,_context:t},t.Consumer=t};de.createElement=s_;de.createFactory=function(t){var e=s_.bind(null,t);return e.type=t,e};de.createRef=function(){return{current:null}};de.forwardRef=function(t){return{$$typeof:tI,render:t}};de.isValidElement=qf;de.lazy=function(t){return{$$typeof:sI,_payload:{_status:-1,_result:t},_init:lI}};de.memo=function(t,e){return{$$typeof:rI,type:t,compare:e===void 0?null:e}};de.startTransition=function(t){var e=Jl.transition;Jl.transition={};try{t()}finally{Jl.transition=e}};de.unstable_act=i_;de.useCallback=function(t,e){return Ct.current.useCallback(t,e)};de.useContext=function(t){return Ct.current.useContext(t)};de.useDebugValue=function(){};de.useDeferredValue=function(t){return Ct.current.useDeferredValue(t)};de.useEffect=function(t,e){return Ct.current.useEffect(t,e)};de.useId=function(){return Ct.current.useId()};de.useImperativeHandle=function(t,e,n){return Ct.current.useImperativeHandle(t,e,n)};de.useInsertionEffect=function(t,e){return Ct.current.useInsertionEffect(t,e)};de.useLayoutEffect=function(t,e){return Ct.current.useLayoutEffect(t,e)};de.useMemo=function(t,e){return Ct.current.useMemo(t,e)};de.useReducer=function(t,e,n){return Ct.current.useReducer(t,e,n)};de.useRef=function(t){return Ct.current.useRef(t)};de.useState=function(t){return Ct.current.useState(t)};de.useSyncExternalStore=function(t,e,n){return Ct.current.useSyncExternalStore(t,e,n)};de.useTransition=function(){return Ct.current.useTransition()};de.version="18.3.1";Xv.exports=de;var C=Xv.exports;const cI=KT(C);/**
10 * @license React
11 * react-jsx-runtime.production.min.js
12 *
13 * Copyright (c) Facebook, Inc. and its affiliates.
14 *
15 * This source code is licensed under the MIT license found in the
16 * LICENSE file in the root directory of this source tree.
17 */var hI=C,dI=Symbol.for("react.element"),fI=Symbol.for("react.fragment"),pI=Object.prototype.hasOwnProperty,mI=hI.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,gI={key:!0,ref:!0,__self:!0,__source:!0};function o_(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)pI.call(e,r)&&!gI.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:dI,type:t,key:i,ref:o,props:s,_owner:mI.current}}yc.Fragment=fI;yc.jsx=o_;yc.jsxs=o_;Yv.exports=yc;var c=Yv.exports,wd={},a_={exports:{}},qt={},l_={exports:{}},u_={};/**
18 * @license React
19 * scheduler.production.min.js
20 *
21 * Copyright (c) Facebook, Inc. and its affiliates.
22 *
23 * This source code is licensed under the MIT license found in the
24 * LICENSE file in the root directory of this source tree.
25 */(function(t){function e(F,B){var W=F.length;F.push(B);e:for(;0<W;){var Y=W-1>>>1,oe=F[Y];if(0<s(oe,B))F[Y]=B,F[W]=oe,W=Y;else break e}}function n(F){return F.length===0?null:F[0]}function r(F){if(F.length===0)return null;var B=F[0],W=F.pop();if(W!==B){F[0]=W;e:for(var Y=0,oe=F.length,be=oe>>>1;Y<be;){var Se=2*(Y+1)-1,Et=F[Se],Vt=Se+1,En=F[Vt];if(0>s(Et,W))Vt<oe&&0>s(En,Et)?(F[Y]=En,F[Vt]=W,Y=Vt):(F[Y]=Et,F[Se]=W,Y=Se);else if(Vt<oe&&0>s(En,W))F[Y]=En,F[Vt]=W,Y=Vt;else break e}}return B}function s(F,B){var W=F.sortIndex-B.sortIndex;return W!==0?W:F.id-B.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var u=[],h=[],f=1,p=null,g=3,E=!1,N=!1,A=!1,P=typeof setTimeout=="function"?setTimeout:null,_=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 S(F){for(var B=n(h);B!==null;){if(B.callback===null)r(h);else if(B.startTime<=F)r(h),B.sortIndex=B.expirationTime,e(u,B);else break;B=n(h)}}function j(F){if(A=!1,S(F),!N)if(n(u)!==null)N=!0,G(V);else{var B=n(h);B!==null&&Q(j,B.startTime-F)}}function V(F,B){N=!1,A&&(A=!1,_(y),y=-1),E=!0;var W=g;try{for(S(B),p=n(u);p!==null&&(!(p.expirationTime>B)||F&&!R());){var Y=p.callback;if(typeof Y=="function"){p.callback=null,g=p.priorityLevel;var oe=Y(p.expirationTime<=B);B=t.unstable_now(),typeof oe=="function"?p.callback=oe:p===n(u)&&r(u),S(B)}else r(u);p=n(u)}if(p!==null)var be=!0;else{var Se=n(h);Se!==null&&Q(j,Se.startTime-B),be=!1}return be}finally{p=null,g=W,E=!1}}var M=!1,T=null,y=-1,I=5,k=-1;function R(){return!(t.unstable_now()-k<I)}function b(){if(T!==null){var F=t.unstable_now();k=F;var B=!0;try{B=T(!0,F)}finally{B?v():(M=!1,T=null)}}else M=!1}var v;if(typeof w=="function")v=function(){w(b)};else if(typeof MessageChannel<"u"){var U=new MessageChannel,O=U.port2;U.port1.onmessage=b,v=function(){O.postMessage(null)}}else v=function(){P(b,0)};function G(F){T=F,M||(M=!0,v())}function Q(F,B){y=P(function(){F(t.unstable_now())},B)}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(F){F.callback=null},t.unstable_continueExecution=function(){N||E||(N=!0,G(V))},t.unstable_forceFrameRate=function(F){0>F||125<F?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<F?Math.floor(1e3/F):5},t.unstable_getCurrentPriorityLevel=function(){return g},t.unstable_getFirstCallbackNode=function(){return n(u)},t.unstable_next=function(F){switch(g){case 1:case 2:case 3:var B=3;break;default:B=g}var W=g;g=B;try{return F()}finally{g=W}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(F,B){switch(F){case 1:case 2:case 3:case 4:case 5:break;default:F=3}var W=g;g=F;try{return B()}finally{g=W}},t.unstable_scheduleCallback=function(F,B,W){var Y=t.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?Y+W:Y):W=Y,F){case 1:var oe=-1;break;case 2:oe=250;break;case 5:oe=1073741823;break;case 4:oe=1e4;break;default:oe=5e3}return oe=W+oe,F={id:f++,callback:B,priorityLevel:F,startTime:W,expirationTime:oe,sortIndex:-1},W>Y?(F.sortIndex=W,e(h,F),n(u)===null&&F===n(h)&&(A?(_(y),y=-1):A=!0,Q(j,W-Y))):(F.sortIndex=oe,e(u,F),N||E||(N=!0,G(V))),F},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(F){var B=g;return function(){var W=g;g=B;try{return F.apply(this,arguments)}finally{g=W}}}})(u_);l_.exports=u_;var yI=l_.exports;/**
26 * @license React
27 * react-dom.production.min.js
28 *
29 * Copyright (c) Facebook, Inc. and its affiliates.
30 *
31 * This source code is licensed under the MIT license found in the
32 * LICENSE file in the root directory of this source tree.
33 */var vI=C,Wt=yI;function q(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 c_=new Set,ha={};function Bs(t,e){ki(t,e),ki(t+"Capture",e)}function ki(t,e){for(ha[t]=e,t=0;t<e.length;t++)c_.add(e[t])}var tr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),xd=Object.prototype.hasOwnProperty,_I=/^[: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]*$/,Gg={},Kg={};function wI(t){return xd.call(Kg,t)?!0:xd.call(Gg,t)?!1:_I.test(t)?Kg[t]=!0:(Gg[t]=!0,!1)}function xI(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 EI(t,e,n,r){if(e===null||typeof e>"u"||xI(t,e,n,r))return!0;
vendor: 5,200 bytes, lines 33-34
33if(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 kt(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var ht={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){ht[t]=new kt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];ht[e]=new kt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){ht[t]=new kt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){ht[t]=new kt(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){ht[t]=new kt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){ht[t]=new kt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){ht[t]=new kt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){ht[t]=new kt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){ht[t]=new kt(t,5,!1,t.toLowerCase(),null,!1,!1)});var Gf=/[\-:]([a-z])/g;function Kf(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(Gf,Kf);ht[e]=new kt(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(Gf,Kf);ht[e]=new kt(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(Gf,Kf);ht[e]=new kt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){ht[t]=new kt(t,1,!1,t.toLowerCase(),null,!1,!1)});ht.xlinkHref=new kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){ht[t]=new kt(t,1,!1,t.toLowerCase(),null,!0,!0)});function Qf(t,e,n,r){var s=ht.hasOwnProperty(e)?ht[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(EI(e,n,s,r)&&(n=null),r||s===null?wI(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var hr=vI.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Tl=Symbol.for("react.element"),si=Symbol.for("react.portal"),ii=Symbol.for("react.fragment"),Yf=Symbol.for("react.strict_mode"),Ed=Symbol.for("react.profiler"),h_=Symbol.for("react.provider"),d_=Symbol.for("react.context"),Xf=Symbol.for("react.forward_ref"),Td=Symbol.for("react.suspense"),Id=Symbol.for("react.suspense_list"),Jf=Symbol.for("react.memo"),xr=Symbol.for("react.lazy"),f_=Symbol.for("react.offscreen"),Qg=Symbol.iterator;function Co(t){return t===null||typeof t!="object"?null:(t=Qg&&t[Qg]||t["@@iterator"],typeof t=="function"?t:null)}var Ve=Object.assign,Rh;function Mo(t){if(Rh===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Rh=e&&e[1]||""}return`
34`+Rh+t}var Ah=!1;function Ph(t,e){if(!t||Ah)return"";Ah=!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(h){var r=h}Reflect.construct(t,[],e)}else{try{e.call()}catch(h){r=h}t.call(e.prototype)}else{try{throw Error()}catch(h){r=h}t()}}
vendor: 16,737 bytes, lines 34-37
34catch(h){if(h&&r&&typeof h.stack=="string"){for(var s=h.stack.split(`
35`),i=r.stack.split(`
36`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var u=`
37`+s[o].replace(" at new "," at ");return t.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",t.displayName)),u}while(1<=o&&0<=l);break}}}finally{Ah=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?Mo(t):""}function TI(t){switch(t.tag){case 5:return Mo(t.type);case 16:return Mo("Lazy");case 13:return Mo("Suspense");case 19:return Mo("SuspenseList");case 0:case 2:case 15:return t=Ph(t.type,!1),t;case 11:return t=Ph(t.type.render,!1),t;case 1:return t=Ph(t.type,!0),t;default:return""}}function bd(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 ii:return"Fragment";case si:return"Portal";case Ed:return"Profiler";case Yf:return"StrictMode";case Td:return"Suspense";case Id:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case d_:return(t.displayName||"Context")+".Consumer";case h_:return(t._context.displayName||"Context")+".Provider";case Xf:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Jf:return e=t.displayName||null,e!==null?e:bd(t.type)||"Memo";case xr:e=t._payload,t=t._init;try{return bd(t(e))}catch{}}return null}function II(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 bd(e);case 8:return e===Yf?"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 Kr(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function p_(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function bI(t){var e=p_(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 s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.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 Il(t){t._valueTracker||(t._valueTracker=bI(t))}function m_(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=p_(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function xu(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 Sd(t,e){var n=e.checked;return Ve({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function Yg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Kr(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 g_(t,e){e=e.checked,e!=null&&Qf(t,"checked",e,!1)}function Cd(t,e){g_(t,e);var n=Kr(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")?kd(t,e.type,n):e.hasOwnProperty("defaultValue")&&kd(t,e.type,Kr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Xg(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 kd(t,e,n){(e!=="number"||xu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Fo=Array.isArray;function yi(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+Kr(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function Nd(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(q(91));return Ve({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Jg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(q(92));if(Fo(n)){if(1<n.length)throw Error(q(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:Kr(n)}}function y_(t,e){var n=Kr(e.value),r=Kr(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 Zg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function v_(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 Rd(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?v_(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var bl,__=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(bl=bl||document.createElement("div"),bl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=bl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function da(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ko={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},SI=["Webkit","ms","Moz","O"];Object.keys(Ko).forEach(function(t){SI.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ko[e]=Ko[t]})});function w_(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ko.hasOwnProperty(t)&&Ko[t]?(""+e).trim():e+"px"}function x_(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=w_(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var CI=Ve({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 Ad(t,e){if(e){if(CI[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(q(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(q(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(q(61))}if(e.style!=null&&typeof e.style!="object")throw Error(q(62))}}function Pd(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 jd=null;function Zf(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Dd=null,vi=null,_i=null;function ey(t){if(t=za(t)){if(typeof Dd!="function")throw Error(q(280));var e=t.stateNode;e&&(e=Ec(e),Dd(t.stateNode,t.type,e))}}function E_(t){vi?_i?_i.push(t):_i=[t]:vi=t}function T_(){if(vi){var t=vi,e=_i;if(_i=vi=null,ey(t),e)for(t=0;t<e.length;t++)ey(e[t])}}function I_(t,e){return t(e)}function b_(){}var jh=!1;function S_(t,e,n){if(jh)return t(e,n);jh=!0;try{return I_(t,e,n)}finally{jh=!1,(vi!==null||_i!==null)&&(b_(),T_())}}function fa(t,e){var n=t.stateNode;if(n===null)return null;var r=Ec(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(q(231,e,typeof n));return n}var Od=!1;if(tr)try{var ko={};Object.defineProperty(ko,"passive",{get:function(){Od=!0}}),window.addEventListener("test",ko,ko),window.removeEventListener("test",ko,ko)}catch{Od=!1}function kI(t,e,n,r,s,i,o,l,u){var h=Array.prototype.slice.call(arguments,3);try{e.apply(n,h)}catch(f){this.onError(f)}}var Qo=!1,Eu=null,Tu=!1,Ld=null,NI={onError:function(t){Qo=!0,Eu=t}};function RI(t,e,n,r,s,i,o,l,u){Qo=!1,Eu=null,kI.apply(NI,arguments)}function AI(t,e,n,r,s,i,o,l,u){if(RI.apply(this,arguments),Qo){if(Qo){var h=Eu;Qo=!1,Eu=null}else throw Error(q(198));Tu||(Tu=!0,Ld=h)}}function zs(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 C_(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 ty(t){if(zs(t)!==t)throw Error(q(188))}function PI(t){var e=t.alternate;if(!e){if(e=zs(t),e===null)throw Error(q(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return ty(s),t;if(i===r)return ty(s),e;i=i.sibling}throw Error(q(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(q(189))}}if(n.alternate!==r)throw Error(q(190))}if(n.tag!==3)throw Error(q(188));return n.stateNode.current===n?t:e}function k_(t){return t=PI(t),t!==null?N_(t):null}function N_(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=N_(t);if(e!==null)return e;t=t.sibling}return null}var R_=Wt.unstable_scheduleCallback,ny=Wt.unstable_cancelCallback,jI=Wt.unstable_shouldYield,DI=Wt.unstable_requestPaint,Ge=Wt.unstable_now,OI=Wt.unstable_getCurrentPriorityLevel,ep=Wt.unstable_ImmediatePriority,A_=Wt.unstable_UserBlockingPriority,Iu=Wt.unstable_NormalPriority,LI=Wt.unstable_LowPriority,P_=Wt.unstable_IdlePriority,vc=null,jn=null;function VI(t){if(jn&&typeof jn.onCommitFiberRoot=="function")try{jn.onCommitFiberRoot(vc,t,void 0,(t.current.flags&128)===128)}catch{}}var pn=Math.clz32?Math.clz32:UI,MI=Math.log,FI=Math.LN2;function UI(t){return t>>>=0,t===0?32:31-(MI(t)/FI|0)|0}var Sl=64,Cl=4194304;function Uo(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 bu(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=Uo(l):(i&=o,i!==0&&(r=Uo(i)))}else o=n&~s,o!==0?r=Uo(o):i!==0&&(r=Uo(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&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-pn(e),s=1<<n,r|=t[n],e&=~s;return r}function $I(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 BI(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-pn(i),l=1<<o,u=s[o];u===-1?(!(l&n)||l&r)&&(s[o]=$I(l,e)):u<=e&&(t.expiredLanes|=l),i&=~l}}function Vd(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function j_(){var t=Sl;return Sl<<=1,!(Sl&4194240)&&(Sl=64),t}function Dh(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function $a(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-pn(e),t[e]=n}function zI(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 s=31-pn(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function tp(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-pn(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var xe=0;function D_(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var O_,np,L_,V_,M_,Md=!1,kl=[],jr=null,Dr=null,Or=null,pa=new Map,ma=new Map,Tr=[],HI="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 ry(t,e){switch(t){case"focusin":case"focusout":jr=null;break;case"dragenter":case"dragleave":Dr=null;break;case"mouseover":case"mouseout":Or=null;break;case"pointerover":case"pointerout":pa.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":ma.delete(e.pointerId)}}function No(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=za(e),e!==null&&np(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function WI(t,e,n,r,s){switch(e){case"focusin":return jr=No(jr,t,e,n,r,s),!0;case"dragenter":return Dr=No(Dr,t,e,n,r,s),!0;case"mouseover":return Or=No(Or,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return pa.set(i,No(pa.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,ma.set(i,No(ma.get(i)||null,t,e,n,r,s)),!0}return!1}function F_(t){var e=ws(t.target);if(e!==null){var n=zs(e);if(n!==null){if(e=n.tag,e===13){if(e=C_(n),e!==null){t.blockedOn=e,M_(t.priority,function(){L_(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 Zl(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Fd(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);jd=r,n.target.dispatchEvent(r),jd=null}else return e=za(n),e!==null&&np(e),t.blockedOn=n,!1;e.shift()}return!0}function sy(t,e,n){Zl(t)&&n.delete(e)}function qI(){Md=!1,jr!==null&&Zl(jr)&&(jr=null),Dr!==null&&Zl(Dr)&&(Dr=null),Or!==null&&Zl(Or)&&(Or=null),pa.forEac
vendor: 9,291 bytes, line 37
37h(sy),ma.forEach(sy)}function Ro(t,e){t.blockedOn===e&&(t.blockedOn=null,Md||(Md=!0,Wt.unstable_scheduleCallback(Wt.unstable_NormalPriority,qI)))}function ga(t){function e(s){return Ro(s,t)}if(0<kl.length){Ro(kl[0],t);for(var n=1;n<kl.length;n++){var r=kl[n];r.blockedOn===t&&(r.blockedOn=null)}}for(jr!==null&&Ro(jr,t),Dr!==null&&Ro(Dr,t),Or!==null&&Ro(Or,t),pa.forEach(e),ma.forEach(e),n=0;n<Tr.length;n++)r=Tr[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Tr.length&&(n=Tr[0],n.blockedOn===null);)F_(n),n.blockedOn===null&&Tr.shift()}var wi=hr.ReactCurrentBatchConfig,Su=!0;function GI(t,e,n,r){var s=xe,i=wi.transition;wi.transition=null;try{xe=1,rp(t,e,n,r)}finally{xe=s,wi.transition=i}}function KI(t,e,n,r){var s=xe,i=wi.transition;wi.transition=null;try{xe=4,rp(t,e,n,r)}finally{xe=s,wi.transition=i}}function rp(t,e,n,r){if(Su){var s=Fd(t,e,n,r);if(s===null)Hh(t,e,r,Cu,n),ry(t,r);else if(WI(s,t,e,n,r))r.stopPropagation();else if(ry(t,r),e&4&&-1<HI.indexOf(t)){for(;s!==null;){var i=za(s);if(i!==null&&O_(i),i=Fd(t,e,n,r),i===null&&Hh(t,e,r,Cu,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Hh(t,e,r,null,n)}}var Cu=null;function Fd(t,e,n,r){if(Cu=null,t=Zf(r),t=ws(t),t!==null)if(e=zs(t),e===null)t=null;else if(n=e.tag,n===13){if(t=C_(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 Cu=t,null}function U_(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(OI()){case ep:return 1;case A_:return 4;case Iu:case LI:return 16;case P_:return 536870912;default:return 16}default:return 16}}var Rr=null,sp=null,eu=null;function $_(){if(eu)return eu;var t,e=sp,n=e.length,r,s="value"in Rr?Rr.value:Rr.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return eu=s.slice(t,1<r?1-r:void 0)}function tu(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 Nl(){return!0}function iy(){return!1}function Gt(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Nl:iy,this.isPropagationStopped=iy,this}return Ve(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=Nl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Nl)},persist:function(){},isPersistent:Nl}),e}var Gi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},ip=Gt(Gi),Ba=Ve({},Gi,{view:0,detail:0}),QI=Gt(Ba),Oh,Lh,Ao,_c=Ve({},Ba,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:op,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!==Ao&&(Ao&&t.type==="mousemove"?(Oh=t.screenX-Ao.screenX,Lh=t.screenY-Ao.screenY):Lh=Oh=0,Ao=t),Oh)},movementY:function(t){return"movementY"in t?t.movementY:Lh}}),oy=Gt(_c),YI=Ve({},_c,{dataTransfer:0}),XI=Gt(YI),JI=Ve({},Ba,{relatedTarget:0}),Vh=Gt(JI),ZI=Ve({},Gi,{animationName:0,elapsedTime:0,pseudoElement:0}),eb=Gt(ZI),tb=Ve({},Gi,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),nb=Gt(tb),rb=Ve({},Gi,{data:0}),ay=Gt(rb),sb={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},ib={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"},ob={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function ab(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=ob[t])?!!e[t]:!1}function op(){return ab}var lb=Ve({},Ba,{key:function(t){if(t.key){var e=sb[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=tu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?ib[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:op,charCode:function(t){return t.type==="keypress"?tu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?tu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),ub=Gt(lb),cb=Ve({},_c,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ly=Gt(cb),hb=Ve({},Ba,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:op}),db=Gt(hb),fb=Ve({},Gi,{propertyName:0,elapsedTime:0,pseudoElement:0}),pb=Gt(fb),mb=Ve({},_c,{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}),gb=Gt(mb),yb=[9,13,27,32],ap=tr&&"CompositionEvent"in window,Yo=null;tr&&"documentMode"in document&&(Yo=document.documentMode);var vb=tr&&"TextEvent"in window&&!Yo,B_=tr&&(!ap||Yo&&8<Yo&&11>=Yo),uy=" ",cy=!1;function z_(t,e){switch(t){case"keyup":return yb.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function H_(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var oi=!1;function _b(t,e){switch(t){case"compositionend":return H_(e);case"keypress":return e.which!==32?null:(cy=!0,uy);case"textInput":return t=e.data,t===uy&&cy?null:t;default:return null}}function wb(t,e){if(oi)return t==="compositionend"||!ap&&z_(t,e)?(t=$_(),eu=sp=Rr=null,oi=!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 B_&&e.locale!=="ko"?null:e.data;default:return null}}var xb={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 hy(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!xb[t.type]:e==="textarea"}function W_(t,e,n,r){E_(r),e=ku(e,"onChange"),0<e.length&&(n=new ip("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Xo=null,ya=null;function Eb(t){nw(t,0)}function wc(t){var e=ui(t);if(m_(e))return t}function Tb(t,e){if(t==="change")return e}var q_=!1;if(tr){var Mh;if(tr){var Fh="oninput"in document;if(!Fh){var dy=document.createElement("div");dy.setAttribute("oninput","return;"),Fh=typeof dy.oninput=="function"}Mh=Fh}else Mh=!1;q_=Mh&&(!document.documentMode||9<document.documentMode)}function fy(){Xo&&(Xo.detachEvent("onpropertychange",G_),ya=Xo=null)}function G_(t){if(t.propertyName==="value"&&wc(ya)){var e=[];W_(e,ya,t,Zf(t)),S_(Eb,e)}}function Ib(t,e,n){t==="focusin"?(fy(),Xo=e,ya=n,Xo.attachEvent("onpropertychange",G_)):t==="focusout"&&fy()}function bb(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return wc(ya)}function Sb(t,e){if(t==="click")return wc(e)}function Cb(t,e){if(t==="input"||t==="change")return wc(e)}function kb(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var vn=typeof Object.is=="function"?Object.is:kb;function va(t,e){if(vn(t,e))return!0;
vendor: 4,808 bytes, line 37
37if(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 s=n[r];if(!xd.call(e,s)||!vn(t[s],e[s]))return!1}return!0}function py(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function my(t,e){var n=py(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=py(n)}}function K_(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?K_(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Q_(){for(var t=window,e=xu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=xu(t.document)}return e}function lp(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 Nb(t){var e=Q_(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&K_(n.ownerDocument.documentElement,n)){if(r!==null&&lp(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 s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=my(n,i);var o=my(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>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 Rb=tr&&"documentMode"in document&&11>=document.documentMode,ai=null,Ud=null,Jo=null,$d=!1;function gy(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;$d||ai==null||ai!==xu(r)||(r=ai,"selectionStart"in r&&lp(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}),Jo&&va(Jo,r)||(Jo=r,r=ku(Ud,"onSelect"),0<r.length&&(e=new ip("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=ai)))}function Rl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var li={animationend:Rl("Animation","AnimationEnd"),animationiteration:Rl("Animation","AnimationIteration"),animationstart:Rl("Animation","AnimationStart"),transitionend:Rl("Transition","TransitionEnd")},Uh={},Y_={};tr&&(Y_=document.createElement("div").style,"AnimationEvent"in window||(delete li.animationend.animation,delete li.animationiteration.animation,delete li.animationstart.animation),"TransitionEvent"in window||delete li.transitionend.transition);function xc(t){if(Uh[t])return Uh[t];if(!li[t])return t;var e=li[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Y_)return Uh[t]=e[n];return t}var X_=xc("animationend"),J_=xc("animationiteration"),Z_=xc("animationstart"),ew=xc("transitionend"),tw=new Map,yy="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 rs(t,e){tw.set(t,e),Bs(e,[t])}for(var $h=0;$h<yy.length;$h++){var Bh=yy[$h],Ab=Bh.toLowerCase(),Pb=Bh[0].toUpperCase()+Bh.slice(1);rs(Ab,"on"+Pb)}rs(X_,"onAnimationEnd");rs(J_,"onAnimationIteration");rs(Z_,"onAnimationStart");rs("dblclick","onDoubleClick");rs("focusin","onFocus");rs("focusout","onBlur");rs(ew,"onTransitionEnd");ki("onMouseEnter",["mouseout","mouseover"]);ki("onMouseLeave",["mouseout","mouseover"]);ki("onPointerEnter",["pointerout","pointerover"]);ki("onPointerLeave",["pointerout","pointerover"]);Bs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));
vendor: 4,434 bytes, line 37
37Bs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Bs("onBeforeInput",["compositionend","keypress","textInput","paste"]);Bs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Bs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var $o="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(" "),jb=new Set("cancel close invalid load scroll toggle".split(" ").concat($o));function vy(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,AI(r,e,void 0,t),t.currentTarget=null}function nw(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],u=l.instance,h=l.currentTarget;if(l=l.listener,u!==i&&s.isPropagationStopped())break e;vy(s,l,h),i=u}else for(o=0;o<r.length;o++){if(l=r[o],u=l.instance,h=l.currentTarget,l=l.listener,u!==i&&s.isPropagationStopped())break e;vy(s,l,h),i=u}}}if(Tu)throw t=Ld,Tu=!1,Ld=null,t}function ke(t,e){var n=e[qd];n===void 0&&(n=e[qd]=new Set);var r=t+"__bubble";n.has(r)||(rw(e,t,2,!1),n.add(r))}function zh(t,e,n){var r=0;e&&(r|=4),rw(n,t,r,e)}var Al="_reactListening"+Math.random().toString(36).slice(2);function _a(t){if(!t[Al]){t[Al]=!0,c_.forEach(function(n){n!=="selectionchange"&&(jb.has(n)||zh(n,!1,t),zh(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[Al]||(e[Al]=!0,zh("selectionchange",!1,e))}}function rw(t,e,n,r){switch(U_(e)){case 1:var s=GI;break;case 4:s=KI;break;default:s=rp}n=s.bind(null,e,n,t),s=void 0,!Od||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function Hh(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var u=o.tag;if((u===3||u===4)&&(u=o.stateNode.containerInfo,u===s||u.nodeType===8&&u.parentNode===s))return;o=o.return}for(;l!==null;){if(o=ws(l),o===null)return;if(u=o.tag,u===5||u===6){r=i=o;continue e}l=l.parentNode}}r=r.return}S_(function(){var h=i,f=Zf(n),p=[];e:{var g=tw.get(t);if(g!==void 0){var E=ip,N=t;switch(t){case"keypress":if(tu(n)===0)break e;case"keydown":case"keyup":E=ub;break;case"focusin":N="focus",E=Vh;break;case"focusout":N="blur",E=Vh;break;case"beforeblur":case"afterblur":E=Vh;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":E=oy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":E=XI;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":E=db;break;case X_:case J_:case Z_:E=eb;break;case ew:E=pb;break;case"scroll":E=QI;break;case"wheel":E=gb;break;case"copy":case"cut":case"paste":E=nb;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":E=ly}var A=(e&4)!==0,P=!A&&t==="scroll",_=A?g!==null?g+"Capture":null:g;A=[];for(var w=h,S;w!==null;){S=w;var j=S.stateNode;if(S.tag===5&&j!==null&&(S=j,_!==null&&(j=fa(w,_),j!=null&&A.push(wa(w,j,S)))),P)break;w=w.return}0<A.length&&(g=new E(g,N,null,n,f),p.push({event:g,listeners:A}))}}if(!(e&7)){e:{if(g=t==="mouseover"||t==="pointerover",E=t==="mouseout"||t==="pointerout",g&&n!==jd&&(N=n.relatedTarget||n.fromElement)&&(ws(N)||N[nr]))break e;if((E||g)&&(g=f.window===f?f:(g=f.ownerDocument)?g.defaultView||g.parentWindow:window,E?(N=n.relatedTarget||n.toElement,E=h,N=N?ws(N):null,N!==null&&(P=zs(N),N!==P||N.tag!==5&&N.tag!==6)&&(N=null)):(E=null,N=h),E!==N)){if(A=oy,j="onMouseLeave",_="onMouseEnter",w="mouse",(t==="pointerout"||t==="pointerover")&&(A=ly,j="onPointerLeave",_="onPointerEnter",w="pointer"),P=E==null?g:ui(E),S=N==null?g:ui(N),g=new A(j,w+"leave",E,n,f),g.target=P,g.relatedTarget=S,j=null,ws(f)===
vendor: 7,949 bytes, lines 37-38
37h&&(A=new A(_,w+"enter",N,n,f),A.target=S,A.relatedTarget=P,j=A),P=j,E&&N)t:{for(A=E,_=N,w=0,S=A;S;S=Js(S))w++;for(S=0,j=_;j;j=Js(j))S++;for(;0<w-S;)A=Js(A),w--;for(;0<S-w;)_=Js(_),S--;for(;w--;){if(A===_||_!==null&&A===_.alternate)break t;A=Js(A),_=Js(_)}A=null}else A=null;E!==null&&_y(p,g,E,A,!1),N!==null&&P!==null&&_y(p,P,N,A,!0)}}e:{if(g=h?ui(h):window,E=g.nodeName&&g.nodeName.toLowerCase(),E==="select"||E==="input"&&g.type==="file")var V=Tb;else if(hy(g))if(q_)V=Cb;else{V=bb;var M=Ib}else(E=g.nodeName)&&E.toLowerCase()==="input"&&(g.type==="checkbox"||g.type==="radio")&&(V=Sb);if(V&&(V=V(t,h))){W_(p,V,n,f);break e}M&&M(t,g,h),t==="focusout"&&(M=g._wrapperState)&&M.controlled&&g.type==="number"&&kd(g,"number",g.value)}switch(M=h?ui(h):window,t){case"focusin":(hy(M)||M.contentEditable==="true")&&(ai=M,Ud=h,Jo=null);break;case"focusout":Jo=Ud=ai=null;break;case"mousedown":$d=!0;break;case"contextmenu":case"mouseup":case"dragend":$d=!1,gy(p,n,f);break;case"selectionchange":if(Rb)break;case"keydown":case"keyup":gy(p,n,f)}var T;if(ap)e:{switch(t){case"compositionstart":var y="onCompositionStart";break e;case"compositionend":y="onCompositionEnd";break e;case"compositionupdate":y="onCompositionUpdate";break e}y=void 0}else oi?z_(t,n)&&(y="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(y="onCompositionStart");y&&(B_&&n.locale!=="ko"&&(oi||y!=="onCompositionStart"?y==="onCompositionEnd"&&oi&&(T=$_()):(Rr=f,sp="value"in Rr?Rr.value:Rr.textContent,oi=!0)),M=ku(h,y),0<M.length&&(y=new ay(y,t,null,n,f),p.push({event:y,listeners:M}),T?y.data=T:(T=H_(n),T!==null&&(y.data=T)))),(T=vb?_b(t,n):wb(t,n))&&(h=ku(h,"onBeforeInput"),0<h.length&&(f=new ay("onBeforeInput","beforeinput",null,n,f),p.push({event:f,listeners:h}),f.data=T))}nw(p,e)})}function wa(t,e,n){return{instance:t,listener:e,currentTarget:n}}function ku(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=fa(t,n),i!=null&&r.unshift(wa(t,i,s)),i=fa(t,e),i!=null&&r.push(wa(t,i,s))),t=t.return}return r}function Js(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function _y(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var l=n,u=l.alternate,h=l.stateNode;if(u!==null&&u===r)break;l.tag===5&&h!==null&&(l=h,s?(u=fa(n,i),u!=null&&o.unshift(wa(n,u,l))):s||(u=fa(n,i),u!=null&&o.push(wa(n,u,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var Db=/\r\n?/g,Ob=/\u0000|\uFFFD/g;function wy(t){return(typeof t=="string"?t:""+t).replace(Db,`
38`).replace(Ob,"")}function Pl(t,e,n){if(e=wy(e),wy(t)!==e&&n)throw Error(q(425))}function Nu(){}var Bd=null,zd=null;function Hd(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 Wd=typeof setTimeout=="function"?setTimeout:void 0,Lb=typeof clearTimeout=="function"?clearTimeout:void 0,xy=typeof Promise=="function"?Promise:void 0,Vb=typeof queueMicrotask=="function"?queueMicrotask:typeof xy<"u"?function(t){return xy.resolve(null).then(t).catch(Mb)}:Wd;function Mb(t){setTimeout(function(){throw t})}function Wh(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),ga(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);ga(e)}function Lr(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 Ey(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 Ki=Math.random().toString(36).slice(2),Nn="__reactFiber$"+Ki,xa="__reactProps$"+Ki,nr="__reactContainer$"+Ki,qd="__reactEvents$"+Ki,Fb="__reactListeners$"+Ki,Ub="__reactHandles$"+Ki;function ws(t){var e=t[Nn];if(e)return e;for(var n=t.parentNode;n;){if(e=n[nr]||n[Nn]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Ey(t);t!==null;){if(n=t[Nn])return n;t=Ey(t)}return e}t=n,n=t.parentNode}return null}function za(t){return t=t[Nn]||t[nr],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ui(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(q(33))}function Ec(t){return t[xa]||null}var Gd=[],ci=-1;function ss(t){return{current:t}}function Re(t){0>ci||(t.current=Gd[ci],Gd[ci]=null,ci--)}function Ie(t,e){ci++,Gd[ci]=t.current,t.current=e}var Qr={},wt=ss(Qr),jt=ss(!1),Rs=Qr;function Ni(t,e){var n=t.type.contextTypes;if(!n)return Qr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function Dt(t){return t=t.childContextTypes,t!=null}function Ru(){Re(jt),Re(wt)}function Ty(t,e,n){if(wt.current!==Qr)throw Error(q(168));Ie(wt,e),Ie(jt,n)}function sw(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(q(108,II(t)||"Unknown",s));return Ve({},n,r)}function Au(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Qr,Rs=wt.current,Ie(wt,t),Ie(jt,jt.current),!0}function Iy(t,e,n){var r=t.stateNode;if(!r)throw Error(q(169));n?(t=sw(t,e,Rs),r.__reactInternalMemoizedMergedChildContext=t,Re(jt),Re(wt),Ie(wt,t)):Re(jt),Ie(jt,n)}var Wn=null,Tc=!1,qh=!1;function iw(t){Wn===null?Wn=[t]:Wn.push(t)}function $b(t){Tc=!0,iw(t)}function is(){if(!qh&&Wn!==null){qh=!0;var t=0,e=xe;try{var n=Wn;for(xe=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Wn=null,Tc=!1}catch(s){throw Wn!==null&&(Wn=Wn.slice(t+1)),R_(ep,is),s}finally{xe=e,qh=!1}}return null}var hi=[],di=0,Pu=null,ju=0,Qt=[],Yt=0,As=null,qn=1,Gn="";function ys(t,e){hi[di++]=ju,hi[di++]=Pu,Pu=t,ju=e}function ow(t,e,n){Qt[Yt++]=qn,Qt[Yt++]=Gn,Qt[Yt++]=As,As=t;var r=qn;t=Gn;var s=32-pn(r)-1;r&=~(1<<s),n+=1;var i=32-pn(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,qn=1<<32-pn(e)+s|n<<s|r,Gn=i+t}else qn=1<<i|n<<s|r,Gn=t}function up(t){t.return!==null&&(ys(t,1),ow(t,1,0))}function cp(t){for(;t===Pu;)Pu=hi[--di],hi[di]=null,ju=hi[--di],hi[di]=null;for(;t===As;)As=Qt[--Yt],Qt[Yt]=null,Gn=Qt[--Yt],Qt[Yt]=null,qn=Qt[--Yt],Qt[Yt]=null}var zt=null,Ut=null,Ae=!1,dn=null;function aw(t,e){var n=Zt(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 by(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,zt=t,Ut=Lr(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,zt=t,Ut=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=As!==null?{id:qn,overflow:Gn}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=Zt(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,zt=t,Ut=null,!0):!1;default:return!1}}function Kd(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Qd(t){if(Ae){var e=Ut;if(e){var n=e;if(!by(t,e)){if(Kd(t))throw Error(q(418));e=Lr(n.nextSibling);var r=zt;e&&by(t,e)?aw(r,n):(t.flags=t.flags&-4097|2,Ae=!1,zt=t)}}else{if(Kd(t))throw Error(q(418));t.flags=t.flags&-4097|2,Ae=!1,zt=t}}}function Sy(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;zt=t}function jl(t){if(t!==zt)return!1;if(!Ae)return Sy(t),Ae=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!Hd(t.type,t.memoizedProps)),e&&(e=Ut)){if(Kd(t))throw lw(),Error(q(418));for(;e;)aw(t,e),e=Lr(e.nextSibling)}if(Sy(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(q(317));e:{for(t=t.nextSibling,e=0;t;
vendor: 14,603 bytes, line 38
38){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){Ut=Lr(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}Ut=null}}else Ut=zt?Lr(t.stateNode.nextSibling):null;return!0}function lw(){for(var t=Ut;t;)t=Lr(t.nextSibling)}function Ri(){Ut=zt=null,Ae=!1}function hp(t){dn===null?dn=[t]:dn.push(t)}var Bb=hr.ReactCurrentBatchConfig;function Po(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(q(309));var r=n.stateNode}if(!r)throw Error(q(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(q(284));if(!n._owner)throw Error(q(290,t))}return t}function Dl(t,e){throw t=Object.prototype.toString.call(e),Error(q(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function Cy(t){var e=t._init;return e(t._payload)}function uw(t){function e(_,w){if(t){var S=_.deletions;S===null?(_.deletions=[w],_.flags|=16):S.push(w)}}function n(_,w){if(!t)return null;for(;w!==null;)e(_,w),w=w.sibling;return null}function r(_,w){for(_=new Map;w!==null;)w.key!==null?_.set(w.key,w):_.set(w.index,w),w=w.sibling;return _}function s(_,w){return _=Ur(_,w),_.index=0,_.sibling=null,_}function i(_,w,S){return _.index=S,t?(S=_.alternate,S!==null?(S=S.index,S<w?(_.flags|=2,w):S):(_.flags|=2,w)):(_.flags|=1048576,w)}function o(_){return t&&_.alternate===null&&(_.flags|=2),_}function l(_,w,S,j){return w===null||w.tag!==6?(w=Zh(S,_.mode,j),w.return=_,w):(w=s(w,S),w.return=_,w)}function u(_,w,S,j){var V=S.type;return V===ii?f(_,w,S.props.children,j,S.key):w!==null&&(w.elementType===V||typeof V=="object"&&V!==null&&V.$$typeof===xr&&Cy(V)===w.type)?(j=s(w,S.props),j.ref=Po(_,w,S),j.return=_,j):(j=lu(S.type,S.key,S.props,null,_.mode,j),j.ref=Po(_,w,S),j.return=_,j)}function h(_,w,S,j){return w===null||w.tag!==4||w.stateNode.containerInfo!==S.containerInfo||w.stateNode.implementation!==S.implementation?(w=ed(S,_.mode,j),w.return=_,w):(w=s(w,S.children||[]),w.return=_,w)}function f(_,w,S,j,V){return w===null||w.tag!==7?(w=Ss(S,_.mode,j,V),w.return=_,w):(w=s(w,S),w.return=_,w)}function p(_,w,S){if(typeof w=="string"&&w!==""||typeof w=="number")return w=Zh(""+w,_.mode,S),w.return=_,w;if(typeof w=="object"&&w!==null){switch(w.$$typeof){case Tl:return S=lu(w.type,w.key,w.props,null,_.mode,S),S.ref=Po(_,null,w),S.return=_,S;case si:return w=ed(w,_.mode,S),w.return=_,w;case xr:var j=w._init;return p(_,j(w._payload),S)}if(Fo(w)||Co(w))return w=Ss(w,_.mode,S,null),w.return=_,w;Dl(_,w)}return null}function g(_,w,S,j){var V=w!==null?w.key:null;if(typeof S=="string"&&S!==""||typeof S=="number")return V!==null?null:l(_,w,""+S,j);if(typeof S=="object"&&S!==null){switch(S.$$typeof){case Tl:return S.key===V?u(_,w,S,j):null;case si:return S.key===V?h(_,w,S,j):null;case xr:return V=S._init,g(_,w,V(S._payload),j)}if(Fo(S)||Co(S))return V!==null?null:f(_,w,S,j,null);Dl(_,S)}return null}function E(_,w,S,j,V){if(typeof j=="string"&&j!==""||typeof j=="number")return _=_.get(S)||null,l(w,_,""+j,V);if(typeof j=="object"&&j!==null){switch(j.$$typeof){case Tl:return _=_.get(j.key===null?S:j.key)||null,u(w,_,j,V);case si:return _=_.get(j.key===null?S:j.key)||null,h(w,_,j,V);case xr:var M=j._init;return E(_,w,S,M(j._payload),V)}if(Fo(j)||Co(j))return _=_.get(S)||null,f(w,_,j,V,null);Dl(w,j)}return null}function N(_,w,S,j){for(var V=null,M=null,T=w,y=w=0,I=null;T!==null&&y<S.length;y++){T.index>y?(I=T,T=null):I=T.sibling;var k=g(_,T,S[y],j);if(k===null){T===null&&(T=I);break}t&&T&&k.alternate===null&&e(_,T),w=i(k,w,y),M===null?V=k:M.sibling=k,M=k,T=I}if(y===S.length)return n(_,T),Ae&&ys(_,y),V;if(T===null){for(;y<S.length;y++)T=p(_,S[y],j),T!==null&&(w=i(T,w,y),M===null?V=T:M.sibling=T,M=T);return Ae&&ys(_,y),V}for(T=r(_,T);y<S.length;y++)I=E(T,_,y,S[y],j),I!==null&&(t&&I.alternate!==null&&T.delete(I.key===null?y:I.key),w=i(I,w,y),M===null?V=I:M.sibling=I,M=I);return t&&T.forEach(function(R){return e(_,R)}),Ae&&ys(_,y),V}function A(_,w,S,j){var V=Co(S);if(typeof V!="function")throw Error(q(150));if(S=V.call(S),S==null)throw Error(q(151));for(var M=V=null,T=w,y=w=0,I=null,k=S.next();T!==null&&!k.done;y++,k=S.next()){T.index>y?(I=T,T=null):I=T.sibling;var R=g(_,T,k.value,j);if(R===null){T===null&&(T=I);break}t&&T&&R.alternate===null&&e(_,T),w=i(R,w,y),M===null?V=R:M.sibling=R,M=R,T=I}if(k.done)return n(_,T),Ae&&ys(_,y),V;if(T===null){for(;!k.done;y++,k=S.next())k=p(_,k.value,j),k!==null&&(w=i(k,w,y),M===null?V=k:M.sibling=k,M=k);return Ae&&ys(_,y),V}for(T=r(_,T);!k.done;y++,k=S.next())k=E(T,_,y,k.value,j),k!==null&&(t&&k.alternate!==null&&T.delete(k.key===null?y:k.key),w=i(k,w,y),M===null?V=k:M.sibling=k,M=k);return t&&T.forEach(function(b){return e(_,b)}),Ae&&ys(_,y),V}function P(_,w,S,j){if(typeof S=="object"&&S!==null&&S.type===ii&&S.key===null&&(S=S.props.children),typeof S=="object"&&S!==null){switch(S.$$typeof){case Tl:e:{for(var V=S.key,M=w;M!==null;){if(M.key===V){if(V=S.type,V===ii){if(M.tag===7){n(_,M.sibling),w=s(M,S.props.children),w.return=_,_=w;break e}}else if(M.elementType===V||typeof V=="object"&&V!==null&&V.$$typeof===xr&&Cy(V)===M.type){n(_,M.sibling),w=s(M,S.props),w.ref=Po(_,M,S),w.return=_,_=w;break e}n(_,M);break}else e(_,M);M=M.sibling}S.type===ii?(w=Ss(S.props.children,_.mode,j,S.key),w.return=_,_=w):(j=lu(S.type,S.key,S.props,null,_.mode,j),j.ref=Po(_,w,S),j.return=_,_=j)}return o(_);case si:e:{for(M=S.key;w!==null;){if(w.key===M)if(w.tag===4&&w.stateNode.containerInfo===S.containerInfo&&w.stateNode.implementation===S.implementation){n(_,w.sibling),w=s(w,S.children||[]),w.return=_,_=w;break e}else{n(_,w);break}else e(_,w);w=w.sibling}w=ed(S,_.mode,j),w.return=_,_=w}return o(_);case xr:return M=S._init,P(_,w,M(S._payload),j)}if(Fo(S))return N(_,w,S,j);if(Co(S))return A(_,w,S,j);Dl(_,S)}return typeof S=="string"&&S!==""||typeof S=="number"?(S=""+S,w!==null&&w.tag===6?(n(_,w.sibling),w=s(w,S),w.return=_,_=w):(n(_,w),w=Zh(S,_.mode,j),w.return=_,_=w),o(_)):n(_,w)}return P}var Ai=uw(!0),cw=uw(!1),Du=ss(null),Ou=null,fi=null,dp=null;function fp(){dp=fi=Ou=null}function pp(t){var e=Du.current;Re(Du),t._currentValue=e}function Yd(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 xi(t,e){Ou=t,dp=fi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Pt=!0),t.firstContext=null)}function sn(t){var e=t._currentValue;if(dp!==t)if(t={context:t,memoizedValue:e,next:null},fi===null){if(Ou===null)throw Error(q(308));fi=t,Ou.dependencies={lanes:0,firstContext:t}}else fi=fi.next=t;return e}var xs=null;function mp(t){xs===null?xs=[t]:xs.push(t)}function hw(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,mp(e)):(n.next=s.next,s.next=n),e.interleaved=n,rr(t,r)}function rr(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 Er=!1;function gp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function dw(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 Yn(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Vr(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ve&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,rr(t,n)}return s=r.interleaved,s===null?(e.next=e,mp(r)):(e.next=s.next,s.next=e),r.interleaved=e,rr(t,n)}function nu(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,tp(t,n)}}function ky(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=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};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,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 Lu(t,e,n,r){var s=t.updateQueue;Er=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var u=l,h=u.next;u.next=null,o===null?i=h:o.next=h,o=u;var f=t.alternate;f!==null&&(f=f.updateQueue,l=f.lastBaseUpdate,l!==o&&(l===null?f.firstBaseUpdate=h:l.next=h,f.lastBaseUpdate=u))}if(i!==null){var p=s.baseState;o=0,f=h=u=null,l=i;do{var g=l.lane,E=l.eventTime;if((r&g)===g){f!==null&&(f=f.next={eventTime:E,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var N=t,A=l;switch(g=e,E=n,A.tag){case 1:if(N=A.payload,typeof N=="function"){p=N.call(E,p,g);break e}p=N;break e;case 3:N.flags=N.flags&-65537|128;case 0:if(N=A.payload,g=typeof N=="function"?N.call(E,p,g):N,g==null)break e;p=Ve({},p,g);break e;case 2:Er=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,g=s.effects,g===null?s.effects=[l]:g.push(l))}else E={eventTime:E,lane:g,tag:l.tag,payload:l.payload,callback:l.callback,next:null},f===null?(h=f=E,u=p):f=f.next=E,o|=g;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;g=l,l=g.next,g.next=null,s.lastBaseUpdate=g,s.shared.pending=null}}while(!0);if(f===null&&(u=p),s.baseState=u,s.firstBaseUpdate=h,s.lastBaseUpdate=f,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);js|=o,t.lanes=o,t.memoizedState=p}}function Ny(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(q(191,s));s.call(r)}}}var Ha={},Dn=ss(Ha),Ea=ss(Ha),Ta=ss(Ha);function Es(t){if(t===Ha)throw Error(q(174));return t}function yp(t,e){switch(Ie(Ta,e),Ie(Ea,t),Ie(Dn,Ha),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Rd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Rd(e,t)}Re(Dn),Ie(Dn,e)}function Pi(){Re(Dn),Re(Ea),Re(Ta)}function fw(t){Es(Ta.current);var e=Es(Dn.current),n=Rd(e,t.type);e!==n&&(Ie(Ea,t),Ie(Dn,n))}function vp(t){Ea.current===t&&(Re(Dn),Re(Ea))}var De=ss(0);function Vu(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 Gh=[];function _p(){for(var t=0;t<Gh.length;t++)Gh[t]._workInProgressVersionPrimary=null;Gh.length=0}var ru=hr.ReactCurrentDispatcher,Kh=hr.ReactCurrentBatchConfig,Ps=0,Le=null,Ze=null,st=null,Mu=!1,Zo=!1,Ia=0,zb=0;function ft(){throw Error(q(321))}function wp(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!vn(t[n],e[n]))return!1;return!0}function xp(t,e,n,r,s,i){if(Ps=i,Le=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,ru.current=t===null||t.memoizedState===null?Gb:Kb,t=n(r,s),Zo){i=0;do{if(Zo=!1,Ia=0,25<=i)throw Error(q(301));i+=1,st=Ze=null,e.updateQueue=null,ru.current=Qb,t=n(r,s)}while(Zo)}if(ru.current=Fu,e=Ze!==null&&Ze.next!==null,Ps=0,st=Ze=Le=null,Mu=!1,e)throw Error(q(300));return t}function Ep(){var t=Ia!==0;return Ia=0,t}function Cn(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return st===null?Le.memoizedState=st=t:st=st.next=t,st}function on(){if(Ze===null){var t=Le.alternate;t=t!==null?t.memoizedState:null}else t=Ze.next;var e=st===null?Le.memoizedState:st.next;if(e!==null)st=e,Ze=t;else{if(t===null)throw Error(q(310));Ze=t,t={memoizedState:Ze.memoizedState,baseState:Ze.baseState,baseQueue:Ze.baseQueue,queue:Ze.queue,next:null},st===null?Le.memoizedState=st=t:st=st.next=t}return st}function ba(t,e){return typeof e=="function"?e(t):e}function Qh(t){var e=on(),n=e.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=t;var r=Ze,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,u=null,h=i;do{var f=h.lane;if((Ps&f)===f)u!==null&&(u=u.next={lane:0,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null}),r=h.hasEagerState?h.eagerState:t(r,h.action);else{var p={lane:f,action:h.action,hasEagerState:h.hasEagerState,eagerState:h.eagerState,next:null};u===null?(l=u=p,o=r):u=u.next=p,Le.lanes|=f,js|=f}h=h.next}while(h!==null&&h!==i);u===null?o=r:u.next=l,vn(r,e.memoizedState)||(Pt=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=u,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,Le.lanes|=i,js|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function Yh(t){var e=on(),n=e.queue;if(n===null)throw Error(q(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);vn(i,e.memoizedState)||(Pt=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function pw(){}function mw(t,e){var n=Le,r=on(),s=e(),i=!vn(r.memoizedState,s);if(i&&(r.memoizedState=s,Pt=!0),r=r.queue,Tp(vw.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||st!==null&&st.memoizedState.tag&1){if(n.flags|=2048,Sa(9,yw.bind(null,n,r,s,e),void 0,null),it===null)throw Error(q(349));Ps&30||gw(n,e,s)}return s}function gw(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function yw(t,e,n,r){e.value=n,e.getSnapshot=r,_w(e)&&ww(t)}function vw(t,e,n){return n(function(){_w(e)&&ww(t)})}function _w(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!vn(t,n)}catch{return!0}}function ww(t){var e=rr(t,1);e!==null&&mn(e,t,1,-1)}function Ry(t){var e=Cn();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:ba,lastRenderedState:t}
vendor: 4,582 bytes, line 38
38,e.queue=t,t=t.dispatch=qb.bind(null,Le,t),[e.memoizedState,t]}function Sa(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Le.updateQueue,e===null?(e={lastEffect:null,stores:null},Le.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 xw(){return on().memoizedState}function su(t,e,n,r){var s=Cn();Le.flags|=t,s.memoizedState=Sa(1|e,n,void 0,r===void 0?null:r)}function Ic(t,e,n,r){var s=on();r=r===void 0?null:r;var i=void 0;if(Ze!==null){var o=Ze.memoizedState;if(i=o.destroy,r!==null&&wp(r,o.deps)){s.memoizedState=Sa(e,n,i,r);return}}Le.flags|=t,s.memoizedState=Sa(1|e,n,i,r)}function Ay(t,e){return su(8390656,8,t,e)}function Tp(t,e){return Ic(2048,8,t,e)}function Ew(t,e){return Ic(4,2,t,e)}function Tw(t,e){return Ic(4,4,t,e)}function Iw(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 bw(t,e,n){return n=n!=null?n.concat([t]):null,Ic(4,4,Iw.bind(null,e,t),n)}function Ip(){}function Sw(t,e){var n=on();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&wp(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Cw(t,e){var n=on();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&wp(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function kw(t,e,n){return Ps&21?(vn(n,e)||(n=j_(),Le.lanes|=n,js|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,Pt=!0),t.memoizedState=n)}function Hb(t,e){var n=xe;xe=n!==0&&4>n?n:4,t(!0);var r=Kh.transition;Kh.transition={};try{t(!1),e()}finally{xe=n,Kh.transition=r}}function Nw(){return on().memoizedState}function Wb(t,e,n){var r=Fr(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},Rw(t))Aw(e,n);else if(n=hw(t,e,n,r),n!==null){var s=St();mn(n,t,r,s),Pw(n,e,r)}}function qb(t,e,n){var r=Fr(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(Rw(t))Aw(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,vn(l,o)){var u=e.interleaved;u===null?(s.next=s,mp(e)):(s.next=u.next,u.next=s),e.interleaved=s;return}}catch{}finally{}n=hw(t,e,s,r),n!==null&&(s=St(),mn(n,t,r,s),Pw(n,e,r))}}function Rw(t){var e=t.alternate;return t===Le||e!==null&&e===Le}function Aw(t,e){Zo=Mu=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Pw(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,tp(t,n)}}var Fu={readContext:sn,useCallback:ft,useContext:ft,useEffect:ft,useImperativeHandle:ft,useInsertionEffect:ft,useLayoutEffect:ft,useMemo:ft,useReducer:ft,useRef:ft,useState:ft,useDebugValue:ft,useDeferredValue:ft,useTransition:ft,useMutableSource:ft,useSyncExternalStore:ft,useId:ft,unstable_isNewReconciler:!1},Gb={readContext:sn,useCallback:function(t,e){return Cn().memoizedState=[t,e===void 0?null:e],t},useContext:sn,useEffect:Ay,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,su(4194308,4,Iw.bind(null,e,t),n)},useLayoutEffect:function(t,e){return su(4194308,4,t,e)},useInsertionEffect:function(t,e){return su(4,2,t,e)},useMemo:function(t,e){var n=Cn();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Cn();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=Wb.bind(null,Le,t),[r.memoizedState,t]},useRef:function(t){var e=Cn();return t={current:t},e.memoizedState=t},useState:Ry,useDebugValue:Ip,useDeferredValue:function(t){return Cn().memoizedState=t},useTransition:function(){var t=Ry(!1),e=t[0];return t=Hb.bind(null,t[1]),Cn().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Le,s=Cn();if(Ae){if(n===void 0)throw Error(q(407));n=n()}else{if(n=e(),it===null)throw Error(q(349));Ps&30||gw(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,Ay(vw.bind(null,r,i,t),[t]),r.flags|=2048,Sa(9,yw.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Cn(),e=it.identifierPrefix;if(Ae){var n=Gn,r=qn;n=(r&~(1<<32-pn(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=Ia++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=zb++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},Kb={readContext:sn,useCallback:Sw,useContext:sn,useEffect:Tp,useImperativeHandle:bw,useInsertionEffect:Ew,useLayoutEffect:Tw,useMemo:Cw,useReducer:Qh,useRef
vendor: 6,411 bytes, lines 38-40
38:xw,useState:function(){return Qh(ba)},useDebugValue:Ip,useDeferredValue:function(t){var e=on();return kw(e,Ze.memoizedState,t)},useTransition:function(){var t=Qh(ba)[0],e=on().memoizedState;return[t,e]},useMutableSource:pw,useSyncExternalStore:mw,useId:Nw,unstable_isNewReconciler:!1},Qb={readContext:sn,useCallback:Sw,useContext:sn,useEffect:Tp,useImperativeHandle:bw,useInsertionEffect:Ew,useLayoutEffect:Tw,useMemo:Cw,useReducer:Yh,useRef:xw,useState:function(){return Yh(ba)},useDebugValue:Ip,useDeferredValue:function(t){var e=on();return Ze===null?e.memoizedState=t:kw(e,Ze.memoizedState,t)},useTransition:function(){var t=Yh(ba)[0],e=on().memoizedState;return[t,e]},useMutableSource:pw,useSyncExternalStore:mw,useId:Nw,unstable_isNewReconciler:!1};function cn(t,e){if(t&&t.defaultProps){e=Ve({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Xd(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ve({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var bc={isMounted:function(t){return(t=t._reactInternals)?zs(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=St(),s=Fr(t),i=Yn(r,s);i.payload=e,n!=null&&(i.callback=n),e=Vr(t,i,s),e!==null&&(mn(e,t,s,r),nu(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=St(),s=Fr(t),i=Yn(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=Vr(t,i,s),e!==null&&(mn(e,t,s,r),nu(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=St(),r=Fr(t),s=Yn(n,r);s.tag=2,e!=null&&(s.callback=e),e=Vr(t,s,r),e!==null&&(mn(e,t,r,n),nu(e,t,r))}};function Py(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!va(n,r)||!va(s,i):!0}function jw(t,e,n){var r=!1,s=Qr,i=e.contextType;return typeof i=="object"&&i!==null?i=sn(i):(s=Dt(e)?Rs:wt.current,r=e.contextTypes,i=(r=r!=null)?Ni(t,s):Qr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=bc,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function jy(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&&bc.enqueueReplaceState(e,e.state,null)}function Jd(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},gp(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=sn(i):(i=Dt(e)?Rs:wt.current,s.context=Ni(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Xd(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&bc.enqueueReplaceState(s,s.state,null),Lu(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function ji(t,e){try{var n="",r=e;do n+=TI(r),r=r.return;while(r);var s=n}catch(i){s=`
39Error generating stack: `+i.message+`
40`+i.stack}return{value:t,source:e,stack:s,digest:null}}function Xh(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Zd(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var Yb=typeof WeakMap=="function"?WeakMap:Map;function Dw(t,e,n){n=Yn(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){$u||($u=!0,cf=r),Zd(t,e)},n}function Ow(t,e,n){n=Yn(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){Zd(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Zd(t,e),typeof r!="function"&&(Mr===null?Mr=new Set([this]):Mr.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function Dy(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new Yb;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=cS.bind(null,t,e,n),e.then(t,t))}function Oy(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 Ly(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,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=Yn(-1,1),e.tag=2,Vr(n,e,1))),n.lanes|=1),t)}var Xb=hr.ReactCurrentOwner,Pt=!1;function bt(t,e,n,r){e.child=t===null?cw(e,null,n,r):Ai(e,t.child,n,r)}function Vy(t,e,n,r,s){n=n.render;var i=e.ref;return xi(e,s),r=xp(t,e,n,r,i,s),n=Ep(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,sr(t,e,s)):(Ae&&n&&up(e),e.flags|=1,bt(t,e,r,s),e.child)}function My(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!Pp(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,Lw(t,e,i,r,s)):(t=lu(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:va,n(o,r)&&t.ref===e.ref)return sr(t,e,s)}return e.flags|=1,t=Ur(i,r),t.ref=e.ref,t.return=e,e.child=t}function Lw(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(va(i,r)&&t.ref===e.ref)if(Pt=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(Pt=!0);else return e.lanes=t.lanes,sr(t,e,s)}return ef(t,e,n,r,s)}function Vw(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ie(mi,Ft),Ft|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ie(mi,Ft),Ft|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ie(mi,Ft),Ft|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Ie(mi,Ft),Ft|=r;return bt(t,e,s,n),e.child}function Mw(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}
vendor: 5,796 bytes, line 40
40function ef(t,e,n,r,s){var i=Dt(n)?Rs:wt.current;return i=Ni(e,i),xi(e,s),n=xp(t,e,n,r,i,s),r=Ep(),t!==null&&!Pt?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,sr(t,e,s)):(Ae&&r&&up(e),e.flags|=1,bt(t,e,n,s),e.child)}function Fy(t,e,n,r,s){if(Dt(n)){var i=!0;Au(e)}else i=!1;if(xi(e,s),e.stateNode===null)iu(t,e),jw(e,n,r),Jd(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var u=o.context,h=n.contextType;typeof h=="object"&&h!==null?h=sn(h):(h=Dt(n)?Rs:wt.current,h=Ni(e,h));var f=n.getDerivedStateFromProps,p=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function";p||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||u!==h)&&jy(e,o,r,h),Er=!1;var g=e.memoizedState;o.state=g,Lu(e,r,o,s),u=e.memoizedState,l!==r||g!==u||jt.current||Er?(typeof f=="function"&&(Xd(e,n,f,r),u=e.memoizedState),(l=Er||Py(e,n,l,r,g,u,h))?(p||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=u),o.props=r,o.state=u,o.context=h,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,dw(t,e),l=e.memoizedProps,h=e.type===e.elementType?l:cn(e.type,l),o.props=h,p=e.pendingProps,g=o.context,u=n.contextType,typeof u=="object"&&u!==null?u=sn(u):(u=Dt(n)?Rs:wt.current,u=Ni(e,u));var E=n.getDerivedStateFromProps;(f=typeof E=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==p||g!==u)&&jy(e,o,r,u),Er=!1,g=e.memoizedState,o.state=g,Lu(e,r,o,s);var N=e.memoizedState;l!==p||g!==N||jt.current||Er?(typeof E=="function"&&(Xd(e,n,E,r),N=e.memoizedState),(h=Er||Py(e,n,h,r,g,N,u)||!1)?(f||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,N,u),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,N,u)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=N),o.props=r,o.state=N,o.context=u,r=h):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&g===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&g===t.memoizedState||(e.flags|=1024),r=!1)}return tf(t,e,n,r,i,s)}function tf(t,e,n,r,s,i){Mw(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&Iy(e,n,!1),sr(t,e,i);r=e.stateNode,Xb.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=Ai(e,t.child,null,i),e.child=Ai(e,null,l,i)):bt(t,e,l,i),e.memoizedState=r.state,s&&Iy(e,n,!0),e.child}function Fw(t){var e=t.stateNode;e.pendingContext?Ty(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Ty(t,e.context,!1),yp(t,e.containerInfo)}function Uy(t,e,n,r,s){return Ri(),hp(s),e.flags|=256,bt(t,e,n,r),e.child}var nf={dehydrated:null,treeContext:null,retryLane:0};function rf(t){return{baseLanes:t,cachePool:null,transitions:null}}function Uw(t,e,n){var r=e.pendingProps,s=De.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),Ie(De,s&1),t===null)return Qd(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,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=kc(o,r,0,null),t=Ss(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=rf(n),e.memoizedState=nf,t):bp(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return Jb(t,e,o,r,l,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,l=s.sibling;var u={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=u,e.deletions=null):(r=Ur(s,u),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=Ur(l,i):(i=Ss(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?rf(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=nf,r}return i=t.child,t=i.sibling,r=Ur(i,{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 bp(t,e){return e=kc({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function Ol(t,e,n,r){return r!==null&&hp(r),Ai(e,t.child,null,n),t=bp(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function Jb(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=Xh(Error(q(422))),Ol(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=kc({mode:"visible",children:r.children},s,0,null),i=Ss(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&Ai(e,t.child,null,o),e.child.memoizedState=rf(o),e.memoizedState=nf,i);if(!(e.mode&1))return Ol(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;
vendor: 7,481 bytes, line 40
40return r=l,i=Error(q(419)),r=Xh(i,r,void 0),Ol(t,e,o,r)}if(l=(o&t.childLanes)!==0,Pt||l){if(r=it,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,rr(t,s),mn(r,t,s,-1))}return Ap(),r=Xh(Error(q(421))),Ol(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=hS.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,Ut=Lr(s.nextSibling),zt=e,Ae=!0,dn=null,t!==null&&(Qt[Yt++]=qn,Qt[Yt++]=Gn,Qt[Yt++]=As,qn=t.id,Gn=t.overflow,As=e),e=bp(e,r.children),e.flags|=4096,e)}function $y(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Yd(t.return,e,n)}function Jh(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function $w(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(bt(t,e,r.children,n),r=De.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&&$y(t,n,e);else if(t.tag===19)$y(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(Ie(De,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&Vu(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),Jh(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&Vu(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}Jh(e,!0,n,null,i);break;case"together":Jh(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function iu(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function sr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),js|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(q(153));if(e.child!==null){for(t=e.child,n=Ur(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Ur(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function Zb(t,e,n){switch(e.tag){case 3:Fw(e),Ri();break;case 5:fw(e);break;case 1:Dt(e.type)&&Au(e);break;case 4:yp(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;Ie(Du,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Ie(De,De.current&1),e.flags|=128,null):n&e.child.childLanes?Uw(t,e,n):(Ie(De,De.current&1),t=sr(t,e,n),t!==null?t.sibling:null);Ie(De,De.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return $w(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ie(De,De.current),r)break;return null;case 22:case 23:return e.lanes=0,Vw(t,e,n)}return sr(t,e,n)}var Bw,sf,zw,Hw;Bw=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}};sf=function(){};zw=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,Es(Dn.current);var i=null;switch(n){case"input":s=Sd(t,s),r=Sd(t,r),i=[];break;case"select":s=Ve({},s,{value:void 0}),r=Ve({},r,{value:void 0}),i=[];break;case"textarea":s=Nd(t,s),r=Nd(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Nu)}Ad(n,r);var o;n=null;for(h in s)if(!r.hasOwnProperty(h)&&s.hasOwnProperty(h)&&s[h]!=null)if(h==="style"){var l=s[h];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else h!=="dangerouslySetInnerHTML"&&h!=="children"&&h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&h!=="autoFocus"&&(ha.hasOwnProperty(h)?i||(i=[]):(i=i||[]).push(h,null));for(h in r){var u=r[h];if(l=s!=null?s[h]:void 0,r.hasOwnProperty(h)&&u!==l&&(u!=null||l!=null))if(h==="style")if(l){for(o in l)!l.hasOwnProperty(o)||u&&u.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in u)u.hasOwnProperty(o)&&l[o]!==u[o]&&(n||(n={}),n[o]=u[o])}else n||(i||(i=[]),i.push(h,n)),n=u;else h==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,l=l?l.__html:void 0,u!=null&&l!==u&&(i=i||[]).push(h,u)):h==="children"?typeof u!="string"&&typeof u!="number"||(i=i||[]).push(h,""+u):h!=="suppressContentEditableWarning"&&h!=="suppressHydrationWarning"&&(ha.hasOwnProperty(h)?(u!=null&&h==="onScroll"&&ke("scroll",t),i||l===u||(i=[])):(i=i||[]).push(h,u))}n&&(i=i||[]).push("style",n);var h=i;(e.updateQueue=h)&&(e.flags|=4)}};Hw=function(t,e,n,r){n!==r&&(e.flags|=4)};function jo(t,e){if(!Ae)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 pt(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function eS(t,e,n){var r=e.pendingProps;switch(cp(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(e),null;case 1:return Dt(e.type)&&Ru(),pt(e),null;case 3:return r=e.stateNode,Pi(),Re(jt),Re(wt),_p(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(jl(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,dn!==null&&(ff(dn),dn=null))),sf(t,e),pt(e),null;case 5:vp(e);var s=Es(Ta.current);if(n=e.type,t!==null&&e.stateNode!=null)zw(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(q(166));return pt(e),null}if(t=Es(Dn.current),jl(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Nn]=e,r[xa]=i,t=(e.mode&1)!==0,n){case"dialog":ke("cancel",r),ke("close",r);break;case"iframe":case"object":case"embed":ke("load",r);break;case"video":case"audio":for(s=0;s<$o.length;s++)ke($o[s],r);break;case"source":ke("error",r);break;case"img":case"image":case"link":ke("error",r),ke("load",r);break;case"details":ke("toggle",r);break;case"input":Yg(r,i),ke("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ke("invalid",r);break;case"textarea":Jg(r,i),ke("invalid",r)}Ad(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&Pl(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&Pl(r.textContent,l,t),s=["children",""+l]):ha.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&ke("scroll",r)}switch(n){case"input":Il(r),Xg(r,i,!0);break;
vendor: 30,925 bytes, line 40
40case"textarea":Il(r),Zg(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Nu)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=v_(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[Nn]=e,t[xa]=r,Bw(t,e,!1,!1),e.stateNode=t;e:{switch(o=Pd(n,r),n){case"dialog":ke("cancel",t),ke("close",t),s=r;break;case"iframe":case"object":case"embed":ke("load",t),s=r;break;case"video":case"audio":for(s=0;s<$o.length;s++)ke($o[s],t);s=r;break;case"source":ke("error",t),s=r;break;case"img":case"image":case"link":ke("error",t),ke("load",t),s=r;break;case"details":ke("toggle",t),s=r;break;case"input":Yg(t,r),s=Sd(t,r),ke("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Ve({},r,{value:void 0}),ke("invalid",t);break;case"textarea":Jg(t,r),s=Nd(t,r),ke("invalid",t);break;default:s=r}Ad(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var u=l[i];i==="style"?x_(t,u):i==="dangerouslySetInnerHTML"?(u=u?u.__html:void 0,u!=null&&__(t,u)):i==="children"?typeof u=="string"?(n!=="textarea"||u!=="")&&da(t,u):typeof u=="number"&&da(t,""+u):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(ha.hasOwnProperty(i)?u!=null&&i==="onScroll"&&ke("scroll",t):u!=null&&Qf(t,i,u,o))}switch(n){case"input":Il(t),Xg(t,r,!1);break;case"textarea":Il(t),Zg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Kr(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?yi(t,!!r.multiple,i,!1):r.defaultValue!=null&&yi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=Nu)}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 pt(e),null;case 6:if(t&&e.stateNode!=null)Hw(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(q(166));if(n=Es(Ta.current),Es(Dn.current),jl(e)){if(r=e.stateNode,n=e.memoizedProps,r[Nn]=e,(i=r.nodeValue!==n)&&(t=zt,t!==null))switch(t.tag){case 3:Pl(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&Pl(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Nn]=e,e.stateNode=r}return pt(e),null;case 13:if(Re(De),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(Ae&&Ut!==null&&e.mode&1&&!(e.flags&128))lw(),Ri(),e.flags|=98560,i=!1;else if(i=jl(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(q(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(q(317));i[Nn]=e}else Ri(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;pt(e),i=!1}else dn!==null&&(ff(dn),dn=null),i=!0;if(!i)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||De.current&1?et===0&&(et=3):Ap())),e.updateQueue!==null&&(e.flags|=4),pt(e),null);case 4:return Pi(),sf(t,e),t===null&&_a(e.stateNode.containerInfo),pt(e),null;case 10:return pp(e.type._context),pt(e),null;case 17:return Dt(e.type)&&Ru(),pt(e),null;case 19:if(Re(De),i=e.memoizedState,i===null)return pt(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)jo(i,!1);else{if(et!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=Vu(t),o!==null){for(e.flags|=128,jo(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Ie(De,De.current&1|2),e.child}t=t.sibling}i.tail!==null&&Ge()>Di&&(e.flags|=128,r=!0,jo(i,!1),e.lanes=4194304)}else{if(!r)if(t=Vu(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),jo(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!Ae)return pt(e),null}else 2*Ge()-i.renderingStartTime>Di&&n!==1073741824&&(e.flags|=128,r=!0,jo(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=Ge(),e.sibling=null,n=De.current,Ie(De,r?n&1|2:n&1),e):(pt(e),null);case 22:case 23:return Rp(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Ft&1073741824&&(pt(e),e.subtreeFlags&6&&(e.flags|=8192)):pt(e),null;case 24:return null;case 25:return null}throw Error(q(156,e.tag))}function tS(t,e){switch(cp(e),e.tag){case 1:return Dt(e.type)&&Ru(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Pi(),Re(jt),Re(wt),_p(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return vp(e),null;case 13:if(Re(De),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(q(340));Ri()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return Re(De),null;case 4:return Pi(),null;case 10:return pp(e.type._context),null;case 22:case 23:return Rp(),null;case 24:return null;default:return null}}var Ll=!1,yt=!1,nS=typeof WeakSet=="function"?WeakSet:Set,Z=null;function pi(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){$e(t,e,r)}else n.current=null}function of(t,e,n){try{n()}catch(r){$e(t,e,r)}}var By=!1;function rS(t,e){if(Bd=Su,t=Q_(),lp(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 s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,u=-1,h=0,f=0,p=t,g=null;t:for(;;){for(var E;p!==n||s!==0&&p.nodeType!==3||(l=o+s),p!==i||r!==0&&p.nodeType!==3||(u=o+r),p.nodeType===3&&(o+=p.nodeValue.length),(E=p.firstChild)!==null;)g=p,p=E;for(;;){if(p===t)break t;if(g===n&&++h===s&&(l=o),g===i&&++f===r&&(u=o),(E=p.nextSibling)!==null)break;p=g,g=p.parentNode}p=E}n=l===-1||u===-1?null:{start:l,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(zd={focusedElem:t,selectionRange:n},Su=!1,Z=e;Z!==null;)if(e=Z,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Z=t;else for(;Z!==null;){e=Z;try{var N=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(N!==null){var A=N.memoizedProps,P=N.memoizedState,_=e.stateNode,w=_.getSnapshotBeforeUpdate(e.elementType===e.type?A:cn(e.type,A),P);_.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var S=e.stateNode.containerInfo;S.nodeType===1?S.textContent="":S.nodeType===9&&S.documentElement&&S.removeChild(S.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(q(163))}}catch(j){$e(e,e.return,j)}if(t=e.sibling,t!==null){t.return=e.return,Z=t;break}Z=e.return}return N=By,By=!1,N}function ea(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&of(e,n,i)}s=s.next}while(s!==r)}}function Sc(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 af(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 Ww(t){var e=t.alternate;e!==null&&(t.alternate=null,Ww(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Nn],delete e[xa],delete e[qd],delete e[Fb],delete e[Ub])),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 qw(t){return t.tag===5||t.tag===3||t.tag===4}function zy(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||qw(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 lf(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=Nu));else if(r!==4&&(t=t.child,t!==null))for(lf(t,e,n),t=t.sibling;t!==null;)lf(t,e,n),t=t.sibling}function uf(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(uf(t,e,n),t=t.sibling;t!==null;)uf(t,e,n),t=t.sibling}var at=null,hn=!1;function _r(t,e,n){for(n=n.child;n!==null;)Gw(t,e,n),n=n.sibling}function Gw(t,e,n){if(jn&&typeof jn.onCommitFiberUnmount=="function")try{jn.onCommitFiberUnmount(vc,n)}catch{}switch(n.tag){case 5:yt||pi(n,e);case 6:var r=at,s=hn;at=null,_r(t,e,n),at=r,hn=s,at!==null&&(hn?(t=at,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):at.removeChild(n.stateNode));break;case 18:at!==null&&(hn?(t=at,n=n.stateNode,t.nodeType===8?Wh(t.parentNode,n):t.nodeType===1&&Wh(t,n),ga(t)):Wh(at,n.stateNode));break;case 4:r=at,s=hn,at=n.stateNode.containerInfo,hn=!0,_r(t,e,n),at=r,hn=s;break;case 0:case 11:case 14:case 15:if(!yt&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&of(n,e,o),s=s.next}while(s!==r)}_r(t,e,n);break;case 1:if(!yt&&(pi(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){$e(n,e,l)}_r(t,e,n);break;case 21:_r(t,e,n);break;case 22:n.mode&1?(yt=(r=yt)||n.memoizedState!==null,_r(t,e,n),yt=r):_r(t,e,n);break;default:_r(t,e,n)}}function Hy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new nS),e.forEach(function(r){var s=dS.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function un(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:at=l.stateNode,hn=!1;break e;case 3:at=l.stateNode.containerInfo,hn=!0;break e;case 4:at=l.stateNode.containerInfo,hn=!0;break e}l=l.return}if(at===null)throw Error(q(160));Gw(i,o,s),at=null,hn=!1;var u=s.alternate;u!==null&&(u.return=null),s.return=null}catch(h){$e(s,e,h)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)Kw(e,t),e=e.sibling}function Kw(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(un(e,t),Sn(t),r&4){try{ea(3,t,t.return),Sc(3,t)}catch(A){$e(t,t.return,A)}try{ea(5,t,t.return)}catch(A){$e(t,t.return,A)}}break;case 1:un(e,t),Sn(t),r&512&&n!==null&&pi(n,n.return);break;case 5:if(un(e,t),Sn(t),r&512&&n!==null&&pi(n,n.return),t.flags&32){var s=t.stateNode;try{da(s,"")}catch(A){$e(t,t.return,A)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,l=t.type,u=t.updateQueue;if(t.updateQueue=null,u!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&g_(s,i),Pd(l,o);var h=Pd(l,i);for(o=0;o<u.length;o+=2){var f=u[o],p=u[o+1];f==="style"?x_(s,p):f==="dangerouslySetInnerHTML"?__(s,p):f==="children"?da(s,p):Qf(s,f,p,h)}switch(l){case"input":Cd(s,i);break;case"textarea":y_(s,i);break;case"select":var g=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var E=i.value;E!=null?yi(s,!!i.multiple,E,!1):g!==!!i.multiple&&(i.defaultValue!=null?yi(s,!!i.multiple,i.defaultValue,!0):yi(s,!!i.multiple,i.multiple?[]:"",!1))}s[xa]=i}catch(A){$e(t,t.return,A)}}break;case 6:if(un(e,t),Sn(t),r&4){if(t.stateNode===null)throw Error(q(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(A){$e(t,t.return,A)}}break;case 3:if(un(e,t),Sn(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{ga(e.containerInfo)}catch(A){$e(t,t.return,A)}break;case 4:un(e,t),Sn(t);break;case 13:un(e,t),Sn(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(kp=Ge())),r&4&&Hy(t);break;case 22:if(f=n!==null&&n.memoizedState!==null,t.mode&1?(yt=(h=yt)||f,un(e,t),yt=h):un(e,t),Sn(t),r&8192){if(h=t.memoizedState!==null,(t.stateNode.isHidden=h)&&!f&&t.mode&1)for(Z=t,f=t.child;f!==null;){for(p=Z=f;Z!==null;){switch(g=Z,E=g.child,g.tag){case 0:case 11:case 14:case 15:ea(4,g,g.return);break;case 1:pi(g,g.return);var N=g.stateNode;if(typeof N.componentWillUnmount=="function"){r=g,n=g.return;try{e=r,N.props=e.memoizedProps,N.state=e.memoizedState,N.componentWillUnmount()}catch(A){$e(r,n,A)}}break;case 5:pi(g,g.return);break;case 22:if(g.memoizedState!==null){qy(p);continue}}E!==null?(E.return=g,Z=E):qy(p)}f=f.sibling}e:for(f=null,p=t;;){if(p.tag===5){if(f===null){f=p;try{s=p.stateNode,h?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=p.stateNode,u=p.memoizedProps.style,o=u!=null&&u.hasOwnProperty("display")?u.display:null,l.style.display=w_("display",o))}catch(A){$e(t,t.return,A)}}}else if(p.tag===6){if(f===null)try{p.stateNode.nodeValue=h?"":p.memoizedProps}catch(A){$e(t,t.return,A)}}else if((p.tag!==22&&p.tag!==23||p.memoizedState===null||p===t)&&p.child!==null){p.child.return=p,p=p.child;continue}if(p===t)break e;for(;p.sibling===null;){if(p.return===null||p.return===t)break e;f===p&&(f=null),p=p.return}f===p&&(f=null),p.sibling.return=p.return,p=p.sibling}}break;case 19:un(e,t),Sn(t),r&4&&Hy(t);break;case 21:break;default:un(e,t),Sn(t)}}function Sn(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(qw(n)){var r=n;break e}n=n.return}throw Error(q(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(da(s,""),r.flags&=-33);var i=zy(t);uf(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=zy(t);lf(t,l,o);break;default:throw Error(q(161))}}catch(u){$e(t,t.return,u)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function sS(t,e,n){Z=t,Qw(t)}function Qw(t,e,n){for(var r=(t.mode&1)!==0;Z!==null;){var s=Z,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||Ll;if(!o){var l=s.alternate,u=l!==null&&l.memoizedState!==null||yt;l=Ll;var h=yt;if(Ll=o,(yt=u)&&!h)for(Z=s;Z!==null;)o=Z,u=o.child,o.tag===22&&o.memoizedState!==null?Gy(s):u!==null?(u.return=o,Z=u):Gy(s);for(;i!==null;)Z=i,Qw(i),i=i.sibling;Z=s,Ll=l,yt=h}Wy(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Z=i):Wy(t)}}function Wy(t){for(;Z!==null;){var e=Z;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:yt||Sc(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!yt)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:cn(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&Ny(e,i,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}Ny(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var u=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":u.autoFocus&&n.focus();break;case"img":u.src&&(n.src=u.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var h=e.alternate;if(h!==null){var f=h.memoizedState;if(f!==null){var p=f.dehydrated;p!==null&&ga(p)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(q(163))}yt||e.flags&512&&af(e)}catch(g){$e(e,e.return,g)}}if(e===t){Z=null;break}if(n=e.sibling,n!==null){n.return=e.return,Z=n;break}Z=e.return}}function qy(t){for(;Z!==null;){var e=Z;if(e===t){Z=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Z=n;break}Z=e.return}}function Gy(t){for(;Z!==null;){var e=Z;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{Sc(4,e)}catch(u){$e(e,n,u)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(u){$e(e,s,u)}}var i=e.return;try{af(e)}catch(u){$e(e,i,u)}break;case 5:var o=e.return;try{af(e)}catch(u){$e(e,o,u)}}}catch(u){$e(e,e.return,u)}if(e===t){Z=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Z=l;break}Z=e.return}}var iS=Math.ceil,Uu=hr.ReactCurrentDispatcher,Sp=hr.ReactCurrentOwner,nn=hr.ReactCurrentBatchConfig,ve=0,it=null,Qe=null,ct=0,Ft=0,mi=ss(0),et=0,Ca=null,js=0,Cc=0,Cp=0,ta=null,Rt=null,kp=0,Di=1/0,Hn=null,$u=!1,cf=null,Mr=null,Vl=!1,Ar=null,Bu=0,na=0,hf=null,ou=-1,au=0;function St(){return ve&6?Ge():ou!==-1?ou:ou=Ge()}function Fr(t){return t.mode&1?ve&2&&ct!==0?ct&-ct:Bb.transition!==null?(au===0&&(au=j_()),au):(t=xe,t!==0||(t=window.event,t=t===void 0?16:U_(t.type)),t):1}function mn(t,e,n,r){if(50<na)throw na=0,hf=null,Error(q(185));$a(t,n,r),(!(ve&2)||t!==it)&&(t===it&&(!(ve&2)&&(Cc|=n),et===4&&Ir(t,ct)),Ot(t,r),n===1&&ve===0&&!(e.mode&1)&&(Di=Ge()+500,Tc&&is()))}function Ot(t,e){var n=t.callbackNode;BI(t,e);var r=bu(t,t===it?ct:0);if(r===0)n!==null&&ny(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&ny(n),e===1)t.tag===0?$b(Ky.bind(null,t)):iw(Ky.bind(null,t)),Vb(function(){!(ve&6)&&is()}),n=null;else{switch(D_(r)){case 1:n=ep;break;case 4:n=A_;break;case 16:n=Iu;break;case 536870912:n=P_;break;default:n=Iu}n=rx(n,Yw.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function Yw(t,e){if(ou=-1,au=0,ve&6)throw Error(q(327));var n=t.callbackNode;if(Ei()&&t.callbackNode!==n)return null;var r=bu(t,t===it?ct:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=zu(t,r);else{e=r;var s=ve;ve|=2;var i=Jw();(it!==t||ct!==e)&&(Hn=null,Di=Ge()+500,bs(t,e));do try{lS();break}catch(l){Xw(t,l)}while(!0);fp(),Uu.current=i,ve=s,Qe!==null?e=0:(it=null,ct=0,e=et)}if(e!==0){if(e===2&&(s=Vd(t),s!==0&&(r=s,e=df(t,s))),e===1)throw n=Ca,bs(t,0),Ir(t,r),Ot(t,Ge()),n;if(e===6)Ir(t,r);else{if(s=t.current.alternate,!(r&30)&&!oS(s)&&(e=zu(t,r),e===2&&(i=Vd(t),i!==0&&(r=i,e=df(t,i))),e===1))throw n=Ca,bs(t,0),Ir(t,r),Ot(t,Ge()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(q(345));case 2:vs(t,Rt,Hn);break;case 3:if(Ir(t,r),(r&130023424)===r&&(e=kp+500-Ge(),10<e)){if(bu(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){St(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Wd(vs.bind(null,t,Rt,Hn),e);break}vs(t,Rt,Hn);break;case 4:if(Ir(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-pn(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=Ge()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*iS(r/1960))-r,10<r){t.timeoutHandle=Wd(vs.bind(null,t,Rt,Hn),r);break}vs(t,Rt,Hn);break;case 5:vs(t,Rt,Hn);break;default:throw Error(q(329))}}}return Ot(t,Ge()),t.callbackNode===n?Yw.bind(null,t):null}function df(t,e){var n=ta;return t.current.memoizedState.isDehydrated&&(bs(t,e).flags|=256),t=zu(t,e),t!==2&&(e=Rt,Rt=n,e!==null&&ff(e)),t}function ff(t){Rt===null?Rt=t:Rt.push.apply(Rt,t)}function oS(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 s=n[r],i=s.getSnapshot;s=s.value;try{if(!vn(i(),s))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 Ir(t,e){for(e&=~Cp,e&=~Cc,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-pn(e),r=1<<n;t[n]=-1,e&=~r}}function Ky(t){if(ve&6)throw Error(q(327));Ei();var e=bu(t,0);if(!(e&1))return Ot(t,Ge()),null;var n=zu(t,e);if(t.tag!==0&&n===2){var r=Vd(t);r!==0&&(e=r,n=df(t,r))}if(n===1)throw n=Ca,bs(t,0),Ir(t,e),Ot(t,Ge()),n;if(n===6)throw Error(q(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,vs(t,Rt,Hn),Ot(t,Ge()),null}function Np(t,e){var n=ve;ve|=1;try{return t(e)}finally{ve=n,ve===0&&(Di=Ge()+500,Tc&&is())}}function Ds(t){Ar!==null&&Ar.tag===0&&!(ve&6)&&Ei();var e=ve;ve|=1;var n=nn.transition,r=xe;try{if(nn.transition=null,xe=1,t)return t()}finally{xe=r,nn.transition=n,ve=e,!(ve&6)&&is()}}function Rp(){Ft=mi.current,Re(mi)}function bs(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,Lb(n)),Qe!==null)for(n=Qe.return;n!==null;){var r=n;switch(cp(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ru();break;case 3:Pi(),Re(jt),Re(wt),_p();break;case 5:vp(r);break;case 4:Pi();break;case 13:Re(De);break;case 19:Re(De);break;case 10:pp(r.type._context);break;case 22:case 23:Rp()}n=n.return}if(it=t,Qe=t=Ur(t.current,null),ct=Ft=e,et=0,Ca=null,Cp=Cc=js=0,Rt=ta=null,xs!==null){for(e=0;e<xs.length;e++)if(n=xs[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}xs=null}return t}function Xw(t,e){do{var n=Qe;try{if(fp(),ru.current=Fu,Mu){for(var r=Le.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}Mu=!1}if(Ps=0,st=Ze=Le=null,Zo=!1,Ia=0,Sp.current=null,n===null||n.return===null){et=1,Ca=e,Qe=null;break}e:{var i=t,o=n.return,l=n,u=e;if(e=ct,l.flags|=32768,u!==null&&typeof u=="object"&&typeof u.then=="function"){var h=u,f=l,p=f.tag;if(!(f.mode&1)&&(p===0||p===11||p===15)){var g=f.alternate;g?(f.updateQueue=g.updateQueue,f.memoizedState=g.memoizedState,f.lanes=g.lanes):(f.updateQueue=null,f.memoizedState=null)}var E=Oy(o);if(E!==null){E.flags&=-257,Ly(E,o,l,i,e),E.mode&1&&Dy(i,h,e),e=E,u=h;var N=e.updateQueue;if(N===null){var A=new Set;A.add(u),e.updateQueue=A}else N.add(u);break e}else{if(!(e&1)){Dy(i,h,e),Ap();break e}u=Error(q(426))}}else if(Ae&&l.mode&1){var P=Oy(o);if(P!==null){!(P.flags&65536)&&(P.flags|=256),Ly(P,o,l,i,e),hp(ji(u,l));break e}}i=u=ji(u,l),et!==4&&(et=2),ta===null?ta=[i]:ta.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var _=Dw(i,u,e);ky(i,_);break e;case 1:l=u;var w=i.type,S=i.stateNode;if(!(i.flags&128)&&(typeof w.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(Mr===null||!Mr.has(S)))){i.flags|=65536,e&=-e,i.lanes|=e;var j=Ow(i,l,e);ky(i,j);break e}}i=i.return}while(i!==null)}ex(n)}catch(V){e=V,Qe===n&&n!==null&&(Qe=n=n.return);continue}break}while(!0)}function Jw(){var t=Uu.current;return Uu.current=Fu,t===null?Fu:t}function Ap(){(et===0||et===3||et===2)&&(et=4),it===null||!(js&268435455)&&!(Cc&268435455)||Ir(it,ct)}function zu(t,e){var n=ve;ve|=2;var r=Jw();(it!==t||ct!==e)&&(Hn=null,bs(t,e));do try{aS();break}catch(s){Xw(t,s)}while(!0);if(fp(),ve=n,Uu.current=r,Qe!==null)throw Error(q(261));return it=null,ct=0,et}function aS(){for(;Qe!==null;)Zw(Qe)}function lS(){for(;Qe!==null&&!jI();)Zw(Qe)}function Zw(t){var e=nx(t.alternate,t,Ft);t.memoizedProps=t.pendingProps,e===null?ex(t):Qe=e,Sp.current=null}function ex(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=tS(n,e),n!==null){n.flags&=32767,Qe=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{et=6,Qe=null;return}}else if(n=eS(n,e,Ft),n!==null){Qe=n;return}if(e=e.sibling,e!==null){Qe=e;return}Qe=e=t}while(e!==null);et===0&&(et=5)}function vs(t,e,n){var r=xe,s=nn.transition;try{nn.transition=null,xe=1,uS(t,e,n,r)}finally{nn.transition=s,xe=r}return null}function uS(t,e,n,r){do Ei();while(Ar!==null);if(ve&6)throw Error(q(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(q(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(zI(t,i),t===it&&(Qe=it=null,ct=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||Vl||(Vl=!0,rx(Iu,function(){return Ei(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=nn.transition,nn.transition=null;var o=xe;xe=1;var l=ve;ve|=4,Sp.current=null,rS(t,n),Kw(n,t),Nb(zd),Su=!!Bd,zd=Bd=null,t.current=n,sS(n),DI(),ve=l,xe=o,nn.transition=i}else t.current=n;if(Vl&&(Vl=!1,Ar=t,Bu=s),i=t.pendingLanes,i===0&&(Mr=null),VI(n.stateNode),Ot(t,Ge()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if($u)throw $u=!1,t=cf,cf=null,t;return Bu&1&&t.tag!==0&&Ei(),i=t.pendingLanes,i&1?t===hf?na++:(na=0,hf=t):na=0,is(),null}function Ei(){if(Ar!==null){var t=D_(Bu),e=nn.transition,n=xe;try{if(nn.transition=null,xe=16>t?16:t,Ar===null)var r=!1;else{if(t=Ar,Ar=null,Bu=0,ve&6)throw Error(q(331));var s=ve;for(ve|=4,Z=t.current;Z!==null;){var i=Z,o=i.child;if(Z.flags&16){var l=i.deletions;if(l!==null){for(var u=0;u<l.length;u++){var h=l[u];for(Z=h;Z!==null;){var f=Z;switch(f.tag){case 0:case 11:case 15:ea(8,f,i)}var p=f.child;if(p!==null)p.return=f,Z=p;else for(;Z!==null;){f=Z;var g=f.sibling,E=f.return;if(Ww(f),f===h){Z=null;break}if(g!==null){g.return=E,Z=g;break}Z=E}}}var N=i.alternate;if(N!==null){var A=N.child;if(A!==null){N.child=null;do{var P=A.sibling;A.sibling=null,A=P}while(A!==null)}}Z=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Z=o;else e:for(;Z!==null;){if(i=Z,i.flags&2048)switch(i.tag){case 0:case 11:case 15:ea(9,i,i.return)}var _=i.sibling;if(_!==null){_.return=i.return,Z=_;break e}Z=i.return}}var w=t.current;for(Z=w;Z!==null;){o=Z;var S=o.child;if(o.subtreeFlags&2064&&S!==null)S.return=o,Z=S;else e:for(o=w;Z!==null;){if(l=Z,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:Sc(9,l)}}catch(V){$e(l,l.return,V)}if(l===o){Z=null;break e}var j=l.sibling;if(j!==null){j.return=l.return,Z=j;break e}Z=l.return}}if(ve=s,is(),jn&&typeof jn.onPostCommitFiberRoot=="function")try{jn.onPostCommitFiberRoot(vc,t)}catch{}r=!0}return r}finally{xe=n,nn.transition=e}}return!1}function Qy(t,e,n){e=ji(n,e),e=Dw(t,e,1),t=Vr(t,e,1),e=St(),t!==null&&($a(t,1,e),Ot(t,e))}function $e(t,e,n){if(t.tag===3)Qy(t,t,n);else for(;e!==null;){if(e.tag===3){Qy(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Mr===null||!Mr.has(r))){t=ji(n,t),t=Ow(e,t,1),e=Vr(e,t,1),t=St(),e!==null&&($a(e,1,t),Ot(e,t));break}}e=e.return}}function cS(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=St(),t.pingedLanes|=t.suspendedLanes&n,it===t&&(ct&n)===n&&(et===4||et===3&&(ct&130023424)===ct&&500>Ge()-kp?bs(t,0):Cp|=n),Ot(t,e)}function tx(t,e){e===0&&(t.mode&1?(e=Cl,Cl<<=1,!(Cl&130023424)&&(Cl=4194304)):e=1);var n=St();t=rr(t,e),t!==null&&($a(t,e,n),Ot(t,n))}function hS(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),tx(t,n)}function dS(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(q(314))}r!==null&&r.delete(e),tx(t,n)}var nx;nx=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||jt.current)Pt=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Pt=!1,Zb(t,e,n);Pt=!!(t.flags&131072)}else Pt=!1,Ae&&e.flags&1048576&&ow(e,ju,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;iu(t,e),t=e.pendingProps;var s=Ni(e,wt.current);xi(e,n),s=xp(null,e,r,t,s,n);var i=Ep();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Dt(r)?(i=!0,Au(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,gp(e),s.updater=bc,e.stateNode=s,s._reactInternals=e,Jd(e,r,t,n),e=tf(null,e,r,!0,i,n)):(e.tag=0,Ae&&i&&up(e),bt(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(iu(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=pS(r),t=cn(r,t),s){case 0:e=ef(null,e,r,t,n);break e;case 1:e=Fy(null,e,r,t,n);break e;case 11:e=Vy(null,e,r,t,n);break e;case 14:e=My(null,e,r,cn(r.type,t),n);break e}throw Error(q(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:cn(r,s),ef(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:cn(r,s),Fy(t,e,r,s,n);case 3:e:{if(Fw(e),t===null)throw Error(q(387));r=e.pendingProps,i=e.memoizedState,s=i.element,dw(t,e),Lu(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=ji(Error(q(423)),e),e=Uy(t,e,r,n,s);break e}else if(r!==s){s=ji(Error(q(424)),e),e=Uy(t,e,r,n,s);break e}else for(Ut=Lr(e.stateNode.containerInfo.firstChild),zt=e,Ae=!0,dn=null,n=cw(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Ri(),r===s){e=sr(t,e,n);break e}bt(t,e,r,n)}e=e.child}return e;case 5:return fw(e),t===null&&Qd(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,Hd(r,s)?o=null:i!==null&&Hd(r,i)&&(e.flags|=32),Mw(t,e),bt(t,e,o,n),e.child;case 6:return t===null&&Qd(e),null;case 13:return Uw(t,e,n);case 4:return yp(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ai(e,null,r,n):bt(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:cn(r,s),Vy(t,e,r,s,n);case 7:return bt(t,e,e.pendingProps,n),e.child;case 8:return bt(t,e,e.pendingProps.children,n),e.child;case 12:return bt(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,Ie(Du,r._currentValue),r._currentValue=o,i!==null)if(vn(i.value,o)){if(i.children===s.children&&!jt.current){e=sr(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var u=l.firstContext;u!==null;){if(u.context===r){if(i.tag===1){u=Yn(-1,n&-n),u.tag=2;var h=i.updateQueue;if(h!==null){h=h.shared;var f=h.pending;f===null?u.next=u:(u.next=f.next,f.next=u),h.pending=u}}i.lanes|=n,u=i.alternate,u!==null&&(u.lanes|=n),Yd(i.return,n,e),l.lanes|=n;break}u=u.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(q(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Yd(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}bt(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,xi(e,n),s=sn(s),r=r(s),e.flags|=1,bt(t,e,r,n),e.child;case 14:return r=e.type,s=cn(r,e.pendingProps),s=cn(r.type,s),My(t,e,r,s,n);
vendor: 6,704 bytes, line 40
40case 15:return Lw(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:cn(r,s),iu(t,e),e.tag=1,Dt(r)?(t=!0,Au(e)):t=!1,xi(e,n),jw(e,r,s),Jd(e,r,s,n),tf(null,e,r,!0,t,n);case 19:return $w(t,e,n);case 22:return Vw(t,e,n)}throw Error(q(156,e.tag))};function rx(t,e){return R_(t,e)}function fS(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 Zt(t,e,n,r){return new fS(t,e,n,r)}function Pp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function pS(t){if(typeof t=="function")return Pp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Xf)return 11;if(t===Jf)return 14}return 2}function Ur(t,e){var n=t.alternate;return n===null?(n=Zt(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 lu(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")Pp(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case ii:return Ss(n.children,s,i,e);case Yf:o=8,s|=8;break;case Ed:return t=Zt(12,n,e,s|2),t.elementType=Ed,t.lanes=i,t;case Td:return t=Zt(13,n,e,s),t.elementType=Td,t.lanes=i,t;case Id:return t=Zt(19,n,e,s),t.elementType=Id,t.lanes=i,t;case f_:return kc(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case h_:o=10;break e;case d_:o=9;break e;case Xf:o=11;break e;case Jf:o=14;break e;case xr:o=16,r=null;break e}throw Error(q(130,t==null?t:typeof t,""))}return e=Zt(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Ss(t,e,n,r){return t=Zt(7,t,r,e),t.lanes=n,t}function kc(t,e,n,r){return t=Zt(22,t,r,e),t.elementType=f_,t.lanes=n,t.stateNode={isHidden:!1},t}function Zh(t,e,n){return t=Zt(6,t,null,e),t.lanes=n,t}function ed(t,e,n){return e=Zt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function mS(t,e,n,r,s){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=Dh(0),this.expirationTimes=Dh(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Dh(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function jp(t,e,n,r,s,i,o,l,u){return t=new mS(t,e,n,l,u),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Zt(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},gp(i),t}function gS(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:si,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function sx(t){if(!t)return Qr;t=t._reactInternals;e:{if(zs(t)!==t||t.tag!==1)throw Error(q(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(Dt(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(q(171))}if(t.tag===1){var n=t.type;if(Dt(n))return sw(t,n,e)}return e}function ix(t,e,n,r,s,i,o,l,u){return t=jp(n,r,!0,t,s,i,o,l,u),t.context=sx(null),n=t.current,r=St(),s=Fr(n),i=Yn(r,s),i.callback=e??null,Vr(n,i,s),t.current.lanes=s,$a(t,s,r),Ot(t,r),t}function Nc(t,e,n,r){var s=e.current,i=St(),o=Fr(s);return n=sx(n),e.context===null?e.context=n:e.pendingContext=n,e=Yn(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=Vr(s,e,o),t!==null&&(mn(t,s,o,i),nu(t,s,o)),o}function Hu(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 Yy(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Dp(t,e){Yy(t,e),(t=t.alternate)&&Yy(t,e)}function yS(){return null}var ox=typeof reportError=="function"?reportError:function(t){console.error(t)};function Op(t){this._internalRoot=t}Rc.prototype.render=Op.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(q(409));Nc(t,e,null,null)};Rc.prototype.unmount=Op.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;Ds(function(){Nc(null,t,null,null)}),e[nr]=null}};function Rc(t){this._internalRoot=t}Rc.prototype.unstable_scheduleHydration=function(t){if(t){var e=V_();t={blockedOn:null,target:t,priority:e};for(var n=0;n<Tr.length&&e!==0&&e<Tr[n].priority;n++);Tr.splice(n,0,t),n===0&&F_(t)}};function Lp(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function Ac(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function Xy(){}function vS(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var h=Hu(o);i.call(h)}}var o=ix(e,r,t,0,null,!1,!1,"",Xy);return t._reactRootContainer=o,t[nr]=o.current,_a(t.nodeType===8?t.parentNode:t),Ds(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var h=Hu(u);l.call(h)}}var u=jp(t,0,!1,null,null,!1,!1,"",Xy);return t._reactRootContainer=u,t[nr]=u.current,_a(t.nodeType===8?t.parentNode:t),Ds(function(){Nc(e,u,n,r)}),u}function Pc(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var u=Hu(o);l.call(u)}}Nc(e,o,t,s)}else o=vS(n,e,t,s,r);return Hu(o)}O_=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=Uo(e.pendingLanes);n!==0&&(tp(e,n|1),Ot(e,Ge()),!(ve&6)&&(Di=Ge()+500,is()))}break;case 13:Ds(function(){var r=rr(t,1);if(r!==null){var s=St();mn(r,t,1,s)}}),Dp(t,1)}};np=function(t){if(t.tag===13){var e=rr(t,134217728);if(e!==null){var n=St();mn(e,t,134217728,n)}Dp(t,134217728)}};L_=function(t){if(t.tag===13){var e=Fr(t),n=rr(t,e);if(n!==null){var r=St();mn(n,t,e,r)}Dp(t,e)}};V_=function(){return xe};M_=function(t,e){var n=xe;try{return xe=t,e()}finally{xe=n}};
40Dd=function(t,e,n){switch(e){case"input":if(Cd(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 s=Ec(r);if(!s)throw Error(q(90));m_(r),Cd(r,s)}}}break;case"textarea":y_(t,n);break;case"select":e=n.value,e!=null&&yi(t,!!n.multiple,e,!1)}};I_=Np;b_=Ds;var _S={usingClientEntryPoint:!1,Events:[za,ui,Ec,E_,T_,Np]},Do={findFiberByHostInstance:ws,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},wS={bundleType:Do.bundleType,version:Do.version,rendererPackageName:Do.rendererPackageName,rendererConfig:Do.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:hr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=k_(t),t===null?null:t.stateNode},findFiberByHostInstance:Do.findFiberByHostInstance||yS,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 Ml=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ml.isDisabled&&Ml.supportsFiber)try{vc=Ml.inject(wS),jn=Ml}catch{}}qt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=_S;qt.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Lp(e))throw Error(q(200));return gS(t,e,null,n)};qt.createRoot=function(t,e){if(!Lp(t))throw Error(q(299));var n=!1,r="",s=ox;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=jp(t,1,!1,null,null,n,!1,r,s),t[nr]=e.current,_a(t.nodeType===8?t.parentNode:t),new Op(e)};qt.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(q(188)):(t=Object.keys(t).join(","),Error(q(268,t)));return t=k_(e),t=t===null?null:t.stateNode,t};qt.flushSync=function(t){return Ds(t)};qt.hydrate=function(t,e,n){if(!Ac(e))throw Error(q(200));return Pc(null,t,e,!0,n)};qt.hydrateRoot=function(t,e,n){if(!Lp(t))throw Error(q(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=ox;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=ix(e,null,t,1,n??null,s,!1,i,o),t[nr]=e.current,_a(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new Rc(e)};qt.render=function(t,e,n){if(!Ac(e))throw Error(q(200));return Pc(null,t,e,!1,n)};qt.unmountComponentAtNode=function(t){if(!Ac(t))throw Error(q(40));return t._reactRootContainer?(Ds(function(){Pc(null,null,t,!1,function(){t._reactRootContainer=null,t[nr]=null})}),!0):!1};qt.unstable_batchedUpdates=Np;qt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Ac(n))throw Error(q(200));if(t==null||t._reactInternals===void 0)throw Error(q(38));return Pc(t,e,n,!1,r)};qt.version="18.3.1-next-f1338f8080-20240426";function ax(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(ax)}catch(t){console.error(t)}}ax(),a_.exports=qt;var xS=a_.exports,Jy=xS;wd.createRoot=Jy.createRoot,wd.hydrateRoot=Jy.hydrateRoot;/**
41 * react-router v7.13.1
42 *
43 * Copyright (c) Remix Software Inc.
44 *
45 * This source code is licensed under the MIT license found in the
46 * LICENSE.md file in the root directory of this source tree.
47 *
48 * @license MIT
49 */var Zy="popstate";function e0(t){return typeof t=="object"&&t!=null&&"pathname"in t&&"search"in t&&"hash"in t&&"state"in t&&"key"in t}function ES(t={}){function e(r,s){var h;let i=(h=s.state)==null?void 0:h.masked,{pathname:o,search:l,hash:u}=i||r.location;return pf("",{pathname:o,search:l,hash:u},s.state&&s.state.usr||null,s.state&&s.state.key||"default",i?{pathname:r.location.pathname,search:r.location.search,hash:r.location.hash}:void 0)}function n(r,s){return typeof s=="string"?s:ka(s)}return IS(e,n,null,t)}function Pe(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function _n(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function TS(){return Math.random().toString(36).substring(2,10)}function t0(t,e){return{usr:t.state,key:t.key,idx:e,masked:t.unstable_mask?{pathname:t.pathname,search:t.search,hash:t.hash}:void 0}}function pf(t,e,n=null,r,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Qi(e):e,state:n,key:e&&e.key||r||TS(),unstable_mask:s}}function ka({pathname:t="/",search:e="",hash:n=""}){return e&&e!=="?"&&(t+=e.charAt(0)==="?"?e:"?"+e),n&&n!=="#"&&(t+=n.charAt(0)==="#"?n:"#"+n),t}function Qi(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substring(r),t=t.substring(0,r)),t&&(e.pathname=t)}return e}function IS(t,e,n,r={}){let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l="POP",u=null,h=f();h==null&&(h=0,o.replaceState({...o.state,idx:h},""));function f(){return(o.state||{idx:null}).idx}function p(){l="POP";let P=f(),_=P==null?null:P-h;h=P,u&&u({action:l,location:A.location,delta:_})}function g(P,_){l="PUSH";let w=e0(P)?P:pf(A.location,P,_);h=f()+1;let S=t0(w,h),j=A.createHref(w.unstable_mask||w);try{o.pushState(S,"",j)}catch(V){if(V instanceof DOMException&&V.name==="DataCloneError")throw V;s.location.assign(j)}i&&u&&u({action:l,location:A.location,delta:1})}function E(P,_){l="REPLACE";let w=e0(P)?P:pf(A.location,P,_);h=f();let S=t0(w,h),j=A.createHref(w.unstable_mask||w);o.replaceState(S,"",j),i&&u&&u({action:l,location:A.location,delta:0})}function N(P){return bS(P)}let A={get action(){return l},get location(){return t(s,o)},listen(P){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(Zy,p),u=P,()=>{s.removeEventListener(Zy,p),u=null}},createHref(P){return e(s,P)},createURL:N,encodeLocation(P){let _=N(P);return{pathname:_.pathname,search:_.search,hash:_.hash}},push:g,replace:E,go(P){return o.go(P)}};return A}function bS(t,e=!1){let n="http://localhost";
49typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Pe(n,"No window.location.(origin|href) available to create URL");let r=typeof t=="string"?t:ka(t);return r=r.replace(/ $/,"%20"),!e&&r.startsWith("//")&&(r=n+r),new URL(r,n)}function lx(t,e,n="/"){return SS(t,e,n,!1)}function SS(t,e,n,r){let s=typeof e=="string"?Qi(e):e,i=ir(s.pathname||"/",n);if(i==null)return null;let o=ux(t);CS(o);let l=null;for(let u=0;l==null&&u<o.length;++u){let h=MS(i);l=LS(o[u],h,r)}return l}function ux(t,e=[],n=[],r="",s=!1){let i=(o,l,u=s,h)=>{let f={relativePath:h===void 0?o.path||"":h,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};if(f.relativePath.startsWith("/")){if(!f.relativePath.startsWith(r)&&u)return;Pe(f.relativePath.startsWith(r),`Absolute route path "${f.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),f.relativePath=f.relativePath.slice(r.length)}let p=On([r,f.relativePath]),g=n.concat(f);o.children&&o.children.length>0&&(Pe(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),ux(o.children,e,g,p,u)),!(o.path==null&&!o.index)&&e.push({path:p,score:DS(p,o.index),routesMeta:g})};return t.forEach((o,l)=>{var u;if(o.path===""||!((u=o.path)!=null&&u.includes("?")))i(o,l);else for(let h of cx(o.path))i(o,l,!0,h)}),e}function cx(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=cx(r.join("/")),l=[];return l.push(...o.map(u=>u===""?i:[i,u].join("/"))),s&&l.push(...o),l.map(u=>t.startsWith("/")&&u===""?"/":u)}function CS(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:OS(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var kS=/^:[\w-]+$/,NS=3,RS=2,AS=1,PS=10,jS=-2,n0=t=>t==="*";function DS(t,e){let n=t.split("/"),r=n.length;return n.some(n0)&&(r+=jS),e&&(r+=RS),n.filter(s=>!n0(s)).reduce((s,i)=>s+(kS.test(i)?NS:i===""?AS:PS),r)}function OS(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function LS(t,e,n=!1){let{routesMeta:r}=t,s={},i="/",o=[];for(let l=0;l<r.length;++l){let u=r[l],h=l===r.length-1,f=i==="/"?e:e.slice(i.length)||"/",p=Wu({path:u.relativePath,caseSensitive:u.caseSensitive,end:h},f),g=u.route;
49if(!p&&h&&n&&!r[r.length-1].route.index&&(p=Wu({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},f)),!p)return null;Object.assign(s,p.params),o.push({params:s,pathname:On([i,p.pathname]),pathnameBase:BS(On([i,p.pathnameBase])),route:g}),p.pathnameBase!=="/"&&(i=On([i,p.pathnameBase]))}return o}function Wu(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=VS(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((h,{paramName:f,isOptional:p},g)=>{if(f==="*"){let N=l[g]||"";o=i.slice(0,i.length-N.length).replace(/(.)\/+$/,"$1")}const E=l[g];return p&&!E?h[f]=void 0:h[f]=(E||"").replace(/%2F/g,"/"),h},{}),pathname:i,pathnameBase:o,pattern:t}}function VS(t,e=!1,n=!0){_n(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=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,u,h,f)=>{if(r.push({paramName:l,isOptional:u!=null}),u){let p=f.charAt(h+o.length);return p&&p!=="/"?"/([^\\/]*)":"(?:/([^\\/]*))?"}return"/([^\\/]+)"}).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function MS(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return _n(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function ir(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)||"/"}var FS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function US(t,e="/"){let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?Qi(t):t,i;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?i=r0(n.substring(1),"/"):i=r0(n,e)):i=e,{pathname:i,search:zS(r),hash:HS(s)}}function r0(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function td(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 $S(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function Vp(t){let e=$S(t);return e.map((n,r)=>r===e.length-1?n.pathname:n.pathnameBase)}function jc(t,e,n,r=!1){let s;typeof t=="string"?s=Qi(t):(s={...t},Pe(!s.pathname||!s.pathname.includes("?"),td("?","pathname","search",s)),Pe(!s.pathname||!s.pathname.includes("#"),td("#","pathname","hash",s)),Pe(!s.search||!s.search.includes("#"),td("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let p=e.length-1;if(!r&&o.startsWith("..")){let g=o.split("/");for(;g[0]==="..";)g.shift(),p-=1;s.pathname=g.join("/")}l=p>=0?e[p]:"/"}let u=US(s,l),h=o&&o!=="/"&&o.endsWith("/"),f=(i||o===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(h||f)&&(u.pathname+="/"),u}var On=t=>t.join("/").replace(/\/\/+/g,"/"),BS=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),zS=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,HS=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,WS=class{constructor(t,e,n,r=!1){this.status=t,this.statusText=e||"",this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function qS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function GS(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var hx=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function dx(t,e){let n=t;
49if(typeof n!="string"||!FS.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,s=!1;if(hx)try{let i=new URL(window.location.href),o=n.startsWith("//")?new URL(i.protocol+n):new URL(n),l=ir(o.pathname,e);o.origin===i.origin&&l!=null?n=l+o.search+o.hash:s=!0}catch{_n(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:s,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var fx=["POST","PUT","PATCH","DELETE"];new Set(fx);var KS=["GET",...fx];new Set(KS);var Yi=C.createContext(null);Yi.displayName="DataRouter";var Dc=C.createContext(null);Dc.displayName="DataRouterState";var QS=C.createContext(!1),px=C.createContext({isTransitioning:!1});px.displayName="ViewTransition";var YS=C.createContext(new Map);YS.displayName="Fetchers";var XS=C.createContext(null);XS.displayName="Await";var Kt=C.createContext(null);Kt.displayName="Navigation";var Wa=C.createContext(null);Wa.displayName="Location";var an=C.createContext({outlet:null,matches:[],isDataRoute:!1});an.displayName="Route";var Mp=C.createContext(null);Mp.displayName="RouteError";var mx="REACT_ROUTER_ERROR",JS="REDIRECT",ZS="ROUTE_ERROR_RESPONSE";function e2(t){if(t.startsWith(`${mx}:${JS}:{`))try{let e=JSON.parse(t.slice(28));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.location=="string"&&typeof e.reloadDocument=="boolean"&&typeof e.replace=="boolean")return e}catch{}}function t2(t){if(t.startsWith(`${mx}:${ZS}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new WS(e.status,e.statusText,e.data)}catch{}}function n2(t,{relative:e}={}){Pe(Xi(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:r}=C.useContext(Kt),{hash:s,pathname:i,search:o}=qa(t,{relative:e}),l=i;return n!=="/"&&(l=i==="/"?n:On([n,i])),r.createHref({pathname:l,search:o,hash:s})}function Xi(){return C.useContext(Wa)!=null}function ln(){return Pe(Xi(),"useLocation() may be used only in the context of a <Router> component."),C.useContext(Wa).location}var gx="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function yx(t){C.useContext(Kt).static||C.useLayoutEffect(t)}function os(){let{isDataRoute:t}=C.useContext(an);return t?g2():r2()}function r2(){Pe(Xi(),"useNavigate() may be used only in the context of a <Router> component.");let t=C.useContext(Yi),{basename:e,navigator:n}=C.useContext(Kt),{matches:r}=C.useContext(an),{pathname:s}=ln(),i=JSON.stringify(Vp(r)),o=C.useRef(!1);return yx(()=>{o.current=!0}),C.useCallback((u,h={})=>{if(_n(o.current,gx),!o.current)return;if(typeof u=="number"){n.go(u);return}let f=jc(u,JSON.parse(i),s,h.relative==="path");t==null&&e!=="/"&&(f.pathname=f.pathname==="/"?e:On([e,f.pathname])),(h.replace?n.replace:n.push)(f,h.state,h)},[e,n,i,s,t])}var vx=C.createContext(null);function Ji(){return C.useContext(vx)}function s2(t){let e=C.useContext(an).outlet;return C.useMemo(()=>e&&C.createElement(vx.Provider,{value:t},e),[e,t])}function _x(){let{matches:t}=C.useContext(an),e=t[t.length-1];return e?e.params:{}}function qa(t,{relative:e}={}){let{matches:n}=C.useContext(an),{pathname:r}=ln(),s=JSON.stringify(Vp(n));return C.useMemo(()=>jc(t,JSON.parse(s),r,e==="path"),[t,s,r,e])}function i2(t,e){return wx(t,e)}function wx(t,e,n){var P;Pe(Xi(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=C.useContext(Kt),{matches:s}=C.useContext(an),i=s[s.length-1],o=i?i.params:{},l=i?i.pathname:"/",u=i?i.pathnameBase:"/",h=i&&i.route;{let _=h&&h.path||"";Ex(l,!h||_.endsWith("*")||_.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${l}" (under <Route path="${_}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
51Please change the parent <Route path="${_}"> to <Route path="${_==="/"?"*":`${_}/*`}">.`)}let f=ln(),p;if(e){let _=typeof e=="string"?Qi(e):e;Pe(u==="/"||((P=_.pathname)==null?void 0:P.startsWith(u)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${u}" but pathname "${_.pathname}" was given in the \`location\` prop.`),p=_}else p=f;let g=p.pathname||"/",E=g;if(u!=="/"){let _=u.replace(/^\//,"").split("/");E="/"+g.replace(/^\//,"").split("/").slice(_.length).join("/")}let N=lx(t,{pathname:E});_n(h||N!=null,`No routes matched location "${p.pathname}${p.search}${p.hash}" `),_n(N==null||N[N.length-1].route.element!==void 0||N[N.length-1].route.Component!==void 0||N[N.length-1].route.lazy!==void 0,`Matched leaf route at location "${p.pathname}${p.search}${p.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=c2(N&&N.map(_=>Object.assign({},_,{params:Object.assign({},o,_.params),pathname:On([u,r.encodeLocation?r.encodeLocation(_.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathname]),pathnameBase:_.pathnameBase==="/"?u:On([u,r.encodeLocation?r.encodeLocation(_.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:_.pathnameBase])})),s,n);return e&&A?C.createElement(Wa.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",unstable_mask:void 0,...p},navigationType:"POP"}},A):A}function o2(){let t=m2(),e=qS(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r},o=null;return console.error("Error handled by React Router default ErrorBoundary:",t),o=C.createElement(C.Fragment,null,C.createElement("p",null,"💿 Hey developer 👋"),C.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",C.createElement("code",{style:i},"ErrorBoundary")," or"," ",C.createElement("code",{style:i},"errorElement")," prop on your route.")),C.createElement(C.Fragment,null,C.createElement("h2",null,"Unexpected Application 
51Error!"),C.createElement("h3",{style:{fontStyle:"italic"}},e),n?C.createElement("pre",{style:s},n):null,o)}var a2=C.createElement(o2,null),xx=class extends C.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,e){return e.location!==t.location||e.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:e.error,location:e.location,revalidation:t.revalidation||e.revalidation}}componentDidCatch(t,e){this.props.onError?this.props.onError(t,e):console.error("React Router caught the following error during render",t)}render(){let t=this.state.error;if(this.context&&typeof t=="object"&&t&&"digest"in t&&typeof t.digest=="string"){const n=t2(t.digest);n&&(t=n)}let e=t!==void 0?C.createElement(an.Provider,{value:this.props.routeContext},C.createElement(Mp.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?C.createElement(l2,{error:t},e):e}};xx.contextType=QS;var nd=new WeakMap;function l2({children:t,error:e}){let{basename:n}=C.useContext(Kt);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let r=e2(e.digest);if(r){let s=nd.get(e);if(s)throw s;let i=dx(r.location,n);if(hx&&!nd.get(e))if(i.isExternal||r.reloadDocument)window.location.href=i.absoluteURL||i.to;else{const o=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:r.replace}));throw nd.set(e,o),o}return C.createElement("meta",{httpEquiv:"refresh",content:`0;url=${i.absoluteURL||i.to}`})}}return t}function u2({routeContext:t,match:e,children:n}){let r=C.useContext(Yi);return r&&r.static&&r.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=e.route.id),C.createElement(an.Provider,{value:t},n)}function c2(t,e=[],n){let r=n==null?void 0:n.state;if(t==null){if(!r)return null;if(r.errors)t=r.matches;else if(e.length===0&&!r.initialized&&r.matches.length>0)t=r.matches;else return null}let s=t,i=r==null?void 0:r.errors;if(i!=null){let f=s.findIndex(p=>p.route.id&&(i==null?void 0:i[p.route.id])!==void 0);Pe(f>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(i).join(",")}`),s=s.slice(0,Math.min(s.length,f+1))}let o=!1,l=-1;if(n&&r){o=r.renderFallback;for(let f=0;f<s.length;f++){let p=s[f];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(l=f),p.route.id){let{loaderData:g,errors:E}=r,N=p.route.loader&&!g.hasOwnProperty(p.route.id)&&(!E||E[p.route.id]===void 0);if(p.route.lazy||N){n.isStatic&&(o=!0),l>=0?s=s.slice(0,l+1):s=[s[0]];break}}}}let u=n==null?void 0:n.onError,h=r&&u?(f,p)=>{var g,E;u(f,{location:r.location,params:((E=(g=r.matches)==null?void 0:g[0])==null?void 0:E.params)??{},unstable_pattern:GS(r.matches),errorInfo:p})}:void 0;return s.reduceRight((f,p,g)=>{let E,N=!1,A=null,P=null;r&&(E=i&&p.route.id?i[p.route.id]:void 0,A=p.route.errorElement||a2,o&&(l<0&&g===0?(Ex("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,P=null):l===g&&(N=!0,P=p.route.hydrateFallbackElement||null)));let _=e.concat(s.slice(0,g+1)),w=()=>{let S;return E?S=A:N?S=P:p.route.Component?S=C.createElement(p.route.Component,null):p.route.element?S=p.route.element:S=f,C.createElement(u2,{match:p,routeContext:{outlet:f,matches:_,isDataRoute:r!=null},children:S})};return r&&(p.route.ErrorBoundary||p.route.errorElement||g===0)?C.createElement(xx,{location:r.location,revalidation:r.revalidation,component:A,error:E,children:w(),routeContext:{outlet:null,matches:_,isDataRoute:!0},onError:h}):w()},null)}function Fp(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function h2(t){let e=C.useContext(Yi);return Pe(e,Fp(t)),e}function d2(t){let e=C.useContext(Dc);return Pe(e,Fp(t)),e}function f2(t){let e=C.useContext(an);return Pe(e,Fp(t)),e}function Up(t){let e=f2(t),n=e.matches[e.matches.length-1];return Pe(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function p2(){return Up("useRouteId")}function m2(){var r;let t=C.useContext(Mp),e=d2("useRouteError"),n=Up("useRouteError");return t!==void 0?t:(r=e.errors)==null?void 0:r[n]}function g2(){let{router:t}=h2("useNavigate"),e=Up("useNavigate"),n=C.useRef(!1);return yx(()=>{n.current=!0}
51),C.useCallback(async(s,i={})=>{_n(n.current,gx),n.current&&(typeof s=="number"?await t.navigate(s):await t.navigate(s,{fromRouteId:e,...i}))},[t,e])}var s0={};function Ex(t,e,n){!e&&!s0[t]&&(s0[t]=!0,_n(!1,n))}C.memo(y2);function y2({routes:t,future:e,state:n,isStatic:r,onError:s}){return wx(t,void 0,{state:n,isStatic:r,onError:s})}function Tx({to:t,replace:e,state:n,relative:r}){Pe(Xi(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=C.useContext(Kt);_n(!s,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:i}=C.useContext(an),{pathname:o}=ln(),l=os(),u=jc(t,Vp(i),o,r==="path"),h=JSON.stringify(u);return C.useEffect(()=>{l(JSON.parse(h),{replace:e,state:n,relative:r})},[l,h,r,e,n]),null}function Ix(t){return s2(t.context)}function ot(t){Pe(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function v2({basename:t="/",children:e=null,location:n,navigationType:r="POP",navigator:s,static:i=!1,unstable_useTransitions:o}){Pe(!Xi(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let l=t.replace(/^\/*/,"/"),u=C.useMemo(()=>({basename:l,navigator:s,static:i,unstable_useTransitions:o,future:{}}),[l,s,i,o]);typeof n=="string"&&(n=Qi(n));let{pathname:h="/",search:f="",hash:p="",state:g=null,key:E="default",unstable_mask:N}=n,A=C.useMemo(()=>{let P=ir(h,l);return P==null?null:{location:{pathname:P,search:f,hash:p,state:g,key:E,unstable_mask:N},navigationType:r}},[l,h,f,p,g,E,r,N]);return _n(A!=null,`<Router basename="${l}"> is not able to match the URL "${h}${f}${p}" because it does not start with the basename, so the <Router> won't render anything.`),A==null?null:C.createElement(Kt.Provider,{value:u},C.createElement(Wa.Provider,{children:e,value:A}))}function _2({children:t,location:e}){return i2(mf(t),e)}function mf(t,e=[]){let n=[];return C.Children.forEach(t,(r,s)=>{if(!C.isValidElement(r))return;let i=[...e,s];if(r.type===C.Fragment){n.push.apply(n,mf(r.props.children,i));return}Pe(r.type===ot,`[${typeof r.type=="string"?r.type:r.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Pe(!r.props.index||!r.props.children,"An index route cannot have child routes.");let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,middleware:r.props.middleware,loader:r.props.loader,action:r.props.action,hydrateFallbackElement:r.props.hydrateFallbackElement,HydrateFallback:r.props.HydrateFallback,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.hasErrorBoundary===!0||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=mf(r.props.children,i)),n.push(o)}),n}var uu="get",cu="application/x-www-form-urlencoded";function Oc(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function w2(t){return Oc(t)&&t.tagName.toLowerCase()==="button"}function x2(t){return Oc(t)&&t.tagName.toLowerCase()==="form"}function E2(t){return Oc(t)&&t.tagName.toLowerCase()==="input"}function T2(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function I2(t,e){return t.button===0&&(!e||e==="_self")&&!T2(t)}var Fl=null;function b2(){if(Fl===null)try{new FormData(document.createElement("form"),0),Fl=!1}catch{Fl=!0}return Fl}var S2=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function rd(t){return t!=null&&!S2.has(t)?(_n(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${cu}"`),null):t}function C2(t,e){let n,r,s,i,o;if(x2(t)){let l=t.getAttribute("action");r=l?ir(l,e):null,n=t.getAttribute("method")||uu,s=rd(t.getAttribute("enctype"))||cu,i=new FormData(t)}else if(w2(t)||E2(t)&&(t.type==="submit"||t.type==="image")){let l=t.form;if(l==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=t.getAttribute("formaction")||l.getAttribute("action");if(r=u?ir(u,e):null,n=t.getAttribute("formmethod")||l.getAttribute("method")||uu,s=rd(t.getAttribute("formenctype"))||rd(l.getAttribute("enctype"))||cu,i=new FormData(l,t),!b2()){let{name:h,type:f,value:p}=t;if(f==="image"){let g=h?`${h}.`:"";i.append(`${g}x`,"0"),i.append(`${g}y`,"0")}
51else h&&i.append(h,p)}}else{if(Oc(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=uu,r=null,s=cu,o=t}return i&&s==="text/plain"&&(o=i,i=void 0),{action:r,method:n.toLowerCase(),encType:s,formData:i,body:o}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function $p(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function k2(t,e,n,r){let s=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?s.pathname.endsWith("/")?s.pathname=`${s.pathname}_.${r}`:s.pathname=`${s.pathname}.${r}`:s.pathname==="/"?s.pathname=`_root.${r}`:e&&ir(s.pathname,e)==="/"?s.pathname=`${e.replace(/\/$/,"")}/_root.${r}`:s.pathname=`${s.pathname.replace(/\/$/,"")}.${r}`,s}async function N2(t,e){if(t.id in e)return e[t.id];try{let n=await import(t.module);return e[t.id]=n,n}catch(n){return console.error(`Error loading route module \`${t.module}\`, reloading page...`),console.error(n),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function R2(t){return t==null?!1:t.href==null?t.rel==="preload"&&typeof t.imageSrcSet=="string"&&typeof t.imageSizes=="string":typeof t.rel=="string"&&typeof t.href=="string"}async function A2(t,e,n){let r=await Promise.all(t.map(async s=>{let i=e.routes[s.route.id];if(i){let o=await N2(i,n);return o.links?o.links():[]}return[]}));return O2(r.flat(1).filter(R2).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function i0(t,e,n,r,s,i){let o=(u,h)=>n[h]?u.route.id!==n[h].route.id:!0,l=(u,h)=>{var f;return n[h].pathname!==u.pathname||((f=n[h].route.path)==null?void 0:f.endsWith("*"))&&n[h].params["*"]!==u.params["*"]};return i==="assets"?e.filter((u,h)=>o(u,h)||l(u,h)):i==="data"?e.filter((u,h)=>{var p;let f=r.routes[u.route.id];if(!f||!f.hasLoader)return!1;if(o(u,h)||l(u,h))return!0;if(u.route.shouldRevalidate){let g=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((p=n[0])==null?void 0:p.params)||{},nextUrl:new URL(t,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof g=="boolean")return g}return!0}):[]}function P2(t,e,{includeHydrateFallback:n}={}){return j2(t.map(r=>{let s=e.routes[r.route.id];if(!s)return[];let i=[s.module];return s.clientActionModule&&(i=i.concat(s.clientActionModule)),s.clientLoaderModule&&(i=i.concat(s.clientLoaderModule)),n&&s.hydrateFallbackModule&&(i=i.concat(s.hydrateFallbackModule)),s.imports&&(i=i.concat(s.imports)),i}).flat(1))}function j2(t){return[...new Set(t)]}function D2(t){let e={},n=Object.keys(t).sort();for(let r of n)e[r]=t[r];return e}function O2(t,e){let n=new Set;return new Set(e),t.reduce((r,s)=>{let i=JSON.stringify(D2(s));return n.has(i)||(n.add(i),r.push({key:i,link:s})),r},[])}function bx(){let t=C.useContext(Yi);return $p(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function L2(){let t=C.useContext(Dc);return $p(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var Bp=C.createContext(void 0);Bp.displayName="FrameworkContext";function Sx(){let t=C.useContext(Bp);return $p(t,"You must render this element inside a <HydratedRouter> element"),t}function V2(t,e){let n=C.useContext(Bp),[r,s]=C.useState(!1),[i,o]=C.useState(!1),{onFocus:l,onBlur:u,onMouseEnter:h,onMouseLeave:f,onTouchStart:p}=e,g=C.useRef(null);C.useEffect(()=>{if(t==="render"&&o(!0),t==="viewport"){let A=_=>{_.forEach(w=>{o(w.isIntersecting)})},P=new IntersectionObserver(A,{threshold:.5});return g.current&&P.observe(g.current),()=>{P.disconnect()}}},[t]),C.useEffect(()=>{if(r){let A=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(A)}}},[r]);let E=()=>{s(!0)},N=()=>{s(!1),o(!1)};return n?t!=="intent"?[i,g,{}]:[i,g,{onFocus:Oo(l,E),onBlur:Oo(u,N),onMouseEnter:Oo(h,E),onMouseLeave:Oo(f,N),onTouchStart:Oo(p,E)}]:[!1,g,{}]}function Oo(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function M2({page:t,...e}){let{router:n}=bx(),r=C.useMemo(()=>lx(n.routes,t,n.basename),[n.routes,t,n.basename]);return r?C.createElement(U2,{page:t,matches:r,...e}):null}function F2(t){let{manifest:e,routeModules:n}=Sx(),[r,s]=C.useState([]);return C.useEffect(()=>{let i=!1;return A2(t,e,n).then(o=>{i||s(o)}),()=>{i=!0}},[t,e,n]),r}function U2({page:t,matches:e,...n}){let r=ln(),{future:s,manifest:i,routeModules:o}=Sx(),{basename:l}=bx(),{loaderData:u,matches:h}=L2(),f=C.useMemo(()=>i0(t,e,h,i,r,"data"),[t,e,h,i,r]),p=C.useMemo(()=>i0(t,e,h,i,r,"assets"),[t,e,h,i,r]),g=C.useMemo(()=>
51{if(t===r.pathname+r.search+r.hash)return[];let A=new Set,P=!1;if(e.forEach(w=>{var j;let S=i.routes[w.route.id];!S||!S.hasLoader||(!f.some(V=>V.route.id===w.route.id)&&w.route.id in u&&((j=o[w.route.id])!=null&&j.shouldRevalidate)||S.hasClientLoader?P=!0:A.add(w.route.id))}),A.size===0)return[];let _=k2(t,l,s.unstable_trailingSlashAwareDataRequests,"data");return P&&A.size>0&&_.searchParams.set("_routes",e.filter(w=>A.has(w.route.id)).map(w=>w.route.id).join(",")),[_.pathname+_.search]},[l,s.unstable_trailingSlashAwareDataRequests,u,r,i,f,e,t,o]),E=C.useMemo(()=>P2(p,i),[p,i]),N=F2(p);return C.createElement(C.Fragment,null,g.map(A=>C.createElement("link",{key:A,rel:"prefetch",as:"fetch",href:A,...n})),E.map(A=>C.createElement("link",{key:A,rel:"modulepreload",href:A,...n})),N.map(({key:A,link:P})=>C.createElement("link",{key:A,nonce:n.nonce,...P,crossOrigin:P.crossOrigin??n.crossOrigin})))}function $2(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var B2=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{B2&&(window.__reactRouterVersion="7.13.1")}catch{}function z2({basename:t,children:e,unstable_useTransitions:n,window:r}){let s=C.useRef();s.current==null&&(s.current=ES({window:r,v5Compat:!0}));let i=s.current,[o,l]=C.useState({action:i.action,location:i.location}),u=C.useCallback(h=>{n===!1?l(h):C.startTransition(()=>l(h))},[n]);return C.useLayoutEffect(()=>i.listen(u),[i,u]),C.createElement(v2,{basename:t,children:e,location:o.location,navigationType:o.action,navigator:i,unstable_useTransitions:n})}var Cx=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Be=C.forwardRef(function({onClick:e,discover:n="render",prefetch:r="none",relative:s,reloadDocument:i,replace:o,unstable_mask:l,state:u,target:h,to:f,preventScrollReset:p,viewTransition:g,unstable_defaultShouldRevalidate:E,...N},A){let{basename:P,navigator:_,unstable_useTransitions:w}=C.useContext(Kt),S=typeof f=="string"&&Cx.test(f),j=dx(f,P);f=j.to;let V=n2(f,{relative:s}),M=ln(),T=null;if(l){let O=jc(l,[],M.unstable_mask?M.unstable_mask.pathname:"/",!0);P!=="/"&&(O.pathname=O.pathname==="/"?P:On([P,O.pathname])),T=_.createHref(O)}let[y,I,k]=V2(r,N),R=G2(f,{replace:o,unstable_mask:l,state:u,target:h,preventScrollReset:p,relative:s,viewTransition:g,unstable_defaultShouldRevalidate:E,unstable_useTransitions:w});function b(O){e&&e(O),O.defaultPrevented||R(O)}let v=!(j.isExternal||i),U=C.createElement("a",{...N,...k,href:(v?T:void 0)||j.absoluteURL||V,onClick:v?b:e,ref:$2(A,I),target:h,"data-discover":!S&&n==="render"?"true":void 0});return y&&!S?C.createElement(C.Fragment,null,U,C.createElement(M2,{page:V})):U});Be.displayName="Link";var H2=C.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:r="",end:s=!1,style:i,to:o,viewTransition:l,children:u,...h},f){let p=qa(o,{relative:h.relative}),g=ln(),E=C.useContext(Dc),{navigator:N,basename:A}=C.useContext(Kt),P=E!=null&&J2(p)&&l===!0,_=N.encodeLocation?N.encodeLocation(p).pathname:p.pathname,w=g.pathname,S=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;n||(w=w.toLowerCase(),S=S?S.toLowerCase():null,_=_.toLowerCase()),S&&A&&(S=ir(S,A)||S);const j=_!=="/"&&_.endsWith("/")?_.length-1:_.length;let V=w===_||!s&&w.startsWith(_)&&w.charAt(j)==="/",M=S!=null&&(S===_||!s&&S.startsWith(_)&&S.charAt(_.length)==="/"),T={isActive:V,isPending:M,isTransitioning:P},y=V?e:void 0,I;typeof r=="function"?I=r(T):I=[r,V?"active":null,M?"pending":null,P?"transitioning":null].filter(Boolean).join(" ");let k=typeof i=="function"?i(T):i;return C.createElement(Be,{...h,"aria-current":y,className:I,ref:f,style:k,to:o,viewTransition:l},typeof u=="function"?u(T):u)});H2.displayName="NavLink";var W2=C.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:r,replace:s,state:i,method:o=uu,action:l,onSubmit:u,relative:h,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:g,...E},N)=>{let{unstable_useTransitions:A}=C.useContext(Kt),P=Y2(),_=X2(l,{relative:h}),w=o.toLowerCase()==="get"?"get":"post",S=typeof l=="string"&&Cx.test(l),j=V=>{if(u&&u(V),V.defaultPrevented)return;V.preventDefault();let M=V.nativeEvent.submitter,T=(M==null?void 0:M.getAttribute("formmethod"))||o,y=()=>P(M||V.currentTarget,{fetcherKey:e,method:T,navigate:n,replace:s,state:i,relative:h,preventScrollReset:f,viewTransition:p,unstable_defaultShouldRevalidate:g});A&&n!==!1?C.startTransition(()=>y()):y()};return C.createElement("form",{ref:N,method:w,action:_,onSubmit:r?u:j,...E,"data-discover":!S&&t==="render"?"true":void 0})});W2.displayName="Form";function q2(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function kx(t){let e=C.useContext(Yi);return Pe(e,q2(t)),e}function G2(t,{target:e,replace:n,unstable_mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u,unstable_useTransitions:h}={}){let f=os(),p=ln(),g=qa(t,{relative:o});return C.useCallback(E=>{if(I2(E,e)){E.preventDefault();let N=n!==void 0?n:ka(p)===ka(g),A=()=>f(t,{replace:N,unstable_mask:r,state:s,preventScrollReset:i,relative:o,viewTransition:l,unstable_defaultShouldRevalidate:u});h?C.startTransition(()=>A()):A()}},[p,f,g,n,r,s,e,t,i,o,l,u,h])}var K2=0,Q2=()=>`__${String(++K2)}__`;function Y2(){let{router:t}=kx("useSubmit"),{basename:e}=C.useContext(Kt),n=p2(),r=t.fetch,s=t.navigate;return C.useCallback(async(i,o={})=>{let{action:l,method:u,encType:h,formData:f,body:p}=C2(i,e);if(o.navigate===!1){let g=o.fetcherKey||Q2();await r(g,n,o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:p,formMethod:o.method||u,formEncType:o.encType||h,flushSync:o.flushSync})}else await s(o.action||l,{unstable_defaultShouldRevalidate:o.unstable_defaultShouldRevalidate,preventScrollReset:o.preventScrollReset,formData:f,body:p,formMethod:o.method||u,formEncType:o.encType||h,replace:o.replace,state:o.state,fromRouteId:n,flushSync:o.flushSync,viewTransition:o.viewTransition})},[r,s,e,n])}function X2(t,{relative:e}={}){let{basename:n}=C.useContext(Kt),r=C.useContext(an);Pe(r,"useFormAction must be used inside a RouteContext");let[s]=r.matches.slice(-1),i={...qa(t||".",{relative:e})},o=ln();if(t==null){i.search=o.search;let l=new URLSearchParams(i.search),u=l.getAll("index");if(u.some(f=>f==="")){l.delete("index"),u.filter(p=>
51p).forEach(p=>l.append("index",p));let f=l.toString();i.search=f?`?${f}`:""}}return(!t||t===".")&&s.route.index&&(i.search=i.search?i.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(i.pathname=i.pathname==="/"?n:On([n,i.pathname])),ka(i)}function J2(t,{relative:e}={}){let n=C.useContext(px);Pe(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=kx("useViewTransitionState"),s=qa(t,{relative:e});if(!n.isTransitioning)return!1;let i=ir(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=ir(n.nextLocation.pathname,r)||n.nextLocation.pathname;return Wu(s.pathname,o)!=null||Wu(s.pathname,i)!=null}const Z2=()=>{};var o0={};/**
52 * @license
53 * Copyright 2017 Google LLC
54 *
55 * Licensed under the Apache License, Version 2.0 (the "License");
56 * you may not use this file except in compliance with the License.
57 * You may obtain a copy of the License at
58 *
59 *   http://www.apache.org/licenses/LICENSE-2.0
60 *
61 * Unless required by applicable law or agreed to in writing, software
62 * distributed under the License is distributed on an "AS IS" BASIS,
63 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
64 * See the License for the specific language governing permissions and
65 * limitations under the License.
66 */const Nx=function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let s=t.charCodeAt(r);s<128?e[n++]=s:s<2048?(e[n++]=s>>6|192,e[n++]=s&63|128):(s&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(s=65536+((s&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=s>>18|240,e[n++]=s>>12&63|128,e[n++]=s>>6&63|128,e[n++]=s&63|128):(e[n++]=s>>12|224,e[n++]=s>>6&63|128,e[n++]=s&63|128)}return e},eC=function(t){const e=[];let n=0,r=0;for(;n<t.length;){const s=t[n++];if(s<128)e[r++]=String.fromCharCode(s);else if(s>191&&s<224){const i=t[n++];e[r++]=String.fromCharCode((s&31)<<6|i&63)}else if(s>239&&s<365){const i=t[n++],o=t[n++],l=t[n++],u=((s&7)<<18|(i&63)<<12|(o&63)<<6|l&63)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(u&1023))}else{const i=t[n++],o=t[n++];e[r++]=String.fromCharCode((s&15)<<12|(i&63)<<6|o&63)}}return e.join("")},Rx={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 s=0;s<t.length;s+=3){const i=t[s],o=s+1<t.length,l=o?t[s+1]:0,u=s+2<t.length,h=u?t[s+2]:0,f=i>>2,p=(i&3)<<4|l>>4;let g=(l&15)<<2|h>>6,E=h&63;u||(E=64,o||(g=64)),r.push(n[f],n[p],n[g],n[E])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Nx(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):eC(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let s=0;s<t.length;){const i=n[t.charAt(s++)],l=s<t.length?n[t.charAt(s)]:0;++s;const h=s<t.length?n[t.charAt(s)]:64;++s;const p=s<t.length?n[t.charAt(s)]:64;if(++s,i==null||l==null||h==null||p==null)throw new tC;const g=i<<2|l>>4;if(r.push(g),h!==64){const E=l<<4&240|h>>2;if(r.push(E),p!==64){const N=h<<6&192|p;r.push(N)}}}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)}}};
66class tC extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const nC=function(t){const e=Nx(t);return Rx.encodeByteArray(e,!0)},qu=function(t){return nC(t).replace(/\./g,"")},Ax=function(t){try{return Rx.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
67 * @license
68 * Copyright 2022 Google LLC
69 *
70 * Licensed under the Apache License, Version 2.0 (the "License");
71 * you may not use this file except in compliance with the License.
72 * You may obtain a copy of the License at
73 *
74 *   http://www.apache.org/licenses/LICENSE-2.0
75 *
76 * Unless required by applicable law or agreed to in writing, software
77 * distributed under the License is distributed on an "AS IS" BASIS,
78 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
79 * See the License for the specific language governing permissions and
80 * limitations under the License.
81 */function rC(){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.")}/**
82 * @license
83 * Copyright 2022 Google LLC
84 *
85 * Licensed under the Apache License, Version 2.0 (the "License");
86 * you may not use this file except in compliance with the License.
87 * You may obtain a copy of the License at
88 *
89 *   http://www.apache.org/licenses/LICENSE-2.0
90 *
91 * Unless required by applicable law or agreed to in writing, software
92 * distributed under the License is distributed on an "AS IS" BASIS,
93 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94 * See the License for the specific language governing permissions and
95 * limitations under the License.
96 */const sC=()=>rC().__FIREBASE_DEFAULTS__,iC=()=>{if(typeof process>"u"||typeof o0>"u")return;const t=o0.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},oC=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&Ax(t[1]);return e&&JSON.parse(e)},Lc=()=>{try{return Z2()||sC()||iC()||oC()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Px=t=>{var e,n;return(n=(e=Lc())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},jx=t=>{const e=Px(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),r]:[e.substring(0,n),r]},Dx=()=>{var t;return(t=Lc())==null?void 0:t.config},Ox=t=>{var e;return(e=Lc())==null?void 0:e[`_${t}`]};/**
97 * @license
98 * Copyright 2017 Google LLC
99 *
100 * Licensed under the Apache License, Version 2.0 (the "License");
101 * you may not use this file except in compliance with the License.
102 * You may obtain a copy of the License at
103 *
104 *   http://www.apache.org/licenses/LICENSE-2.0
105 *
106 * Unless required by applicable law or agreed to in writing, software
107 * distributed under the License is distributed on an "AS IS" BASIS,
108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
109 * See the License for the specific language governing permissions and
110 * limitations under the License.
111 */class aC{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))}}}/**
112 * @license
113 * Copyright 2025 Google LLC
114 *
115 * Licensed under the Apache License, Version 2.0 (the "License");
116 * you may not use this file except in compliance with the License.
117 * You may obtain a copy of the License at
118 *
119 *   http://www.apache.org/licenses/LICENSE-2.0
120 *
121 * Unless required by applicable law or agreed to in writing, software
122 * distributed under the License is distributed on an "AS IS" BASIS,
123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
124 * See the License for the specific language governing permissions and
125 * limitations under the License.
126 */function as(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function zp(t){return(await fetch(t,{credentials:"include"})).ok}/**
127 * @license
128 * Copyright 2021 Google LLC
129 *
130 * Licensed under the Apache License, Version 2.0 (the "License");
131 * you may not use this file except in compliance with the License.
132 * You may obtain a copy of the License at
133 *
134 *   http://www.apache.org/licenses/LICENSE-2.0
135 *
136 * Unless required by applicable law or agreed to in writing, software
137 * distributed under the License is distributed on an "AS IS" BASIS,
138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
139 * See the License for the specific language governing permissions and
140 * limitations under the License.
141 */function Lx(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",s=t.iat||0,i=t.sub||t.user_id;if(!i)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const o={iss:`https://securetoken.google.com/${r}`,aud:r,iat:s,exp:s+3600,auth_time:s,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...t};return[qu(JSON.stringify(n)),qu(JSON.stringify(o)),""].join(".")}const ra={};function lC(){const t={prod:[],emulator:[]};for(const e of Object.keys(ra))ra[e]?t.emulator.push(e):t.prod.push(e);return t}function uC(t){let e=document.getElementById(t),n=!1;return e||(e=document.createElement("div"),e.setAttribute("id",t),n=!0),{created:n,element:e}}let a0=!1;function Hp(t,e){if(typeof window>"u"||typeof document>"u"||!as(window.location.host)||ra[t]===e||ra[t]||a0)return;ra[t]=e;function n(g){return`__firebase__banner__${g}`}const r="__firebase__banner",i=lC().prod.length>0;function o(){const g=document.getElementById(r);g&&g.remove()}function l(g){g.style.display="flex",g.style.background="#7faaf0",g.style.position="fixed",g.style.bottom="5px",g.style.left="5px",g.style.padding=".5em",g.style.borderRadius="5px",g.style.alignItems="center"}function u(g,E){g.setAttribute("width","24"),g.setAttribute("id",E),g.setAttribute("height","24"),g.setAttribute("viewBox","0 0 24 24"),g.setAttribute("fill","none"),g.style.marginLeft="-6px"}function h(){const g=document.createElement("span");return g.style.cursor="pointer",g.style.marginLeft="16px",g.style.fontSize="24px",g.innerHTML=" &times;",g.onclick=()=>{a0=!0,o()},g}function f(g,E){g.setAttribute("id",E),g.innerText="Learn more",g.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",g.setAttribute("target","__blank"),g.style.paddingLeft="5px",g.style.textDecoration="underline"}function p(){const g=uC(r),E=n("text"),N=document.getElementById(E)||document.createElement("span"),A=n("learnmore"),P=document.getElementById(A)||document.createElement("a"),_=n("preprendIcon"),w=document.getElementById(_)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(g.created){const S=g.element;l(S),f(P,A);const j=h();u(w,_),S.append(w,N,P,j),document.body.appendChild(S)}i?(N.innerText="Preview backend disconnected.",w.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
142<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
143</g>
144<defs>
145<clipPath id="clip0_6013_33858">
146<rect width="24" height="24" fill="white"/>
147</clipPath>
148</defs>`):(w.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
149<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
150</g>
151<defs>
152<clipPath id="clip0_6083_34804">
153<rect width="24" height="24" fill="white"/>
154</clipPath>
155</defs>`,N.innerText="Preview backend running in this workspace."),N.setAttribute("id",E)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",p):p()}/**
156 * @license
157 * Copyright 2017 Google LLC
158 *
159 * Licensed under the Apache License, Version 2.0 (the "License");
160 * you may not use this file except in compliance with the License.
161 * You may obtain a copy of the License at
162 *
163 *   http://www.apache.org/licenses/LICENSE-2.0
164 *
165 * Unless required by applicable law or agreed to in writing, software
166 * distributed under the License is distributed on an "AS IS" BASIS,
167 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
168 * See the License for the specific language governing permissions and
169 * limitations under the License.
170 */function xt(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function cC(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(xt())}function hC(){var e;const t=(e=Lc())==null?void 0:e.forceEnvironment;if(t==="node")return!0;if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function dC(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function fC(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function pC(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function mC(){const t=xt();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function gC(){return!hC()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function yC(){try{return typeof indexedDB=="object"}catch{return!1}}function vC(){return new Promise((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",s=self.indexedDB.open(r);s.onsuccess=()=>{s.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},s.onupgradeneeded=()=>{n=!1},s.onerror=()=>{var i;e(((i=s.error)==null?void 0:i.message)||"")}}catch(n){e(n)}})}/**
171 * @license
172 * Copyright 2017 Google LLC
173 *
174 * Licensed under the Apache License, Version 2.0 (the "License");
175 * you may not use this file except in compliance with the License.
176 * You may obtain a copy of the License at
177 *
178 *   http://www.apache.org/licenses/LICENSE-2.0
179 *
180 * Unless required by applicable law or agreed to in writing, software
181 * distributed under the License is distributed on an "AS IS" BASIS,
182 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183 * See the License for the specific language governing permissions and
184 * limitations under the License.
185 */const _C="FirebaseError";class zn extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=_C,Object.setPrototypeOf(this,zn.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Ga.prototype.create)}}class Ga{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){const r=n[0]||{},s=`${this.service}/${e}`,i=this.errors[e],o=i?wC(i,r):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new zn(s,l,r)}}function wC(t,e){return t.replace(xC,(n,r)=>{const s=e[r];return s!=null?String(s):`<${r}?>`})}const xC=/\{\$([^}]+)}/g;function EC(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Os(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const s of n){if(!r.includes(s))return!1;const i=t[s],o=e[s];if(l0(i)&&l0(o)){if(!Os(i,o))return!1}else if(i!==o)return!1}for(const s of r)if(!n.includes(s))return!1;return!0}function l0(t){return t!==null&&typeof t=="object"}/**
186 * @license
187 * Copyright 2017 Google LLC
188 *
189 * Licensed under the Apache License, Version 2.0 (the "License");
190 * you may not use this file except in compliance with the License.
191 * You may obtain a copy of the License at
192 *
193 *   http://www.apache.org/licenses/LICENSE-2.0
194 *
195 * Unless required by applicable law or agreed to in writing, software
196 * distributed under the License is distributed on an "AS IS" BASIS,
197 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
198 * See the License for the specific language governing permissions and
199 * limitations under the License.
200 */function Ka(t){const e=[];for(const[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(s=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(s))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Bo(t){const e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[s,i]=r.split("=");e[decodeURIComponent(s)]=decodeURIComponent(i)}}),e}function zo(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function TC(t,e){const n=new IC(t,e);return n.subscribe.bind(n)}class IC{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Prom
200ise.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 s;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");bC(e,["next","error","complete"])?s=e:s={next:e,error:n,complete:r},s.next===void 0&&(s.next=sd),s.error===void 0&&(s.error=sd),s.complete===void 0&&(s.complete=sd);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?s.error(this.finalError):s.complete()}catch{}}),this.observers.push(s),i}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 bC(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 sd(){}/**
201 * @license
202 * Copyright 2021 Google LLC
203 *
204 * Licensed under the Apache License, Version 2.0 (the "License");
205 * you may not use this file except in compliance with the License.
206 * You may obtain a copy of the License at
207 *
208 *   http://www.apache.org/licenses/LICENSE-2.0
209 *
210 * Unless required by applicable law or agreed to in writing, software
211 * distributed under the License is distributed on an "AS IS" BASIS,
212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
213 * See the License for the specific language governing permissions and
214 * limitations under the License.
215 */function je(t){return t&&t._delegate?t._delegate:t}class Yr{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}}/**
216 * @license
217 * Copyright 2019 Google LLC
218 *
219 * Licensed under the Apache License, Version 2.0 (the "License");
220 * you may not use this file except in compliance with the License.
221 * You may obtain a copy of the License at
222 *
223 *   http://www.apache.org/licenses/LICENSE-2.0
224 *
225 * Unless required by applicable law or agreed to in writing, software
226 * distributed under the License is distributed on an "AS IS" BASIS,
227 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
228 * See the License for the specific language governing permissions and
229 * limitations under the License.
230 */const _s="[DEFAULT]";/**
231 * @license
232 * Copyright 2019 Google LLC
233 *
234 * Licensed under the Apache License, Version 2.0 (the "License");
235 * you may not use this file except in compliance with the License.
236 * You may obtain a copy of the License at
237 *
238 *   http://www.apache.org/licenses/LICENSE-2.0
239 *
240 * Unless required by applicable law or agreed to in writing, software
241 * distributed under the License is distributed on an "AS IS" BASIS,
242 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
243 * See the License for the specific language governing permissions and
244 * limitations under the License.
245 */class SC{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 aC;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:n});s&&r.resolve(s)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),r=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(s){if(r)return null;throw s}else{if(r)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(kC(e))try{this.getOrInitializeService({instanceIdentifier:_s})}catch{}for(const[n,r]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(n);try{const i=this.getOrInitializeService({instanceIdentifier:s});r.resolve(i)}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 s=this.getOrInitializeService({instanceIdentifier:r,options:n});for(const[i,o]of this.instancesDeferred.entries()){const l=this.normalizeInstanceIdentifier(i);r===l&&o.resolve(s)}return s}onInit(e,n){const r=this.normalizeInstanceIdentifier(n),s=this.onInitCallbacks.get(r)??new Set;s.add(e),this.onInitCallbacks.set(r,s);const i=this.instances.get(r);return i&&e(i,r),()=>{s.delete(e)}}invokeOnInitCallbacks(e,n){const r=this.onInitCallbacks.get(n);if(r)for(const s of r)try{s(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:CC(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 CC(t){return t===_s?void 0:t}function kC(t){return t.instantiationMode==="EAGER"}/**
246 * @license
247 * Copyright 2019 Google LLC
248 *
249 * Licensed under the Apache License, Version 2.0 (the "License");
250 * you may not use this file except in compliance with the License.
251 * You may obtain a copy of the License at
252 *
253 *   http://www.apache.org/licenses/LICENSE-2.0
254 *
255 * Unless required by applicable law or agreed to in writing, software
256 * distributed under the License is distributed on an "AS IS" BASIS,
257 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258 * See the License for the specific language governing permissions and
259 * limitations under the License.
260 */class NC{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 SC(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
261 * @license
262 * Copyright 2017 Google LLC
263 *
264 * Licensed under the Apache License, Version 2.0 (the "License");
265 * you may not use this file except in compliance with the License.
266 * You may obtain a copy of the License at
267 *
268 *   http://www.apache.org/licenses/LICENSE-2.0
269 *
270 * Unless required by applicable law or agreed to in writing, software
271 * distributed under the License is distributed on an "AS IS" BASIS,
272 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
273 * See the License for the specific language governing permissions and
274 * limitations under the License.
275 */var pe;(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"})(pe||(pe={}));const RC={debug:pe.DEBUG,verbose:pe.VERBOSE,info:pe.INFO,warn:pe.WARN,error:pe.ERROR,silent:pe.SILENT},AC=pe.INFO,PC={[pe.DEBUG]:"log",[pe.VERBOSE]:"log",[pe.INFO]:"info",[pe.WARN]:"warn",[pe.ERROR]:"error"},jC=(t,e,...n)=>{if(e<t.logLevel)return;const r=new Date().toISOString(),s=PC[e];if(s)console[s](`[${r}]  ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class Wp{constructor(e){this.name=e,this._logLevel=AC,this._logHandler=jC,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in pe))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?RC[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,pe.DEBUG,...e),this._logHandler(this,pe.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,pe.VERBOSE,...e),this._logHandler(this,pe.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,pe.INFO,...e),this._logHandler(this,pe.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,pe.WARN,...e),this._logHandler(this,pe.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,pe.ERROR,...e),this._logHandler(this,pe.ERROR,...e)}}const DC=(t,e)=>e.some(n=>t instanceof n);let u0,c0;function OC(){return u0||(u0=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function LC(){return c0||(c0=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Vx=new WeakMap,gf=new WeakMap,Mx=new WeakMap,id=new WeakMap,qp=new WeakMap;function VC(t){const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{n($r(t.result)),s()},o=()=>{r(t.error),s()};t.addEventListener("success",i),t.addEventListener("error",o)});return e.then(n=>{n instanceof IDBCursor&&Vx.set(n,t)}).catch(()=>{}),qp.set(e,t),e}function MC(t){if(gf.has(t))return;const e=new Promise((n,r)=>{const s=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{n(),s()},o=()=>{r(t.error||new DOMException("AbortError","AbortError")),s()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)});gf.set(t,e)}let yf={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return gf.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Mx.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return $r(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 FC(t){yf=t(yf)}function UC(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const r=t.call(od(this),e,...n);return Mx.set(r,e.sort?e.sort():[e]),$r(r)}:LC().includes(t)?function(...e){return t.apply(od(this),e),$r(Vx.get(this))}:function(...e){return $r(t.apply(od(this),e))}}function $C(t){return typeof t=="function"?UC(t):(t instanceof IDBTransaction&&MC(t),DC(t,OC())?new Proxy(t,yf):t)}function $r(t){if(t instanceof IDBRequest)return VC(t);if(id.has(t))return id.get(t);const e=$C(t);return e!==t&&(id.set(t,e),qp.set(e,t)),e}const od=t=>qp.get(t);function BC(t,e,{blocked:n,upgrade:r,blocking:s,terminated:i}={}){const o=indexedDB.open(t,e),l=$r(o);return r&&o.addEventListener("upgradeneeded",u=>{r($r(o.result),u.oldVersion,u.newVersion,$r(o.transaction),u)}),n&&o.addEventListener("blocked",u=>n(u.oldVersion,u.newVersion,u)),l.then(u=>{i&&u.addEventListener("close",()=>i()),s&&u.addEventListener("versionchange",h=>s(h.oldVersion,h.newVersion,h))}).catch(()=>{}),l}const zC=["get","getKey","getAll","getAllKeys","count"],HC=["put","add","delete","clear"],ad=new Map;function h0(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(ad.get(e))return ad.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,s=HC.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(s||zC.includes(n)))return;const i=async function(o,...l){const u=this.transaction(o,s?"readwrite":"readonly");let h=u.store;
275return r&&(h=h.index(l.shift())),(await Promise.all([h[n](...l),s&&u.done]))[0]};return ad.set(e,i),i}FC(t=>({...t,get:(e,n,r)=>h0(e,n)||t.get(e,n,r),has:(e,n)=>!!h0(e,n)||t.has(e,n)}));/**
276 * @license
277 * Copyright 2019 Google LLC
278 *
279 * Licensed under the Apache License, Version 2.0 (the "License");
280 * you may not use this file except in compliance with the License.
281 * You may obtain a copy of the License at
282 *
283 *   http://www.apache.org/licenses/LICENSE-2.0
284 *
285 * Unless required by applicable law or agreed to in writing, software
286 * distributed under the License is distributed on an "AS IS" BASIS,
287 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
288 * See the License for the specific language governing permissions and
289 * limitations under the License.
290 */class WC{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(qC(n)){const r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}}function qC(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const vf="@firebase/app",d0="0.14.9";/**
291 * @license
292 * Copyright 2019 Google LLC
293 *
294 * Licensed under the Apache License, Version 2.0 (the "License");
295 * you may not use this file except in compliance with the License.
296 * You may obtain a copy of the License at
297 *
298 *   http://www.apache.org/licenses/LICENSE-2.0
299 *
300 * Unless required by applicable law or agreed to in writing, software
301 * distributed under the License is distributed on an "AS IS" BASIS,
302 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
303 * See the License for the specific language governing permissions and
304 * limitations under the License.
305 */const or=new Wp("@firebase/app"),GC="@firebase/app-compat",KC="@firebase/analytics-compat",QC="@firebase/analytics",YC="@firebase/app-check-compat",XC="@firebase/app-check",JC="@firebase/auth",ZC="@firebase/auth-compat",ek="@firebase/database",tk="@firebase/data-connect",nk="@firebase/database-compat",rk="@firebase/functions",sk="@firebase/functions-compat",ik="@firebase/installations",ok="@firebase/installations-compat",ak="@firebase/messaging",lk="@firebase/messaging-compat",uk="@firebase/performance",ck="@firebase/performance-compat",hk="@firebase/remote-config",dk="@firebase/remote-config-compat",fk="@firebase/storage",pk="@firebase/storage-compat",mk="@firebase/firestore",gk="@firebase/ai",yk="@firebase/firestore-compat",vk="firebase",_k="12.10.0";/**
306 * @license
307 * Copyright 2019 Google LLC
308 *
309 * Licensed under the Apache License, Version 2.0 (the "License");
310 * you may not use this file except in compliance with the License.
311 * You may obtain a copy of the License at
312 *
313 *   http://www.apache.org/licenses/LICENSE-2.0
314 *
315 * Unless required by applicable law or agreed to in writing, software
316 * distributed under the License is distributed on an "AS IS" BASIS,
317 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
318 * See the License for the specific language governing permissions and
319 * limitations under the License.
320 */const _f="[DEFAULT]",wk={[vf]:"fire-core",[GC]:"fire-core-compat",[QC]:"fire-analytics",[KC]:"fire-analytics-compat",[XC]:"fire-app-check",[YC]:"fire-app-check-compat",[JC]:"fire-auth",[ZC]:"fire-auth-compat",[ek]:"fire-rtdb",[tk]:"fire-data-connect",[nk]:"fire-rtdb-compat",[rk]:"fire-fn",[sk]:"fire-fn-compat",[ik]:"fire-iid",[ok]:"fire-iid-compat",[ak]:"fire-fcm",[lk]:"fire-fcm-compat",[uk]:"fire-perf",[ck]:"fire-perf-compat",[hk]:"fire-rc",[dk]:"fire-rc-compat",[fk]:"fire-gcs",[pk]:"fire-gcs-compat",[mk]:"fire-fst",[yk]:"fire-fst-compat",[gk]:"fire-vertex","fire-js":"fire-js",[vk]:"fire-js-all"};/**
321 * @license
322 * Copyright 2019 Google LLC
323 *
324 * Licensed under the Apache License, Version 2.0 (the "License");
325 * you may not use this file except in compliance with the License.
326 * You may obtain a copy of the License at
327 *
328 *   http://www.apache.org/licenses/LICENSE-2.0
329 *
330 * Unless required by applicable law or agreed to in writing, software
331 * distributed under the License is distributed on an "AS IS" BASIS,
332 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
333 * See the License for the specific language governing permissions and
334 * limitations under the License.
335 */const Gu=new Map,xk=new Map,wf=new Map;function f0(t,e){try{t.container.addComponent(e)}catch(n){or.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Ls(t){const e=t.name;if(wf.has(e))return or.debug(`There were multiple attempts to register component ${e}.`),!1;wf.set(e,t);for(const n of Gu.values())f0(n,t);for(const n of xk.values())f0(n,t);return!0}function Vc(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Xt(t){return t==null?!1:t.settings!==void 0}/**
336 * @license
337 * Copyright 2019 Google LLC
338 *
339 * Licensed under the Apache License, Version 2.0 (the "License");
340 * you may not use this file except in compliance with the License.
341 * You may obtain a copy of the License at
342 *
343 *   http://www.apache.org/licenses/LICENSE-2.0
344 *
345 * Unless required by applicable law or agreed to in writing, software
346 * distributed under the License is distributed on an "AS IS" BASIS,
347 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
348 * See the License for the specific language governing permissions and
349 * limitations under the License.
350 */const Ek={"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.","invali
350d-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."},Br=new Ga("app","Firebase",Ek);/**
351 * @license
352 * Copyright 2019 Google LLC
353 *
354 * Licensed under the Apache License, Version 2.0 (the "License");
355 * you may not use this file except in compliance with the License.
356 * You may obtain a copy of the License at
357 *
358 *   http://www.apache.org/licenses/LICENSE-2.0
359 *
360 * Unless required by applicable law or agreed to in writing, software
361 * distributed under the License is distributed on an "AS IS" BASIS,
362 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
363 * See the License for the specific language governing permissions and
364 * limitations under the License.
365 */class Tk{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new Yr("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 Br.create("app-deleted",{appName:this._name})}}/**
366 * @license
367 * Copyright 2019 Google LLC
368 *
369 * Licensed under the Apache License, Version 2.0 (the "License");
370 * you may not use this file except in compliance with the License.
371 * You may obtain a copy of the License at
372 *
373 *   http://www.apache.org/licenses/LICENSE-2.0
374 *
375 * Unless required by applicable law or agreed to in writing, software
376 * distributed under the License is distributed on an "AS IS" BASIS,
377 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
378 * See the License for the specific language governing permissions and
379 * limitations under the License.
380 */const Hs=_k;function Fx(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const r={name:_f,automaticDataCollectionEnabled:!0,...e},s=r.name;if(typeof s!="string"||!s)throw Br.create("bad-app-name",{appName:String(s)});if(n||(n=Dx()),!n)throw Br.create("no-options");const i=Gu.get(s);if(i){if(Os(n,i.options)&&Os(r,i.config))return i;throw Br.create("duplicate-app",{appName:s})}const o=new NC(s);for(const u of wf.values())o.addComponent(u);const l=new Tk(n,r,o);return Gu.set(s,l),l}function Gp(t=_f){const e=Gu.get(t);if(!e&&t===_f&&Dx())return Fx();if(!e)throw Br.create("no-app",{appName:t});return e}function Ln(t,e,n){let r=wk[t]??t;n&&(r+=`-${n}`);const s=r.match(/\s|\//),i=e.match(/\s|\//);if(s||i){const o=[`Unable to register library "${r}" with version "${e}":`];s&&o.push(`library name "${r}" contains illegal characters (whitespace or "/")`),s&&i&&o.push("and"),i&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),or.warn(o.join(" "));return}Ls(new Yr(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}/**
381 * @license
382 * Copyright 2021 Google LLC
383 *
384 * Licensed under the Apache License, Version 2.0 (the "License");
385 * you may not use this file except in compliance with the License.
386 * You may obtain a copy of the License at
387 *
388 *   http://www.apache.org/licenses/LICENSE-2.0
389 *
390 * Unless required by applicable law or agreed to in writing, softw
390are
391 * distributed under the License is distributed on an "AS IS" BASIS,
392 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
393 * See the License for the specific language governing permissions and
394 * limitations under the License.
395 */const Ik="firebase-heartbeat-database",bk=1,Na="firebase-heartbeat-store";let ld=null;function Ux(){return ld||(ld=BC(Ik,bk,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Na)}catch(n){console.warn(n)}}}}).catch(t=>{throw Br.create("idb-open",{originalErrorMessage:t.message})})),ld}async function Sk(t){try{const n=(await Ux()).transaction(Na),r=await n.objectStore(Na).get($x(t));return await n.done,r}catch(e){if(e instanceof zn)or.warn(e.message);else{const n=Br.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});or.warn(n.message)}}}async function p0(t,e){try{const r=(await Ux()).transaction(Na,"readwrite");await r.objectStore(Na).put(e,$x(t)),await r.done}catch(n){if(n instanceof zn)or.warn(n.message);else{const r=Br.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});or.warn(r.message)}}}function $x(t){return`${t.name}!${t.options.appId}`}/**
396 * @license
397 * Copyright 2021 Google LLC
398 *
399 * Licensed under the Apache License, Version 2.0 (the "License");
400 * you may not use this file except in compliance with the License.
401 * You may obtain a copy of the License at
402 *
403 *   http://www.apache.org/licenses/LICENSE-2.0
404 *
405 * Unless required by applicable law or agreed to in writing, software
406 * distributed under the License is distributed on an "AS IS" BASIS,
407 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
408 * See the License for the specific language governing permissions and
409 * limitations under the License.
410 */const Ck=1024,kk=30;class Nk{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new Ak(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){var e,n;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=m0();if(((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,((n=this._heartbeatsCache)==null?void 0:n.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(o=>o.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:s}),this._heartbeatsCache.heartbeats.length>kk){const o=Pk(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(o,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(r){or.warn(r)}}async getHeartbeatsHeader(){var e;try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,((e=this._heartbeatsCache)==null?void 0:e.heartbeats)==null||this._heartbeatsCache.heartbeats.length===0)return"";const n=m0(),{heartbeatsToSend:r,unsentEntries:s}=Rk(this._heartbeatsCache.heartbeats),i=qu(JSON.stringify({version:2,heartbeats:r}));return this._heartbeatsCache.lastSentHeartbeatDate=n,s.length>0?(this._heartbeatsCache.heartbeats=s,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(n){return or.warn(n),""}}}function m0(){return new Date().toISOString().substring(0,10)}function Rk(t,e=Ck){const n=[];let r=t.slice();for(const s of t){const i=n.find(o=>o.agent===s.agent);if(i){if(i.dates.push(s.date),g0(n)>e){i.dates.pop();break}}else if(n.push({agent:s.agent,dates:[s.date]}),g0(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}class Ak{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return yC()?vC().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await Sk(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return p0(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const r=await this.read();return p0(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}}function g0(t){return qu(JSON.stringify({version:2,heartbeats:t})).length}function Pk(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}/**
411 * @license
412 * Copyright 2019 Google LLC
413 *
414 * Licensed under the Apache License, Version 2.0 (the "License");
415 * you may not use this file except in compliance with the License.
416 * You may obtain a copy of the License at
417 *
418 *   http://www.apache.org/licenses/LICENSE-2.0
419 *
420 * Unless required by applicable law or agreed to in writing, software
421 * distributed under the License is distributed on an "AS IS" BASIS,
422 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
423 * See the License for the specific language governing permissions and
424 * limitations under the License.
425 */function jk(t){Ls(new Yr("platform-logger",e=>new WC(e),"PRIVATE")),Ls(new Yr("heartbeat",e=>new Nk(e),"PRIVATE")),Ln(vf,d0,t),Ln(vf,d0,"esm2020"),Ln("fire-js","")}jk("");function Bx(){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 Dk=Bx,zx=new Ga("auth","Firebase",Bx());/**
426 * @license
427 * Copyright 2020 Google LLC
428 *
429 * Licensed under the Apache License, Version 2.0 (the "License");
430 * you may not use this file except in compliance with the License.
431 * You may obtain a copy of the License at
432 *
433 *   http://www.apache.org/licenses/LICENSE-2.0
434 *
435 * Unless required by applicable law or agreed to in writing, software
436 * distributed under the License is distributed on an "AS IS" BASIS,
437 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
438 * See the License for the specific language governing permissions and
439 * limitations under the License.
440 */const Ku=new Wp("@firebase/auth");function Ok(t,...e){Ku.logLevel<=pe.WARN&&Ku.warn(`Auth (${Hs}): ${t}`,...e)}function hu(t,...e){Ku.logLevel<=pe.ERROR&&Ku.error(`Auth (${Hs}): ${t}`,...e)}/**
441 * @license
442 * Copyright 2020 Google LLC
443 *
444 * Licensed under the Apache License, Version 2.0 (the "License");
445 * you may not use this file except in compliance with the License.
446 * You may obtain a copy of the License at
447 *
448 *   http://www.apache.org/licenses/LICENSE-2.0
449 *
450 * Unless required by applicable law or agreed to in writing, software
451 * distributed under the License is distributed on an "AS IS" BASIS,
452 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
453 * See the License for the specific language governing permissions and
454 * limitations under the License.
455 */function wn(t,...e){throw Kp(t,...e)}function Vn(t,...e){return Kp(t,...e)}function Hx(t,e,n){const r={...Dk(),[e]:n};return new Ga("auth","Firebase",r).create(e,{appName:t.name})}function zr(t){return Hx(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Kp(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 zx.create(t,...e)}function ne(t,e,...n){if(!t)throw Kp(e,...n)}function Kn(t){const e="INTERNAL ASSERTION FAILED: "+t;throw hu(e),new Error(e)}function ar(t,e){t||Kn(e)}/**
456 * @license
457 * Copyright 2020 Google LLC
458 *
459 * Licensed under the Apache License, Version 2.0 (the "License");
460 * you may not use this file except in compliance with the License.
461 * You may obtain a copy of the License at
462 *
463 *   http://www.apache.org/licenses/LICENSE-2.0
464 *
465 * Unless required by applicable law or agreed to in writing, software
466 * distributed under the License is distributed on an "AS IS" BASIS,
467 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
468 * See the License for the specific language governing permissions and
469 * limitations under the License.
470 */function xf(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function Lk(){return y0()==="http:"||y0()==="https:"}function y0(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/**
471 * @license
472 * Copyright 2020 Google LLC
473 *
474 * Licensed under the Apache License, Version 2.0 (the "License");
475 * you may not use this file except in compliance with the License.
476 * You may obtain a copy of the License at
477 *
478 *   http://www.apache.org/licenses/LICENSE-2.0
479 *
480 * Unless required by applicable law or agreed to in writing, softw
480are
481 * distributed under the License is distributed on an "AS IS" BASIS,
482 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
483 * See the License for the specific language governing permissions and
484 * limitations under the License.
485 */function Vk(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Lk()||fC()||"connection"in navigator)?navigator.onLine:!0}function Mk(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
486 * @license
487 * Copyright 2020 Google LLC
488 *
489 * Licensed under the Apache License, Version 2.0 (the "License");
490 * you may not use this file except in compliance with the License.
491 * You may obtain a copy of the License at
492 *
493 *   http://www.apache.org/licenses/LICENSE-2.0
494 *
495 * Unless required by applicable law or agreed to in writing, software
496 * distributed under the License is distributed on an "AS IS" BASIS,
497 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
498 * See the License for the specific language governing permissions and
499 * limitations under the License.
500 */class Qa{constructor(e,n){this.shortDelay=e,this.longDelay=n,ar(n>e,"Short delay should be less than long delay!"),this.isMobile=cC()||pC()}get(){return Vk()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
501 * @license
502 * Copyright 2020 Google LLC
503 *
504 * Licensed under the Apache License, Version 2.0 (the "License");
505 * you may not use this file except in compliance with the License.
506 * You may obtain a copy of the License at
507 *
508 *   http://www.apache.org/licenses/LICENSE-2.0
509 *
510 * Unless required by applicable law or agreed to in writing, software
511 * distributed under the License is distributed on an "AS IS" BASIS,
512 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
513 * See the License for the specific language governing permissions and
514 * limitations under the License.
515 */function Qp(t,e){ar(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
516 * @license
517 * Copyright 2020 Google LLC
518 *
519 * Licensed under the Apache License, Version 2.0 (the "License");
520 * you may not use this file except in compliance with the License.
521 * You may obtain a copy of the License at
522 *
523 *   http://www.apache.org/licenses/LICENSE-2.0
524 *
525 * Unless required by applicable law or agreed to in writing, software
526 * distributed under the License is distributed on an "AS IS" BASIS,
527 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
528 * See the License for the specific language governing permissions and
529 * limitations under the License.
530 */class Wx{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;Kn("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;Kn("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;Kn("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
531 * @license
532 * Copyright 2020 Google LLC
533 *
534 * Licensed under the Apache License, Version 2.0 (the "License");
535 * you may not use this file except in compliance with the License.
536 * You may obtain a copy of the License at
537 *
538 *   http://www.apache.org/licenses/LICENSE-2.0
539 *
540 * Unless required by applicable law or agreed to in writing, softw
540are
541 * distributed under the License is distributed on an "AS IS" BASIS,
542 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
543 * See the License for the specific language governing permissions and
544 * limitations under the License.
545 */const Fk={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"};/**
546 * @license
547 * Copyright 2020 Google LLC
548 *
549 * Licensed under the Apache License, Version 2.0 (the "License");
550 * you may not use this file except in compliance with the License.
551 * You may obtain a copy of the License at
552 *
553 *   http://www.apache.org/licenses/LICENSE-2.0
554 *
555 * Unless required by applicable law or agreed to in writing, software
556 * distributed under the License is distributed on an "AS IS" BASIS,
557 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
558 * See the License for the specific language governing permissions and
559 * limitations under the License.
560 */const Uk=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],$k=new Qa(3e4,6e4);function Ws(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function ls(t,e,n,r,s={}){return qx(t,s,async()=>{let i={},o={};r&&(e==="GET"?o=r:i={body:JSON.stringify(r)});const l=Ka({key:t.config.apiKey,...o}).slice(1),u=await t._getAdditionalHeaders();u["Content-Type"]="application/json",t.languageCode&&(u["X-Firebase-Locale"]=t.languageCode);const h={method:e,headers:u,...i};return dC()||(h.referrerPolicy="no-referrer"),t.emulatorConfig&&as(t.emulatorConfig.host)&&(h.credentials="include"),Wx.fetch()(await Gx(t,t.config.apiHost,n,l),h)})}async function qx(t,e,n){t._canInitEmulator=!1;const r={...Fk,...e};try{const s=new zk(t),i=await Promise.race([n(),s.promise]);s.clearNetworkTimeout();const o=await i.json();if("needConfirmation"in o)throw Ul(t,"account-exists-with-different-credential",o);if(i.ok&&!("errorMessage"in o))return o;{const l=i.ok?o.errorMessage:o.error.message,[u,h]=l.split(" : ");if(u==="FEDERATED_USER_ID_ALREADY_LINKED")throw Ul(t,"credential-already-in-use",o);if(u==="EMAIL_EXISTS")throw Ul(t,"email-already-in-use",o);if(u==="USER_DISABLED")throw Ul(t,"user-disabled",o);const f=r[u]||u.toLowerCase().replace(/[_\s]+/g,"-");if(h)throw Hx(t,f,h);wn(t,f)}}catch(s){if(s instanceof zn)throw s;wn(t,"network-request-failed",{message:String(s)})}}async function Mc(t,e,n,r,s={}){const i=await ls(t,e,n,r,s);return"mfaPendingCredential"in i&&wn(t,"multi-factor-auth-required",{_serverResponse:i}),i}async function Gx(t,e,n,r){const s=`${e}${n}?${r}`,i=t,o=i.config.emulator?Qp(t.config,s):`${t.config.apiScheme}://${s}`;return Uk.includes(n)&&(await i._persistenceManagerAvailable,i._getPersistenceType()==="COOKIE")?
560i._getPersistence()._getFinalTarget(o).toString():o}function Bk(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class zk{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(Vn(this.auth,"network-request-failed")),$k.get())})}}function Ul(t,e,n){const r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const s=Vn(t,e,r);return s.customData._tokenResponse=n,s}function v0(t){return t!==void 0&&t.enterprise!==void 0}class Hk{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 Bk(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function Wk(t,e){return ls(t,"GET","/v2/recaptchaConfig",Ws(t,e))}/**
561 * @license
562 * Copyright 2020 Google LLC
563 *
564 * Licensed under the Apache License, Version 2.0 (the "License");
565 * you may not use this file except in compliance with the License.
566 * You may obtain a copy of the License at
567 *
568 *   http://www.apache.org/licenses/LICENSE-2.0
569 *
570 * Unless required by applicable law or agreed to in writing, software
571 * distributed under the License is distributed on an "AS IS" BASIS,
572 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
573 * See the License for the specific language governing permissions and
574 * limitations under the License.
575 */async function qk(t,e){return ls(t,"POST","/v1/accounts:delete",e)}async function Qu(t,e){return ls(t,"POST","/v1/accounts:lookup",e)}/**
576 * @license
577 * Copyright 2020 Google LLC
578 *
579 * Licensed under the Apache License, Version 2.0 (the "License");
580 * you may not use this file except in compliance with the License.
581 * You may obtain a copy of the License at
582 *
583 *   http://www.apache.org/licenses/LICENSE-2.0
584 *
585 * Unless required by applicable law or agreed to in writing, software
586 * distributed under the License is distributed on an "AS IS" BASIS,
587 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
588 * See the License for the specific language governing permissions and
589 * limitations under the License.
590 */function sa(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function Gk(t,e=!1){const n=je(t),r=await n.getIdToken(e),s=Yp(r);ne(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");const i=typeof s.firebase=="object"?s.firebase:void 0,o=i==null?void 0:i.sign_in_provider;return{claims:s,token:r,authTime:sa(ud(s.auth_time)),issuedAtTime:sa(ud(s.iat)),expirationTime:sa(ud(s.exp)),signInProvider:o||null,signInSecondFactor:(i==null?void 0:i.sign_in_second_factor)||null}}function ud(t){return Number(t)*1e3}function Yp(t){const[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return hu("JWT malformed, contained fewer than 3 sections"),null;try{const s=Ax(n);return s?JSON.parse(s):(hu("Failed to decode base64 JWT payload"),null)}catch(s){return hu("Caught error parsing JWT payload as JSON",s==null?void 0:s.toString()),null}}function _0(t){const e=Yp(t);return ne(e,"internal-error"),ne(typeof e.exp<"u","internal-error"),ne(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
591 * @license
592 * Copyright 2020 Google LLC
593 *
594 * Licensed under the Apache License, Version 2.0 (the "License");
595 * you may not use this file except in compliance with the License.
596 * You may obtain a copy of the License at
597 *
598 *   http://www.apache.org/licenses/LICENSE-2.0
599 *
600 * Unless required by applicable law or agreed to in writing, softw
600are
601 * distributed under the License is distributed on an "AS IS" BASIS,
602 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
603 * See the License for the specific language governing permissions and
604 * limitations under the License.
605 */async function Ra(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof zn&&Kk(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function Kk({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
606 * @license
607 * Copyright 2020 Google LLC
608 *
609 * Licensed under the Apache License, Version 2.0 (the "License");
610 * you may not use this file except in compliance with the License.
611 * You may obtain a copy of the License at
612 *
613 *   http://www.apache.org/licenses/LICENSE-2.0
614 *
615 * Unless required by applicable law or agreed to in writing, software
616 * distributed under the License is distributed on an "AS IS" BASIS,
617 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
618 * See the License for the specific language governing permissions and
619 * limitations under the License.
620 */class Qk{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){if(e){const n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;const r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}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()}}/**
621 * @license
622 * Copyright 2020 Google LLC
623 *
624 * Licensed under the Apache License, Version 2.0 (the "License");
625 * you may not use this file except in compliance with the License.
626 * You may obtain a copy of the License at
627 *
628 *   http://www.apache.org/licenses/LICENSE-2.0
629 *
630 * Unless required by applicable law or agreed to in writing, software
631 * distributed under the License is distributed on an "AS IS" BASIS,
632 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
633 * See the License for the specific language governing permissions and
634 * limitations under the License.
635 */class Ef{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=sa(this.lastLoginAt),this.creationTime=sa(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
636 * @license
637 * Copyright 2019 Google LLC
638 *
639 * Licensed under the Apache License, Version 2.0 (the "License");
640 * you may not use this file except in compliance with the License.
641 * You may obtain a copy of the License at
642 *
643 *   http://www.apache.org/licenses/LICENSE-2.0
644 *
645 * Unless required by applicable law or agreed to in writing, software
646 * distributed under the License is distributed on an "AS IS" BASIS,
647 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
648 * See the License for the specific language governing permissions and
649 * limitations under the License.
650 */async function Yu(t){var p;const e=t.auth,n=await t.getIdToken(),r=await Ra(t,Qu(e,{idToken:n}));ne(r==null?void 0:r.users.length,e,"internal-error");const s=r.users[0];t._notifyReloadListener(s);const i=(p=s.providerUserInfo)!=null&&p.length?Kx(s.providerUserInfo):[],o=Xk(t.providerData,i),l=t.isAnonymous,u=!(t.email&&s.passwordHash)&&!(o!=null&&o.length),h=l?u:!1,f={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:o,metadata:new Ef(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(t,f)}async function Yk(t){const e=je(t);await Yu(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Xk(t,e){return[...t.filter(r=>!e.some(s=>s.providerId===r.providerId)),...e]}function Kx(t){return t.map(({providerId:e,...n})=>
650({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
651 * @license
652 * Copyright 2020 Google LLC
653 *
654 * Licensed under the Apache License, Version 2.0 (the "License");
655 * you may not use this file except in compliance with the License.
656 * You may obtain a copy of the License at
657 *
658 *   http://www.apache.org/licenses/LICENSE-2.0
659 *
660 * Unless required by applicable law or agreed to in writing, software
661 * distributed under the License is distributed on an "AS IS" BASIS,
662 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
663 * See the License for the specific language governing permissions and
664 * limitations under the License.
665 */async function Jk(t,e){const n=await qx(t,{},async()=>{const r=Ka({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:s,apiKey:i}=t.config,o=await Gx(t,s,"/v1/token",`key=${i}`),l=await t._getAdditionalHeaders();l["Content-Type"]="application/x-www-form-urlencoded";const u={method:"POST",headers:l,body:r};return t.emulatorConfig&&as(t.emulatorConfig.host)&&(u.credentials="include"),Wx.fetch()(o,u)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function Zk(t,e){return ls(t,"POST","/v2/accounts:revokeToken",Ws(t,e))}/**
666 * @license
667 * Copyright 2020 Google LLC
668 *
669 * Licensed under the Apache License, Version 2.0 (the "License");
670 * you may not use this file except in compliance with the License.
671 * You may obtain a copy of the License at
672 *
673 *   http://www.apache.org/licenses/LICENSE-2.0
674 *
675 * Unless required by applicable law or agreed to in writing, software
676 * distributed under the License is distributed on an "AS IS" BASIS,
677 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
678 * See the License for the specific language governing permissions and
679 * limitations under the License.
680 */class Ti{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){ne(e.idToken,"internal-error"),ne(typeof e.idToken<"u","internal-error"),ne(typeof e.refreshToken<"u","internal-error");const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):_0(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){ne(e.length!==0,"internal-error");const n=_0(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(ne(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:s,expiresIn:i}=await Jk(e,n);this.updateTokensAndExpiration(r,s,Number(i))}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:s,expirationTime:i}=n,o=new Ti;return r&&(ne(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),s&&(ne(typeof s=="string","internal-error",{appName:e}),o.accessToken=s),i&&(ne(typeof i=="number","internal-error",{appName:e}),o.expirationTime=i),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 Ti,this.toJSON())}_performRefresh(){return Kn("not implemented")}}/**
681 * @license
682 * Copyright 2020 Google LLC
683 *
684 * Licensed under the Apache License, Version 2.0 (the "License");
685 * you may not use this file except in compliance with the License.
686 * You may obtain a copy of the License at
687 *
688 *   http://www.apache.org/licenses/LICENSE-2.0
689 *
690 * Unless required by applicable law or agreed to in writing, software
691 * distributed under the License is distributed on an "AS IS" BASIS,
692 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
693 * See the License for the specific language governing permissions and
694 * limitations under the License.
695 */function wr(t,e){ne(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class fn{constructor({uid:e,auth:n,stsTokenManager:r,...s}){this.providerId="firebase",this.proactiveRefresh=new Qk(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=r,this.accessToken=r.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 Ef(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const n=await Ra(this,this.stsTokenManager.getToken(this.auth,e));return ne(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Gk(this,e)}reload(){return Yk(this)}_assign(e){this!==e&&(ne(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.ph
695otoURL,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=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new fn({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){ne(!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 Yu(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(Xt(this.auth.app))return Promise.reject(zr(this.auth));const e=await this.getIdToken();return await Ra(this,qk(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{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=>({...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){const r=n.displayName??void 0,s=n.email??void 0,i=n.phoneNumber??void 0,o=n.photoURL??void 0,l=n.tenantId??void 0,u=n._redirectEventId??void 0,h=n.createdAt??void 0,f=n.lastLoginAt??void 0,{uid:p,emailVerified:g,isAnonymous:E,providerData:N,stsTokenManager:A}=n;ne(p&&A,e,"internal-error");const P=Ti.fromJSON(this.name,A);ne(typeof p=="string",e,"internal-error"),wr(r,e.name),wr(s,e.name),ne(typeof g=="boolean",e,"internal-error"),ne(typeof E=="boolean",e,"internal-error"),wr(i,e.name),wr(o,e.name),wr(l,e.name),wr(u,e.name),wr(h,e.name),wr(f,e.name);const _=new fn({uid:p,auth:e,email:s,emailVerified:g,displayName:r,isAnonymous:E,photoURL:o,phoneNumber:i,tenantId:l,stsTokenManager:P,createdAt:h,lastLoginAt:f});return N&&Array.isArray(N)&&(_.providerData=N.map(w=>({...w}))),u&&(_._redirectEventId=u),_}static async _fromIdTokenResponse(e,n,r=!1){const s=new Ti;s.updateFromServerResponse(n);const i=new fn({uid:n.localId,auth:e,stsTokenManager:s,isAnonymous:r});return await Yu(i),i}static async _fromGetAccountInfoResponse(e,n,r){const s=n.users[0];ne(s.localId!==void 0,"internal-error");const i=s.providerUserInfo!==void 0?Kx(s.providerUserInfo):[],o=!(s.email&&s.passwordHash)&&!(i!=null&&i.length),l=new Ti;l.updateFromIdToken(r);const u=new fn({uid:s.localId,auth:e,stsTokenManager:l,isAnonymous:o}),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:i,metadata:new Ef(s.createdAt,s.lastLoginAt),isAnonymous:!(s.email&&s.passwordHash)&&!(i!=null&&i.length)};return Object.assign(u,h),u}}/**
696 * @license
697 * Copyright 2020 Google LLC
698 *
699 * Licensed under the Apache License, Version 2.0 (the "License");
700 * you may not use this file except in compliance with the License.
701 * You may obtain a copy of the License at
702 *
703 *   http://www.apache.org/licenses/LICENSE-2.0
704 *
705 * Unless required by applicable law or agreed to in writing, software
706 * distributed under the License is distributed on an "AS IS" BASIS,
707 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
708 * See the License for the specific language governing permissions and
709 * limitations under the License.
710 */const w0=new Map;function Qn(t){ar(t instanceof Function,"Expected a class definition");let e=w0.get(t);
710return e?(ar(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,w0.set(t,e),e)}/**
711 * @license
712 * Copyright 2019 Google LLC
713 *
714 * Licensed under the Apache License, Version 2.0 (the "License");
715 * you may not use this file except in compliance with the License.
716 * You may obtain a copy of the License at
717 *
718 *   http://www.apache.org/licenses/LICENSE-2.0
719 *
720 * Unless required by applicable law or agreed to in writing, software
721 * distributed under the License is distributed on an "AS IS" BASIS,
722 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
723 * See the License for the specific language governing permissions and
724 * limitations under the License.
725 */class Qx{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){}}Qx.type="NONE";const x0=Qx;/**
726 * @license
727 * Copyright 2019 Google LLC
728 *
729 * Licensed under the Apache License, Version 2.0 (the "License");
730 * you may not use this file except in compliance with the License.
731 * You may obtain a copy of the License at
732 *
733 *   http://www.apache.org/licenses/LICENSE-2.0
734 *
735 * Unless required by applicable law or agreed to in writing, software
736 * distributed under the License is distributed on an "AS IS" BASIS,
737 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
738 * See the License for the specific language governing permissions and
739 * limitations under the License.
740 */function du(t,e,n){return`firebase:${t}:${e}:${n}`}class Ii{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;const{config:s,name:i}=this.auth;this.fullUserKey=du(this.userKey,s.apiKey,i),this.fullPersistenceKey=du("persistence",s.apiKey,i),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);if(!e)return null;if(typeof e=="string"){const n=await Qu(this.auth,{idToken:e}).catch(()=>{});return n?fn._fromGetAccountInfoResponse(this.auth,n,e):null}return fn._fromJSON(this.auth,e)}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 Ii(Qn(x0),e,r);const s=(await Promise.all(n.map(async h=>{if(await h._isAvailable())return h}))).filter(h=>h);let i=s[0]||Qn(x0);const o=du(r,e.config.apiKey,e.name);let l=null;for(const h of n)try{const f=await h._get(o);if(f){let p;if(typeof f=="string"){const g=await Qu(e,{idToken:f}).catch(()=>{});if(!g)break;p=await fn._fromGetAccountInfoResponse(e,g,f)}else p=fn._fromJSON(e,f);h!==i&&(l=p),i=h;break}}catch{}const u=s.filter(h=>h._shouldAllowMigration);return!i._shouldAllowMigration||!u.length?new Ii(i,e,r):(i=u[0],l&&await i._set(o,l.toJSON()),await Promise.all(n.map(async h=>{if(h!==i)try{await h._remove(o)}catch{}})),new Ii(i,e,r))}}/**
741 * @license
742 * Copyright 2020 Google LLC
743 *
744 * Licensed under the Apache License, Version 2.0 (the "License");
745 * you may not use this file except in compliance with the License.
746 * You may obtain a copy of the License at
747 *
748 *   http://www.apache.org/licenses/LICENSE-2.0
749 *
750 * Unless required by applicable law or agreed to in writing, software
751 * distributed under the License is distributed on an "AS IS" BASIS,
752 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
753 * See the License for the specific language governing permissions and
754 * limitations under the License.
755 */function E0(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Zx(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Yx(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(t1(e))return"Blackberry";if(n1(e))return"Webos";if(Xx(e))return"Safari";if((e.includes("chrome/")||Jx(e))&&!e.includes("edge/"))return"Chrome";if(e1(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 Yx(t=xt()){return/firefox\//i.test(t)}function Xx(t=xt()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Jx(t=xt()){return/crios\//i.test(t)}function Zx(t=xt()){return/iemobile/i.test(t)}function e1(t=xt()){return/android/i.test(t)}function t1(t=xt()){return/blackberry/i.test(t)}
755function n1(t=xt()){return/webos/i.test(t)}function Xp(t=xt()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function eN(t=xt()){var e;return Xp(t)&&!!((e=window.navigator)!=null&&e.standalone)}function tN(){return mC()&&document.documentMode===10}function r1(t=xt()){return Xp(t)||e1(t)||n1(t)||t1(t)||/windows phone/i.test(t)||Zx(t)}/**
756 * @license
757 * Copyright 2020 Google LLC
758 *
759 * Licensed under the Apache License, Version 2.0 (the "License");
760 * you may not use this file except in compliance with the License.
761 * You may obtain a copy of the License at
762 *
763 *   http://www.apache.org/licenses/LICENSE-2.0
764 *
765 * Unless required by applicable law or agreed to in writing, software
766 * distributed under the License is distributed on an "AS IS" BASIS,
767 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
768 * See the License for the specific language governing permissions and
769 * limitations under the License.
770 */function s1(t,e=[]){let n;switch(t){case"Browser":n=E0(xt());break;case"Worker":n=`${E0(xt())}-${t}`;break;default:n=t}const r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Hs}/${r}`}/**
771 * @license
772 * Copyright 2022 Google LLC
773 *
774 * Licensed under the Apache License, Version 2.0 (the "License");
775 * you may not use this file except in compliance with the License.
776 * You may obtain a copy of the License at
777 *
778 *   http://www.apache.org/licenses/LICENSE-2.0
779 *
780 * Unless required by applicable law or agreed to in writing, software
781 * distributed under the License is distributed on an "AS IS" BASIS,
782 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
783 * See the License for the specific language governing permissions and
784 * limitations under the License.
785 */class nN{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const r=i=>new Promise((o,l)=>{try{const u=e(i);o(u)}catch(u){l(u)}});r.onAbort=n,this.queue.push(r);const s=this.queue.length-1;return()=>{this.queue[s]=()=>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 s of n)try{s()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
786 * @license
787 * Copyright 2023 Google LLC
788 *
789 * Licensed under the Apache License, Version 2.0 (the "License");
790 * you may not use this file except in compliance with the License.
791 * You may obtain a copy of the License at
792 *
793 *   http://www.apache.org/licenses/LICENSE-2.0
794 *
795 * Unless required by applicable law or agreed to in writing, software
796 * distributed under the License is distributed on an "AS IS" BASIS,
797 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
798 * See the License for the specific language governing permissions and
799 * limitations under the License.
800 */async function rN(t,e={}){return ls(t,"GET","/v2/passwordPolicy",Ws(t,e))}/**
801 * @license
802 * Copyright 2023 Google LLC
803 *
804 * Licensed under the Apache License, Version 2.0 (the "License");
805 * you may not use this file except in compliance with the License.
806 * You may obtain a copy of the License at
807 *
808 *   http://www.apache.org/licenses/LICENSE-2.0
809 *
810 * Unless required by applicable law or agreed to in writing, software
811 * distributed under the License is distributed on an "AS IS" BASIS,
812 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
813 * See the License for the specific language governing permissions and
814 * limitations under the License.
815 */const sN=6;class iN{constructor(e){var r;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??sN,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=((r=e.allowedNonAlphanumericCharacters)==null?void 0:r.join(""))??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){const n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&
815(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){const r=this.customStrengthOptions.minPasswordLength,s=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),s&&(n.meetsMaxPasswordLength=e.length<=s)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let s=0;s<e.length;s++)r=e.charAt(s),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,s,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=s)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}/**
816 * @license
817 * Copyright 2020 Google LLC
818 *
819 * Licensed under the Apache License, Version 2.0 (the "License");
820 * you may not use this file except in compliance with the License.
821 * You may obtain a copy of the License at
822 *
823 *   http://www.apache.org/licenses/LICENSE-2.0
824 *
825 * Unless required by applicable law or agreed to in writing, software
826 * distributed under the License is distributed on an "AS IS" BASIS,
827 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
828 * See the License for the specific language governing permissions and
829 * limitations under the License.
830 */class oN{constructor(e,n,r,s){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=s,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new T0(this),this.idTokenSubscription=new T0(this),this.beforeStateQueue=new nN(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=zx,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=s.sdkClientVersion,this._persistenceManagerAvailable=new Promise(i=>this._resolvePersistenceManagerAvailable=i)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Qn(n)),this._initializationPromise=this.queue(async()=>{var r,s,i;if(!this._deleted&&(this.persistenceManager=await Ii.create(this,e),(r=this._resolvePersistenceManagerAvailable)==null||r.call(this),!this._deleted)){if((s=this._popupRedirectResolver)!=null&&s._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((i=this.currentUser)==null?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 Qu(this,{idToken:e}),r=await fn._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 i;if(Xt(this.app)){const o=this.app.settings.authIdToken;return o?new Promise(l=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(o).then(l,l))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let r=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(i=this.redirectUser)==null?void 0:i._redirectEventId,l=r==null?void 0:r._redirectEventId,u=await this.tryRedirectSignIn(e);(!o||o===l)&&(u!=null&&u.user)&&(r=u.user,s=!0)}if(!r)return this.directlySetCurrentUser(null);
830if(!r._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(r)}catch(o){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return ne(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}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 Yu(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=Mk()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(Xt(this.app))return Promise.reject(zr(this));const n=e?je(e):null;return n&&ne(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&&ne(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 Xt(this.app)?Promise.reject(zr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return Xt(this.app)?Promise.reject(zr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Qn(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 rN(this),n=new iN(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Ga("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 Zk(this,r)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)==null?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&&Qn(e)||this._popupRedirectResolver;ne(n,this,"argument-error"),this.redirectPersistenceManager=await Ii.create(this,[Qn(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?void 0:n._redirectEventId)===e?this._currentUser:((r=this.redirectUser)==null?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 n;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const e=((n=this.currentUser)==null?void 0:n.uid)??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,s){if(this._deleted)return()=>{};const i=typeof n=="function"?n:n.next.bind(n);let o=!1;const l=this._isInitialized?Promise.resolve():this._initializationPromise;if(ne(l,this,"internal-error"),l.then(()=>{o||i(this.currentUser)}),typeof n=="function"){const u=e.addObserver(n,r,s);return()=>{o=!0,u()}}else{const u=e.addObserver(n);return()=>{o=!0,u()}}}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 ne(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=s1(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var s;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((s=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:s.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){var n;if(Xt(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=await((n=this.appCheckServiceProvider.getImmediate({optional:!0}))==null?void 0:n.getToken());return e!=null&&e.error&&Ok(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function Zi(t){return je(t)}class T0{constructor(e){this.auth=e,this.observer=null,this.addObserver=TC(n=>this.observer=n)}get next(){return ne(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
831 * @license
832 * Copyright 2020 Google LLC
833 *
834 * Licensed under the Apache License, Version 2.0 (the "License");
835 * you may not use this file except in compliance with the License.
836 * You may obtain a copy of the License at
837 *
838 *   http://www.apache.org/licenses/LICENSE-2.0
839 *
840 * Unless required by applicable law or agreed to in writing, software
841 * distributed under the License is distributed on an "AS IS" BASIS,
842 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
843 * See the License for the specific language governing permissions and
844 * limitations under the License.
845 */let Fc={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function aN(t){Fc=t}function i1(t){return Fc.loadJS(t)}function lN(){return Fc.recaptchaEnterpriseScript}function uN(){return Fc.gapiScript}function cN(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class hN{constructor(){this.enterprise=new dN}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class dN{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const fN="recaptcha-enterprise",o1="NO_RECAPTCHA";class pN{constructor(e){this.type=fN,this.auth=Zi(e)}async verify(e="verify",n=!1){async function r(i){if(!n){if(i.tenantId==null&&i._agentRecaptchaConfig!=null)return i._agentRecaptchaConfig.siteKey;if(i.tenantId!=null&&i._tenantRecaptchaConfigs[i.tenantId]!==void 0)return i._tenantRecaptchaConfigs[i.tenantId].siteKey}return new Promise(async(o,l)=>{Wk(i,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(u=>{if(u.recaptchaKey===void 0)l(new Error("recaptcha Enterprise site key undefined"));else{const h=new Hk(u);return i.tenantId==null?i._agentRecaptchaConfig=h:i._tenantRecaptchaConfigs[i.tenantId]=h,o(h.siteKey)}}).catch(u=>{l(u)})})}function s(i,o,l){const u=window.grecaptcha;v0(u)?u.enterprise.ready(()=>{u.enterprise.execute(i,{action:e}).then(h=>{o(h)}).catch(()=>{o(o1)})}):l(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new hN().execute("siteKey",{action:"verify"}):new Promise((i,o)=>{r(this.auth).then(l=>{if(!n&&v0(window.grecaptcha))s(l,i,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let u=lN();u.length!==0&&(u+=l),i1(u).then(()=>{s(l,i,o)}).catch(h=>{o(h)})}}).catch(l=>{o(l)})})}}async function I0(t,e,n,r=!1,s=!1){const i=new pN(t);let o;if(s)o=o1;else try{o=await i.verify(n)}catch{o=await i.verify(n,!0)}const l={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in l){const u=l.phoneEnrollmentInfo.phoneNumber,h=l.phoneEnrollmentInfo.recaptchaToken;Object.assign(l,{phoneEnrollmentInfo:{phoneNumber:u,recaptchaToken:h,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in l){const u=l.phoneSignInInfo.recaptchaToken;Object.assign(l,{phoneSignInInfo:{recaptchaToken:u,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return l}return r?Object.assign(l,{captchaResp:o}):Object.assign(l,{captchaResponse:o}),Object.assign(l,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(l,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),l}async function b0(t,e,n,r,s){var i;if((i=t._getRecaptchaConfig())!=null&&i.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const o=await I0(t,e,n,n==="getOobCode");return r(t,o)}else return r(t,e).catch(async o=>{if(o.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 l=await I0(t,e,n,n==="getOobCode");return r(t,l)}else return Promise.reject(o)})}/**
846 * @license
847 * Copyright 2020 Google LLC
848 *
849 * Licensed under the Apache License, Version 2.0 (the "License");
850 * you may not use this file except in compliance with the License.
851 * You may obtain a copy of the License at
852 *
853 *   http://www.apache.org/licenses/LICENSE-2.0
854 *
855 * Unless required by applicable law or agreed to in writing, software
856 * distributed under the License is distributed on an "AS IS" BASIS,
857 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
858 * See the License for the specific language governing permissions and
859 * limitations under the License.
860 */function mN(t,e){const n=Vc(t,"auth");if(n.isInitialized()){const s=n.getImmediate(),i=n.getOptions();if(Os(i,e??{}))return s;wn(s,"already-initialized")}return n.initialize({options:e})}function gN(t,e){const n=(e==null?void 0:e.persistence)||[],r=(Array.isArray(n)?n:[n]).map(Qn);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function yN(t,e,n){const r=Zi(t);
860ne(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const s=!1,i=a1(e),{host:o,port:l}=vN(e),u=l===null?"":`:${l}`,h={url:`${i}//${o}${u}/`},f=Object.freeze({host:o,port:l,protocol:i.replace(":",""),options:Object.freeze({disableWarnings:s})});if(!r._canInitEmulator){ne(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),ne(Os(h,r.config.emulator)&&Os(f,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=h,r.emulatorConfig=f,r.settings.appVerificationDisabledForTesting=!0,as(o)?(zp(`${i}//${o}${u}`),Hp("Auth",!0)):_N()}function a1(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function vN(t){const e=a1(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",s=/^(\[[^\]]+\])(:|$)/.exec(r);if(s){const i=s[1];return{host:i,port:S0(r.substr(i.length+1))}}else{const[i,o]=r.split(":");return{host:i,port:S0(o)}}}function S0(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function _N(){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())}/**
861 * @license
862 * Copyright 2020 Google LLC
863 *
864 * Licensed under the Apache License, Version 2.0 (the "License");
865 * you may not use this file except in compliance with the License.
866 * You may obtain a copy of the License at
867 *
868 *   http://www.apache.org/licenses/LICENSE-2.0
869 *
870 * Unless required by applicable law or agreed to in writing, software
871 * distributed under the License is distributed on an "AS IS" BASIS,
872 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
873 * See the License for the specific language governing permissions and
874 * limitations under the License.
875 */class Jp{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Kn("not implemented")}_getIdTokenResponse(e){return Kn("not implemented")}_linkToIdToken(e,n){return Kn("not implemented")}_getReauthenticationResolver(e){return Kn("not implemented")}}async function wN(t,e){return ls(t,"POST","/v1/accounts:signUp",e)}/**
876 * @license
877 * Copyright 2020 Google LLC
878 *
879 * Licensed under the Apache License, Version 2.0 (the "License");
880 * you may not use this file except in compliance with the License.
881 * You may obtain a copy of the License at
882 *
883 *   http://www.apache.org/licenses/LICENSE-2.0
884 *
885 * Unless required by applicable law or agreed to in writing, software
886 * distributed under the License is distributed on an "AS IS" BASIS,
887 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
888 * See the License for the specific language governing permissions and
889 * limitations under the License.
890 */async function xN(t,e){return Mc(t,"POST","/v1/accounts:signInWithPassword",Ws(t,e))}/**
891 * @license
892 * Copyright 2020 Google LLC
893 *
894 * Licensed under the Apache License, Version 2.0 (the "License");
895 * you may not use this file except in compliance with the License.
896 * You may obtain a copy of the License at
897 *
898 *   http://www.apache.org/licenses/LICENSE-2.0
899 *
900 * Unless required by applicable law or agreed to in writing, software
901 * distributed under the License is distributed on an "AS IS" BASIS,
902 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
903 * See the License for the specific language governing permissions and
904 * limitations under the License.
905 */async function EN(t,e){return Mc(t,"POST","/v1/accounts:signInWithEmailLink",Ws(t,e))}async function TN(t,e){return Mc(t,"POST","/v1/accounts:signInWithEmailLink",Ws(t,e))}/**
906 * @license
907 * Copyright 2020 Google LLC
908 *
909 * Licensed under the Apache License, Version 2.0 (the "License");
910 * you may not use this file except in compliance with the License.
911 * You may obtain a copy of the License at
912 *
913 *   http://www.apache.org/licenses/LICENSE-2.0
914 *
915 * Unless required by applicable law or agreed to in writing, software
916 * distributed under the License is distributed on an "AS IS" BASIS,
917 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
918 * See the License for the specific language governing permissions and
919 * limitations under the License.
920 */class Aa extends Jp{constructor(e,n,r,s=null){super("password",r),this._email=e,this._password=n,this._tenantId=s}static _fromEmailAndPassword(e,n){return new Aa(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new Aa(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 b0(e,n,"signInWithPassword",xN);case"emailLink":return EN(e,{email:this._email,oobCode:this._password});default:wn(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 b0(e,r,"signUpPassword",wN);case"emailLink":return TN(e,{idToken:n,email:this._email,oobCode:this._password});default:wn(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
921 * @license
922 * Copyright 2020 Google LLC
923 *
924 * Licensed under the Apache License, Version 2.0 (the "License");
925 * you may not use this file except in compliance with the License.
926 * You may obtain a copy of the License at
927 *
928 *   http://www.apache.org/licenses/LICENSE-2.0
929 *
930 * Unless required by applicable law or agreed to in writing, software
931 * distributed under the License is distributed on an "AS IS" BASIS,
932 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
933 * See the License for the specific language governing permissions and
934 * limitations under the License.
935 */async function bi(t,e){return Mc(t,"POST","/v1/accounts:signInWithIdp",Ws(t,e))}/**
936 * @license
937 * Copyright 2020 Google LLC
938 *
939 * Licensed under the Apache License, Version 2.0 (the "License");
940 * you may not use this file except in compliance with the License.
941 * You may obtain a copy of the License at
942 *
943 *   http://www.apache.org/licenses/LICENSE-2.0
944 *
945 * Unless required by applicable law or agreed to in writing, software
946 * distributed under the License is distributed on an "AS IS" BASIS,
947 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
948 * See the License for the specific language governing permissions and
949 * limitations under the License.
950 */const IN="http://localhost";class Vs extends Jp{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new Vs(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):wn("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
950once: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:s,...i}=n;if(!r||!s)return null;const o=new Vs(r,s);return o.idToken=i.idToken||void 0,o.accessToken=i.accessToken||void 0,o.secret=i.secret,o.nonce=i.nonce,o.pendingToken=i.pendingToken||null,o}_getIdTokenResponse(e){const n=this.buildRequest();return bi(e,n)}_linkToIdToken(e,n){const r=this.buildRequest();return r.idToken=n,bi(e,r)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,bi(e,n)}buildRequest(){const e={requestUri:IN,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=Ka(n)}return e}}/**
951 * @license
952 * Copyright 2020 Google LLC
953 *
954 * Licensed under the Apache License, Version 2.0 (the "License");
955 * you may not use this file except in compliance with the License.
956 * You may obtain a copy of the License at
957 *
958 *   http://www.apache.org/licenses/LICENSE-2.0
959 *
960 * Unless required by applicable law or agreed to in writing, software
961 * distributed under the License is distributed on an "AS IS" BASIS,
962 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
963 * See the License for the specific language governing permissions and
964 * limitations under the License.
965 */function bN(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 SN(t){const e=Bo(zo(t)).link,n=e?Bo(zo(e)).deep_link_id:null,r=Bo(zo(t)).deep_link_id;return(r?Bo(zo(r)).link:null)||r||n||e||t}class Zp{constructor(e){const n=Bo(zo(e)),r=n.apiKey??null,s=n.oobCode??null,i=bN(n.mode??null);ne(r&&s&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=s,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=SN(e);try{return new Zp(n)}catch{return null}}}/**
966 * @license
967 * Copyright 2020 Google LLC
968 *
969 * Licensed under the Apache License, Version 2.0 (the "License");
970 * you may not use this file except in compliance with the License.
971 * You may obtain a copy of the License at
972 *
973 *   http://www.apache.org/licenses/LICENSE-2.0
974 *
975 * Unless required by applicable law or agreed to in writing, software
976 * distributed under the License is distributed on an "AS IS" BASIS,
977 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
978 * See the License for the specific language governing permissions and
979 * limitations under the License.
980 */class eo{constructor(){this.providerId=eo.PROVIDER_ID}static credential(e,n){return Aa._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const r=Zp.parseLink(n);return ne(r,"argument-error"),Aa._fromEmailAndCode(e,r.code,r.tenantId)}}eo.PROVIDER_ID="password";eo.EMAIL_PASSWORD_SIGN_IN_METHOD="password";eo.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
981 * @license
982 * Copyright 2020 Google LLC
983 *
984 * Licensed under the Apache License, Version 2.0 (the "License");
985 * you may not use this file except in compliance with the License.
986 * You may obtain a copy of the License at
987 *
988 *   http://www.apache.org/licenses/LICENSE-2.0
989 *
990 * Unless required by applicable law or agreed to in writing, software
991 * distributed under the License is distributed on an "AS IS" BASIS,
992 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
993 * See the License for the specific language governing permissions and
994 * limitations under the License.
995 */class l1{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}}/**
996 * @license
997 * Copyright 2019 Google LLC
998 *
999 * Licensed under the Apache License, Version 2.0 (the "License");
1000 * you may not use this file except in compliance with the License.
1001 * You may obtain a copy of the License at
1002 *
1003 *   http://www.apache.org/licenses/LICENSE-2.0
1004 *
1005 * Unless required by applicable law or agreed to in writing, software
1006 * distributed under the License is distributed on an "AS IS" BASIS,
1007 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1008 * See the License for the specific language governing permissions and
1009 * limitations under the License.
1010 */class Ya extends l1{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
1011 * @license
1012 * Copyright 2020 Google LLC
1013 *
1014 * Licensed under the Apache License, Version 2.0 (the "License");
1015 * you may not use this file except in compliance with the License.
1016 * You may obtain a copy of the License at
1017 *
1018 *   http://www.apache.org/licenses/LICENSE-2.0
1019 *
1020 * Unless required by applicable law or agreed to in writing, software
1021 * distributed under the License is distributed on an "AS IS" BASIS,
1022 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1023 * See the License for the specific language governing permissions and
1024 * limitations under the License.
1025 */class br extends Ya{constructor(){super("facebook.com")}static credential(e){return Vs._fromParams({providerId:br.PROVIDER_ID,signInMethod:br.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return br.credentialFromTaggedObject(e)}static credentialFromError(e){return br.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return br.credential(e.oauthAccessToken)}catch{return null}}}br.FACEBOOK_SIGN_IN_METHOD="facebook.com";br.PROVIDER_ID="facebook.com";/**
1026 * @license
1027 * Copyright 2020 Google LLC
1028 *
1029 * Licensed under the Apache License, Version 2.0 (the "License");
1030 * you may not use this file except in compliance with the License.
1031 * You may obtain a copy of the License at
1032 *
1033 *   http://www.apache.org/licenses/LICENSE-2.0
1034 *
1035 * Unless required by applicable law or agreed to in writing, software
1036 * distributed under the License is distributed on an "AS IS" BASIS,
1037 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1038 * See the License for the specific language governing permissions and
1039 * limitations under the License.
1040 */class Sr extends Ya{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Vs._fromParams({providerId:Sr.PROVIDER_ID,signInMethod:Sr.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Sr.credentialFromTaggedObject(e)}static credentialFromError(e){return Sr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return Sr.credential(n,r)}catch{return null}}}Sr.GOOGLE_SIGN_IN_METHOD="google.com";Sr.PROVIDER_ID="google.com";/**
1041 * @license
1042 * Copyright 2020 Google LLC
1043 *
1044 * Licensed under the Apache License, Version 2.0 (the "License");
1045 * you may not use this file except in compliance with the License.
1046 * You may obtain a copy of the License at
1047 *
1048 *   http://www.apache.org/licenses/LICENSE-2.0
1049 *
1050 * Unless required by applicable law or agreed to in writing, software
1051 * distributed under the License is distributed on an "AS IS" BASIS,
1052 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1053 * See the License for the specific language governing permissions and
1054 * limitations under the License.
1055 */class Cr extends Ya{constructor(){super("github.com")}static credential(e){return Vs._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";/**
1056 * @license
1057 * Copyright 2020 Google LLC
1058 *
1059 * Licensed under the Apache License, Version 2.0 (the "License");
1060 * you may not use this file except in compliance with the License.
1061 * You may obtain a copy of the License at
1062 *
1063 *   http://www.apache.org/licenses/LICENSE-2.0
1064 *
1065 * Unless required by applicable law or agreed to in writing, software
1066 * distributed under the License is distributed on an "AS IS" BASIS,
1067 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1068 * See the License for the specific language governing permissions and
1069 * limitations under the License.
1070 */class kr extends Ya{constructor(){super("twitter.com")}static credential(e,n){return Vs._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";/**
1071 * @license
1072 * Copyright 2020 Google LLC
1073 *
1074 * Licensed under the Apache License, Version 2.0 (the "License");
1075 * you may not use this file except in compliance with the License.
1076 * You may obtain a copy of the License at
1077 *
1078 *   http://www.apache.org/licenses/LICENSE-2.0
1079 *
1080 * Unless required by applicable law or agreed to in writing, software
1081 * distributed under the License is distributed on an "AS IS" BASIS,
1082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1083 * See the License for the specific language governing permissions and
1084 * limitations under the License.
1085 */class Oi{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,s=!1){const i=await fn._fromIdTokenResponse(e,r,s),o=C0(r);return new Oi({user:i,providerId:o,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);const s=C0(r);return new Oi({user:e,providerId:s,_tokenResponse:r,operationType:n})}}function C0(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
1086 * @license
1087 * Copyright 2020 Google LLC
1088 *
1089 * Licensed under the Apache License, Version 2.0 (the "License");
1090 * you may not use this file except in compliance with the License.
1091 * You may obtain a copy of the License at
1092 *
1093 *   http://www.apache.org/licenses/LICENSE-2.0
1094 *
1095 * Unless required by applicable law or agreed to in writing, software
1096 * distributed under the License is distributed on an "AS IS" BASIS,
1097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1098 * See the License for the specific language governing permissions and
1099 * limitations under the License.
1100 */class Xu extends zn{constructor(e,n,r,s){super(n.code,n.message),this.operationType=r,this.user=s,Object.setPrototypeOf(this,Xu.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,s){return new Xu(e,n,r,s)}}function u1(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(i=>{throw i.code==="auth/multi-factor-auth-required"?Xu._fromErrorAndOperation(t,i,e,r):i})}async function CN(t,e,n=!1){const r=await Ra(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return Oi._forOperation(t,"link",r)}/**
1101 * @license
1102 * Copyright 2019 Google LLC
1103 *
1104 * Licensed under the Apache License, Version 2.0 (the "License");
1105 * you may not use this file except in compliance with the License.
1106 * You may obtain a copy of the License at
1107 *
1108 *   http://www.apache.org/licenses/LICENSE-2.0
1109 *
1110 * Unless required by applicable law or agreed to in writing, software
1111 * distributed under the License is distributed on an "AS IS" BASIS,
1112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1113 * See the License for the specific language governing permissions and
1114 * limitations under the License.
1115 */async function kN(t,e,n=!1){const{auth:r}=t;if(Xt(r.app))return Promise.reject(zr(r));const s="reauthenticate";try{const i=await Ra(t,u1(r,s,e,t),n);ne(i.idToken,r,"internal-error");const o=Yp(i.idToken);ne(o,r,"internal-error");const{sub:l}=o;return ne(t.uid===l,r,"user-mismatch"),Oi._forOperation(t,s,i)}catch(i){throw(i==null?void 0:i.code)==="auth/user-not-found"&&wn(r,"user-mismatch"),i}}/**
1116 * @license
1117 * Copyright 2020 Google LLC
1118 *
1119 * Licensed under the Apache License, Version 2.0 (the "License");
1120 * you may not use this file except in compliance with the License.
1121 * You may obtain a copy of the License at
1122 *
1123 *   http://www.apache.org/licenses/LICENSE-2.0
1124 *
1125 * Unless required by applicable law or agreed to in writing, software
1126 * distributed under the License is distributed on an "AS IS" BASIS,
1127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1128 * See the License for the specific language governing permissions and
1129 * limitations under the License.
1130 */async function c1(t,e,n=!1){if(Xt(t.app))return Promise.reject(zr(t));const r="signIn",s=await u1(t,r,e),i=await Oi._fromIdTokenResponse(t,r,s);return n||await t._updateCurrentUser(i.user),i}async function NN(t,e){return c1(Zi(t),e)}/**
1131 * @license
1132 * Copyright 2020 Google LLC
1133 *
1134 * Licensed under the Apache License, Version 2.0 (the "License");
1135 * you may not use this file except in compliance with the License.
1136 * You may obtain a copy of the License at
1137 *
1138 *   http://www.apache.org/licenses/LICENSE-2.0
1139 *
1140 * Unless required by applicable law or agreed to in writing, software
1141 * distributed under the License is distributed on an "AS IS" BASIS,
1142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1143 * See the License for the specific language governing permissions and
1144 * limitations under the License.
1145 */async function RN(t){const e=Zi(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}function AN(t,e,n){return Xt(t.app)?Promise.reject(zr(t)):NN(je(t),eo.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&RN(t),r})}function PN(t,e,n,r){return je(t).onIdTokenChanged(e,n,r)}function jN(t,e,n){return je(t).beforeAuthStateChanged(e,n)}function DN(t,e,n,r){return je(t).onAuthStateChanged(e,n,r)}function k0(t){return je(t).signOut()}const Ju="__sak";/**
1146 * @license
1147 * Copyright 2019 Google LLC
1148 *
1149 * Licensed under the Apache License, Version 2.0 (the "License");
1150 * you may not use this file except in compliance with the License.
1151 * You may obtain a copy of the License at
1152 *
1153 *   http://www.apache.org/licenses/LICENSE-2.0
1154 *
1155 * Unless required by applicable law or agreed to in writing, software
1156 * distributed under the License is distributed on an "AS IS" BASIS,
1157 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1158 * See the License for the specific language governing permissions and
1159 * limitations under the License.
1160 */class h1{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Ju,"1"),this.storage.removeItem(Ju),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()}}/**
1161 * @license
1162 * Copyright 2020 Google LLC
1163 *
1164 * Licensed under the Apache License, Version 2.0 (the "License");
1165 * you may not use this file except in compliance with the License.
1166 * You may obtain a copy of the License at
1167 *
1168 *   http://www.apache.org/licenses/LICENSE-2.0
1169 *
1170 * Unless required by applicable law or agreed to in writing, software
1171 * distributed under the License is distributed on an "AS IS" BASIS,
1172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1173 * See the License for the specific language governing permissions and
1174 * limitations under the License.
1175 */const ON=1e3,LN=10;class d1 extends h1{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=r1(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const r=this.storage.getItem(n),s=this.localCache[n];r!==s&&e(n,s,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((o,l,u)=>{this.notifyListeners(o,u)});return}const r=e.key;n?this.detachListener():this.stopPolling();const s=()=>{const o=this.storage.getItem(r);!n&&this.localCache[r]===o||this.notifyListeners(r,o)},i=this.storage.getItem(r);tN()&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(s,LN):s()}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(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)})},ON)}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]),Ob
1175ject.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]}}d1.type="LOCAL";const VN=d1;/**
1176 * @license
1177 * Copyright 2020 Google LLC
1178 *
1179 * Licensed under the Apache License, Version 2.0 (the "License");
1180 * you may not use this file except in compliance with the License.
1181 * You may obtain a copy of the License at
1182 *
1183 *   http://www.apache.org/licenses/LICENSE-2.0
1184 *
1185 * Unless required by applicable law or agreed to in writing, software
1186 * distributed under the License is distributed on an "AS IS" BASIS,
1187 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1188 * See the License for the specific language governing permissions and
1189 * limitations under the License.
1190 */class f1 extends h1{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}f1.type="SESSION";const p1=f1;/**
1191 * @license
1192 * Copyright 2019 Google LLC
1193 *
1194 * Licensed under the Apache License, Version 2.0 (the "License");
1195 * you may not use this file except in compliance with the License.
1196 * You may obtain a copy of the License at
1197 *
1198 *   http://www.apache.org/licenses/LICENSE-2.0
1199 *
1200 * Unless required by applicable law or agreed to in writing, software
1201 * distributed under the License is distributed on an "AS IS" BASIS,
1202 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1203 * See the License for the specific language governing permissions and
1204 * limitations under the License.
1205 */function MN(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1206 * @license
1207 * Copyright 2019 Google LLC
1208 *
1209 * Licensed under the Apache License, Version 2.0 (the "License");
1210 * you may not use this file except in compliance with the License.
1211 * You may obtain a copy of the License at
1212 *
1213 *   http://www.apache.org/licenses/LICENSE-2.0
1214 *
1215 * Unless required by applicable law or agreed to in writing, software
1216 * distributed under the License is distributed on an "AS IS" BASIS,
1217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1218 * See the License for the specific language governing permissions and
1219 * limitations under the License.
1220 */class Uc{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(s=>s.isListeningto(e));if(n)return n;const r=new Uc(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:r,eventType:s,data:i}=n.data,o=this.handlersMap[s];if(!(o!=null&&o.size))return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:s});const l=Array.from(o).map(async h=>h(n.origin,i)),u=await MN(l);n.ports[0].postMessage({status:"done",eventId:r,eventType:s,response:u})}_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)}}Uc.receivers=[];/**
1221 * @license
1222 * Copyright 2020 Google LLC
1223 *
1224 * Licensed under the Apache License, Version 2.0 (the "License");
1225 * you may not use this file except in compliance with the License.
1226 * You may obtain a copy of the License at
1227 *
1228 *   http://www.apache.org/licenses/LICENSE-2.0
1229 *
1230 * Unless required by applicable law or agreed to in writing, software
1231 * distributed under the License is distributed on an "AS IS" BASIS,
1232 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1233 * See the License for the specific language governing permissions and
1234 * limitations under the License.
1235 */function em(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}/**
1236 * @license
1237 * Copyright 2019 Google LLC
1238 *
1239 * Licensed under the Apache License, Version 2.0 (the "License");
1240 * you may not use this file except in compliance with the License.
1241 * You may obtain a copy of the License at
1242 *
1243 *   http://www.apache.org/licenses/LICENSE-2.0
1244 *
1245 * Unless required by applicable law or agreed to in writing, software
1246 * distributed under the License is distributed on an "AS IS" BASIS,
1247 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1248 * See the License for the specific language governing permissions and
1249 * limitations under the License.
1250 */class FN{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 s=typeof MessageChannel<"u"?new MessageChannel:null;if(!s)throw new Error("connection_unavailable");let i,o;return new Promise((l,u)=>{const h=em("",20);s.port1.start();const f=setTimeout(()=>{u(new Error("unsupported_event"))},r);o={messageChannel:s,onMessage(p){const g=p;if(g.data.eventId===h)switch(g.data.status){case"ack":clearTimeout(f),i=setTimeout(()=>{u(new Error("timeout"))},3e3);break;case"done":clearTimeout(i),l(g.data.response);break;default:clearTimeout(f),clearTimeout(i),u(new Error("invalid_response"));break}}},this.handlers.add(o),s.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:h,data:n},[s.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
1251 * @license
1252 * Copyright 2020 Google LLC
1253 *
1254 * Licensed under the Apache License, Version 2.0 (the "License");
1255 * you may not use this file except in compliance with the License.
1256 * You may obtain a copy of the License at
1257 *
1258 *   http://www.apache.org/licenses/LICENSE-2.0
1259 *
1260 * Unless required by applicable law or agreed to in writing, software
1261 * distributed under the License is distributed on an "AS IS" BASIS,
1262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1263 * See the License for the specific language governing permissions and
1264 * limitations under the License.
1265 */function Mn(){return window}function UN(t){Mn().location.href=t}/**
1266 * @license
1267 * Copyright 2020 Google LLC.
1268 *
1269 * Licensed under the Apache License, Version 2.0 (the "License");
1270 * you may not use this file except in compliance with the License.
1271 * You may obtain a copy of the License at
1272 *
1273 *   http://www.apache.org/licenses/LICENSE-2.0
1274 *
1275 * Unless required by applicable law or agreed to in writing, software
1276 * distributed under the License is distributed on an "AS IS" BASIS,
1277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1278 * See the License for the specific language governing permissions and
1279 * limitations under the License.
1280 */function m1(){return typeof Mn().WorkerGlobalScope<"u"&&typeof Mn().importScripts=="function"}async function $N(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function BN(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function zN(){return m1()?self:null}/**
1281 * @license
1282 * Copyright 2019 Google LLC
1283 *
1284 * Licensed under the Apache License, Version 2.0 (the "License");
1285 * you may not use this file except in compliance with the License.
1286 * You may obtain a copy of the License at
1287 *
1288 *   http://www.apache.org/licenses/LICENSE-2.0
1289 *
1290 * Unless required by applicable law or agreed to in writing, software
1291 * distributed under the License is distributed on an "AS IS" BASIS,
1292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1293 * See the License for the specific language governing permissions and
1294 * limitations under the License.
1295 */const g1="firebaseLocalStorageDb",HN=1,Zu="firebaseLocalStorage",y1="fbase_key";class Xa{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 $c(t,e){return t.transaction([Zu],e?"readwrite":"readonly").objectStore(Zu)}function WN(){const t=indexedDB.deleteDatabase(g1);
1295return new Xa(t).toPromise()}function Tf(){const t=indexedDB.open(g1,HN);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const r=t.result;try{r.createObjectStore(Zu,{keyPath:y1})}catch(s){n(s)}}),t.addEventListener("success",async()=>{const r=t.result;r.objectStoreNames.contains(Zu)?e(r):(r.close(),await WN(),e(await Tf()))})})}async function N0(t,e,n){const r=$c(t,!0).put({[y1]:e,value:n});return new Xa(r).toPromise()}async function qN(t,e){const n=$c(t,!1).get(e),r=await new Xa(n).toPromise();return r===void 0?null:r.value}function R0(t,e){const n=$c(t,!0).delete(e);return new Xa(n).toPromise()}const GN=800,KN=3;class v1{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 Tf(),this.db)}async _withRetries(e){let n=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(n++>KN)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return m1()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Uc._getInstance(zN()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)}
1295)),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,r;if(this.activeServiceWorker=await $N(),!this.activeServiceWorker)return;this.sender=new FN(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(r=e[0])!=null&&r.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||BN()!==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 Tf();return await N0(e,Ju,"1"),await R0(e,Ju),!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=>N0(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(r=>qN(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>R0(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(s=>{const i=$c(s,!1).getAll();return new Xa(i).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],r=new Set;if(e.length!==0)for(const{fbase_key:s,value:i}of e)r.add(s),JSON.stringify(this.localCache[s])!==JSON.stringify(i)&&(this.notifyListeners(s,i),n.push(s));for(const s of Object.keys(this.localCache))this.localCache[s]&&!r.has(s)&&(this.notifyListeners(s,null),n.push(s));return n}notifyListeners(e,n){this.localCache[e]=n;const r=this.listeners[e];if(r)for(const s of Array.from(r))s(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),GN)}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]),Ob
vendor: 4,318 bytes, lines 1295-1344
1295ject.keys(this.listeners).length===0&&this.stopPolling()}}v1.type="LOCAL";const QN=v1;new Qa(3e4,6e4);/**
1296 * @license
1297 * Copyright 2021 Google LLC
1298 *
1299 * Licensed under the Apache License, Version 2.0 (the "License");
1300 * you may not use this file except in compliance with the License.
1301 * You may obtain a copy of the License at
1302 *
1303 *   http://www.apache.org/licenses/LICENSE-2.0
1304 *
1305 * Unless required by applicable law or agreed to in writing, software
1306 * distributed under the License is distributed on an "AS IS" BASIS,
1307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1308 * See the License for the specific language governing permissions and
1309 * limitations under the License.
1310 */function YN(t,e){return e?Qn(e):(ne(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
1311 * @license
1312 * Copyright 2019 Google LLC
1313 *
1314 * Licensed under the Apache License, Version 2.0 (the "License");
1315 * you may not use this file except in compliance with the License.
1316 * You may obtain a copy of the License at
1317 *
1318 *   http://www.apache.org/licenses/LICENSE-2.0
1319 *
1320 * Unless required by applicable law or agreed to in writing, software
1321 * distributed under the License is distributed on an "AS IS" BASIS,
1322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1323 * See the License for the specific language governing permissions and
1324 * limitations under the License.
1325 */class tm extends Jp{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return bi(e,this._buildIdpRequest())}_linkToIdToken(e,n){return bi(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return bi(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 XN(t){return c1(t.auth,new tm(t),t.bypassAuthState)}function JN(t){const{auth:e,user:n}=t;return ne(n,e,"internal-error"),kN(n,new tm(t),t.bypassAuthState)}async function ZN(t){const{auth:e,user:n}=t;return ne(n,e,"internal-error"),CN(n,new tm(t),t.bypassAuthState)}/**
1326 * @license
1327 * Copyright 2020 Google LLC
1328 *
1329 * Licensed under the Apache License, Version 2.0 (the "License");
1330 * you may not use this file except in compliance with the License.
1331 * You may obtain a copy of the License at
1332 *
1333 *   http://www.apache.org/licenses/LICENSE-2.0
1334 *
1335 * Unless required by applicable law or agreed to in writing, software
1336 * distributed under the License is distributed on an "AS IS" BASIS,
1337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1338 * See the License for the specific language governing permissions and
1339 * limitations under the License.
1340 */class _1{constructor(e,n,r,s,i=!1){this.auth=e,this.resolver=r,this.user=s,this.bypassAuthState=i,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:s,tenantId:i,error:o,type:l}=e;if(o){this.reject(o);return}const u={auth:this.auth,requestUri:n,sessionId:r,tenantId:i||void 0,postBody:s||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(l)(u))}catch(h){this.reject(h)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return XN;case"linkViaPopup":case"linkViaRedirect":return ZN;case"reauthViaPopup":case"reauthViaRedirect":return JN;default:wn(this.auth,"internal-error")}}resolve(e){ar(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ar(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()}}/**
1341 * @license
1342 * Copyright 2020 Google LLC
1343 *
1344 * Licensed under the Apache License, Version 2.0 (the "License");
1345 * you may not use this file except in compliance with the License.
1346 * You may obtain a copy of the License at
1347 *
1348 *   http://www.apache.org/licenses/LICENSE-2.0
1349 *
1350 * Unless required by applicable law or agreed to in writing, software
1351 * distributed under the License is distributed on an "AS IS" BASIS,
1352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1353 * See the License for the specific language governing permissions and
1354 * limitations under the License.
1355 */const eR=new Qa(2e3,1e4);class gi extends _1{constructor(e,n,r,s,i){super(e,n,s,i),this.provider=r,this.authWindow=null,this.pollId=null,gi.currentPopupAction&&gi.currentPopupAction.cancel(),gi.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return ne(e,this.auth,"internal-error"),e}async onExecution(){ar(this.filter.length===1,"Popup operations only handle one event");const e=em();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(Vn(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(Vn(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,gi.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,r;if((r=(n=this.authWindow)==null?void 0:n.window)!=null&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Vn(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,eR.get())};e()}}gi.currentPopupAction=null;/**
1356 * @license
1357 * Copyright 2020 Google LLC
1358 *
1359 * Licensed under the Apache License, Version 2.0 (the "License");
1360 * you may not use this file except in compliance with the License.
1361 * You may obtain a copy of the License at
1362 *
1363 *   http://www.apache.org/licenses/LICENSE-2.0
1364 *
1365 * Unless required by applicable law or agreed to in writing, software
1366 * distributed under the License is distributed on an "AS IS" BASIS,
1367 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1368 * See the License for the specific language governing permissions and
1369 * limitations under the License.
1370 */const tR="pendingRedirect",fu=new Map;class nR extends _1{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=fu.get(this.auth._key());if(!e){try{const r=await rR(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}fu.set(this.auth._key(),e)}return this.bypassAuthState||fu.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 rR(t,e){const n=oR(e),r=iR(t);if(!await r._isAvailable())return!1;const s=await r._get(n)==="true";return await r._remove(n),s}function sR(t,e){fu.set(t._key(),e)}function iR(t){return Qn(t._redirectPersistence)}function oR(t){return du(tR,t.config.apiKey,t.name)}async function aR(t,e,n=!1){if(Xt(t.app))return Promise.reject(zr(t));const r=Zi(t),s=YN(r,e),o=await new nR(r,s,n).execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
1371 * @license
1372 * Copyright 2020 Google LLC
1373 *
1374 * Licensed under the Apache License, Version 2.0 (the "License");
1375 * you may not use this file except in compliance with the License.
1376 * You may obtain a copy of the License at
1377 *
1378 *   http://www.apache.org/licenses/LICENSE-2.0
1379 *
1380 * Unless required by applicable law or agreed to in writing, softw
1380are
1381 * distributed under the License is distributed on an "AS IS" BASIS,
1382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1383 * See the License for the specific language governing permissions and
1384 * limitations under the License.
1385 */const lR=10*60*1e3;class uR{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||!cR(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var r;if(e.error&&!w1(e)){const s=((r=e.error.code)==null?void 0:r.split("auth/")[1])||"internal-error";n.onError(Vn(this.auth,s))}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>=lR&&this.cachedEventUids.clear(),this.cachedEventUids.has(A0(e))}saveEventToCache(e){this.cachedEventUids.add(A0(e)),this.lastProcessedEventTime=Date.now()}}function A0(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function w1({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function cR(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return w1(t);default:return!1}}/**
1386 * @license
1387 * Copyright 2020 Google LLC
1388 *
1389 * Licensed under the Apache License, Version 2.0 (the "License");
1390 * you may not use this file except in compliance with the License.
1391 * You may obtain a copy of the License at
1392 *
1393 *   http://www.apache.org/licenses/LICENSE-2.0
1394 *
1395 * Unless required by applicable law or agreed to in writing, software
1396 * distributed under the License is distributed on an "AS IS" BASIS,
1397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1398 * See the License for the specific language governing permissions and
1399 * limitations under the License.
1400 */async function hR(t,e={}){return ls(t,"GET","/v1/projects",e)}/**
1401 * @license
1402 * Copyright 2020 Google LLC
1403 *
1404 * Licensed under the Apache License, Version 2.0 (the "License");
1405 * you may not use this file except in compliance with the License.
1406 * You may obtain a copy of the License at
1407 *
1408 *   http://www.apache.org/licenses/LICENSE-2.0
1409 *
1410 * Unless required by applicable law or agreed to in writing, software
1411 * distributed under the License is distributed on an "AS IS" BASIS,
1412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1413 * See the License for the specific language governing permissions and
1414 * limitations under the License.
1415 */const dR=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,fR=/^https?/;async function pR(t){if(t.config.emulator)return;const{authorizedDomains:e}=await hR(t);for(const n of e)try{if(mR(n))return}catch{}wn(t,"unauthorized-domain")}function mR(t){const e=xf(),{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(!fR.test(n))return!1;if(dR.test(t))return r===t;const s=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+s+"|"+s+")$","i").test(r)}/**
1416 * @license
1417 * Copyright 2020 Google LLC.
1418 *
1419 * Licensed under the Apache License, Version 2.0 (the "License");
1420 * you may not use this file except in compliance with the License.
1421 * You may obtain a copy of the License at
1422 *
1423 *   http://www.apache.org/licenses/LICENSE-2.0
1424 *
1425 * Unless required by applicable law or agreed to in writing, softw
1425are
1426 * distributed under the License is distributed on an "AS IS" BASIS,
1427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1428 * See the License for the specific language governing permissions and
1429 * limitations under the License.
1430 */const gR=new Qa(3e4,6e4);function P0(){const t=Mn().___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 yR(t){return new Promise((e,n)=>{var s,i,o;function r(){P0(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{P0(),n(Vn(t,"network-request-failed"))},timeout:gR.get()})}if((i=(s=Mn().gapi)==null?void 0:s.iframes)!=null&&i.Iframe)e(gapi.iframes.getContext());else if((o=Mn().gapi)!=null&&o.load)r();else{const l=cN("iframefcb");return Mn()[l]=()=>{gapi.load?r():n(Vn(t,"network-request-failed"))},i1(`${uN()}?onload=${l}`).catch(u=>n(u))}}).catch(e=>{throw pu=null,e})}let pu=null;function vR(t){return pu=pu||yR(t),pu}/**
1431 * @license
1432 * Copyright 2020 Google LLC.
1433 *
1434 * Licensed under the Apache License, Version 2.0 (the "License");
1435 * you may not use this file except in compliance with the License.
1436 * You may obtain a copy of the License at
1437 *
1438 *   http://www.apache.org/licenses/LICENSE-2.0
1439 *
1440 * Unless required by applicable law or agreed to in writing, software
1441 * distributed under the License is distributed on an "AS IS" BASIS,
1442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1443 * See the License for the specific language governing permissions and
1444 * limitations under the License.
1445 */const _R=new Qa(5e3,15e3),wR="__/auth/iframe",xR="emulator/auth/iframe",ER={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},TR=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function IR(t){const e=t.config;ne(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Qp(e,xR):`https://${t.config.authDomain}/${wR}`,r={apiKey:e.apiKey,appName:t.name,v:Hs},s=TR.get(t.config.apiHost);s&&(r.eid=s);const i=t._getFrameworks();return i.length&&(r.fw=i.join(",")),`${n}?${Ka(r).slice(1)}`}async function bR(t){const e=await vR(t),n=Mn().gapi;return ne(n,t,"internal-error"),e.open({where:document.body,url:IR(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:ER,dontclear:!0},r=>new Promise(async(s,i)=>{await r.restyle({setHideOnLeave:!1});const o=Vn(t,"network-request-failed"),l=Mn().setTimeout(()=>{i(o)},_R.get());function u(){Mn().clearTimeout(l),s(r)}r.ping(u).then(u,()=>{i(o)})}))}/**
1446 * @license
1447 * Copyright 2020 Google LLC.
1448 *
1449 * Licensed under the Apache License, Version 2.0 (the "License");
1450 * you may not use this file except in compliance with the License.
1451 * You may obtain a copy of the License at
1452 *
1453 *   http://www.apache.org/licenses/LICENSE-2.0
1454 *
1455 * Unless required by applicable law or agreed to in writing, software
1456 * distributed under the License is distributed on an "AS IS" BASIS,
1457 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1458 * See the License for the specific language governing permissions and
1459 * limitations under the License.
1460 */const SR={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},CR=500,kR=600,NR="_blank",RR="http://localhost";class j0{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function AR(t,e,n,r=CR,s=kR){const i=Math.max((window.screen.availHeight-s)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let l="";const u={...SR,width:r.toString(),height:s.toString(),top:i,left:o},h=xt().toLowerCase();n&&(l=Jx(h)?NR:n),Yx(h)&&(e=e||RR,u.scrollbars="yes");const f=Object.entries(u).reduce((g,[E,N])=>`${g}${E}=${N},`,"");if(eN(h)&&l!=="_self")return PR(e||"",l),new j0(null);const p=window.open(e||"",l,f);ne(p,t,"popup-blocked");try{p.focus()}catch{}return new j0(p)}function PR(t,e){const n=document.createElement("a");n.href=t,n.target=e;const r=document.createEvent("MouseEvent");
1460r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}/**
1461 * @license
1462 * Copyright 2021 Google LLC
1463 *
1464 * Licensed under the Apache License, Version 2.0 (the "License");
1465 * you may not use this file except in compliance with the License.
1466 * You may obtain a copy of the License at
1467 *
1468 *   http://www.apache.org/licenses/LICENSE-2.0
1469 *
1470 * Unless required by applicable law or agreed to in writing, software
1471 * distributed under the License is distributed on an "AS IS" BASIS,
1472 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1473 * See the License for the specific language governing permissions and
1474 * limitations under the License.
1475 */const jR="__/auth/handler",DR="emulator/auth/handler",OR=encodeURIComponent("fac");async function D0(t,e,n,r,s,i){ne(t.config.authDomain,t,"auth-domain-config-required"),ne(t.config.apiKey,t,"invalid-api-key");const o={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Hs,eventId:s};if(e instanceof l1){e.setDefaultLanguage(t.languageCode),o.providerId=e.providerId||"",EC(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[f,p]of Object.entries({}))o[f]=p}if(e instanceof Ya){const f=e.getScopes().filter(p=>p!=="");f.length>0&&(o.scopes=f.join(","))}t.tenantId&&(o.tid=t.tenantId);const l=o;for(const f of Object.keys(l))l[f]===void 0&&delete l[f];const u=await t._getAppCheckToken(),h=u?`#${OR}=${encodeURIComponent(u)}`:"";return`${LR(t)}?${Ka(l).slice(1)}${h}`}function LR({config:t}){return t.emulator?Qp(t,DR):`https://${t.authDomain}/${jR}`}/**
1476 * @license
1477 * Copyright 2020 Google LLC
1478 *
1479 * Licensed under the Apache License, Version 2.0 (the "License");
1480 * you may not use this file except in compliance with the License.
1481 * You may obtain a copy of the License at
1482 *
1483 *   http://www.apache.org/licenses/LICENSE-2.0
1484 *
1485 * Unless required by applicable law or agreed to in writing, software
1486 * distributed under the License is distributed on an "AS IS" BASIS,
1487 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1488 * See the License for the specific language governing permissions and
1489 * limitations under the License.
1490 */const cd="webStorageSupport";class VR{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=p1,this._completeRedirectFn=aR,this._overrideRedirectResult=sR}
1490async _openPopup(e,n,r,s){var o;ar((o=this.eventManagers[e._key()])==null?void 0:o.manager,"_initialize() not called before _openPopup()");const i=await D0(e,n,r,xf(),s);return AR(e,i,em())}async _openRedirect(e,n,r,s){await this._originValidation(e);const i=await D0(e,n,r,xf(),s);return UN(i),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:s,promise:i}=this.eventManagers[n];return s?Promise.resolve(s):(ar(i,"If manager is not set, promise should be"),i)}const r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){const n=await bR(e),r=new uR(e);return n.register("authEvent",s=>(ne(s==null?void 0:s.authEvent,e,"invalid-auth-event"),{status:r.onEvent(s.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(cd,{type:cd},s=>{var o;const i=(o=s==null?void 0:s[0])==null?void 0:o[cd];i!==void 0&&n(!!i),wn(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=pR(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return r1()||Xx()||Xp()}}const MR=VR;var O0="@firebase/auth",L0="1.12.1";/**
1491 * @license
1492 * Copyright 2020 Google LLC
1493 *
1494 * Licensed under the Apache License, Version 2.0 (the "License");
1495 * you may not use this file except in compliance with the License.
1496 * You may obtain a copy of the License at
1497 *
1498 *   http://www.apache.org/licenses/LICENSE-2.0
1499 *
1500 * Unless required by applicable law or agreed to in writing, software
1501 * distributed under the License is distributed on an "AS IS" BASIS,
1502 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1503 * See the License for the specific language governing permissions and
1504 * limitations under the License.
1505 */class FR{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)==null?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(){ne(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
1506 * @license
1507 * Copyright 2020 Google LLC
1508 *
1509 * Licensed under the Apache License, Version 2.0 (the "License");
1510 * you may not use this file except in compliance with the License.
1511 * You may obtain a copy of the License at
1512 *
1513 *   http://www.apache.org/licenses/LICENSE-2.0
1514 *
1515 * Unless required by applicable law or agreed to in writing, software
1516 * distributed under the License is distributed on an "AS IS" BASIS,
1517 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1518 * See the License for the specific language governing permissions and
1519 * limitations under the License.
1520 */function UR(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 $R(t){Ls(new Yr("auth",(e,{options:n})=>{const r=e.getProvider("app").getImmediate(),s=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:o,authDomain:l}=r.options;ne(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const u={apiKey:o,authDomain:l,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:s1(t)},h=new oN(r,s,i,u);return gN(h,n),h},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),Ls(new Yr("auth-internal",e=>{const n=Zi(e.getProvider("auth").getImmediate());return(r=>new FR(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),Ln(O0,L0,UR(t)),Ln(O0,L0,"esm2020")}/**
1521 * @license
1522 * Copyright 2021 Google LLC
1523 *
1524 * Licensed under the Apache License, Version 2.0 (the "License");
1525 * you may not use this file except in compliance with the License.
1526 * You may obtain a copy of the License at
1527 *
1528 *   http://www.apache.org/licenses/LICENSE-2.0
1529 *
1530 * Unless required by applicable law or agreed to in writing, software
1531 * distributed under the License is distributed on an "AS IS" BASIS,
1532 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1533 * See the License for the specific language governing permissions and
1534 * limitations under the License.
1535 */const BR=5*60,zR=Ox("authIdTokenMaxAge")||BR;let V0=null;const HR=t=>async e=>{const n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>zR)return;const s=n==null?void 0:n.token;V0!==s&&(V0=s,await fetch(t,{method:s?"POST":"DELETE",headers:s?{Authorization:`Bearer ${s}`}:{}}))};function WR(t=Gp()){const e=Vc(t,"auth");if(e.isInitialized())return e.getImmediate();const n=mN(t,{popupRedirectResolver:MR,persistence:[QN,VN,p1]}),r=Ox("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){const i=new URL(r,location.origin);if(location.origin===i.origin){const o=HR(i.toString());jN(n,o,()=>o(n.currentUser)),PN(n,l=>o(l))}}const s=Px("auth");return s&&yN(n,`http://${s}`),n}function qR(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}aN({loadJS(t){return new Promise((e,n)=>{const r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=s=>{const i=Vn("internal-error");i.customData=s,n(i)},r.type="text/javascript",r.charset="UTF-8",qR().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="});$R("Browser");var M0=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1536Copyright The Closure Library Authors.
1537SPDX-License-Identifier: Apache-2.0
1538*/var Hr,x1;(function(){var t;/** @license
1539
1540 Copyright The Closure Library Authors.
1541 SPDX-License-Identifier: Apache-2.0
1542*/function e(T,y){function I(){}I.prototype=y.prototype,T.F=y.prototype,T.prototype=new I,T.prototype.constructor=T,T.D=function(k,R,b){for(var v=Array(arguments.length-2),U=2;U<arguments.length;U++)v[U-2]=arguments[U];return y.prototype[R].apply(k,v)}}function n(){this.blockSize=-1}function r(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(r,n),r.prototype.u=function(){this.g[0]=1732584193,this.g[1]=4023233417,this.g[2]=2562383102,this.g[3]=271733878,this.o=this.h=0};function s(T,y,I){I||(I=0);const k=Array(16);if(typeof y=="string")for(var R=0;R<16;++R)k[R]=y.charCodeAt(I++)|y.charCodeAt(I++)<<8|y.charCodeAt(I++)<<16|y.charCodeAt(I++)<<24;else for(R=0;R<16;++R)k[R]=y[I++]|y[I++]<<8|y[I++]<<16|y[I++]<<24;y=T.g[0],I=T.g[1],R=T.g[2];let b=T.g[3],v;v=y+(b^I&(R^b))+k[0]+3614090360&4294967295,y=I+(v<<7&4294967295|v>>>25),v=b+(R^y&(I^R))+k[1]+3905402710&4294967295,b=y+(v<<12&4294967295|v>>>20),v=R+(I^b&(y^I))+k[2]+606105819&4294967295,R=b+(v<<17&4294967295|v>>>15),v=I+(y^R&(b^y))+k[3]+3250441966&4294967295,I=R+(v<<22&4294967295|v>>>10),v=y+(b^I&(R^b))+k[4]+4118548399&4294967295,y=I+(v<<7&4294967295|v>>>25),v=b+(R^y&(I^R))+k[5]+1200080426&4294967295,b=y+(v<<12&4294967295|v>>>20),v=R+(I^b&(y^I))+k[6]+2821735955&4294967295,R=b+(v<<17&4294967295|v>>>15),v=I+(y^R&(b^y))+k[7]+4249261313&4294967295,I=R+(v<<22&4294967295|v>>>10),v=y+(b^I&(R^b))+k[8]+1770035416&4294967295,y=I+(v<<7&4294967295|v>>>25),v=b+(R^y&(I^R))+k[9]+2336552879&4294967295,b=y+(v<<12&4294967295|v>>>20),v=R+(I^b&(y^I))+k[10]+4294925233&4294967295,R=b+(v<<17&4294967295|v>>>15),v=I+(y^R&(b^y))+k[11]+2304563134&4294967295,I=R+(v<<22&4294967295|v>>>10),v=y+(b^I&(R^b))+k[12]+1804603682&4294967295,y=I+(v<<7&4294967295|v>>>25),v=b+(R^y&(I^R))+k[13]+4254626195&4294967295,b=y+(v<<12&4294967295|v>>>20),v=R+(I^b&(y^I))+k[14]+2792965006&4294967295,R=b+(v<<17&4294967295|v>>>15),v=I+(y^R&(b^y))+k[15]+1236535329&4294967295,I=R+(v<<22&4294967295|v>>>10),v=y+(R^b&(I^R))+k[1]+4129170786&4294967295,y=I+(v<<5&4294967295|v>>>27),v=b+(I^R&(y^I))+k[6]+3225465664&4294967295,b=y+(v<<9&4294967295|v>>>23),v=R+(y^I&(b^y))+k[11]+643717713&4294967295,R=b+(v<<14&4294967295|v>>>18),v=I+(b^y&(R^b))+k[0]+3921069994&4294967295,I=R+(v<<20&4294967295|v>>>12),v=y+(R^b&(I^R))+k[5]+3593408605&4294967295,y=I+(v<<5&4294967295|v>>>27),v=b+(I^R&(y^I))+k[10]+38016083&4294967295,b=y+(v<<9&4294967295|v>>>23),v=R+(y^I&(b^y))+k[15]+3634488961&4294967295,R=b+(v<<14&4294967295|v>>>18),v=I+(b^y&(R^b))+k[4]+3889429448&4294967295,I=R+(v<<20&4294967295|v>>>12),v=y+(R^b&(I^R))+k[9]+568446438&4294967295,y=I+(v<<5&4294967295|v>>>27),v=b+(I^R&(y^I))+k[14]+3275163606&4294967295,b=y+(v<<9&4294967295|v>>>23),v=R+(y^I&(b^y))+k[3]+4107603335&4294967295,R=b+(v<<14&4294967295|v>>>18),v=I+(b^y&(R^b))+k[8]+1163531501&4294967295,I=R+(v<<20&4294967295|v>>>12),v=y+(R^b&(I^R))+k[13]+2850285829&4294967295,y=I+(v<<5&4294967295|v>>>27),v=b+(I^R&(y^I))+k[2]+4243563512&4294967295,b=y+(v<<9&4294967295|v>>>23),v=R+(y^I&(b^y))+k[7]+1735328473&4294967295,R=b+(v<<14&4294967295|v>>>18),v=I+(b^y&(R^b))+k[12]+2368359562&4294967295,I=R+(v<<20&4294967295|v>>>12),v=y+(I^R^b)+k[5]+4294588738&4294967295,y=I+(v<<4&4294967295|v>>>28),v=b+(y^I^R)+k[8]+2272392833&4294967295,b=y+(v<<11&4294967295|v>>>21),v=R+(b^y^I)+k[11]+1839030562&4294967295,R=b+(v<<16&4294967295|v>>>16),v=I+(R^b^y)+k[14]+4259657740&4294967295,I=R+(v<<23&4294967295|v>>>9),v=y+(I^R^b)+k[1]+2763975236&4294967295,y=I+(v<<4&4294967295|v>>>28),v=b+(y^I^R)+k[4]+1272893353&4294967295,b=y+(v<<11&4294967295|v>>>21),v=R+(b^y^I)+k[7]+4139469664&4294967295,R=b+(v<<16&4294967295|v>>>16),v=I+(R^b^y)+k[10]+3200236656&4294967295,I=R+(v<<23&4294967295|v>>>9),v=y+(I^R^b)+k[13]+681279174&4294967295,y=I+(v<<4&4294967295|v>>>28),v=b+(y^I^R)+k[0]+3936430074&4294967295,b=y+(v<<11&4294967295|v>>>21),v=R+(b^y^I)+k[3]+3572445317&4294967295,R=b+(v<<16&4294967295|v>>>16),v=I+(R^b^y)+k[6]+76029189&4294967295,I=R+(v<<23&4294967295|v>>>9),v=y+(I^R^b)+k[9]+3654602809&4294967295,y=I+(v<<4&4294967295|v>>>28),v=b+(y^I^R)+k[12]+3873151461&4294967295,b=y+(v<<11&4294967295|v>>>21),v=R+(b^y^I)+k[15]+530742520&4294967295,R=b+(v<<16&4294967295|v>>>16),v=I+(R^b^y)+k[2]+3299628645&4294967295,I=R+(v<<23&4294967295|v>>>9),v=y+(R^(I|~b))+k[0]+4096336452&4294967295,y=I+(v<<6&4294967295|v>>>26),v=b+(I^(y|~R))+k[7]+1126891415&4294967295,b=y+(v<<10&4294967295|v>>>22),v=R+(y^(b|~I))+k[14]+2878612391&4294967295,R=b+(v<<15&4294967295|v>>>17),v=I+(b^(R|~y))+k[5]+4237533241&4294967295,I=R+(v<<21&4294967295|v>>>11),v=y+(R^(I|~b))+k[12]+1700485571&4294967295,y=I+(v<<6&4294967295|v>>>26),v=b+(I^(y|~R))+k[3]+2399980690&4294967295,b=y+(v<<10&4294967295|v>>>22),v=R+(y^(b|~I))+k[10]+4293915773&4294967295,R=b+(v<<15&4294967295|v>>>17),v=I+(b^(R|~y))+k[1]+2240044497&4294967295,I=R+(v<<21&4294967295|v>>>11),v=y+(R^(I|~b))+k[8]+1873313359&4294967295,y=I+(v<<6&4294967295|v>>>26),v=b+(I^(y|~R))+k[15]+4264355552&4294967295,b=y+(v<<10&4294967295|v>>>22),v=R+(y^(b|~I))+k[6]+2734768916&4294967295,R=b+(v<<15&4294967295|v>>>17),v=I+(b^(R|~y))+k[13]+1309151649&4294967295,I=R+(v<<21&4294967295|v>>>11),v=y+(R^(I|~b))+k[4]+4149444226&4294967295,y=I+(v<<6&4294967295|v>>>26),v=b+(I^(y|~R))+k[11]+3174756917&4294967295,b=y+(v<<10&4294967295|v>>>22),v=R+(y^(b|~I))+k[2]+718787259&4294967295,R=b+(v<<15&4294967295|v>>>17),v=I+(b^(R|~y))+k[9]+3951481745&4294967295,T.g[0]=T.g[0]+y&4294967295,T.g[1]=T.g[1]+(R+(v<<21&4294967295|v>>>11))&4294967295,T.g[2]=T.g[2]+R&4294967295,T.g[3]=T.g[3]+b&4294967295}r.prototype.v=function(T,y){y===void 0&&(y=T.length);const I=y-this.blockSize,k=this.C;let R=this.h,b=0;for(;b<y;){if(R==0)for(;b<=I;)s(this,T,b),b+=this.blockSize;if(typeof T=="string"){for(;b<y;)if(k[R++]=T.charCodeAt(b++),R==this.blockSize){s(this,k),R=0;break}}else for(;b<y;)if(k[R++]=T[b++],R==this.blockSize){s(this,k),R=0;break}}this.h=R,this.o+=y},r.prototype.A=function(){var T=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);T[0]=128;for(var y=1;y<T.length-8;++y)T[y]=0;y=this.o*8;for(var I=T.length-8;I<T.length;++I)T[I]=y&255,y/=256;for(this.v(T),T=Array(16),y=0,I=0;I<4;++I)for(let k=0;k<32;k+=8)T[y++]=this.g[I]>>>k&255;return T};function i(T,y){var I=l;return Object.prototype.hasOwnProperty.call(I,T)?I[T]:I[T]=y(T)}function o(T,y){this.h=y;const I=[];let k=!0;for(let R=T.length-1;R>=0;R--){const b=T[R]|0;k&&b==y||(I[R]=b,k=!1)}this.g=I}var l={};function u(T){return-128<=T&&T<128?i(T,function(y){return new o([y|0],y<0?-1:0)}):new o([T|0],T<0?-1:0)}function h(T){if(isNaN(T)||!isFinite(T))return p;if(T<0)return P(h(-T));const y=[];let I=1;for(let k=0;T>=I;k++)y[k]=T/I|0,I*=4294967296;return new o(y,0)}function f(T,y){if(T.length==0)throw Error("number format error: empty string");if(y=y||10,y<2||36<y)throw Error("radix out of range: "+y);if(T.charAt(0)=="-")return P(f(T.substring(1),y));if(T.indexOf("-")>=0)throw Error('number format error: interior "-" character');const I=h(Math.pow(y,8));let k=p;for(let b=0;b<T.length;b+=8){var R=Math.min(8,T.length-b);const v=parseInt(T.substring(b,b+R),y);R<8?(R=h(Math.pow(y,R)),k=k.j(R).add(h(v))):(k=k.j(I),k=k.add(h(v)))}return k}var p=u(0),g=u(1),E=u(16777216);
1542t=o.prototype,t.m=function(){if(A(this))return-P(this).m();let T=0,y=1;for(let I=0;I<this.g.length;I++){const k=this.i(I);T+=(k>=0?k:4294967296+k)*y,y*=4294967296}return T},t.toString=function(T){if(T=T||10,T<2||36<T)throw Error("radix out of range: "+T);if(N(this))return"0";if(A(this))return"-"+P(this).toString(T);const y=h(Math.pow(T,6));var I=this;let k="";for(;;){const R=j(I,y).g;I=_(I,R.j(y));let b=((I.g.length>0?I.g[0]:I.h)>>>0).toString(T);if(I=R,N(I))return b+k;for(;b.length<6;)b="0"+b;k=b+k}},t.i=function(T){return T<0?0:T<this.g.length?this.g[T]:this.h};function N(T){if(T.h!=0)return!1;for(let y=0;y<T.g.length;y++)if(T.g[y]!=0)return!1;return!0}function A(T){return T.h==-1}t.l=function(T){return T=_(this,T),A(T)?-1:N(T)?0:1};function P(T){const y=T.g.length,I=[];for(let k=0;k<y;k++)I[k]=~T.g[k];return new o(I,~T.h).add(g)}t.abs=function(){return A(this)?P(this):this},t.add=function(T){const y=Math.max(this.g.length,T.g.length),I=[];let k=0;for(let R=0;R<=y;R++){let b=k+(this.i(R)&65535)+(T.i(R)&65535),v=(b>>>16)+(this.i(R)>>>16)+(T.i(R)>>>16);k=v>>>16,b&=65535,v&=65535,I[R]=v<<16|b}return new o(I,I[I.length-1]&-2147483648?-1:0)};function _(T,y){return T.add(P(y))}t.j=function(T){if(N(this)||N(T))return p;if(A(this))return A(T)?P(this).j(P(T)):P(P(this).j(T));if(A(T))return P(this.j(P(T)));if(this.l(E)<0&&T.l(E)<0)return h(this.m()*T.m());const y=this.g.length+T.g.length,I=[];for(var k=0;k<2*y;k++)I[k]=0;for(k=0;k<this.g.length;k++)for(let R=0;R<T.g.length;R++){const b=this.i(k)>>>16,v=this.i(k)&65535,U=T.i(R)>>>16,O=T.i(R)&65535;I[2*k+2*R]+=v*O,w(I,2*k+2*R),I[2*k+2*R+1]+=b*O,w(I,2*k+2*R+1),I[2*k+2*R+1]+=v*U,w(I,2*k+2*R+1),I[2*k+2*R+2]+=b*U,w(I,2*k+2*R+2)}for(T=0;T<y;T++)I[T]=I[2*T+1]<<16|I[2*T];for(T=y;T<2*y;T++)I[T]=0;return new o(I,0)};function w(T,y){for(;(T[y]&65535)!=T[y];)T[y+1]+=T[y]>>>16,T[y]&=65535,y++}function S(T,y){this.g=T,this.h=y}function j(T,y){if(N(y))throw Error("division by zero");if(N(T))return new S(p,p);if(A(T))return y=j(P(T),y),new S(P(y.g),P(y.h));if(A(y))return y=j(T,P(y)),new S(P(y.g),y.h);if(T.g.length>30){if(A(T)||A(y))throw Error("slowDivide_ only works with positive integers.");for(var I=g,k=y;k.l(T)<=0;)I=V(I),k=V(k);var R=M(I,1),b=M(k,1);for(k=M(k,2),I=M(I,2);!N(k);){var v=b.add(k);v.l(T)<=0&&(R=R.add(I),b=v),k=M(k,1),I=M(I,1)}return y=_(T,R.j(y)),new S(R,y)}for(R=p;T.l(y)>=0;){for(I=Math.max(1,Math.floor(T.m()/y.m())),k=Math.ceil(Math.log(I)/Math.LN2),k=k<=48?1:Math.pow(2,k-48),b=h(I),v=b.j(y);A(v)||v.l(T)>0;)I-=k,b=h(I),v=b.j(y);N(b)&&(b=g),R=R.add(b),T=_(T,v)}return new S(R,T)}t.B=function(T){return j(this,T).h},t.and=function(T){const y=Math.max(this.g.length,T.g.length),I=[];for(let k=0;k<y;k++)I[k]=this.i(k)&T.i(k);return new o(I,this.h&T.h)},t.or=function(T){const y=Math.max(this.g.length,T.g.length),I=[];for(let k=0;k<y;k++)I[k]=this.i(k)|T.i(k);return new o(I,this.h|T.h)},t.xor=function(T){const y=Math.max(this.g.length,T.g.length),I=[];for(let k=0;k<y;k++)I[k]=this.i(k)^T.i(k);return new o(I,this.h^T.h)};function V(T){const y=T.g.length+1,I=[];for(let k=0;k<y;k++)I[k]=T.i(k)<<1|T.i(k-1)>>>31;return new o(I,T.h)}function M(T,y){const I=y>>5;y%=32;const k=T.g.length-I,R=[];for(let b=0;b<k;b++)R[b]=y>0?T.i(b+I)>>>y|T.i(b+I+1)<<32-y:T.i(b+I);return new o(R,T.h)}r.prototype.digest=r.prototype.A,r.prototype.reset=r.prototype.u,r.prototype.update=r.prototype.v,x1=r,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.B,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=h,o.fromString=f,Hr=o}).apply(typeof M0<"u"?M0:typeof self<"u"?self:typeof window<"u"?window:{});var $l=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
1543Copyright The Closure Library Authors.
1544SPDX-License-Identifier: Apache-2.0
1545*/var E1,Ho,T1,mu,If,I1,b1,S1;(function(){var t,e=Object.defineProperty;function n(a){a=[typeof globalThis=="object"&&globalThis,a,typeof window=="object"&&window,typeof self=="object"&&self,typeof $l=="object"&&$l];for(var d=0;d<a.length;++d){var m=a[d];if(m&&m.Math==Math)return m}throw Error("Cannot find global object")}var r=n(this);function s(a,d){if(d)e:{var m=r;a=a.split(".");for(var x=0;x<a.length-1;x++){var D=a[x];if(!(D in m))break e;m=m[D]}a=a[a.length-1],x=m[a],d=d(x),d!=x&&d!=null&&e(m,a,{configurable:!0,writable:!0,value:d})}}s("Symbol.dispose",function(a){return a||Symbol("Symbol.dispose")}),s("Array.prototype.values",function(a){return a||function(){return this[Symbol.iterator]()}}),s("Object.entries",function(a){return a||function(d){var m=[],x;for(x in d)Object.prototype.hasOwnProperty.call(d,x)&&m.push([x,d[x]]);return m}});/** @license
1546
1547 Copyright The Closure Library Authors.
1548 SPDX-License-Identifier: Apache-2.0
1549*/var i=i||{},o=this||self;function l(a){var d=typeof a;return d=="object"&&a!=null||d=="function"}function u(a,d,m){return a.call.apply(a.bind,arguments)}function h(a,d,m){return h=u,h.apply(null,arguments)}
1549function f(a,d){var m=Array.prototype.slice.call(arguments,1);return function(){var x=m.slice();return x.push.apply(x,arguments),a.apply(this,x)}}function p(a,d){function m(){}m.prototype=d.prototype,a.Z=d.prototype,a.prototype=new m,a.prototype.constructor=a,a.Ob=function(x,D,L){for(var K=Array(arguments.length-2),ue=2;ue<arguments.length;ue++)K[ue-2]=arguments[ue];return d.prototype[D].apply(x,K)}}var g=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?a=>a&&AsyncContext.Snapshot.wrap(a):a=>a;function E(a){const d=a.length;if(d>0){const m=Array(d);for(let x=0;x<d;x++)m[x]=a[x];return m}return[]}function N(a,d){for(let x=1;x<arguments.length;x++){const D=arguments[x];var m=typeof D;if(m=m!="object"?m:D?Array.isArray(D)?"array":m:"null",m=="array"||m=="object"&&typeof D.length=="number"){m=a.length||0;const L=D.length||0;a.length=m+L;for(let K=0;K<L;K++)a[m+K]=D[K]}else a.push(D)}}class A{constructor(d,m){this.i=d,this.j=m,this.h=0,this.g=null}get(){let d;return this.h>0?(this.h--,d=this.g,this.g=d.next,d.next=null):d=this.i(),d}}function P(a){o.setTimeout(()=>{throw a},0)}function _(){var a=T;let d=null;return a.g&&(d=a.g,a.g=a.g.next,a.g||(a.h=null),d.next=null),d}class w{constructor(){this.h=this.g=null}add(d,m){const x=S.get();x.set(d,m),this.h?this.h.next=x:this.g=x,this.h=x}}var S=new A(()=>new j,a=>a.reset());class j{constructor(){this.next=this.g=this.h=null}set(d,m){this.h=d,this.g=m,this.next=null}reset(){this.next=this.g=this.h=null}}let V,M=!1,T=new w,y=()=>{const a=Promise.resolve(void 0);V=()=>{a.then(I)}};function I(){for(var a;a=_();){try{a.h.call(a.g)}catch(m){P(m)}var d=S;d.j(a),d.h<100&&(d.h++,a.next=d.g,d.g=a)}M=!1}function k(){this.u=this.u,this.C=this.C}k.prototype.u=!1,k.prototype.dispose=function(){this.u||(this.u=!0,this.N())},k.prototype[Symbol.dispose]=function(){this.dispose()},k.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function R(a,d){this.type=a,this.g=this.target=d,this.defaultPrevented=!1}R.prototype.h=function(){this.defaultPrevented=!0};var b=function(){if(!o.addEventListener||!Object.defineProperty)return!1;var a=!1,d=Object.defineProperty({},"passive",{get:function(){a=!0}});try{const m=()=>{};o.addEventListener("test",m,d),o.removeEventListener("test",m,d)}catch{}return a}();function v(a){return/^[\s\xa0]*$/.test(a)}function U(a,d){R.call(this,a?a.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,a&&this.init(a,d)}p(U,R),U.prototype.init=function(a,d){const m=this.type=a.type,x=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement,this.g=d,d=a.relatedTarget,d||(m=="mouseover"?d=a.fromElement:m=="mouseout"&&(d=a.toElement)),this.relatedTarget=d,x?(this.clientX=x.clientX!==void 0?x.clientX:x.pageX,this.clientY=x.clientY!==void 0?x.clientY:x.pageY,this.screenX=x.screenX||0,this.screenY=x.screenY||0):(this.clientX=a.clientX!==void 0?a.clientX:a.pageX,this.clientY=a.clientY!==void 0?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0),this.button=a.button,this.key=a.key||"",this.ctrlKey=a.ctrlKey,this.altKey=a.altKey,this.shiftKey=a.shiftKey,this.metaKey=a.metaKey,this.pointerId=a.pointerId||0,this.pointerType=a.pointerType,this.state=a.state,this.i=a,a.defaultPrevented&&U.Z.h.call(this)},U.prototype.h=function(){U.Z.h.call(this);const a=this.i;a.preventDefault?a.preventDefault():a.returnValue=!1};var O="closure_listenable_"+(Math.random()*1e6|0),G=0;function Q(a,d,m,x,D){this.listener=a,this.proxy=null,this.src=d,this.type=m,this.capture=!!x,this.ha=D,this.key=++G,this.da=this.fa=!1}function F(a){a.da=!0,a.listener=null,a.proxy=null,a.src=null,a.ha=null}function B(a,d,m){for(const x in a)d.call(m,a[x],x,a)}function W(a,d){for(const m in a)d.call(void 0,a[m],m,a)}function Y(a){const d={};for(const m in a)d[m]=a[m];return d}const oe="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
1549ing toString valueOf".split(" ");function be(a,d){let m,x;for(let D=1;D<arguments.length;D++){x=arguments[D];for(m in x)a[m]=x[m];for(let L=0;L<oe.length;L++)m=oe[L],Object.prototype.hasOwnProperty.call(x,m)&&(a[m]=x[m])}}function Se(a){this.src=a,this.g={},this.h=0}Se.prototype.add=function(a,d,m,x,D){const L=a.toString();a=this.g[L],a||(a=this.g[L]=[],this.h++);const K=Vt(a,d,x,D);return K>-1?(d=a[K],m||(d.fa=!1)):(d=new Q(d,this.src,L,!!x,D),d.fa=m,a.push(d)),d};function Et(a,d){const m=d.type;if(m in a.g){var x=a.g[m],D=Array.prototype.indexOf.call(x,d,void 0),L;(L=D>=0)&&Array.prototype.splice.call(x,D,1),L&&(F(d),a.g[m].length==0&&(delete a.g[m],a.h--))}}function Vt(a,d,m,x){for(let D=0;D<a.length;++D){const L=a[D];if(!L.da&&L.listener==d&&L.capture==!!m&&L.ha==x)return D}return-1}var En="closure_lm_"+(Math.random()*1e6|0),ao={};function ul(a,d,m,x,D){if(Array.isArray(d)){for(let L=0;L<d.length;L++)ul(a,d[L],m,x,D);return null}return m=le(m),a&&a[O]?a.J(d,m,l(x)?!!x.capture:!1,D):dr(a,d,m,!1,x,D)}function dr(a,d,m,x,D,L){if(!d)throw Error("Invalid event type");const K=l(D)?!!D.capture:!!D;let ue=H(a);if(ue||(a[En]=ue=new Se(a)),m=ue.add(d,m,x,K,L),m.proxy)return m;if(x=uh(),m.proxy=x,x.src=a,x.listener=m,a.addEventListener)b||(D=K),D===void 0&&(D=!1),a.addEventListener(d.toString(),x,D);else if(a.attachEvent)a.attachEvent(ch(d.toString()),x);else if(a.addListener&&a.removeListener)a.addListener(x);else throw Error("addEventListener and attachEvent are unavailable.");return m}function uh(){function a(m){return d.call(a.src,a.listener,m)}const d=hh;return a}function cl(a,d,m,x,D){if(Array.isArray(d))for(var L=0;L<d.length;L++)cl(a,d[L],m,x,D);else x=l(x)?!!x.capture:!!x,m=le(m),a&&a[O]?(a=a.i,L=String(d).toString(),L in a.g&&(d=a.g[L],m=Vt(d,m,x,D),m>-1&&(F(d[m]),Array.prototype.splice.call(d,m,1),d.length==0&&(delete a.g[L],a.h--)))):a&&(a=H(a))&&(d=a.g[d.toString()],a=-1,d&&(a=Vt(d,m,x,D)),(m=a>-1?d[a]:null)&&lo(m))}function lo(a){if(typeof a!="number"&&a&&!a.da){var d=a.src;if(d&&d[O])Et(d.i,a);else{var m=a.type,x=a.proxy;d.removeEventListener?d.removeEventListener(m,x,a.capture):d.detachEvent?d.detachEvent(ch(m),x):d.addListener&&d.removeListener&&d.removeListener(x),(m=H(d))?(Et(m,a),m.h==0&&(m.src=null,d[En]=null)):F(a)}}}function ch(a){return a in ao?ao[a]:ao[a]="on"+a}function hh(a,d){if(a.da)a=!0;else{d=new U(d,this);const m=a.listener,x=a.ha||a.src;a.fa&&lo(a),a=m.call(x,d)}return a}function H(a){return a=a[En],a instanceof Se?a:null}var se="__closure_events_fn_"+(Math.random()*1e9>>>0);function le(a){return typeof a=="function"?a:(a[se]||(a[se]=function(d){return a.handleEvent(d)}),a[se])}function ee(){k.call(this),this.i=new Se(this),this.M=this,this.G=null}p(ee,k),ee.prototype[O]=!0,ee.prototype.removeEventListener=function(a,d,m,x){cl(this,a,d,m,x)};function he(a,d){var m,x=a.G;if(x)for(m=[];x;x=x.G)m.push(x);if(a=a.M,x=d.type||d,typeof d=="string")d=new R(d,a);else if(d instanceof R)d.target=d.target||a;else{var D=d;d=new R(x,a),be(d,D)}D=!0;let L,K;if(m)for(K=m.length-1;K>=0;K--)L=d.g=m[K],D=fe(L,x,!0,d)&&D;if(L=d.g=a,D=fe(L,x,!0,d)&&D,D=fe(L,x,!1,d)&&D,m)for(K=0;K<m.length;K++)L=d.g=m[K],D=fe(L,x,!1,d)&&D}ee.prototype.N=function(){if(ee.Z.N.call(this),this.i){var a=this.i;for(const d in a.g){const m=a.g[d];for(let x=0;x<m.length;x++)F(m[x]);delete a.g[d],a.h--}}this.G=null},ee.prototype.J=function(a,d,m,x){return this.i.add(String(a),d,!1,m,x)},ee.prototype.K=function(a,d,m,x){return this.i.add(String(a),d,!0,m,x)};function fe(a,d,m,x){if(d=a.i.g[String(d)],!d)return!0;d=d.concat();let D=!0;for(let L=0;L<d.length;++L){const K=d[L];if(K&&!K.da&&K.capture==m){const ue=K.listener,Je=K.ha||K.src;K.fa&&Et(a.i,K),D=ue.call(Je,x)!==!1&&D}}return D&&!x.defaultPrevented}function Tn(a,d){if(typeof a!="function")if(a&&typeof a.handleEvent=="function")a=h(a.handleEvent,a);else throw Error("Invalid listener argument");return Number(d)>2147483647?-1:o.setTimeout(a,d||0)}function Ks(a){a.g=Tn(()=>{a.g=null,a.i&&(a.i=!1,Ks(a))},a.l);const d=a.h;a.h=null,a.m.apply(null,d)}class uo extends k{constructor(d,m){super(),this.m=d,this.l=m,this.h=null,this.i=!1,this.g=null}j(d){this.h=arguments,this.g?this.i=!0:Ks(this)}N(){super.N(),this.g&&(o.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function co(a){k.call(this),this.h=a,this.g={}}p(co,k);var Xm=[];function Jm(a){B(a.g,function(d,m){this.g.hasOwnProperty(m)&&lo(d)},a),a.g={}}co.prototype.N=function(){co.Z.N.call(this),Jm(this)},co.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var dh=o.JSON.stringify,IT=o.JSON.parse,bT=class{stringify(a){return o.JSON.stringify(a,void 0)}parse(a){return o.JSON.parse(a,void 0)}};function Zm(){}function eg(){}var ho={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function fh(){R.call(this,"d")}p(fh,R);function ph(){R.call(this,"c")}p(ph,R);var ds={},tg=null;function hl(){return tg=tg||new ee}ds.Ia="serverreachability";function ng(a){R.call(this,ds.Ia,a)}p(ng,R);function fo(a){const d=hl();he(d,new ng(d))}ds.STAT_EVENT="statevent";function rg(a,d){R.call(this,ds.STAT_EVENT,a),this.stat=d}p(rg,R);function Tt(a){const d=hl();he(d,new rg(d,a))}ds.Ja="timingevent";function sg(a,d){R.call(this,ds.Ja,a),this.size=d}p(sg,R);function po(a,d){if(typeof a!="function")throw Error("Fn must not be null and must be a function");return o.setTimeout(function(){a()},d)}function mo(){this.g=!0}mo.prototype.ua=function(){this.g=!1};function ST(a,d,m,x,D,L){a.info(function(){if(a.g)if(L){var K="",ue=L.split("&");for(let Ee=0;Ee<ue.length;Ee++){var Je=ue[Ee].split("=");if(Je.length>1){const nt=Je[0];Je=Je[1];const bn=nt.split("_");K=bn.length>=2&&bn[1]=="type"?K+(nt+"="+Je+"&"):K+(nt+"=redacted&")}}}else K=null;else K=L;return"XMLHTTP REQ ("+x+") [attempt "+D+"]: "+d+`
1550`+m+`
1551`+K})}function CT(a,d,m,x,D,L,K){a.info(function(){return"XMLHTTP RESP ("+x+") [ attempt "+D+"]: "+d+`
1552`+m+`
1553`+L+" "+K})}function Qs(a,d,m,x){a.info(function(){return"XMLHTTP TEXT ("+d+"): "+NT(a,m)+(x?" "+x:"")})}function kT(a,d){a.info(function(){return"TIMEOUT: "+d})}mo.prototype.info=function(){};function NT(a,d){if(!a.g)return d;if(!d)return null;try{const L=JSON.parse(d);if(L){for(a=0;a<L.length;a++)if(Array.isArray(L[a])){var m=L[a];if(!(m.length<2)){var x=m[1];if(Array.isArray(x)&&!(x.length<1)){var D=x[0];if(D!="noop"&&D!="stop"&&D!="close")for(let K=1;K<x.length;K++)x[K]=""}}}}return dh(L)}catch{return d}}var dl={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},ig={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},og;function mh(){}p(mh,Zm),mh.prototype.g=function(){return new XMLHttpRequest},og=new mh;function go(a){return encodeURIComponent(String(a))}function RT(a){var d=1;a=a.split(":");const m=[];for(;d>0&&a.length;)m.push(a.shift()),d--;return a.length&&m.push(a.join(":")),m}function fr(a,d,m,x){this.j=a,this.i=d,this.l=m,this.S=x||1,this.V=new co(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new ag}function ag(){this.i=null,this.g="",this.h=!1}var lg={},gh={};function yh(a,d,m){a.M=1,a.A=pl(In(d)),a.u=m,a.R=!0,ug(a,null)}function ug(a,d){a.F=Date.now(),fl(a),a.B=In(a.A);var m=a.B,x=a.S;Array.isArray(x)||(x=[String(x)]),Eg(m.i,"t",x),a.C=0,m=a.j.L,a.h=new ag,a.g=Ug(a.j,m?d:null,!a.u),a.P>0&&(a.O=new uo(h(a.Y,a,a.g),a.P)),d=a.V,m=a.g,x=a.ba;var D="readystatechange";Array.isArray(D)||(D&&(Xm[0]=D.toString()),D=Xm);for(let L=0;L<D.length;L++){const K=ul(m,D[L],x||d.handleEvent,!1,d.h||d);if(!K)break;d.g[K.key]=K}d=a.J?Y(a.J):{}
1553,a.u?(a.v||(a.v="POST"),d["Content-Type"]="application/x-www-form-urlencoded",a.g.ea(a.B,a.v,a.u,d)):(a.v="GET",a.g.ea(a.B,a.v,null,d)),fo(),ST(a.i,a.v,a.B,a.l,a.S,a.u)}fr.prototype.ba=function(a){a=a.target;const d=this.O;d&&gr(a)==3?d.j():this.Y(a)},fr.prototype.Y=function(a){try{if(a==this.g)e:{const ue=gr(this.g),Je=this.g.ya(),Ee=this.g.ca();if(!(ue<3)&&(ue!=3||this.g&&(this.h.h||this.g.la()||Ng(this.g)))){this.K||ue!=4||Je==7||(Je==8||Ee<=0?fo(3):fo(2)),vh(this);var d=this.g.ca();this.X=d;var m=AT(this);if(this.o=d==200,CT(this.i,this.v,this.B,this.l,this.S,ue,d),this.o){if(this.U&&!this.L){t:{if(this.g){var x,D=this.g;if((x=D.g?D.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!v(x)){var L=x;break t}}L=null}if(a=L)Qs(this.i,this.l,a,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,_h(this,a);else{this.o=!1,this.m=3,Tt(12),fs(this),yo(this);break e}}if(this.R){a=!0;let nt;for(;!this.K&&this.C<m.length;)if(nt=PT(this,m),nt==gh){ue==4&&(this.m=4,Tt(14),a=!1),Qs(this.i,this.l,null,"[Incomplete Response]");break}else if(nt==lg){this.m=4,Tt(15),Qs(this.i,this.l,m,"[Invalid Chunk]"),a=!1;break}else Qs(this.i,this.l,nt,null),_h(this,nt);if(cg(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),ue!=4||m.length!=0||this.h.h||(this.m=1,Tt(16),a=!1),this.o=this.o&&a,!a)Qs(this.i,this.l,m,"[Invalid Chunked Response]"),fs(this),yo(this);else if(m.length>0&&!this.W){this.W=!0;var K=this.j;K.g==this&&K.aa&&!K.P&&(K.j.info("Great, no buffering proxy detected. Bytes received: "+m.length),Ch(K),K.P=!0,Tt(11))}}else Qs(this.i,this.l,m,null),_h(this,m);ue==4&&fs(this),this.o&&!this.K&&(ue==4?Lg(this.j,this):(this.o=!1,fl(this)))}else qT(this.g),d==400&&m.indexOf("Unknown SID")>0?(this.m=3,Tt(12)):(this.m=0,Tt(13)),fs(this),yo(this)}}}catch{}finally{}};function AT(a){if(!cg(a))return a.g.la();const d=Ng(a.g);if(d==="")return"";let m="";const x=d.length,D=gr(a.g)==4;if(!a.h.i){if(typeof TextDecoder>"u")return fs(a),yo(a),"";a.h.i=new o.TextDecoder}for(let L=0;L<x;L++)a.h.h=!0,m+=a.h.i.decode(d[L],{stream:!(D&&L==x-1)});return d.length=0,a.h.g+=m,a.C=0,a.h.g}function cg(a){return a.g?a.v=="GET"&&a.M!=2&&a.j.Aa:!1}function PT(a,d){var m=a.C,x=d.indexOf(`
1554`,m);return x==-1?gh:(m=Number(d.substring(m,x)),isNaN(m)?lg:(x+=1,x+m>d.length?gh:(d=d.slice(x,x+m),a.C=x+m,d)))}fr.prototype.cancel=function(){this.K=!0,fs(this)};function fl(a){a.T=Date.now()+a.H,hg(a,a.H)}function hg(a,d){if(a.D!=null)throw Error("WatchDog timer not null");a.D=po(h(a.aa,a),d)}function vh(a){a.D&&(o.clearTimeout(a.D),a.D=null)}fr.prototype.aa=function(){this.D=null;const a=Date.now();a-this.T>=0?(kT(this.i,this.B),this.M!=2&&(fo(),Tt(17)),fs(this),this.m=2,yo(this)):hg(this,this.T-a)};function yo(a){a.j.I==0||a.K||Lg(a.j,a)}function fs(a){vh(a);var d=a.O;d&&typeof d.dispose=="function"&&d.dispose(),a.O=null,Jm(a.V),a.g&&(d=a.g,a.g=null,d.abort(),d.dispose())}function _h(a,d){try{var m=a.j;if(m.I!=0&&(m.g==a||wh(m.h,a))){if(!a.L&&wh(m.h,a)&&m.I==3){try{var x=m.Ba.g.parse(d)}catch{x=null}if(Array.isArray(x)&&x.length==3){var D=x;if(D[0]==0){e:if(!m.v){if(m.g)if(m.g.F+3e3<a.F)_l(m),yl(m);else break e;Sh(m),Tt(18)}}else m.xa=D[1],0<m.xa-m.K&&D[2]<37500&&m.F&&m.A==0&&!m.C&&(m.C=po(h(m.Va,m),6e3));pg(m.h)<=1&&m.ta&&(m.ta=void 0)}else ms(m,11)}else if((a.L||m.g==a)&&_l(m),!v(d))for(D=m.Ba.g.parse(d),d=0;d<D.length;d++){let Ee=D[d];const nt=Ee[0];if(!(nt<=m.K))if(m.K=nt,Ee=Ee[1],m.I==2)if(Ee[0]=="c"){m.M=Ee[1],m.ba=Ee[2];const bn=Ee[3];bn!=null&&(m.ka=bn,m.j.info("VER="+m.ka));const gs=Ee[4];gs!=null&&(m.za=gs,m.j.info("SVER="+m.za));const yr=Ee[5];yr!=null&&typeof yr=="number"&&yr>0&&(x=1.5*yr,m.O=x,m.j.info("backChannelRequestTimeoutMs_="+x)),x=m;const vr=a.g;if(vr){const xl=vr.g?vr.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(xl){var L=x.h;L.g||xl.indexOf("spdy")==-1&&xl.indexOf("quic")==-1&&xl.indexOf("h2")==-1||(L.j=L.l,L.g=new Set,L.h&&(xh(L,L.h),L.h=null))}if(x.G){const kh=vr.g?vr.g.getResponseHeader("X-HTTP-Session-Id"):null;kh&&(x.wa=kh,Ce(x.J,x.G,kh))}}m.I=3,m.l&&m.l.ra(),m.aa&&(m.T=Date.now()-a.F,m.j.info("Handshake RTT: "+m.T+"ms")),x=m;var K=a;if(x.na=Fg(x,x.L?x.ba:null,x.W),K.L){mg(x.h,K);var ue=K,Je=x.O;Je&&(ue.H=Je),ue.D&&(vh(ue),fl(ue)),x.g=K}else Dg(x);m.i.length>0&&vl(m)}else Ee[0]!="stop"&&Ee[0]!="close"||ms(m,7);else m.I==3&&(Ee[0]=="stop"||Ee[0]=="close"?Ee[0]=="stop"?ms(m,7):bh(m):Ee[0]!="noop"&&m.l&&m.l.qa(Ee),m.A=0)}}fo(4)}catch{}}var jT=class{constructor(a,d){this.g=a,this.map=d}};function dg(a){this.l=a||10,o.PerformanceNavigationTiming?(a=o.performance.getEntriesByType("navigation"),a=a.length>
15540&&(a[0].nextHopProtocol=="hq"||a[0].nextHopProtocol=="h2")):a=!!(o.chrome&&o.chrome.loadTimes&&o.chrome.loadTimes()&&o.chrome.loadTimes().wasFetchedViaSpdy),this.j=a?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function fg(a){return a.h?!0:a.g?a.g.size>=a.j:!1}function pg(a){return a.h?1:a.g?a.g.size:0}function wh(a,d){return a.h?a.h==d:a.g?a.g.has(d):!1}function xh(a,d){a.g?a.g.add(d):a.h=d}function mg(a,d){a.h&&a.h==d?a.h=null:a.g&&a.g.has(d)&&a.g.delete(d)}dg.prototype.cancel=function(){if(this.i=gg(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const a of this.g.values())a.cancel();this.g.clear()}};function gg(a){if(a.h!=null)return a.i.concat(a.h.G);if(a.g!=null&&a.g.size!==0){let d=a.i;for(const m of a.g.values())d=d.concat(m.G);return d}return E(a.i)}var yg=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function DT(a,d){if(a){a=a.split("&");for(let m=0;m<a.length;m++){const x=a[m].indexOf("=");let D,L=null;x>=0?(D=a[m].substring(0,x),L=a[m].substring(x+1)):D=a[m],d(D,L?decodeURIComponent(L.replace(/\+/g," ")):"")}}}function pr(a){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let d;a instanceof pr?(this.l=a.l,vo(this,a.j),this.o=a.o,this.g=a.g,_o(this,a.u),this.h=a.h,Eh(this,Tg(a.i)),this.m=a.m):a&&(d=String(a).match(yg))?(this.l=!1,vo(this,d[1]||"",!0),this.o=wo(d[2]||""),this.g=wo(d[3]||"",!0),_o(this,d[4]),this.h=wo(d[5]||"",!0),Eh(this,d[6]||"",!0),this.m=wo(d[7]||"")):(this.l=!1,this.i=new Eo(null,this.l))}pr.prototype.toString=function(){const a=[];var d=this.j;d&&a.push(xo(d,vg,!0),":");var m=this.g;return(m||d=="file")&&(a.push("//"),(d=this.o)&&a.push(xo(d,vg,!0),"@"),a.push(go(m).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),m=this.u,m!=null&&a.push(":",String(m))),(m=this.h)&&(this.g&&m.charAt(0)!="/"&&a.push("/"),a.push(xo(m,m.charAt(0)=="/"?VT:LT,!0))
1554),(m=this.i.toString())&&a.push("?",m),(m=this.m)&&a.push("#",xo(m,FT)),a.join("")},pr.prototype.resolve=function(a){const d=In(this);let m=!!a.j;m?vo(d,a.j):m=!!a.o,m?d.o=a.o:m=!!a.g,m?d.g=a.g:m=a.u!=null;var x=a.h;if(m)_o(d,a.u);else if(m=!!a.h){if(x.charAt(0)!="/")if(this.g&&!this.h)x="/"+x;else{var D=d.h.lastIndexOf("/");D!=-1&&(x=d.h.slice(0,D+1)+x)}if(D=x,D==".."||D==".")x="";else if(D.indexOf("./")!=-1||D.indexOf("/.")!=-1){x=D.lastIndexOf("/",0)==0,D=D.split("/");const L=[];for(let K=0;K<D.length;){const ue=D[K++];ue=="."?x&&K==D.length&&L.push(""):ue==".."?((L.length>1||L.length==1&&L[0]!="")&&L.pop(),x&&K==D.length&&L.push("")):(L.push(ue),x=!0)}x=L.join("/")}else x=D}return m?d.h=x:m=a.i.toString()!=="",m?Eh(d,Tg(a.i)):m=!!a.m,m&&(d.m=a.m),d};function In(a){return new pr(a)}function vo(a,d,m){a.j=m?wo(d,!0):d,a.j&&(a.j=a.j.replace(/:$/,""))}function _o(a,d){if(d){if(d=Number(d),isNaN(d)||d<0)throw Error("Bad port number "+d);a.u=d}else a.u=null}function Eh(a,d,m){d instanceof Eo?(a.i=d,UT(a.i,a.l)):(m||(d=xo(d,MT)),a.i=new Eo(d,a.l))}function Ce(a,d,m){a.i.set(d,m)}function pl(a){return Ce(a,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),a}function wo(a,d){return a?d?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function xo(a,d,m){return typeof a=="string"?(a=encodeURI(a).replace(d,OT),m&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function OT(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var vg=/[#\/\?@]/g,LT=/[#\?:]/g,VT=/[#\?]/g,MT=/[#\?@]/g,FT=/#/g;function Eo(a,d){this.h=this.g=null,this.i=a||null,this.j=!!d}function ps(a){a.g||(a.g=new Map,a.h=0,a.i&&DT(a.i,function(d,m){a.add(decodeURIComponent(d.replace(/\+/g," ")),m)}))}t=Eo.prototype,t.add=function(a,d){ps(this),this.i=null,a=Ys(this,a);let m=this.g.get(a);return m||this.g.set(a,m=[]),m.push(d),this.h+=1,this};function _g(a,d){ps(a),d=Ys(a,d),a.g.has(d)&&(a.i=null,a.h-=a.g.get(d).length,a.g.delete(d))}function wg(a,d){return ps(a),d=Ys(a,d),a.g.has(d)}t.forEach=function(a,d){ps(this),this.g.forEach(function(m,x){m.forEach(function(D){a.call(d,D,x,this)},this)},this)};function xg(a,d){ps(a);let m=[];if(typeof d=="string")wg(a,d)&&(m=m.concat(a.g.get(Ys(a,d))));else for(a=Array.from(a.g.values()),d=0;d<a.length;d++)m=m.concat(a[d]);return m}t.set=function(a,d){return ps(this),this.i=null,a=Ys(this,a),wg(this,a)&&(this.h-=this.g.get(a).length),this.g.set(a,[d]),this.h+=1,this},t.get=function(a,d){return a?(a=xg(this,a),a.length>0?String(a[0]):d):d};function Eg(a,d,m){_g(a,d),m.length>0&&(a.i=null,a.g.set(Ys(a,d),E(m)),a.h+=m.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const a=[],d=Array.from(this.g.keys());for(let x=0;x<d.length;x++){var m=d[x];const D=go(m);m=xg(this,m);for(let L=0;L<m.length;L++){let K=D;m[L]!==""&&(K+="="+go(m[L])),a.push(K)}}return this.i=a.join("&")};function Tg(a){const d=new Eo;return d.i=a.i,a.g&&(d.g=new Map(a.g),d.h=a.h),d}function Ys(a,d){return d=String(d),a.j&&(d=d.toLowerCase()),d}function UT(a,d){d&&!a.j&&(ps(a),a.i=null,a.g.forEach(function(m,x){const D=x.toLowerCase();x!=D&&(_g(this,x),Eg(this,D,m))},a)),a.j=d}function $T(a,d){const m=new mo;if(o.Image){const x=new Image;x.onload=f(mr,m,"TestLoadImage: loaded",!0,d,x),x.onerror=f(mr,m,"TestLoadImage: error",!1,d,x),x.onabort=f(mr,m,"TestLoadImage: abort",!1,d,x),x.ontimeout=f(mr,m,"TestLoadImage: timeout",!1,d,x),o.setTimeout(function(){x.ontimeout&&x.ontimeout()},1e4),x.src=a}else d(!1)}function BT(a,d){const m=new mo,x=new AbortController,D=setTimeout(()=>{x.abort(),mr(m,"TestPingServer: timeout",!1,d)},1e4);fetch(a,{signal:x.signal}).then(L=>{clearTimeout(D),L.ok?mr(m,"TestPingServer: ok",!0,d):mr(m,"TestPingServer: server error",!1,d)}).catch(()=>{clearTimeout(D),mr(m,"TestPingServer: error",!1,d)})}function mr(a,d,m,x,D){try{D&&(D.onload=null,D.onerror=null,D.onabort=null,D.ontimeout=null),x(m)}catch{}}function zT(){this.g=new bT}function Th(a){this.i=a.Sb||null,this.h=a.ab||!1}p(Th,Zm),Th.prototype.g=function(){return new ml(this.i,this.h)};function ml(a,d){ee.call(this),this.H=a,this.o=d,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}p(ml,ee),t=ml.prototype,t.open=function(a,d){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=a,this.D=d,this.readyState=1,Io(this)}
vendor: 4,912 bytes, lines 1554-1556
1554,t.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const d={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};a&&(d.body=a),(this.H||o).fetch(new Request(this.D,d)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&this.readyState!=4&&(this.g=!1,To(this)),this.readyState=0},t.Pa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,Io(this)),this.g&&(this.readyState=3,Io(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof o.ReadableStream<"u"&&"body"in a){if(this.j=a.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.B=new TextDecoder;Ig(this)}else a.text().then(this.Oa.bind(this),this.ga.bind(this))};function Ig(a){a.j.read().then(a.Ma.bind(a)).catch(a.ga.bind(a))}t.Ma=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var d=a.value?a.value:new Uint8Array(0);(d=this.B.decode(d,{stream:!a.done}))&&(this.response=this.responseText+=d)}a.done?To(this):Io(this),this.readyState==3&&Ig(this)}},t.Oa=function(a){this.g&&(this.response=this.responseText=a,To(this))},t.Na=function(a){this.g&&(this.response=a,To(this))},t.ga=function(){this.g&&To(this)};function To(a){a.readyState=4,a.l=null,a.j=null,a.B=null,Io(a)}t.setRequestHeader=function(a,d){this.A.append(a,d)},t.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const a=[],d=this.h.entries();for(var m=d.next();!m.done;)m=m.value,a.push(m[0]+": "+m[1]),m=d.next();return a.join(`\r
1555`)};function Io(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(ml.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function bg(a){let d="";return B(a,function(m,x){d+=x,d+=":",d+=m,d+=`\r
1556`}),d}function Ih(a,d,m){e:{for(x in m){var x=!1;break e}x=!0}x||(m=bg(m),typeof a=="string"?m!=null&&go(m):Ce(a,d,m))}function Fe(a){ee.call(this),this.headers=new Map,this.L=a||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}p(Fe,ee);var HT=/^https?$/i,WT=["POST","PUT"];t=Fe.prototype,t.Fa=function(a){this.H=a},t.ea=function(a,d,m,x){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);d=d?d.toUpperCase():"GET",this.D=a,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():og.g(),this.g.onreadystatechange=g(h(this.Ca,this));try{this.B=!0,this.g.open(d,String(a),!0),this.B=!1}catch(L){Sg(this,L);return}if(a=m||"",m=new Map(this.headers),x)if(Object.getPrototypeOf(x)===Object.prototype)for(var D in x)m.set(D,x[D]);else if(typeof x.keys=="function"&&typeof x.get=="function")for(const L of x.keys())m.set(L,x.get(L));else throw Error("Unknown input type for opt_headers: "+String(x));x=Array.from(m.keys()).find(L=>L.toLowerCase()=="content-type"),D=o.FormData&&a instanceof o.FormData,!(Array.prototype.indexOf.call(WT,d,void 0)>=0)||x||D||m.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[L,K]of m)this.g.setRequestHeader(L,K);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(a),this.v=!1}catch(L){Sg(this,L)}};function Sg(a,d){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=d,a.o=5,Cg(a),gl(a)}function Cg(a){a.A||(a.A=!0,he(a,"complete"),he(a,"error"))}t.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=a||7,he(this,"complete"),he(this,"abort"),gl(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),gl(this,!0)),Fe.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?kg(this):this.Xa())},t.Xa=function(){kg(this)};function kg(a){if(a.h&&typeof i<"u"){if(a.v&&gr(a)==4)setTimeout(a.Ca.bind(a),0);else if(he(a,"readystatechange"),gr(a)==4){a.h=!1;try{const L=a.ca();e:switch(L){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var d=!0;break e;default:d=!1}var m;if(!(m=d)){var x;if(x=L===0){let K=String(a.D).match(yg)[1]||null;!K&&o.self&&o.self.location&&(K=o.self.location.protocol.slice(0,-1)),x=!HT.test(K?K.toLowerCase():"")}m=x}if(m)he(a,"complete"),he(a,"success");else{a.o=6;
vendor: 5,366 bytes, lines 1556-1557
1556try{var D=gr(a)>2?a.g.statusText:""}catch{D=""}a.l=D+" ["+a.ca()+"]",Cg(a)}}finally{gl(a)}}}}function gl(a,d){if(a.g){a.m&&(clearTimeout(a.m),a.m=null);const m=a.g;a.g=null,d||he(a,"ready");try{m.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function gr(a){return a.g?a.g.readyState:0}t.ca=function(){try{return gr(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(a){if(this.g){var d=this.g.responseText;return a&&d.indexOf(a)==0&&(d=d.substring(a.length)),IT(d)}};function Ng(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.F){case"":case"text":return a.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch{return null}}function qT(a){const d={};a=(a.g&&gr(a)>=2&&a.g.getAllResponseHeaders()||"").split(`\r
1557`);for(let x=0;x<a.length;x++){if(v(a[x]))continue;var m=RT(a[x]);const D=m[0];if(m=m[1],typeof m!="string")continue;m=m.trim();const L=d[D]||[];d[D]=L,L.push(m)}W(d,function(x){return x.join(", ")})}t.ya=function(){return this.o},t.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function bo(a,d,m){return m&&m.internalChannelParams&&m.internalChannelParams[a]||d}function Rg(a){this.za=0,this.i=[],this.j=new mo,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=bo("failFast",!1,a),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=bo("baseRetryDelayMs",5e3,a),this.Za=bo("retryDelaySeedMs",1e4,a),this.Ta=bo("forwardChannelMaxRetries",2,a),this.va=bo("forwardChannelRequestTimeoutMs",2e4,a),this.ma=a&&a.xmlHttpFactory||void 0,this.Ua=a&&a.Rb||void 0,this.Aa=a&&a.useFetchStreams||!1,this.O=void 0,this.L=a&&a.supportsCrossDomainXhr||!1,this.M="",this.h=new dg(a&&a.concurrentRequestLimit),this.Ba=new zT,this.S=a&&a.fastHandshake||!1,this.R=a&&a.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=a&&a.Pb||!1,a&&a.ua&&this.j.ua(),a&&a.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&a&&a.detectBufferingProxy||!1,this.ia=void 0,a&&a.longPollingTimeout&&a.longPollingTimeout>0&&(this.ia=a.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=Rg.prototype,t.ka=8,t.I=1,t.connect=function(a,d,m,x){Tt(0),this.W=a,this.H=d||{},m&&x!==void 0&&(this.H.OSID=m,this.H.OAID=x),this.F=this.X,this.J=Fg(this,null,this.W),vl(this)};function bh(a){if(Ag(a),a.I==3){var d=a.V++,m=In(a.J);if(Ce(m,"SID",a.M),Ce(m,"RID",d),Ce(m,"TYPE","terminate"),So(a,m),d=new fr(a,a.j,d),d.M=2,d.A=pl(In(m)),m=!1,o.navigator&&o.navigator.sendBeacon)try{m=o.navigator.sendBeacon(d.A.toString(),"")}catch{}!m&&o.Image&&(new Image().src=d.A,m=!0),m||(d.g=Ug(d.j,null),d.g.ea(d.A)),d.F=Date.now(),fl(d)}Mg(a)}function yl(a){a.g&&(Ch(a),a.g.cancel(),a.g=null)}function Ag(a){yl(a),a.v&&(o.clearTimeout(a.v),a.v=null),_l(a),a.h.cancel(),a.m&&(typeof a.m=="number"&&o.clearTimeout(a.m),a.m=null)}function vl(a){if(!fg(a.h)&&!a.m){a.m=!0;var d=a.Ea;V||y(),M||(V(),M=!0),T.add(d,a),a.D=0}}function GT(a,d){return pg(a.h)>=a.h.j-(a.m?1:0)?!1:a.m?(a.i=d.G.concat(a.i),!0):a.I==1||a.I==2||a.D>=(a.Sa?0:a.Ta)?!1:(a.m=po(h(a.Ea,a,d),Vg(a,a.D)),a.D++,!0)}t.Ea=function(a){if(this.m)if(this.m=null,this.I==1){if(!a){this.V=Math.floor(Math.random()*1e5),a=this.V++;const D=new fr(this,this.j,a);let L=this.o;if(this.U&&(L?(L=Y(L),be(L,this.U)):L=this.U),this.u!==null||this.R||(D.J=L,L=null),this.S)e:{for(var d=0,m=0;m<this.i.length;m++){t:{var x=this.i[m];if("__data__"in x.map&&(x=x.map.__data__,typeof x=="string")){x=x.length;break t}x=void 0}if(x===void 0)break;if(d+=x,d>4096){d=m;break e}if(d===4096||m===this.i.length-1){d=m+1;break e}}d=1e3}else d=1e3;d=jg(this,D,d),m=In(this.J),Ce(m,"RID",a),Ce(m,"CVER",22),this.G&&Ce(m,"X-HTTP-Session-Id",this.G),So(this,m),L&&(this.R?d="headers="+go(bg(L))+"&"+d:this.u&&Ih(m,this.u,L)),xh(this.h,D),this.Ra&&Ce(m,"TYPE","init"),this.S?(Ce(m,"$req",d),Ce(m,"SID","null"),D.U=!0,yh(D,m,null)):yh(D,m,d),this.I=2}}else this.I==3&&(a?Pg(this,a):this.i.length==0||fg(this.h)||Pg(this))};function Pg(a,d){var m;d?m=d.l:m=a.V++;const x=In(a.J);Ce(x,"SID",a.M),Ce(x,"RID",m),Ce(x,"AID",a.K),So(a,x),a.u&&a.o&&Ih(x,a.u,a.o),m=new fr(a,a.j,m,a.D+1),a.u===null&&(m.J=a.o),d&&(a.i=d.G.concat(a.i)),d=jg(a,m,1e3),m.H=Math.round(a.va*.5)+Math.round(a.va*.5*Math.random()),xh(a.h,m),yh(m,x,d)}function So(a,d){a.H&&B(a.H,function(m,x){Ce(d,x,m)}),a.l&&B({},function(m,x){Ce(d,x,m)})}function jg(a,d,m){m=Math.min(a.i.length,m);const x=a.l?h(a.l.Ka,a.l,a):null;e:{var D=a.i;let ue=-1;for(;;){const Je=["count="+m];ue==-1?m>0?(ue=D[0].g,Je.push("ofs="+ue)):ue=0:Je.push("ofs="+ue);let Ee=!0;for(let nt=0;nt<m;nt++){var L=D[nt].g;const bn=D[nt].map;if(L-=ue,L<0)ue=Math.max(0,D[nt].g-100),Ee=!1;else try{L="req"+L+"_"||"";try{var K=bn instanceof Map?bn:Object.entries(bn);for(const[gs,yr]of K){let vr=yr;l(yr)&&(vr=dh(yr)),Je.push(L+gs+"="+encodeURIComponent(vr))}}catch(gs){throw Je.push(L+"type="+encodeURIComponent("_badmap")),gs}}catch{x&&x(bn)}}if(Ee){K=Je.join("&");break e}}K=void 0}return a=a.i.splice(0,m),d.G=a,K}function Dg(a){if(!a.g&&!a.v){a.Y=1;var d=a.Da;V||y(),M||(V(),M=!0),T.add(d,a),a.A=0}}function Sh(a){return a.g||a.v||a.A>=3?!1:(a.Y++,a.v=po(h(a.Da,a),Vg(a,a.A)),a.A++,!0)}
vendor: 5,497 bytes, lines 1557-1561
1557t.Da=function(){if(this.v=null,Og(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var a=4*this.T;this.j.info("BP detection timer enabled: "+a),this.B=po(h(this.Wa,this),a)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,Tt(10),yl(this),Og(this))};function Ch(a){a.B!=null&&(o.clearTimeout(a.B),a.B=null)}function Og(a){a.g=new fr(a,a.j,"rpc",a.Y),a.u===null&&(a.g.J=a.o),a.g.P=0;var d=In(a.na);Ce(d,"RID","rpc"),Ce(d,"SID",a.M),Ce(d,"AID",a.K),Ce(d,"CI",a.F?"0":"1"),!a.F&&a.ia&&Ce(d,"TO",a.ia),Ce(d,"TYPE","xmlhttp"),So(a,d),a.u&&a.o&&Ih(d,a.u,a.o),a.O&&(a.g.H=a.O);var m=a.g;a=a.ba,m.M=1,m.A=pl(In(d)),m.u=null,m.R=!0,ug(m,a)}t.Va=function(){this.C!=null&&(this.C=null,yl(this),Sh(this),Tt(19))};function _l(a){a.C!=null&&(o.clearTimeout(a.C),a.C=null)}function Lg(a,d){var m=null;if(a.g==d){_l(a),Ch(a),a.g=null;var x=2}else if(wh(a.h,d))m=d.G,mg(a.h,d),x=1;else return;if(a.I!=0){if(d.o)if(x==1){m=d.u?d.u.length:0,d=Date.now()-d.F;var D=a.D;x=hl(),he(x,new sg(x,m)),vl(a)}else Dg(a);else if(D=d.m,D==3||D==0&&d.X>0||!(x==1&&GT(a,d)||x==2&&Sh(a)))switch(m&&m.length>0&&(d=a.h,d.i=d.i.concat(m)),D){case 1:ms(a,5);break;case 4:ms(a,10);break;case 3:ms(a,6);break;default:ms(a,2)}}}function Vg(a,d){let m=a.Qa+Math.floor(Math.random()*a.Za);return a.isActive()||(m*=2),m*d}function ms(a,d){if(a.j.info("Error code "+d),d==2){var m=h(a.bb,a),x=a.Ua;const D=!x;x=new pr(x||"//www.google.com/images/cleardot.gif"),o.location&&o.location.protocol=="http"||vo(x,"https"),pl(x),D?$T(x.toString(),m):BT(x.toString(),m)}else Tt(2);a.I=0,a.l&&a.l.pa(d),Mg(a),Ag(a)}t.bb=function(a){a?(this.j.info("Successfully pinged google.com"),Tt(2)):(this.j.info("Failed to ping google.com"),Tt(1))};function Mg(a){if(a.I=0,a.ja=[],a.l){const d=gg(a.h);(d.length!=0||a.i.length!=0)&&(N(a.ja,d),N(a.ja,a.i),a.h.i.length=0,E(a.i),a.i.length=0),a.l.oa()}}function Fg(a,d,m){var x=m instanceof pr?In(m):new pr(m);if(x.g!="")d&&(x.g=d+"."+x.g),_o(x,x.u);else{var D=o.location;x=D.protocol,d=d?d+"."+D.hostname:D.hostname,D=+D.port;const L=new pr(null);x&&vo(L,x),d&&(L.g=d),D&&_o(L,D),m&&(L.h=m),x=L}return m=a.G,d=a.wa,m&&d&&Ce(x,m,d),Ce(x,"VER",a.ka),So(a,x),x}function Ug(a,d,m){if(d&&!a.L)throw Error("Can't create secondary domain capable XhrIo object.");return d=a.Aa&&!a.ma?new Fe(new Th({ab:m})):new Fe(a.ma),d.Fa(a.L),d}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function $g(){}t=$g.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function wl(){}wl.prototype.g=function(a,d){return new Mt(a,d)};function Mt(a,d){ee.call(this),this.g=new Rg(d),this.l=a,this.h=d&&d.messageUrlParams||null,a=d&&d.messageHeaders||null,d&&d.clientProtocolHeaderRequired&&(a?a["X-Client-Protocol"]="webchannel":a={"X-Client-Protocol":"webchannel"}),this.g.o=a,a=d&&d.initMessageHeaders||null,d&&d.messageContentType&&(a?a["X-WebChannel-Content-Type"]=d.messageContentType:a={"X-WebChannel-Content-Type":d.messageContentType}),d&&d.sa&&(a?a["X-WebChannel-Client-Profile"]=d.sa:a={"X-WebChannel-Client-Profile":d.sa}),this.g.U=a,(a=d&&d.Qb)&&!v(a)&&(this.g.u=a),this.A=d&&d.supportsCrossDomainXhr||!1,this.v=d&&d.sendRawJson||!1,(d=d&&d.httpSessionIdParam)&&!v(d)&&(this.g.G=d,a=this.h,a!==null&&d in a&&(a=this.h,d in a&&delete a[d])),this.j=new Xs(this)}p(Mt,ee),Mt.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},Mt.prototype.close=function(){bh(this.g)},Mt.prototype.o=function(a){var d=this.g;if(typeof a=="string"){var m={};m.__data__=a,a=m}else this.v&&(m={},m.__data__=dh(a),a=m);d.i.push(new jT(d.Ya++,a)),d.I==3&&vl(d)},Mt.prototype.N=function(){this.g.l=null,delete this.j,bh(this.g),delete this.g,Mt.Z.N.call(this)};function Bg(a){fh.call(this),a.__headers__&&(this.headers=a.__headers__,this.statusCode=a.__status__,delete a.__headers__,delete a.__status__);var d=a.__sm__;if(d){e:{for(const m in d){a=m;break e}a=void 0}(this.i=a)&&(a=this.i,d=d!==null&&a in d?d[a]:void 0),this.data=d}else this.data=a}p(Bg,fh);function zg(){ph.call(this),this.status=1}p(zg,ph);function Xs(a){this.g=a}p(Xs,$g),Xs.prototype.ra=function(){he(this.g,"a")},Xs.prototype.qa=function(a){he(this.g,new Bg(a))},Xs.prototype.pa=function(a){he(this.g,new zg)},Xs.prototype.oa=function(){he(this.g,"b")},wl.prototype.createWebChannel=wl.prototype.g,Mt.prototype.send=Mt.prototype.o,Mt.prototype.open=Mt.prototype.m,Mt.prototype.close=Mt.prototype.close,S1=function(){return new wl},b1=function(){return hl()},I1=ds,If={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},dl.NO_ERROR=0,dl.TIMEOUT=8,dl.HTTP_ERROR=6,mu=dl,ig.COMPLETE="complete",T1=ig,eg.EventType=ho,ho.OPEN="a",ho.CLOSE="b",ho.ERROR="c",ho.MESSAGE="d",ee.prototype.listen=ee.prototype.J,Ho=eg,Fe.prototype.listenOnce=Fe.prototype.K,Fe.prototype.getLastError=Fe.prototype.Ha,Fe.prototype.getLastErrorCode=Fe.prototype.ya,Fe.prototype.getStatus=Fe.prototype.ca,Fe.prototype.getResponseJson=Fe.prototype.La,Fe.prototype.getResponseText=Fe.prototype.la,Fe.prototype.send=Fe.prototype.ea,Fe.prototype.setWithCredentials=Fe.prototype.Fa,E1=Fe}).apply(typeof $l<"u"?$l:typeof self<"u"?self:typeof window<"u"?window:{});/**
1558 * @license
1559 * Copyright 2017 Google LLC
1560 *
1561 * Licensed under the Apache License, Version 2.0 (the "License");
1562 * you may not use this file except in compliance with the License.
1563 * You may obtain a copy of the License at
1564 *
1565 *   http://www.apache.org/licenses/LICENSE-2.0
1566 *
1567 * Unless required by applicable law or agreed to in writing, software
1568 * distributed under the License is distributed on an "AS IS" BASIS,
1569 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1570 * See the License for the specific language governing permissions and
1571 * limitations under the License.
1572 */class gt{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}}gt.UNAUTHENTICATED=new gt(null),gt.GOOGLE_CREDENTIALS=new gt("google-credentials-uid"),gt.FIRST_PARTY=new gt("first-party-uid"),gt.MOCK_USER=new gt("mock-user");/**
1573 * @license
1574 * Copyright 2017 Google LLC
1575 *
1576 * Licensed under the Apache License, Version 2.0 (the "License");
1577 * you may not use this file except in compliance with the License.
1578 * You may obtain a copy of the License at
1579 *
1580 *   http://www.apache.org/licenses/LICENSE-2.0
1581 *
1582 * Unless required by applicable law or agreed to in writing, software
1583 * distributed under the License is distributed on an "AS IS" BASIS,
1584 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1585 * See the License for the specific language governing permissions and
1586 * limitations under the License.
1587 */let to="12.10.0";function GR(t){to=t}/**
1588 * @license
1589 * Copyright 2020 Google LLC
1590 *
1591 * Licensed under the Apache License, Version 2.0 (the "License");
1592 * you may not use this file except in compliance with the License.
1593 * You may obtain a copy of the License at
1594 *
1595 *   http://www.apache.org/licenses/LICENSE-2.0
1596 *
1597 * Unless required by applicable law or agreed to in writing, software
1598 * distributed under the License is distributed on an "AS IS" BASIS,
1599 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1600 * See the License for the specific language governing permissions and
1601 * limitations under the License.
1602 *//**
1603 * @license
1604 * Copyright 2017 Google LLC
1605 *
1606 * Licensed under the Apache License, Version 2.0 (the "License");
1607 * you may not use this file except in compliance with the License.
1608 * You may obtain a copy of the License at
1609 *
1610 *   http://www.apache.org/licenses/LICENSE-2.0
1611 *
1612 * Unless required by applicable law or agreed to in writing, software
1613 * distributed under the License is distributed on an "AS IS" BASIS,
1614 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1615 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1617 */const Ms=new Wp("@firebase/firestore");function ei(){return Ms.logLevel}function J(t,...e){if(Ms.logLevel<=pe.DEBUG){const n=e.map(nm);Ms.debug(`Firestore (${to}): ${t}`,...n)}}function lr(t,...e){if(Ms.logLevel<=pe.ERROR){const n=e.map(nm);Ms.error(`Firestore (${to}): ${t}`,...n)}}function Fs(t,...e){if(Ms.logLevel<=pe.WARN){const n=e.map(nm);Ms.warn(`Firestore (${to}): ${t}`,...n)}}function nm(t){if(typeof t=="string")return t;try{return function(n){return JSON.stringify(n)}(t)}catch{return t}}/**
1618 * @license
1619 * Copyright 2017 Google LLC
1620 *
1621 * Licensed under the Apache License, Version 2.0 (the "License");
1622 * you may not use this file except in compliance with the License.
1623 * You may obtain a copy of the License at
1624 *
1625 *   http://www.apache.org/licenses/LICENSE-2.0
1626 *
1627 * Unless required by applicable law or agreed to in writing, software
1628 * distributed under the License is distributed on an "AS IS" BASIS,
1629 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1630 * See the License for the specific language governing permissions and
1631 * limitations under the License.
1632 */function re(t,e,n){let r="Unexpected state";typeof e=="string"?r=e:n=e,C1(t,r,n)}function C1(t,e,n){let r=`FIRESTORE (${to}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{r+=" CONTEXT: "+JSON.stringify(n)}catch{r+=" CONTEXT: "+n}throw lr(r),new Error(r)}function _e(t,e,n,r){let s="Unexpected state";
1632typeof n=="string"?s=n:r=n,t||C1(e,s,r)}function ae(t,e){return t}/**
1633 * @license
1634 * Copyright 2017 Google LLC
1635 *
1636 * Licensed under the Apache License, Version 2.0 (the "License");
1637 * you may not use this file except in compliance with the License.
1638 * You may obtain a copy of the License at
1639 *
1640 *   http://www.apache.org/licenses/LICENSE-2.0
1641 *
1642 * Unless required by applicable law or agreed to in writing, software
1643 * distributed under the License is distributed on an "AS IS" BASIS,
1644 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1645 * See the License for the specific language governing permissions and
1646 * limitations under the License.
1647 */const $={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 X extends zn{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
1648 * @license
1649 * Copyright 2017 Google LLC
1650 *
1651 * Licensed under the Apache License, Version 2.0 (the "License");
1652 * you may not use this file except in compliance with the License.
1653 * You may obtain a copy of the License at
1654 *
1655 *   http://www.apache.org/licenses/LICENSE-2.0
1656 *
1657 * Unless required by applicable law or agreed to in writing, software
1658 * distributed under the License is distributed on an "AS IS" BASIS,
1659 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1660 * See the License for the specific language governing permissions and
1661 * limitations under the License.
1662 */class Xn{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
1663 * @license
1664 * Copyright 2017 Google LLC
1665 *
1666 * Licensed under the Apache License, Version 2.0 (the "License");
1667 * you may not use this file except in compliance with the License.
1668 * You may obtain a copy of the License at
1669 *
1670 *   http://www.apache.org/licenses/LICENSE-2.0
1671 *
1672 * Unless required by applicable law or agreed to in writing, software
1673 * distributed under the License is distributed on an "AS IS" BASIS,
1674 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1675 * See the License for the specific language governing permissions and
1676 * limitations under the License.
1677 */class k1{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class KR{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(gt.UNAUTHENTICATED))}shutdown(){}}class QR{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 YR{constructor(e){this.t=e,this.currentUser=gt.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){_e(this.o===void 0,42304);let r=this.i;const s=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let i=new Xn;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new Xn,e.enqueueRetryable(()=>s(this.currentUser))};const o=()=>{const u=i;e.enqueueRetryable(async()=>{await u.promise,await s(this.currentUser)})},l=u=>{J("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>l(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?l(u):(J("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new Xn)}},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?(J("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(_e(typeof r.accessToken=="string",31837,{l:r}),new k1(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return _e(e===null||typeof e=="string",2055,{h:e}),new gt(e)}}class XR{constructor(e,n,r){this.P=e,this.T=n,this.I=r,this.type="FirstParty",this.user=gt.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);const e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class JR{constructor(e,n,r){this.P=e,this.T=n,this.I=r}getToken(){return Promise.resolve(new XR(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable(()=>n(gt.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class F0{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 ZR{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,Xt(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){_e(this.o===void 0,3512);const r=i=>{i.error!=null&&J("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${i.error.message}`);const o=i.token!==this.m;return this.m=i.token,J("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(i.token):Promise.resolve()};this.o=i=>{e.enqueueRetryable(()=>r(i))};const s=i=>{J("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=i,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(i=>s(i)),setTimeout(()=>{if(!this.appCheck){const i=this.V.getImmediate({optional:!0});i?s(i):J("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new F0(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(_e(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new F0(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
1678 * @license
1679 * Copyright 2020 Google LLC
1680 *
1681 * Licensed under the Apache License, Version 2.0 (the "License");
1682 * you may not use this file except in compliance with the License.
1683 * You may obtain a copy of the License at
1684 *
1685 *   http://www.apache.org/licenses/LICENSE-2.0
1686 *
1687 * Unless required by applicable law or agreed to in writing, software
1688 * distributed under the License is distributed on an "AS IS" BASIS,
1689 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1690 * See the License for the specific language governing permissions and
1691 * limitations under the License.
1692 */function eA(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}/**
1693 * @license
1694 * Copyright 2017 Google LLC
1695 *
1696 * Licensed under the Apache License, Version 2.0 (the "License");
1697 * you may not use this file except in compliance with the License.
1698 * You may obtain a copy of the License at
1699 *
1700 *   http://www.apache.org/licenses/LICENSE-2.0
1701 *
1702 * Unless required by applicable law or agreed to in writing, software
1703 * distributed under the License is distributed on an "AS IS" BASIS,
1704 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1705 * See the License for the specific language governing permissions and
1706 * limitations under the License.
1707 */class rm{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516);let r="";for(;r.length<20;){const s=eA(40);for(let i=0;i<s.length;++i)r.length<20&&s[i]<n&&(r+=e.charAt(s[i]%62))}return r}}function me(t,e){return t<e?-1:t>e?1:0}function bf(t,e){const n=Math.min(t.length,e.length);for(let r=0;r<n;r++){const s=t.charAt(r),i=e.charAt(r);if(s!==i)return hd(s)===hd(i)?me(s,i):hd(s)?1:-1}return me(t.length,e.length)}const tA=55296,nA=57343;function hd(t){const e=t.charCodeAt(0);return e>=tA&&e<=nA}function Li(t,e,n){return t.length===e.length&&t.every((r,s)=>n(r,e[s]))}/**
1708 * @license
1709 * Copyright 2017 Google LLC
1710 *
1711 * Licensed under the Apache License, Version 2.0 (the "License");
1712 * you may not use this file except in compliance with the License.
1713 * You may obtain a copy of the License at
1714 *
1715 *   http://www.apache.org/licenses/LICENSE-2.0
1716 *
1717 * Unless required by applicable law or agreed to in writing, software
1718 * distributed under the License is distributed on an "AS IS" BASIS,
1719 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1720 * See the License for the specific language governing permissions and
1721 * limitations under the License.
1722 */const U0="__name__";class kn{constructor(e,n,r){n===void 0?n=0:n>e.length&&re(637,{offset:n,range:e.length}),r===void 0?r=e.length-n:r>e.length-n&&re(1746,{length:r,range:e.length-n}),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return kn.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof kn?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 s=0;s<r;s++){const i=kn.compareSegments(e.get(s),n.get(s));if(i!==0)return i}return me(e.length,n.length)}static compareSegments(e,n){const r=kn.isNumericId(e),s=kn.isNumericId(n);return r&&!s?-1:!r&&s?1:r&&s?kn.extractNumericId(e).compare(kn.extractNumericId(n)):bf(e,n)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Hr.fromString(e.substring(4,e.length-2))}}class Te extends kn{construct(e,n,r){return new Te(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}
vendor: 5,011 bytes, lines 1722-1756
1722toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new X($.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(s=>s.length>0))}return new Te(n)}static emptyPath(){return new Te([])}}const rA=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class ut extends kn{construct(e,n,r){return new ut(e,n,r)}static isValidIdentifier(e){return rA.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),ut.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===U0}static keyField(){return new ut([U0])}static fromServerFormat(e){const n=[];let r="",s=0;const i=()=>{if(r.length===0)throw new X($.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(;s<e.length;){const l=e[s];if(l==="\\"){if(s+1===e.length)throw new X($.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const u=e[s+1];if(u!=="\\"&&u!=="."&&u!=="`")throw new X($.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=u,s+=2}else l==="`"?(o=!o,s++):l!=="."||o?(r+=l,s++):(i(),s++)}if(i(),o)throw new X($.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new ut(n)}static emptyPath(){return new ut([])}}/**
1723 * @license
1724 * Copyright 2017 Google LLC
1725 *
1726 * Licensed under the Apache License, Version 2.0 (the "License");
1727 * you may not use this file except in compliance with the License.
1728 * You may obtain a copy of the License at
1729 *
1730 *   http://www.apache.org/licenses/LICENSE-2.0
1731 *
1732 * Unless required by applicable law or agreed to in writing, software
1733 * distributed under the License is distributed on an "AS IS" BASIS,
1734 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1735 * See the License for the specific language governing permissions and
1736 * limitations under the License.
1737 */class te{constructor(e){this.path=e}static fromPath(e){return new te(Te.fromString(e))}static fromName(e){return new te(Te.fromString(e).popFirst(5))}static empty(){return new te(Te.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&&Te.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Te.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new te(new Te(e.slice()))}}/**
1738 * @license
1739 * Copyright 2017 Google LLC
1740 *
1741 * Licensed under the Apache License, Version 2.0 (the "License");
1742 * you may not use this file except in compliance with the License.
1743 * You may obtain a copy of the License at
1744 *
1745 *   http://www.apache.org/licenses/LICENSE-2.0
1746 *
1747 * Unless required by applicable law or agreed to in writing, software
1748 * distributed under the License is distributed on an "AS IS" BASIS,
1749 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1750 * See the License for the specific language governing permissions and
1751 * limitations under the License.
1752 */function N1(t,e,n){if(!n)throw new X($.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function sA(t,e,n,r){if(e===!0&&r===!0)throw new X($.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function $0(t){if(!te.isDocumentKey(t))throw new X($.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function B0(t){if(te.isDocumentKey(t))throw new X($.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function R1(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function Bc(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":re(12329,{type:typeof t})}function Lt(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new X($.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Bc(t);throw new X($.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/**
1753 * @license
1754 * Copyright 2025 Google LLC
1755 *
1756 * Licensed under the Apache License, Version 2.0 (the "License");
1757 * you may not use this file except in compliance with the License.
1758 * You may obtain a copy of the License at
1759 *
1760 *   http://www.apache.org/licenses/LICENSE-2.0
1761 *
1762 * Unless required by applicable law or agreed to in writing, software
1763 * distributed under the License is distributed on an "AS IS" BASIS,
1764 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1765 * See the License for the specific language governing permissions and
1766 * limitations under the License.
1767 */function Xe(t,e){const n={typeString:t};return e&&(n.value=e),n}function Ja(t,e){if(!R1(t))throw new X($.INVALID_ARGUMENT,"JSON must be an object");let n;for(const r in e)if(e[r]){const s=e[r].typeString,i="value"in e[r]?{value:e[r].value}:void 0;if(!(r in t)){n=`JSON missing required field: '${r}'`;break}const o=t[r];if(s&&typeof o!==s){n=`JSON field '${r}' must be a ${s}.`;break}if(i!==void 0&&o!==i.value){n=`Expected '${r}' field to equal '${i.value}'`;break}}if(n)throw new X($.INVALID_ARGUMENT,n);return!0}/**
1768 * @license
1769 * Copyright 2017 Google LLC
1770 *
1771 * Licensed under the Apache License, Version 2.0 (the "License");
1772 * you may not use this file except in compliance with the License.
1773 * You may obtain a copy of the License at
1774 *
1775 *   http://www.apache.org/licenses/LICENSE-2.0
1776 *
1777 * Unless required by applicable law or agreed to in writing, software
1778 * distributed under the License is distributed on an "AS IS" BASIS,
1779 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1780 * See the License for the specific language governing permissions and
1781 * limitations under the License.
1782 */const z0=-62135596800,H0=1e6;class Ne{static now(){return Ne.fromMillis(Date.now())}static fromDate(e){return Ne.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor((e-1e3*n)*H0);return new Ne(n,r)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new X($.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new X($.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<z0)throw new X($.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new X($.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/H0}_compareTo(e){return this.seconds===e.seconds?me(this.nanoseconds,e.nanoseconds):me(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{type:Ne._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(Ja(e,Ne._jsonSchema))return new Ne(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-z0;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ne._jsonSchemaVersion="firestore/timestamp/1.0",Ne._jsonSchema={type:Xe("string",Ne._jsonSchemaVersion),seconds:Xe("number"),nanoseconds:Xe("number")};/**
1783 * @license
1784 * Copyright 2017 Google LLC
1785 *
1786 * Licensed under the Apache License, Version 2.0 (the "License");
1787 * you may not use this file except in compliance with the License.
1788 * You may obtain a copy of the License at
1789 *
1790 *   http://www.apache.org/licenses/LICENSE-2.0
1791 *
1792 * Unless required by applicable law or agreed to in writing, software
1793 * distributed under the License is distributed on an "AS IS" BASIS,
1794 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1795 * See the License for the specific language governing permissions and
1796 * limitations under the License.
1797 */class ie{static fromTimestamp(e){return new ie(e)}static min(){return new ie(new Ne(0,0))}static max(){return new ie(new Ne(253402300799,999999999))}constructor(e){this.timestamp=e}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}}/**
1798 * @license
1799 * Copyright 2021 Google LLC
1800 *
1801 * Licensed under the Apache License, Version 2.0 (the "License");
1802 * you may not use this file except in compliance with the License.
1803 * You may obtain a copy of the License at
1804 *
1805 *   http://www.apache.org/licenses/LICENSE-2.0
1806 *
1807 * Unless required by applicable law or agreed to in writing, software
1808 * distributed under the License is distributed on an "AS IS" BASIS,
1809 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1810 * See the License for the specific language governing permissions and
1811 * limitations under the License.
1812 */const Pa=-1;function iA(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,s=ie.fromTimestamp(r===1e9?new Ne(n+1,0):new Ne(n,r));return new Xr(s,te.empty(),e)}function oA(t){return new Xr(t.readTime,t.key,Pa)}class Xr{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Xr(ie.min(),te.empty(),Pa)}static max(){return new Xr(ie.max(),te.empty(),Pa)}}function aA(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=te.comparator(t.documentKey,e.documentKey),n!==0?n:me(t.largestBatchId,e.largestBatchId))}/**
1813 * @license
1814 * Copyright 2020 Google LLC
1815 *
1816 * Licensed under the Apache License, Version 2.0 (the "License");
1817 * you may not use this file except in compliance with the License.
1818 * You may obtain a copy of the License at
1819 *
1820 *   http://www.apache.org/licenses/LICENSE-2.0
1821 *
1822 * Unless required by applicable law or agreed to in writing, software
1823 * distributed under the License is distributed on an "AS IS" BASIS,
1824 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1825 * See the License for the specific language governing permissions and
1826 * limitations under the License.
1827 */const lA="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class uA{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
1828 * @license
1829 * Copyright 2017 Google LLC
1830 *
1831 * Licensed under the Apache License, Version 2.0 (the "License");
1832 * you may not use this file except in compliance with the License.
1833 * You may obtain a copy of the License at
1834 *
1835 *   http://www.apache.org/licenses/LICENSE-2.0
1836 *
1837 * Unless required by applicable law or agreed to in writing, software
1838 * distributed under the License is distributed on an "AS IS" BASIS,
1839 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1840 * See the License for the specific language governing permissions and
1841 * limitations under the License.
1842 */async function no(t){if(t.code!==$.FAILED_PRECONDITION||t.message!==lA)throw t;J("LocalStore","Unexpectedly lost primary lease")}/**
1843 * @license
1844 * Copyright 2017 Google LLC
1845 *
1846 * Licensed under the Apache License, Version 2.0 (the "License");
1847 * you may not use this file except in compliance with the License.
1848 * You may obtain a copy of the License at
1849 *
1850 *   http://www.apache.org/licenses/LICENSE-2.0
1851 *
1852 * Unless required by applicable law or agreed to in writing, software
1853 * distributed under the License is distributed on an "AS IS" BASIS,
1854 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1855 * See the License for the specific language governing permissions and
1856 * limitations under the License.
1857 */class z{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&&re(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new z((r,s)=>{this.nextCallback=i=>{this.wrapSuccess(e,i).next(r,s)},this.catchCallback=i=>{this.wrapFailure(n,i).next(r,s)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof z?n:z.resolve(n)}catch(n){return z.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):z.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):z.reject(n)}static resolve(e){return new z((n,r)=>{n(e)})}static reject(e){return new z((n,r)=>{r(e)})}static waitFor(e){return new z((n,r)=>{let s=0,i=0,o=!1;e.forEach(l=>{++s,l.next(()=>{++i,o&&i===s&&n()},u=>r(u))}),o=!0,i===s&&n()})}static or(e){let n=z.resolve(!1);for(const r of e)n=n.next(s=>s?z.resolve(s):r());return n}static forEach(e,n){const r=[];return e.forEach((s,i)=>{r.push(n.call(this,s,i))}),this.waitFor(r)}static mapArray(e,n){return new z((r,s)=>{const i=e.length,o=new Array(i);let l=0;for(let u=0;u<i;u++){const h=u;n(e[h]).next(f=>{o[h]=f,++l,l===i&&r(o)},f=>s(f))}})}static doWhile(e,n){return new z((r,s)=>{const i=()=>{e()===!0?n().next(()=>{i()},s):r()};i()})}}function cA(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function ro(t){return t.name==="IndexedDbTransactionError"}/**
1858 * @license
1859 * Copyright 2018 Google LLC
1860 *
1861 * Licensed under the Apache License, Version 2.0 (the "License");
1862 * you may not use this file except in compliance with the License.
1863 * You may obtain a copy of the License at
1864 *
1865 *   http://www.apache.org/licenses/LICENSE-2.0
1866 *
1867 * Unless required by applicable law or agreed to in writing, software
1868 * distributed under the License is distributed on an "AS IS" BASIS,
1869 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1870 * See the License for the specific language governing permissions and
1871 * limitations under the License.
1872 */class zc{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ae(r),this.ue=r=>n.writeSequenceNumber(r))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}zc.ce=-1;/**
1873 * @license
1874 * Copyright 2017 Google LLC
1875 *
1876 * Licensed under the Apache License, Version 2.0 (the "License");
1877 * you may not use this file except in compliance with the License.
1878 * You may obtain a copy of the License at
1879 *
1880 *   http://www.apache.org/licenses/LICENSE-2.0
1881 *
1882 * Unless required by applicable law or agreed to in writing, software
1883 * distributed under the License is distributed on an "AS IS" BASIS,
1884 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1885 * See the License for the specific language governing permissions and
1886 * limitations under the License.
1887 */const sm=-1;function Hc(t){return t==null}function ec(t){return t===0&&1/t==-1/0}function hA(t){return typeof t=="number"&&Number.isInteger(t)&&!ec(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
1888 * @license
1889 * Copyright 2017 Google LLC
1890 *
1891 * Licensed under the Apache License, Version 2.0 (the "License");
1892 * you may not use this file except in compliance with the License.
1893 * You may obtain a copy of the License at
1894 *
1895 *   http://www.apache.org/licenses/LICENSE-2.0
1896 *
1897 * Unless required by applicable law or agreed to in writing, software
1898 * distributed under the License is distributed on an "AS IS" BASIS,
1899 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1900 * See the License for the specific language governing permissions and
1901 * limitations under the License.
1902 */const A1="�";function dA(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=W0(e)),e=fA(t.get(n),e);return W0(e)}function fA(t,e){let n=e;const r=t.length;for(let s=0;s<r;s++){const i=t.charAt(s);switch(i){case"\0":n+="��";break;case A1:n+="��";break;default:n+=i}}return n}function W0(t){return t+A1+"�"}/**
1903 * @license
1904 * Copyright 2017 Google LLC
1905 *
1906 * Licensed under the Apache License, Version 2.0 (the "License");
1907 * you may not use this file except in compliance with the License.
1908 * You may obtain a copy of the License at
1909 *
1910 *   http://www.apache.org/licenses/LICENSE-2.0
1911 *
1912 * Unless required by applicable law or agreed to in writing, software
1913 * distributed under the License is distributed on an "AS IS" BASIS,
1914 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1915 * See the License for the specific language governing permissions and
1916 * limitations under the License.
1917 */function q0(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function us(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function P1(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
1918 * @license
1919 * Copyright 2017 Google LLC
1920 *
1921 * Licensed under the Apache License, Version 2.0 (the "License");
1922 * you may not use this file except in compliance with the License.
1923 * You may obtain a copy of the License at
1924 *
1925 *   http://www.apache.org/licenses/LICENSE-2.0
1926 *
1927 * Unless required by applicable law or agreed to in writing, software
1928 * distributed under the License is distributed on an "AS IS" BASIS,
1929 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1930 * See the License for the specific language governing permissions and
1931 * limitations under the License.
1932 */class Me{constructor(e,n){this.comparator=e,this.root=n||lt.EMPTY}insert(e,n){return new Me(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,lt.BLACK,null,
vendor: 4,544 bytes, line 1932
1932null))}remove(e){return new Me(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 s=this.comparator(e,r.key);if(s===0)return n+r.left.size;s<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 Bl(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new Bl(this.root,e,this.comparator,!1)}getReverseIterator(){return new Bl(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new Bl(this.root,e,this.comparator,!0)}}class Bl{constructor(e,n,r,s){this.isReverse=s,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=n?r(e.key,n):1,n&&s&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(i===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,s,i){this.key=e,this.value=n,this.color=r??lt.RED,this.left=s??lt.EMPTY,this.right=i??lt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,s,i){return new lt(e??this.key,n??this.value,r??this.color,s??this.left,i??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 s=this;const i=r(e,s.key);return s=i<0?s.copy(null,null,null,s.left.insert(e,n,r),null):i===0?s.copy(null,n,null,null,null):s.copy(null,null,null,null,s.right.insert(e,n,r)),s.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,s=this;if(n(e,s.key)<0)s.left.isEmpty()||s.left.isRed()||s.left.left.isRed()||(s=s.moveRedLeft()),s=s.copy(null,null,null,s.left.remove(e,n),null);else{if(s.left.isRed()&&(s=s.rotateRight()),s.right.isEmpty()||s.right.isRed()||s.right.left.isRed()||(s=s.moveRedRight()),n(e,s.key)===0){if(s.right.isEmpty())return lt.EMPTY;r=s.right.min(),s=s.copy(r.key,r.value,null,null,s.right.removeMin())}s=s.copy(null,null,null,null,s.right.remove(e,n))}return s.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())throw re(43730,{key:this.key,value:this.value});if(this.right.isRed())throw re(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw re(27949);return e+(this.isRed()?0:1)}}lt.EMPTY=null,lt.RED=!0,lt.BLACK=!1;
1932lt.EMPTY=new class{constructor(){this.size=0}get key(){throw re(57766)}get value(){throw re(16141)}get color(){throw re(16727)}get left(){throw re(29726)}get right(){throw re(36894)}copy(e,n,r,s,i){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}};/**
1933 * @license
1934 * Copyright 2017 Google LLC
1935 *
1936 * Licensed under the Apache License, Version 2.0 (the "License");
1937 * you may not use this file except in compliance with the License.
1938 * You may obtain a copy of the License at
1939 *
1940 *   http://www.apache.org/licenses/LICENSE-2.0
1941 *
1942 * Unless required by applicable law or agreed to in writing, software
1943 * distributed under the License is distributed on an "AS IS" BASIS,
1944 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1945 * See the License for the specific language governing permissions and
1946 * limitations under the License.
1947 */class tt{constructor(e){this.comparator=e,this.data=new Me(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 s=r.getNext();if(this.comparator(s.key,e[1])>=0)return;n(s.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 G0(this.data.getIterator())}getIteratorFrom(e){return new G0(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 tt)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(this.comparator(s,i)!==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 tt(this.comparator);return n.data=e,n}}class G0{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
1948 * @license
1949 * Copyright 2020 Google LLC
1950 *
1951 * Licensed under the Apache License, Version 2.0 (the "License");
1952 * you may not use this file except in compliance with the License.
1953 * You may obtain a copy of the License at
1954 *
1955 *   http://www.apache.org/licenses/LICENSE-2.0
1956 *
1957 * Unless required by applicable law or agreed to in writing, software
1958 * distributed under the License is distributed on an "AS IS" BASIS,
1959 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1960 * See the License for the specific language governing permissions and
1961 * limitations under the License.
1962 */class $t{constructor(e){this.fields=e,e.sort(ut.comparator)}static empty(){return new $t([])}unionWith(e){let n=new tt(ut.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new $t(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Li(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
1963 * @license
1964 * Copyright 2023 Google LLC
1965 *
1966 * Licensed under the Apache License, Version 2.0 (the "License");
1967 * you may not use this file except in compliance with the License.
1968 * You may obtain a copy of the License at
1969 *
1970 *   http://www.apache.org/licenses/LICENSE-2.0
1971 *
1972 * Unless required by applicable law or agreed to in writing, software
1973 * distributed under the License is distributed on an "AS IS" BASIS,
1974 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1975 * See the License for the specific language governing permissions and
1976 * limitations under the License.
1977 */class j1 extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
1978 * @license
1979 * Copyright 2020 Google LLC
1980 *
1981 * Licensed under the Apache License, Version 2.0 (the "License");
1982 * you may not use this file except in compliance with the License.
1983 * You may obtain a copy of the License at
1984 *
1985 *   http://www.apache.org/licenses/LICENSE-2.0
1986 *
1987 * Unless required by applicable law or agreed to in writing, software
1988 * distributed under the License is distributed on an "AS IS" BASIS,
1989 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1990 * See the License for the specific language governing permissions and
1991 * limitations under the License.
1992 */class dt{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(s){try{return atob(s)}catch(i){throw typeof DOMException<"u"&&i instanceof DOMException?new j1("Invalid base64 string: "+i):i}}(e);return new dt(n)}static fromUint8Array(e){const n=function(s){let i="";for(let o=0;o<s.length;++o)i+=String.fromCharCode(s[o]);return i}(e);return new dt(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 s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return me(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}dt.EMPTY_BYTE_STRING=new dt("");const pA=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function Jr(t){if(_e(!!t,39018),typeof t=="string"){let e=0;const n=pA.exec(t);if(_e(!!n,46558,{timestamp:t}),n[1]){let s=n[1];s=(s+"000000000").substr(0,9),e=Number(s)}const r=new Date(t);return{seconds:Math.floor(r.getTime()/1e3),nanos:e}}return{seconds:qe(t.seconds),nanos:qe(t.nanos)}}function qe(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function Zr(t){return typeof t=="string"?dt.fromBase64String(t):dt.fromUint8Array(t)}/**
1993 * @license
1994 * Copyright 2020 Google LLC
1995 *
1996 * Licensed under the Apache License, Version 2.0 (the "License");
1997 * you may not use this file except in compliance with the License.
1998 * You may obtain a copy of the License at
1999 *
2000 *   http://www.apache.org/licenses/LICENSE-2.0
2001 *
2002 * Unless required by applicable law or agreed to in writing, software
2003 * distributed under the License is distributed on an "AS IS" BASIS,
2004 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2005 * See the License for the specific language governing permissions and
2006 * limitations under the License.
2007 */const D1="server_timestamp",O1="__type__",L1="__previous_value__",V1="__local_write_time__";function im(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[O1])==null?void 0:r.stringValue)===D1}function Wc(t){const e=t.mapValue.fields[L1];return im(e)?Wc(e):e}function ja(t){const e=Jr(t.mapValue.fields[V1].timestampValue);return new Ne(e.seconds,e.nanos)}/**
2008 * @license
2009 * Copyright 2017 Google LLC
2010 *
2011 * Licensed under the Apache License, Version 2.0 (the "License");
2012 * you may not use this file except in compliance with the License.
2013 * You may obtain a copy of the License at
2014 *
2015 *   http://www.apache.org/licenses/LICENSE-2.0
2016 *
2017 * Unless required by applicable law or agreed to in writing, software
2018 * distributed under the License is distributed on an "AS IS" BASIS,
2019 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2020 * See the License for the specific language governing permissions and
2021 * limitations under the License.
2022 */class mA{constructor(e,n,r,s,i,o,l,u,h,f,p){this.databaseId=e,this.appId=n,this.persistenceKey=r,this.host=s,this.ssl=i,this.forceLongPolling=o,this.autoDetectLongPolling=l,this.longPollingOptions=u,this.useFetchStreams=h,this.isUsingEmulator=f,this.apiKey=p}}const tc="(default)";class Da{constructor(e,n){this.projectId=e,this.database=n||tc}static empty(){return new Da("","")}get isDefaultDatabase(){return this.database===tc}isEqual(e){return e instanceof Da&&e.projectId===this.projectId&&e.database===this.database}}function gA(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new X($.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Da(t.options.projectId,e)}/**
2023 * @license
2024 * Copyright 2020 Google LLC
2025 *
2026 * Licensed under the Apache License, Version 2.0 (the "License");
2027 * you may not use this file except in compliance with the License.
2028 * You may obtain a copy of the License at
2029 *
2030 *   http://www.apache.org/licenses/LICENSE-2.0
2031 *
2032 * Unless required by applicable law or agreed to in writing, software
2033 * distributed under the License is distributed on an "AS IS" BASIS,
2034 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2035 * See the License for the specific language governing permissions and
2036 * limitations under the License.
2037 */const M1="__type__",yA="__max__",zl={mapValue:{}},F1="__vector__",nc="value";function es(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?im(t)?4:_A(t)?9007199254740991:vA(t)?10:11:re(28295,{value:t})}function Bn(t,e){if(t===e)return!0;const n=es(t);if(n!==es(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return ja(t).isEqual(ja(e));case 3:return function(s,i){if(typeof s.timestampValue=="string"&&typeof i.timestampValue=="string"&&s.timestampValue.length===i.timestampValue.length)return s.timestampValue===i.timestampValue;const o=Jr(s.timestampValue),l=Jr(i.timestampValue);return o.seconds===l.seconds&&o.nanos===l.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(s,i){return Zr(s.bytesValue).isEqual(Zr(i.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(s,i){return qe(s.geoPointValue.latitude)===qe(i.geoPointValue.latitude)&&qe(s.geoPointValue.longitude)===qe(i.geoPointValue.longitude)}(t,e);case 2:return function(s,i){if("integerValue"in s&&"integerValue"in i)return qe(s.integerValue)===qe(i.integerValue);if("doubleValue"in s&&"doubleValue"in i){const o=qe(s.doubleValue),l=qe(i.doubleValue);return o===l?ec(o)===ec(l):isNaN(o)&&isNaN(l)}return!1}(t,e);case 9:return Li(t.arrayValue.values||[],e.arrayValue.values||[],Bn);case 10:case 11:return function(s,i){const o=s.mapValue.fields||{},l=i.mapValue.fields||{};if(q0(o)!==q0(l))return!1;for(const u in o)if(o.hasOwnProperty(u)&&(l[u]===void 0||!Bn(o[u],l[u])))return!1;return!0}(t,e);default:return re(52216,{left:t})}}function Oa(t,e){return(t.values||[]).find(n=>Bn(n,e))!==void 0}function Vi(t,e){if(t===e)return 0;const n=es(t),r=es(e);if(n!==r)return me(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return me(t.booleanValue,e.booleanValue);case 2:return function(i,o){const l=qe(i.integerValue||i.doubleValue),u=qe(o.integerValue||o.doubleValue);return l<u?-1:l>u?1:l===u?0:isNaN(l)?isNaN(u)?0:-1:1}(t,e);case 3:return K0(t.timestampValue,e.timestampValue);case 4:return K0(ja(t),ja(e));case 5:return bf(t.stringValue,e.stringValue);case 6:return function(i,o){const l=Zr(i),u=Zr(o);return l.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(i,o){const l=i.split("/"),u=o.split("/");for(let h=0;h<l.length&&h<u.length;h++){const f=me(l[h],u[h]);if(f!==0)return f}return me(l.length,u.length)}(t.referenceValue,e.referenceValue);case 8:return function(i,o){const l=me(qe(i.latitude),qe(o.latitude));return l!==0?l:me(qe(i.longitude),qe(o.longitude))}(t.geoPointValue,e.geoPointValue);case 9:return Q0(t.arrayValue,e.arrayValue);case 10:return function(i,o){var g,E,N,A;const l=i.fields||{},u=o.fields||{},h=(g=l[nc])==null?void 0:g.arrayValue,f=(E=u[nc])==null?void 0:E.arrayValue,p=me(((N=h==null?void 0:h.values)==null?void 0:N.length)||0,((A=f==null?void 0:f.values)==null?void 0:A.length)||0);return p!==0?p:Q0(h,f)}(t.mapValue,e.mapValue);case 11:return function(i,o){if(i===zl.mapValue&&o===zl.mapValue)return 0;if(i===zl.mapValue)return 1;if(o===zl.mapValue)return-1;const l=i.fields||{},u=Object.keys(l),h=o.fields||{},f=Object.keys(h);u.sort(),f.sort();for(let p=0;p<u.length&&p<f.length;++p){const g=bf(u[p],f[p]);if(g!==0)return g;const E=Vi(l[u[p]],h[f[p]]);if(E!==0)return E}return me(u.length,f.length)}(t.mapValue,e.mapValue);default:throw re(23264,{he:n})}}function K0(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return me(t,e);const n=Jr(t),r=Jr(e),s=me(n.seconds,r.seconds);return s!==0?s:me(n.nanos,r.nanos)}function Q0(t,e){const n=t.values||[],r=e.values||[];for(let s=0;s<n.length&&s<r.length;++s){const i=Vi(n[s],r[s]);if(i)return i}return me(n.length,r.length)}function Mi(t){return Sf(t)}function Sf(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=Jr(n);return`time(${r.seconds},${r.nanos})`}(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?function(n){return Zr(n).toBase64()}(t.bytesValue):"referenceValue"in t?function(n){return te.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="[",s=!0;for(const i of n.values||[])s?s=!1:r+=",",r+=Sf(i);return r+"]"}(t.arrayValue):"mapValue"in t?function(n){const r=Object.keys(n.fields||{}).sort();let s="{",i=!0;for(const o of r)i?i=!1:s+=",",s+=`${o}:${Sf(n.fields[o])}`;return s+"}"}(t.mapValue):re(61005,{value:t})}function gu(t){switch(es(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=Wc(t);return e?16+gu(e):16;case 5:return 2*t.stringValue.length;case 6:return Zr(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return function(r){return(r.values||[]).reduce((s,i)=>s+gu(i),0)}(t.arrayValue);case 10:case 11:return function(r){let s=0;return us(r.fields,(i,o)=>{s+=i.length+gu(o)}),s}(t.mapValue);
2037default:throw re(13486,{value:t})}}function Y0(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Cf(t){return!!t&&"integerValue"in t}function om(t){return!!t&&"arrayValue"in t}function X0(t){return!!t&&"nullValue"in t}function J0(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function yu(t){return!!t&&"mapValue"in t}function vA(t){var n,r;return((r=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[M1])==null?void 0:r.stringValue)===F1}function ia(t){if(t.geoPointValue)return{geoPointValue:{...t.geoPointValue}};if(t.timestampValue&&typeof t.timestampValue=="object")return{timestampValue:{...t.timestampValue}};if(t.mapValue){const e={mapValue:{fields:{}}};return us(t.mapValue.fields,(n,r)=>e.mapValue.fields[n]=ia(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=ia(t.arrayValue.values[n]);return e}return{...t}}function _A(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===yA}/**
2038 * @license
2039 * Copyright 2017 Google LLC
2040 *
2041 * Licensed under the Apache License, Version 2.0 (the "License");
2042 * you may not use this file except in compliance with the License.
2043 * You may obtain a copy of the License at
2044 *
2045 *   http://www.apache.org/licenses/LICENSE-2.0
2046 *
2047 * Unless required by applicable law or agreed to in writing, software
2048 * distributed under the License is distributed on an "AS IS" BASIS,
2049 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2050 * See the License for the specific language governing permissions and
2051 * limitations under the License.
2052 */class At{constructor(e){this.value=e}static empty(){return new At({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)],!yu(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=ia(n)}setAll(e){let n=ut.emptyPath(),r={},s=[];e.forEach((o,l)=>{if(!n.isImmediateParentOf(l)){const u=this.getFieldsMap(n);this.applyChanges(u,r,s),r={},s=[],n=l.popLast()}o?r[l.lastSegment()]=ia(o):s.push(l.lastSegment())});const i=this.getFieldsMap(n);this.applyChanges(i,r,s)}delete(e){const n=this.field(e.popLast());yu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return Bn(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 s=n.mapValue.fields[e.get(r)];yu(s)&&s.mapValue.fields||(s={mapValue:{fields:{}}},n.mapValue.fields[e.get(r)]=s),n=s}return n.mapValue.fields}applyChanges(e,n,r){us(n,(s,i)=>e[s]=i);for(const s of r)delete e[s]}clone(){return new At(ia(this.value))}}function U1(t){const e=[];return us(t.fields,(n,r)=>{const s=new ut([n]);if(yu(r)){const i=U1(r.mapValue).fields;
vendor: 4,180 bytes, lines 2052-2092
2052if(i.length===0)e.push(s);else for(const o of i)e.push(s.child(o))}else e.push(s)}),new $t(e)}/**
2053 * @license
2054 * Copyright 2017 Google LLC
2055 *
2056 * Licensed under the Apache License, Version 2.0 (the "License");
2057 * you may not use this file except in compliance with the License.
2058 * You may obtain a copy of the License at
2059 *
2060 *   http://www.apache.org/licenses/LICENSE-2.0
2061 *
2062 * Unless required by applicable law or agreed to in writing, software
2063 * distributed under the License is distributed on an "AS IS" BASIS,
2064 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2065 * See the License for the specific language governing permissions and
2066 * limitations under the License.
2067 */class vt{constructor(e,n,r,s,i,o,l){this.key=e,this.documentType=n,this.version=r,this.readTime=s,this.createTime=i,this.data=o,this.documentState=l}static newInvalidDocument(e){return new vt(e,0,ie.min(),ie.min(),ie.min(),At.empty(),0)}static newFoundDocument(e,n,r,s){return new vt(e,1,n,ie.min(),r,s,0)}static newNoDocument(e,n){return new vt(e,2,n,ie.min(),ie.min(),At.empty(),0)}static newUnknownDocument(e,n){return new vt(e,3,n,ie.min(),ie.min(),At.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(ie.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=At.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=At.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ie.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 vt&&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 vt(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}})`}}/**
2068 * @license
2069 * Copyright 2022 Google LLC
2070 *
2071 * Licensed under the Apache License, Version 2.0 (the "License");
2072 * you may not use this file except in compliance with the License.
2073 * You may obtain a copy of the License at
2074 *
2075 *   http://www.apache.org/licenses/LICENSE-2.0
2076 *
2077 * Unless required by applicable law or agreed to in writing, software
2078 * distributed under the License is distributed on an "AS IS" BASIS,
2079 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2080 * See the License for the specific language governing permissions and
2081 * limitations under the License.
2082 */class rc{constructor(e,n){this.position=e,this.inclusive=n}}function Z0(t,e,n){let r=0;for(let s=0;s<t.position.length;s++){const i=e[s],o=t.position[s];if(i.field.isKeyField()?r=te.comparator(te.fromName(o.referenceValue),n.key):r=Vi(o,n.data.field(i.field)),i.dir==="desc"&&(r*=-1),r!==0)break}return r}function ev(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(!Bn(t.position[n],e.position[n]))return!1;return!0}/**
2083 * @license
2084 * Copyright 2022 Google LLC
2085 *
2086 * Licensed under the Apache License, Version 2.0 (the "License");
2087 * you may not use this file except in compliance with the License.
2088 * You may obtain a copy of the License at
2089 *
2090 *   http://www.apache.org/licenses/LICENSE-2.0
2091 *
2092 * Unless required by applicable law or agreed to in writing, softw
2092are
2093 * distributed under the License is distributed on an "AS IS" BASIS,
2094 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2095 * See the License for the specific language governing permissions and
2096 * limitations under the License.
2097 */class La{constructor(e,n="asc"){this.field=e,this.dir=n}}function wA(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
2098 * @license
2099 * Copyright 2022 Google LLC
2100 *
2101 * Licensed under the Apache License, Version 2.0 (the "License");
2102 * you may not use this file except in compliance with the License.
2103 * You may obtain a copy of the License at
2104 *
2105 *   http://www.apache.org/licenses/LICENSE-2.0
2106 *
2107 * Unless required by applicable law or agreed to in writing, software
2108 * distributed under the License is distributed on an "AS IS" BASIS,
2109 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2110 * See the License for the specific language governing permissions and
2111 * limitations under the License.
2112 */class $1{}class Ye extends $1{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 EA(e,n,r):n==="array-contains"?new bA(e,r):n==="in"?new SA(e,r):n==="not-in"?new CA(e,r):n==="array-contains-any"?new kA(e,r):new Ye(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new TA(e,r):new IA(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&n.nullValue===void 0&&this.matchesComparison(Vi(n,this.value)):n!==null&&es(this.value)===es(n)&&this.matchesComparison(Vi(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 re(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class xn extends $1{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new xn(e,n)}matches(e){return B1(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.Pe!==null||(this.Pe=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function B1(t){return t.op==="and"}function z1(t){return xA(t)&&B1(t)}function xA(t){for(const e of t.filters)if(e instanceof xn)return!1;return!0}function kf(t){if(t instanceof Ye)return t.field.canonicalString()+t.op.toString()+Mi(t.value);if(z1(t))return t.filters.map(e=>kf(e)).join(",");{const e=t.filters.map(n=>kf(n)).join(",");return`${t.op}(${e})`}}function H1(t,e){return t instanceof Ye?function(r,s){return s instanceof Ye&&r.op===s.op&&r.field.isEqual(s.field)&&Bn(r.value,s.value)}(t,e):t instanceof xn?function(r,s){return s instanceof xn&&r.op===s.op&&r.filters.length===s.filters.length?r.filters.reduce((i,o,l)=>i&&H1(o,s.filters[l]),!0):!1}(t,e):void re(19439)}function W1(t){return t instanceof Ye?function(n){return`${n.field.canonicalString()} ${n.op} ${Mi(n.value)}`}(t):t instanceof xn?function(n){return n.op.toString()+" {"+n.getFilters().map(W1).join(" ,")+"}"}(t):"Filter"}class EA extends Ye{constructor(e,n,r){super(e,n,r),this.key=te.fromName(r.referenceValue)}matches(e){const n=te.comparator(e.key,this.key);return this.matchesComparison(n)}}class TA extends Ye{constructor(e,n){super(e,"in",n),this.keys=q1("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class IA extends Ye{constructor(e,n){super(e,"not-in",n),this.keys=q1("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function q1(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map(r=>te.fromName(r.referenceValue))}class bA extends Ye{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return om(n)&&Oa(n.arrayValue,this.value)}}class SA extends Ye{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Oa(this.value.arrayValue,n)}}class CA extends Ye{constructor(e,n){super(e,"not-in",n)}matches(e){if(Oa(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!Oa(this.value.arrayValue,n)}}class kA extends Ye{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!om(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Oa(this.value.arrayValue,r))}}/**
2113 * @license
2114 * Copyright 2019 Google LLC
2115 *
2116 * Licensed under the Apache License, Version 2.0 (the "License");
2117 * you may not use this file except in compliance with the License.
2118 * You may obtain a copy of the License at
2119 *
2120 *   http://www.apache.org/licenses/LICENSE-2.0
2121 *
2122 * Unless required by applicable law or agreed to in writing, software
2123 * distributed under the License is distributed on an "AS IS" BASIS,
2124 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2125 * See the License for the specific language governing permissions and
2126 * limitations under the License.
2127 */class NA{constructor(e,n=null,r=[],s=[],i=null,o=null,l=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=s,this.limit=i,this.startAt=o,this.endAt=l,this.Te=null}}function tv(t,e=null,n=[],r=[],s=null,i=null,o=null){return new NA(t,e,n,r,s,i,o)}function am(t){const e=ae(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>kf(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(i){return i.field.canonicalString()+i.dir}(r)).join(","),Hc(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Mi(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Mi(r)).join(",")),e.Te=n}return e.Te}function lm(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(!wA(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(!H1(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!ev(t.startAt,e.startAt)&&ev(t.endAt,e.endAt)}function Nf(t){return te.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
2128 * @license
2129 * Copyright 2017 Google LLC
2130 *
2131 * Licensed under the Apache License, Version 2.0 (the "License");
2132 * you may not use this file except in compliance with the License.
2133 * You may obtain a copy of the License at
2134 *
2135 *   http://www.apache.org/licenses/LICENSE-2.0
2136 *
2137 * Unless required by applicable law or agreed to in writing, software
2138 * distributed under the License is distributed on an "AS IS" BASIS,
2139 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2140 * See the License for the specific language governing permissions and
2141 * limitations under the License.
2142 */class so{constructor(e,n=null,r=[],s=[],i=null,o="F",l=null,u=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=s,this.limit=i,this.limitType=o,this.startAt=l,this.endAt=u,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}}function RA(t,e,n,r,s,i,o,l){return new so(t,e,n,r,s,i,o,l)}function qc(t){return new so(t)}function nv(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 AA(t){return te.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}function G1(t){return t.collectionGroup!==null}function oa(t){const e=ae(t);if(e.Ie===null){e.Ie=[];const n=new Set;for(const i of e.explicitOrderBy)e.Ie.push(i),n.add(i.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let l=new tt(ut.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(h=>{h.isInequality()&&(l=l.add(h.field))})}),l})(e).forEach(i=>{n.has(i.canonicalString())||i.isKeyField()||e.Ie.push(new La(i,r))}),n.has(ut.keyField().canonicalString())||e.Ie.push(new La(ut.keyField(),r))}return e.Ie}function Fn(t){const e=ae(t);return e.Ee||(e.Ee=PA(e,oa(t))),e.Ee}function PA(t,e){if(t.limitType==="F")return tv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(s=>{const i=s.dir==="desc"?"asc":"desc";return new La(s.field,i)});const n=t.endAt?new rc(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new rc(t.startAt.position,t.startAt.inclusive):null;return tv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function Rf(t,e){const n=t.filters.concat([e]);return new so(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function jA(t,e){const n=t.explicitOrderBy.concat([e]);return new so(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function Af(t,e,n){return new so(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Gc(t,e){return lm(Fn(t),Fn(e))&&t.limitType===e.limitType}function K1(t){return`${am(Fn(t))}|lt:${t.limitType}`}function ti(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(s=>W1(s)).join(", ")}]`),Hc(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(s=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(s)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(s=>Mi(s)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(s=>Mi(s)).join(",")),`Target(${r})`}(Fn(t))}; limitType=${t.limitType})`}function Kc(t,e){return e.isFoundDocument()&&function(r,s){const i=s.key.path;return r.collectionGroup!==null?s.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(i):te.isDocumentKey(r.path)?r.path.isEqual(i):r.path.isImmediateParentOf(i)}(t,e)&&function(r,s){for(const i of oa(r))if(!i.field.isKeyField()&&s.data.field(i.field)===null)return!1;return!0}(t,e)&&function(r,s){for(const i of r.filters)if(!i.matches(s))return!1;return!0}(t,e)&&function(r,s){return!(r.startAt&&!function(o,l,u){const h=Z0(o,l,u);return o.inclusive?h<=0:h<0}(r.startAt,oa(r),s)||r.endAt&&!function(o,l,u){const h=Z0(o,l,u);return o.inclusive?h>=0:h>0}(r.endAt,oa(r),s))}(t,e)}function DA(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Q1(t){return(e,n)=>{let r=!1;
2142for(const s of oa(t)){const i=OA(s,e,n);if(i!==0)return i;r=r||s.field.isKeyField()}return 0}}function OA(t,e,n){const r=t.field.isKeyField()?te.comparator(e.key,n.key):function(i,o,l){const u=o.data.field(i),h=l.data.field(i);return u!==null&&h!==null?Vi(u,h):re(42886)}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return re(19790,{direction:t.dir})}}/**
2143 * @license
2144 * Copyright 2017 Google LLC
2145 *
2146 * Licensed under the Apache License, Version 2.0 (the "License");
2147 * you may not use this file except in compliance with the License.
2148 * You may obtain a copy of the License at
2149 *
2150 *   http://www.apache.org/licenses/LICENSE-2.0
2151 *
2152 * Unless required by applicable law or agreed to in writing, software
2153 * distributed under the License is distributed on an "AS IS" BASIS,
2154 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2155 * See the License for the specific language governing permissions and
2156 * limitations under the License.
2157 */class qs{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[s,i]of r)if(this.equalsFn(s,e))return i}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),s=this.inner[r];if(s===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let i=0;i<s.length;i++)if(this.equalsFn(s[i][0],e))return void(s[i]=[e,n]);s.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r===void 0)return!1;for(let s=0;s<r.length;s++)if(this.equalsFn(r[s][0],e))return r.length===1?delete this.inner[n]:r.splice(s,1),this.innerSize--,!0;return!1}forEach(e){us(this.inner,(n,r)=>{for(const[s,i]of r)e(s,i)})}isEmpty(){return P1(this.inner)}size(){return this.innerSize}}/**
2158 * @license
2159 * Copyright 2017 Google LLC
2160 *
2161 * Licensed under the Apache License, Version 2.0 (the "License");
2162 * you may not use this file except in compliance with the License.
2163 * You may obtain a copy of the License at
2164 *
2165 *   http://www.apache.org/licenses/LICENSE-2.0
2166 *
2167 * Unless required by applicable law or agreed to in writing, software
2168 * distributed under the License is distributed on an "AS IS" BASIS,
2169 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2170 * See the License for the specific language governing permissions and
2171 * limitations under the License.
2172 */const LA=new Me(te.comparator);function ur(){return LA}const Y1=new Me(te.comparator);function Wo(...t){let e=Y1;for(const n of t)e=e.insert(n.key,n);return e}function X1(t){let e=Y1;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function Ts(){return aa()}function J1(){return aa()}function aa(){return new qs(t=>t.toString(),(t,e)=>t.isEqual(e))}const VA=new Me(te.comparator),MA=new tt(te.comparator);function ge(...t){let e=MA;for(const n of t)e=e.add(n);return e}const FA=new tt(me);function UA(){return FA}/**
2173 * @license
2174 * Copyright 2020 Google LLC
2175 *
2176 * Licensed under the Apache License, Version 2.0 (the "License");
2177 * you may not use this file except in compliance with the License.
2178 * You may obtain a copy of the License at
2179 *
2180 *   http://www.apache.org/licenses/LICENSE-2.0
2181 *
2182 * Unless required by applicable law or agreed to in writing, software
2183 * distributed under the License is distributed on an "AS IS" BASIS,
2184 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2185 * See the License for the specific language governing permissions and
2186 * limitations under the License.
2187 */function um(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:ec(e)?"-0":e}}function Z1(t){return{integerValue:""+t}}function $A(t,e){return hA(e)?Z1(e):um(t,e)}/**
2188 * @license
2189 * Copyright 2018 Google LLC
2190 *
2191 * Licensed under the Apache License, Version 2.0 (the "License");
2192 * you may not use this file except in compliance with the License.
2193 * You may obtain a copy of the License at
2194 *
2195 *   http://www.apache.org/licenses/LICENSE-2.0
2196 *
2197 * Unless required by applicable law or agreed to in writing, softw
2197are
2198 * distributed under the License is distributed on an "AS IS" BASIS,
2199 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2200 * See the License for the specific language governing permissions and
2201 * limitations under the License.
2202 */class Qc{constructor(){this._=void 0}}function BA(t,e,n){return t instanceof Va?function(s,i){const o={fields:{[O1]:{stringValue:D1},[V1]:{timestampValue:{seconds:s.seconds,nanos:s.nanoseconds}}}};return i&&im(i)&&(i=Wc(i)),i&&(o.fields[L1]=i),{mapValue:o}}(n,e):t instanceof Ma?tE(t,e):t instanceof Fa?nE(t,e):function(s,i){const o=eE(s,i),l=rv(o)+rv(s.Ae);return Cf(o)&&Cf(s.Ae)?Z1(l):um(s.serializer,l)}(t,e)}function zA(t,e,n){return t instanceof Ma?tE(t,e):t instanceof Fa?nE(t,e):n}function eE(t,e){return t instanceof sc?function(r){return Cf(r)||function(i){return!!i&&"doubleValue"in i}(r)}(e)?e:{integerValue:0}:null}class Va extends Qc{}class Ma extends Qc{constructor(e){super(),this.elements=e}}function tE(t,e){const n=rE(e);for(const r of t.elements)n.some(s=>Bn(s,r))||n.push(r);return{arrayValue:{values:n}}}class Fa extends Qc{constructor(e){super(),this.elements=e}}function nE(t,e){let n=rE(e);for(const r of t.elements)n=n.filter(s=>!Bn(s,r));return{arrayValue:{values:n}}}class sc extends Qc{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function rv(t){return qe(t.integerValue||t.doubleValue)}function rE(t){return om(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/**
2203 * @license
2204 * Copyright 2017 Google LLC
2205 *
2206 * Licensed under the Apache License, Version 2.0 (the "License");
2207 * you may not use this file except in compliance with the License.
2208 * You may obtain a copy of the License at
2209 *
2210 *   http://www.apache.org/licenses/LICENSE-2.0
2211 *
2212 * Unless required by applicable law or agreed to in writing, software
2213 * distributed under the License is distributed on an "AS IS" BASIS,
2214 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2215 * See the License for the specific language governing permissions and
2216 * limitations under the License.
2217 */class HA{constructor(e,n){this.field=e,this.transform=n}}function WA(t,e){return t.field.isEqual(e.field)&&function(r,s){return r instanceof Ma&&s instanceof Ma||r instanceof Fa&&s instanceof Fa?Li(r.elements,s.elements,Bn):r instanceof sc&&s instanceof sc?Bn(r.Ae,s.Ae):r instanceof Va&&s instanceof Va}(t.transform,e.transform)}class qA{constructor(e,n){this.version=e,this.transformResults=n}}class rn{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new rn}static exists(e){return new rn(void 0,e)}static updateTime(e){return new rn(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 vu(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Yc{}function sE(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new cm(t.key,rn.none()):new Za(t.key,t.data,rn.none());{const n=t.data,r=At.empty();let s=new tt(ut.comparator);for(let i of e.fields)if(!s.has(i)){let o=n.field(i);o===null&&i.length>1&&(i=i.popLast(),o=n.field(i)),o===null?r.delete(i):r.set(i,o),s=s.add(i)}return new cs(t.key,r,new $t(s.toArray()),rn.none())}}function GA(t,e,n){t instanceof Za?function(s,i,o){const l=s.value.clone(),u=iv(s.fieldTransforms,i,o.transformResults);l.setAll(u),i.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):t instanceof cs?function(s,i,o){if(!vu(s.precondition,i))return void i.convertToUnknownDocument(o.version);const l=iv(s.fieldTransforms,i,o.transformResults),u=i.data;u.setAll(iE(s)),u.setAll(l),i.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(s,i,o){i.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function la(t,e,n,r){return t instanceof Za?function(i,o,l,u){if(!vu(i.precondition,o))return l;const h=i.value.clone(),f=ov(i.fieldTransforms,u,o);return h.setAll(f),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),null}(t,e,n,r):t instanceof cs?function(i,o,l,u){if(!vu(i.precondition,o))return l;const h=ov(i.fieldTransforms,u,o),f=o.data;return f.setAll(iE(i)),f.setAll(h),o.convertToFoundDocument(o.version,f).setHasLocalMutations(),l===null?null:l.unionWith(i.fieldMask.fields).unionWith(i.fieldTransforms.map(p=>p.field))}(t,e,n,r):function(i,o,l){return vu(i.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):l}(t,e,n)}function KA(t,e){let n=null;for(const r of t.fieldTransforms){const s=e.data.field(r.field),i=eE(r.transform,s||null);i!=null&&(n===null&&(n=At.empty()),n.set(r.field,i))}return n||null}function sv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,s){return r===void 0&&s===void 0||!(!r||!s)&&Li(r,s,(i,o)=>WA(i,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 Za extends Yc{constructor(e,n,r,s=[]){super(),this.key=e,this.value=n,this.prec
2217ondition=r,this.fieldTransforms=s,this.type=0}getFieldMask(){return null}}class cs extends Yc{constructor(e,n,r,s,i=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=s,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function iE(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 iv(t,e,n){const r=new Map;_e(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let s=0;s<n.length;s++){const i=t[s],o=i.transform,l=e.data.field(i.field);r.set(i.field,zA(o,l,n[s]))}return r}function ov(t,e,n){const r=new Map;for(const s of t){const i=s.transform,o=n.data.field(s.field);r.set(s.field,BA(i,o,e))}return r}class cm extends Yc{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class QA extends Yc{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
2218 * @license
2219 * Copyright 2017 Google LLC
2220 *
2221 * Licensed under the Apache License, Version 2.0 (the "License");
2222 * you may not use this file except in compliance with the License.
2223 * You may obtain a copy of the License at
2224 *
2225 *   http://www.apache.org/licenses/LICENSE-2.0
2226 *
2227 * Unless required by applicable law or agreed to in writing, software
2228 * distributed under the License is distributed on an "AS IS" BASIS,
2229 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2230 * See the License for the specific language governing permissions and
2231 * limitations under the License.
2232 */class YA{constructor(e,n,r,s){this.batchId=e,this.localWriteTime=n,this.baseMutations=r,this.mutations=s}applyToRemoteDocument(e,n){const r=n.mutationResults;for(let s=0;s<this.mutations.length;s++){const i=this.mutations[s];i.key.isEqual(e.key)&&GA(i,e,r[s])}}applyToLocalView(e,n){for(const r of this.baseMutations)r.key.isEqual(e.key)&&(n=la(r,e,n,this.localWriteTime));for(const r of this.mutations)r.key.isEqual(e.key)&&(n=la(r,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const r=J1();return this.mutations.forEach(s=>{const i=e.get(s.key),o=i.overlayedDocument;let l=this.applyToLocalView(o,i.mutatedFields);l=n.has(s.key)?null:l;const u=sE(o,l);u!==null&&r.set(s.key,u),o.isValidDocument()||o.convertToNoDocument(ie.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),ge())}isEqual(e){return this.batchId===e.batchId&&Li(this.mutations,e.mutations,(n,r)=>sv(n,r))&&Li(this.baseMutations,e.baseMutations,(n,r)=>sv(n,r))}}class hm{constructor(e,n,r,s){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=s}static from(e,n,r){_e(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let s=function(){return VA}();const i=e.mutations;for(let o=0;o<i.length;o++)s=s.insert(i[o].key,r[o].version);return new hm(e,n,r,s)}}/**
2233 * @license
2234 * Copyright 2022 Google LLC
2235 *
2236 * Licensed under the Apache License, Version 2.0 (the "License");
2237 * you may not use this file except in compliance with the License.
2238 * You may obtain a copy of the License at
2239 *
2240 *   http://www.apache.org/licenses/LICENSE-2.0
2241 *
2242 * Unless required by applicable law or agreed to in writing, software
2243 * distributed under the License is distributed on an "AS IS" BASIS,
2244 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2245 * See the License for the specific language governing permissions and
2246 * limitations under the License.
2247 */class XA{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{
2248      largestBatchId: ${this.largestBatchId},
2249      mutation: ${this.mutation.toString()}
2250    }`}}/**
2251 * @license
2252 * Copyright 2017 Google LLC
2253 *
2254 * Licensed under the Apache License, Version 2.0 (the "License");
2255 * you may not use this file except in compliance with the License.
2256 * You may obtain a copy of the License at
2257 *
2258 *   http://www.apache.org/licenses/LICENSE-2.0
2259 *
2260 * Unless required by applicable law or agreed to in writing, softw
2260are
2261 * distributed under the License is distributed on an "AS IS" BASIS,
2262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2263 * See the License for the specific language governing permissions and
2264 * limitations under the License.
2265 */class JA{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
2266 * @license
2267 * Copyright 2017 Google LLC
2268 *
2269 * Licensed under the Apache License, Version 2.0 (the "License");
2270 * you may not use this file except in compliance with the License.
2271 * You may obtain a copy of the License at
2272 *
2273 *   http://www.apache.org/licenses/LICENSE-2.0
2274 *
2275 * Unless required by applicable law or agreed to in writing, software
2276 * distributed under the License is distributed on an "AS IS" BASIS,
2277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2278 * See the License for the specific language governing permissions and
2279 * limitations under the License.
2280 */var Ke,ye;function ZA(t){switch(t){case $.OK:return re(64938);case $.CANCELLED:case $.UNKNOWN:case $.DEADLINE_EXCEEDED:case $.RESOURCE_EXHAUSTED:case $.INTERNAL:case $.UNAVAILABLE:case $.UNAUTHENTICATED:return!1;case $.INVALID_ARGUMENT:case $.NOT_FOUND:case $.ALREADY_EXISTS:case $.PERMISSION_DENIED:case $.FAILED_PRECONDITION:case $.ABORTED:case $.OUT_OF_RANGE:case $.UNIMPLEMENTED:case $.DATA_LOSS:return!0;default:return re(15467,{code:t})}}function oE(t){if(t===void 0)return lr("GRPC error has no .code"),$.UNKNOWN;switch(t){case Ke.OK:return $.OK;case Ke.CANCELLED:return $.CANCELLED;case Ke.UNKNOWN:return $.UNKNOWN;case Ke.DEADLINE_EXCEEDED:return $.DEADLINE_EXCEEDED;case Ke.RESOURCE_EXHAUSTED:return $.RESOURCE_EXHAUSTED;case Ke.INTERNAL:return $.INTERNAL;case Ke.UNAVAILABLE:return $.UNAVAILABLE;case Ke.UNAUTHENTICATED:return $.UNAUTHENTICATED;case Ke.INVALID_ARGUMENT:return $.INVALID_ARGUMENT;case Ke.NOT_FOUND:return $.NOT_FOUND;case Ke.ALREADY_EXISTS:return $.ALREADY_EXISTS;case Ke.PERMISSION_DENIED:return $.PERMISSION_DENIED;case Ke.FAILED_PRECONDITION:return $.FAILED_PRECONDITION;case Ke.ABORTED:return $.ABORTED;case Ke.OUT_OF_RANGE:return $.OUT_OF_RANGE;case Ke.UNIMPLEMENTED:return $.UNIMPLEMENTED;case Ke.DATA_LOSS:return $.DATA_LOSS;default:return re(39323,{code:t})}}(ye=Ke||(Ke={}))[ye.OK=0]="OK",ye[ye.CANCELLED=1]="CANCELLED",ye[ye.UNKNOWN=2]="UNKNOWN",ye[ye.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",ye[ye.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",ye[ye.NOT_FOUND=5]="NOT_FOUND",ye[ye.ALREADY_EXISTS=6]="ALREADY_EXISTS",ye[ye.PERMISSION_DENIED=7]="PERMISSION_DENIED",ye[ye.UNAUTHENTICATED=16]="UNAUTHENTICATED",ye[ye.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",ye[ye.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",ye[ye.ABORTED=10]="ABORTED",ye[ye.OUT_OF_RANGE=11]="OUT_OF_RANGE",ye[ye.UNIMPLEMENTED=12]="UNIMPLEMENTED",ye[ye.INTERNAL=13]="INTERNAL",ye[ye.UNAVAILABLE=14]="UNAVAILABLE",ye[ye.DATA_LOSS=15]="DATA_LOSS";/**
2281 * @license
2282 * Copyright 2023 Google LLC
2283 *
2284 * Licensed under the Apache License, Version 2.0 (the "License");
2285 * you may not use this file except in compliance with the License.
2286 * You may obtain a copy of the License at
2287 *
2288 *   http://www.apache.org/licenses/LICENSE-2.0
2289 *
2290 * Unless required by applicable law or agreed to in writing, software
2291 * distributed under the License is distributed on an "AS IS" BASIS,
2292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2293 * See the License for the specific language governing permissions and
2294 * limitations under the License.
2295 */function eP(){return new TextEncoder}/**
2296 * @license
2297 * Copyright 2022 Google LLC
2298 *
2299 * Licensed under the Apache License, Version 2.0 (the "License");
2300 * you may not use this file except in compliance with the License.
2301 * You may obtain a copy of the License at
2302 *
2303 *   http://www.apache.org/licenses/LICENSE-2.0
2304 *
2305 * Unless required by applicable law or agreed to in writing, software
2306 * distributed under the License is distributed on an "AS IS" BASIS,
2307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2308 * See the License for the specific language governing permissions and
2309 * limitations under the License.
2310 */const tP=new Hr([4294967295,4294967295],0);function av(t){const e=eP().encode(t),n=new x1;return n.update(e),new Uint8Array(n.digest())}function lv(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),r=e.getUint32(4,!0),s=e.getUint32(8,!0),i=e.getUint32(12,!0);
2310return[new Hr([n,r],0),new Hr([s,i],0)]}class dm{constructor(e,n,r){if(this.bitmap=e,this.padding=n,this.hashCount=r,n<0||n>=8)throw new qo(`Invalid padding: ${n}`);if(r<0)throw new qo(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new qo(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new qo(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Hr.fromNumber(this.ge)}ye(e,n,r){let s=e.add(n.multiply(Hr.fromNumber(r)));return s.compare(tP)===1&&(s=new Hr([s.getBits(0),s.getBits(1)],0)),s.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(this.ge===0)return!1;const n=av(e),[r,s]=lv(n);for(let i=0;i<this.hashCount;i++){const o=this.ye(r,s,i);if(!this.we(o))return!1}return!0}static create(e,n,r){const s=e%8==0?0:8-e%8,i=new Uint8Array(Math.ceil(e/8)),o=new dm(i,s,n);return r.forEach(l=>o.insert(l)),o}insert(e){if(this.ge===0)return;const n=av(e),[r,s]=lv(n);for(let i=0;i<this.hashCount;i++){const o=this.ye(r,s,i);this.be(o)}}be(e){const n=Math.floor(e/8),r=e%8;this.bitmap[n]|=1<<r}}class qo extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
2311 * @license
2312 * Copyright 2017 Google LLC
2313 *
2314 * Licensed under the Apache License, Version 2.0 (the "License");
2315 * you may not use this file except in compliance with the License.
2316 * You may obtain a copy of the License at
2317 *
2318 *   http://www.apache.org/licenses/LICENSE-2.0
2319 *
2320 * Unless required by applicable law or agreed to in writing, software
2321 * distributed under the License is distributed on an "AS IS" BASIS,
2322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2323 * See the License for the specific language governing permissions and
2324 * limitations under the License.
2325 */class Xc{constructor(e,n,r,s,i){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=r,this.documentUpdates=s,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,n,r){const s=new Map;return s.set(e,el.createSynthesizedTargetChangeForCurrentChange(e,n,r)),new Xc(ie.min(),s,new Me(me),ur(),ge())}}class el{constructor(e,n,r,s,i){this.resumeToken=e,this.current=n,this.addedDocuments=r,this.modifiedDocuments=s,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,n,r){return new el(r,n,ge(),ge(),ge())}}/**
2326 * @license
2327 * Copyright 2017 Google LLC
2328 *
2329 * Licensed under the Apache License, Version 2.0 (the "License");
2330 * you may not use this file except in compliance with the License.
2331 * You may obtain a copy of the License at
2332 *
2333 *   http://www.apache.org/licenses/LICENSE-2.0
2334 *
2335 * Unless required by applicable law or agreed to in writing, software
2336 * distributed under the License is distributed on an "AS IS" BASIS,
2337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2338 * See the License for the specific language governing permissions and
2339 * limitations under the License.
2340 */class _u{constructor(e,n,r,s){this.Se=e,this.removedTargetIds=n,this.key=r,this.De=s}}class aE{constructor(e,n){this.targetId=e,this.Ce=n}}class lE{constructor(e,n,r=dt.EMPTY_BYTE_STRING,s=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=s}}class uv{constructor(){this.ve=0,this.Fe=cv(),this.Me=dt.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return this.ve!==0}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}
vendor: 7,735 bytes, line 2340
2340ke(){let e=ge(),n=ge(),r=ge();return this.Fe.forEach((s,i)=>{switch(i){case 0:e=e.add(s);break;case 2:n=n.add(s);break;case 1:r=r.add(s);break;default:re(38017,{changeType:i})}}),new el(this.Me,this.xe,e,n,r)}Ke(){this.Oe=!1,this.Fe=cv()}qe(e,n){this.Oe=!0,this.Fe=this.Fe.insert(e,n)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,_e(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class nP{constructor(e){this.Ge=e,this.ze=new Map,this.je=ur(),this.He=Hl(),this.Je=Hl(),this.Ze=new Me(me)}Xe(e){for(const n of e.Se)e.De&&e.De.isFoundDocument()?this.Ye(n,e.De):this.et(n,e.key,e.De);for(const n of e.removedTargetIds)this.et(n,e.key,e.De)}tt(e){this.forEachTarget(e,n=>{const r=this.nt(n);switch(e.state){case 0:this.rt(n)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.Ke(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),r.Le(e.resumeToken));break;default:re(56790,{state:e.state})}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach((r,s)=>{this.rt(s)&&n(s)})}st(e){const n=e.targetId,r=e.Ce.count,s=this.ot(n);if(s){const i=s.target;if(Nf(i))if(r===0){const o=new te(i.path);this.et(n,o,vt.newNoDocument(o,ie.min()))}else _e(r===1,20013,{expectedCount:r});else{const o=this._t(n);if(o!==r){const l=this.ut(e),u=l?this.ct(l,e,o):1;if(u!==0){this.it(n);const h=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,h)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:s=0},hashCount:i=0}=n;let o,l;try{o=Zr(r).toUint8Array()}catch(u){if(u instanceof j1)return Fs("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{l=new dm(o,s,i)}catch(u){return Fs(u instanceof qo?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return l.ge===0?null:l}ct(e,n,r){return n.Ce.count===r-this.Pt(e,n.targetId)?0:2}Pt(e,n){const r=this.Ge.getRemoteKeysForTarget(n);let s=0;return r.forEach(i=>{const o=this.Ge.ht(),l=`projects/${o.projectId}/databases/${o.database}/documents/${i.path.canonicalString()}`;e.mightContain(l)||(this.et(n,i,null),s++)}),s}Tt(e){const n=new Map;this.ze.forEach((i,o)=>{const l=this.ot(o);if(l){if(i.current&&Nf(l.target)){const u=new te(l.target.path);this.It(u).has(o)||this.Et(o,u)||this.et(o,u,vt.newNoDocument(u,e))}i.Be&&(n.set(o,i.ke()),i.Ke())}});let r=ge();this.Je.forEach((i,o)=>{let l=!0;o.forEachWhile(u=>{const h=this.ot(u);return!h||h.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(i))}),this.je.forEach((i,o)=>o.setReadTime(e));const s=new Xc(e,n,this.Ze,this.je,r);return this.je=ur(),this.He=Hl(),this.Je=Hl(),this.Ze=new Me(me),s}Ye(e,n){if(!this.rt(e))return;const r=this.Et(e,n.key)?2:0;this.nt(e).qe(n.key,r),this.je=this.je.insert(n.key,n),this.He=this.He.insert(n.key,this.It(n.key).add(e)),this.Je=this.Je.insert(n.key,this.Rt(n.key).add(e))}et(e,n,r){if(!this.rt(e))return;const s=this.nt(e);this.Et(e,n)?s.qe(n,1):s.Ue(n),this.Je=this.Je.insert(n,this.Rt(n).delete(e)),this.Je=this.Je.insert(n,this.Rt(n).add(e)),r&&(this.je=this.je.insert(n,r))}removeTarget(e){this.ze.delete(e)}_t(e){const n=this.nt(e).ke();return this.Ge.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}$e(e){this.nt(e).$e()}nt(e){let n=this.ze.get(e);return n||(n=new uv,this.ze.set(e,n)),n}Rt(e){let n=this.Je.get(e);return n||(n=new tt(me),this.Je=this.Je.insert(e,n)),n}It(e){let n=this.He.get(e);return n||(n=new tt(me),this.He=this.He.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||J("WatchChangeAggregator","Detected inactive target",e),n}ot(e){const n=this.ze.get(e);return n&&n.Ne?null:this.Ge.At(e)}it(e){this.ze.set(e,new uv),this.Ge.getRemoteKeysForTarget(e).forEach(n=>{this.et(e,n,null)})}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function Hl(){return new Me(te.comparator)}function cv(){return new Me(te.comparator)}const rP={asc:"ASCENDING",desc:"DESCENDING"},sP={"<":"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"},iP={and:"AND",or:"OR"};class oP{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function Pf(t,e){return t.useProto3Json||Hc(e)?e:{value:e}}function ic(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 uE(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function aP(t,e){return ic(t,e.toTimestamp())}function Un(t){return _e(!!t,49232),ie.fromTimestamp(function(n){const r=Jr(n);return new Ne(r.seconds,r.nanos)}(t))}function fm(t,e){return jf(t,e).canonicalString()}function jf(t,e){const n=function(s){return new Te(["projects",s.projectId,"databases",s.database])}(t).child("documents");return e===void 0?n:n.child(e)}function cE(t){const e=Te.fromString(t);return _e(mE(e),10190,{key:e.toString()}),e}function Df(t,e){return fm(t.databaseId,e.path)}function dd(t,e){const n=cE(e);if(n.get(1)!==t.databaseId.projectId)throw new X($.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 X($.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new te(dE(n))}function hE(t,e){return fm(t.databaseId,e)}function lP(t){const e=cE(t);return e.length===4?Te.emptyPath():dE(e)}function Of(t){return new Te(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function dE(t){return _e(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function hv(t,e,n){return{name:Df(t,e),fields:n.value.mapValue.fields}}function uP(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(h){return h==="NO_CHANGE"?0:h==="ADD"?1:h==="REMOVE"?2:h==="CURRENT"?3:h==="RESET"?4:re(39313,{state:h})}(e.targetChange.targetChangeType||"NO_CHANGE"),s=e.targetChange.targetIds||[],i=function(h,f){return h.useProto3Json?(_e(f===void 0||typeof f=="string",58123),dt.fromBase64String(f||"")):(_e(f===void 0||f instanceof Buffer||f instanceof Uint8Array,16193),dt.fromUint8Array(f||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,l=o&&function(h){const f=h.code===void 0?$.UNKNOWN:oE(h.code);return new X(f,h.message||"")}(o);n=new lE(r,s,i,l||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const s=dd(t,r.document.name),i=Un(r.document.updateTime),o=r.document.createTime?Un(r.document.createTime):ie.min(),l=new At({mapValue:{fields:r.document.fields}}),u=vt.newFoundDocument(s,i,o,l),h=r.targetIds||[],f=r.removedTargetIds||[];n=new _u(h,f,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const s=dd(t,r.document),i=r.readTime?Un(r.readTime):ie.min(),o=vt.newNoDocument(s,i),l=r.removedTargetIds||[];n=new _u([],l,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const s=dd(t,r.document),i=r.removedTargetIds||[];n=new _u([],i,s,null)}else{if(!("filter"in e))return re(11601,{Vt:e});{e.filter;const r=e.filter;r.targetId;const{count:s=0,unchangedNames:i}=r,o=new JA(s,i),l=r.targetId;n=new aE(l,o)}}return n}function cP(t,e){let n;if(e instanceof Za)n={update:hv(t,e.key,e.value)};
2340else if(e instanceof cm)n={delete:Df(t,e.key)};else if(e instanceof cs)n={update:hv(t,e.key,e.data),updateMask:_P(e.fieldMask)};else{if(!(e instanceof QA))return re(16599,{dt:e.type});n={verify:Df(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(i,o){const l=o.transform;if(l instanceof Va)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Ma)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof Fa)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof sc)return{fieldPath:o.field.canonicalString(),increment:l.Ae};throw re(20930,{transform:o.transform})}(0,r))),e.precondition.isNone||(n.currentDocument=function(s,i){return i.updateTime!==void 0?{updateTime:aP(s,i.updateTime)}:i.exists!==void 0?{exists:i.exists}:re(27497)}(t,e.precondition)),n}function hP(t,e){return t&&t.length>0?(_e(e!==void 0,14353),t.map(n=>function(s,i){let o=s.updateTime?Un(s.updateTime):Un(i);return o.isEqual(ie.min())&&(o=Un(i)),new qA(o,s.transformResults||[])}(n,e))):[]}function dP(t,e){return{documents:[hE(t,e.path)]}}function fP(t,e){const n={structuredQuery:{}},r=e.path;let s;e.collectionGroup!==null?(s=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(s=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=hE(t,s);const i=function(h){if(h.length!==0)return pE(xn.create(h,"and"))}(e.filters);i&&(n.structuredQuery.where=i);const o=function(h){if(h.length!==0)return h.map(f=>function(g){return{field:ni(g.field),direction:gP(g.dir)}}(f))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const l=Pf(t,e.limit);return l!==null&&(n.structuredQuery.limit=l),e.startAt&&(n.structuredQuery.startAt=function(h){return{before:h.inclusive,values:h.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(h){return{before:!h.inclusive,values:h.position}}(e.endAt)),{ft:n,parent:s}}function pP(t){let e=lP(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let s=null;if(r>0){_e(r===1,65062);const f=n.from[0];f.allDescendants?s=f.collectionId:e=e.child(f.collectionId)}let i=[];n.where&&(i=function(p){const g=fE(p);return g instanceof xn&&z1(g)?g.getFilters():[g]}(n.where));let o=[];n.orderBy&&(o=function(p){return p.map(g=>function(N){return new La(ri(N.field),function(P){switch(P){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(N.direction))}(g))}(n.orderBy));let l=null;n.limit&&(l=function(p){let g;return g=typeof p=="object"?p.value:p,Hc(g)?null:g}(n.limit));let u=null;n.startAt&&(u=function(p){const g=!!p.before,E=p.values||[];return new rc(E,g)}(n.startAt));let h=null;return n.endAt&&(h=function(p){const g=!p.before,E=p.values||[];return new rc(E,g)}(n.endAt)),RA(e,s,o,i,l,"F",u,h)}function mP(t,e){const n=function(s){switch(s){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return re(28987,{purpose:s})}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function fE(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=ri(n.unaryFilter.field);return Ye.create(r,"==",{doubleValue:NaN});case"IS_NULL":const s=ri(n.unaryFilter.field);return Ye.create(s,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const i=ri(n.unaryFilter.field);return Ye.create(i,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=ri(n.unaryFilter.field);return Ye.create(o,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return re(61313);default:return re(60726)}}(t):t.fieldFilter!==void 0?function(n){return Ye.create(ri(n.fieldFilter.field),function(s){switch(s){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";case"OPERATOR_UNSPECIFIED":return re(58110);default:return re(50506)}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return xn.create(n.compositeFilter.filters.map(r=>fE(r)),function(s){switch(s){case"AND":return"and";case"OR":return"or";default:return re(1026)}}(n.compositeFilter.op))}(t):re(30097,{filter:t})}function gP(t){return rP[t]}function yP(t){return sP[t]}function vP(t){return iP[t]}function ni(t){return{fieldPath:t.canonicalString()}}function ri(t){return ut.fromServerFormat(t.fieldPath)}function pE(t){return t instanceof Ye?function(n){if(n.op==="=="){if(J0(n.value))return{unaryFilter:{field:ni(n.field),op:"IS_NAN"}};if(X0(n.value))return{unaryFilter:{field:ni(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(J0(n.value))return{unaryFilter:{field:ni(n.field),op:"IS_NOT_NA
2340N"}};if(X0(n.value))return{unaryFilter:{field:ni(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ni(n.field),op:yP(n.op),value:n.value}}}(t):t instanceof xn?function(n){const r=n.getFilters().map(s=>pE(s));return r.length===1?r[0]:{compositeFilter:{op:vP(n.op),filters:r}}}(t):re(54877,{filter:t})}function _P(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function mE(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function gE(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/**
2341 * @license
2342 * Copyright 2017 Google LLC
2343 *
2344 * Licensed under the Apache License, Version 2.0 (the "License");
2345 * you may not use this file except in compliance with the License.
2346 * You may obtain a copy of the License at
2347 *
2348 *   http://www.apache.org/licenses/LICENSE-2.0
2349 *
2350 * Unless required by applicable law or agreed to in writing, software
2351 * distributed under the License is distributed on an "AS IS" BASIS,
2352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2353 * See the License for the specific language governing permissions and
2354 * limitations under the License.
2355 */class Pr{constructor(e,n,r,s,i=ie.min(),o=ie.min(),l=dt.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=s,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=u}withSequenceNumber(e){return new Pr(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Pr(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Pr(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Pr(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
2356 * @license
2357 * Copyright 2017 Google LLC
2358 *
2359 * Licensed under the Apache License, Version 2.0 (the "License");
2360 * you may not use this file except in compliance with the License.
2361 * You may obtain a copy of the License at
2362 *
2363 *   http://www.apache.org/licenses/LICENSE-2.0
2364 *
2365 * Unless required by applicable law or agreed to in writing, software
2366 * distributed under the License is distributed on an "AS IS" BASIS,
2367 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2368 * See the License for the specific language governing permissions and
2369 * limitations under the License.
2370 */class wP{constructor(e){this.yt=e}}function xP(t){const e=pP({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?Af(e,e.limit,"L"):e}/**
2371 * @license
2372 * Copyright 2019 Google LLC
2373 *
2374 * Licensed under the Apache License, Version 2.0 (the "License");
2375 * you may not use this file except in compliance with the License.
2376 * You may obtain a copy of the License at
2377 *
2378 *   http://www.apache.org/licenses/LICENSE-2.0
2379 *
2380 * Unless required by applicable law or agreed to in writing, software
2381 * distributed under the License is distributed on an "AS IS" BASIS,
2382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2383 * See the License for the specific language governing permissions and
2384 * limitations under the License.
2385 */class EP{constructor(){this.Sn=new TP}addToCollectionParentIndex(e,n){return this.Sn.add(n),z.resolve()}getCollectionParents(e,n){return z.resolve(this.Sn.getEntries(n))}addFieldIndex(e,n){return z.resolve()}deleteFieldIndex(e,n){return z.resolve()}deleteAllFieldIndexes(e){return z.resolve()}createTargetIndexes(e,n){return z.resolve()}getDocumentsMatchingTarget(e,n){return z.resolve(null)}getIndexType(e,n){return z.resolve(0)}getFieldIndexes(e,n){return z.resolve([])}getNextCollectionGroupToUpdate(e){return z.resolve(null)}getMinOffset(e,n){return z.resolve(Xr.min())}getMinOffsetFromCollectionGroup(e,n){return z.resolve(Xr.min())}updateCollectionGroup(e,n,r){return z.resolve()}updateIndexEntries(e,n){return z.resolve()}}class TP{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n]||new tt(Te.comparator),i=!s.has(r);return this.index[n]=s.add(r),i}has(e){const n=e.lastSegment(),r=e.popLast(),s=this.index[n];return s&&s.has(r)}getEntries(e){return(this.index[e]||new tt(Te.comparator)).toArray()}}/**
2386 * @license
2387 * Copyright 2018 Google LLC
2388 *
2389 * Licensed under the Apache License, Version 2.0 (the "License");
2390 * you may not use this file except in compliance with the License.
2391 * You may obtain a copy of the License at
2392 *
2393 *   http://www.apache.org/licenses/LICENSE-2.0
2394 *
2395 * Unless required by applicable law or agreed to in writing, software
2396 * distributed under the License is distributed on an "AS IS" BASIS,
2397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2398 * See the License for the specific language governing permissions and
2399 * limitations under the License.
2400 */const dv={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},yE=41943040;class Nt{static withCacheSize(e){return new Nt(e,Nt.DEFAULT_COLLECTION_PERCENTILE,Nt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=r}}/**
2401 * @license
2402 * Copyright 2017 Google LLC
2403 *
2404 * Licensed under the Apache License, Version 2.0 (the "License");
2405 * you may not use this file except in compliance with the License.
2406 * You may obtain a copy of the License at
2407 *
2408 *   http://www.apache.org/licenses/LICENSE-2.0
2409 *
2410 * Unless required by applicable law or agreed to in writing, software
2411 * distributed under the License is distributed on an "AS IS" BASIS,
2412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2413 * See the License for the specific language governing permissions and
2414 * limitations under the License.
2415 */Nt.DEFAULT_COLLECTION_PERCENTILE=10,Nt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,Nt.DEFAULT=new Nt(yE,Nt.DEFAULT_COLLECTION_PERCENTILE,Nt.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),Nt.DISABLED=new Nt(-1,0,0);/**
2416 * @license
2417 * Copyright 2017 Google LLC
2418 *
2419 * Licensed under the Apache License, Version 2.0 (the "License");
2420 * you may not use this file except in compliance with the License.
2421 * You may obtain a copy of the License at
2422 *
2423 *   http://www.apache.org/licenses/LICENSE-2.0
2424 *
2425 * Unless required by applicable law or agreed to in writing, software
2426 * distributed under the License is distributed on an "AS IS" BASIS,
2427 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2428 * See the License for the specific language governing permissions and
2429 * limitations under the License.
2430 */class Fi{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new Fi(0)}static ar(){return new Fi(-1)}}/**
2431 * @license
2432 * Copyright 2020 Google LLC
2433 *
2434 * Licensed under the Apache License, Version 2.0 (the "License");
2435 * you may not use this file except in compliance with the License.
2436 * You may obtain a copy of the License at
2437 *
2438 *   http://www.apache.org/licenses/LICENSE-2.0
2439 *
2440 * Unless required by applicable law or agreed to in writing, software
2441 * distributed under the License is distributed on an "AS IS" BASIS,
2442 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2443 * See the License for the specific language governing permissions and
2444 * limitations under the License.
2445 */const fv="LruGarbageCollector",IP=1048576;function pv([t,e],[n,r]){const s=me(t,n);return s===0?me(e,r):s}class bP{constructor(e){this.Pr=e,this.buffer=new tt(pv),this.Tr=0}Ir(){return++this.Tr}Er(e){const n=[e,this.Ir()];if(this.buffer.size<this.Pr)this.buffer=this.buffer.add(n);else{const r=this.buffer.last();pv(n,r)<0&&(this.buffer=this.buffer.delete(r).add(n))}}get maxValue(){return this.buffer.last()[0]}}class SP{constructor(e,n,r){this.garbageCollector=e,this.asyncQueue=n,this.localStore=r,this.Rr=null}start(){this.garbageCollector.params.cacheSizeCollectionThreshold!==-1&&this.Ar(6e4)}stop(){this.Rr&&(this.Rr.cancel(),this.Rr=null)}get started(){return this.Rr!==null}Ar(e){J(fv,`Garbage collection scheduled in ${e}ms`),this.Rr=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Rr=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(n){ro(n)?J(fv,"Ignoring IndexedDB error during garbage collection: ",n):await no(n)}await this.Ar(3e5)})}}class CP{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next(r=>Math.floor(n/100*r))}nthSequenceNumber(e,n){if(n===0)return z.resolve(zc.ce);const r=new bP(n);return this.Vr.forEachTarget(e,s=>r.Er(s.sequenceNumber)).next(()=>this.Vr.mr(e,s=>r.Er(s))).next(()=>r.maxValue)}removeTargets(e,n,r){return this.Vr.removeTargets(e,n,r)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(J("LruGarbageCollector","Garbage collection skipped; disabled"),z.resolve(dv)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(J("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),dv):this.gr(e,n))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,n){let r,s,i,o,l,u,h;const f=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(p=>(p>this.params.maximumSequenceNumbersToCollect?(J("LruGarbageCollector",`C
2445apping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${p}`),s=this.params.maximumSequenceNumbersToCollect):s=p,o=Date.now(),this.nthSequenceNumber(e,s))).next(p=>(r=p,l=Date.now(),this.removeTargets(e,r,n))).next(p=>(i=p,u=Date.now(),this.removeOrphanedDocuments(e,r))).next(p=>(h=Date.now(),ei()<=pe.DEBUG&&J("LruGarbageCollector",`LRU Garbage Collection
2446	Counted targets in ${o-f}ms
2447	Determined least recently used ${s} in `+(l-o)+`ms
2448	Removed ${i} targets in `+(u-l)+`ms
2449	Removed ${p} documents in `+(h-u)+`ms
2450Total Duration: ${h-f}ms`),z.resolve({didRun:!0,sequenceNumbersCollected:s,targetsRemoved:i,documentsRemoved:p})))}}function kP(t,e){return new CP(t,e)}/**
2451 * @license
2452 * Copyright 2017 Google LLC
2453 *
2454 * Licensed under the Apache License, Version 2.0 (the "License");
2455 * you may not use this file except in compliance with the License.
2456 * You may obtain a copy of the License at
2457 *
2458 *   http://www.apache.org/licenses/LICENSE-2.0
2459 *
2460 * Unless required by applicable law or agreed to in writing, software
2461 * distributed under the License is distributed on an "AS IS" BASIS,
2462 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2463 * See the License for the specific language governing permissions and
2464 * limitations under the License.
2465 */class NP{constructor(){this.changes=new qs(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,vt.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?z.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(){}}/**
2466 * @license
2467 * Copyright 2017 Google LLC
2468 *
2469 * Licensed under the Apache License, Version 2.0 (the "License");
2470 * you may not use this file except in compliance with the License.
2471 * You may obtain a copy of the License at
2472 *
2473 *   http://www.apache.org/licenses/LICENSE-2.0
2474 *
2475 * Unless required by applicable law or agreed to in writing, software
2476 * distributed under the License is distributed on an "AS IS" BASIS,
2477 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2478 * See the License for the specific language governing permissions and
2479 * limitations under the License.
2480 *//**
2481 * @license
2482 * Copyright 2022 Google LLC
2483 *
2484 * Licensed under the Apache License, Version 2.0 (the "License");
2485 * you may not use this file except in compliance with the License.
2486 * You may obtain a copy of the License at
2487 *
2488 *   http://www.apache.org/licenses/LICENSE-2.0
2489 *
2490 * Unless required by applicable law or agreed to in writing, software
2491 * distributed under the License is distributed on an "AS IS" BASIS,
2492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2493 * See the License for the specific language governing permissions and
2494 * limitations under the License.
2495 */class RP{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
2496 * @license
2497 * Copyright 2017 Google LLC
2498 *
2499 * Licensed under the Apache License, Version 2.0 (the "License");
2500 * you may not use this file except in compliance with the License.
2501 * You may obtain a copy of the License at
2502 *
2503 *   http://www.apache.org/licenses/LICENSE-2.0
2504 *
2505 * Unless required by applicable law or agreed to in writing, software
2506 * distributed under the License is distributed on an "AS IS" BASIS,
2507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2508 * See the License for the specific language governing permissions and
2509 * limitations under the License.
2510 */class AP{constructor(e,n,r,s){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=s}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(s=>(r=s,this.remoteDocumentCache.getEntry(e,n))).next(s=>(r!==null&&la(r.mutation,s,$t.empty(),Ne.now()),s))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,ge()).next(()=>r))}getLocalViewOfDocuments(e,n,r=ge()){const s=Ts();return this.populateOverlays(e,s,n).next(()=>this.computeViews(e,n,s,r).next(i=>{let o=Wo();
2510return i.forEach((l,u)=>{o=o.insert(l,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=Ts();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,ge()))}populateOverlays(e,n,r){const s=[];return r.forEach(i=>{n.has(i)||s.push(i)}),this.documentOverlayCache.getOverlays(e,s).next(i=>{i.forEach((o,l)=>{n.set(o,l)})})}computeViews(e,n,r,s){let i=ur();const o=aa(),l=function(){return aa()}();return n.forEach((u,h)=>{const f=r.get(h.key);s.has(h.key)&&(f===void 0||f.mutation instanceof cs)?i=i.insert(h.key,h):f!==void 0?(o.set(h.key,f.mutation.getFieldMask()),la(f.mutation,h,f.mutation.getFieldMask(),Ne.now())):o.set(h.key,$t.empty())}),this.recalculateAndSaveOverlays(e,i).next(u=>(u.forEach((h,f)=>o.set(h,f)),n.forEach((h,f)=>l.set(h,new RP(f,o.get(h)??null))),l))}recalculateAndSaveOverlays(e,n){const r=aa();let s=new Me((o,l)=>o-l),i=ge();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const l of o)l.keys().forEach(u=>{const h=n.get(u);if(h===null)return;let f=r.get(u)||$t.empty();f=l.applyToLocalView(h,f),r.set(u,f);const p=(s.get(l.batchId)||ge()).add(u);s=s.insert(l.batchId,p)})}).next(()=>{const o=[],l=s.getReverseIterator();for(;l.hasNext();){const u=l.getNext(),h=u.key,f=u.value,p=J1();f.forEach(g=>{if(!i.has(g)){const E=sE(n.get(g),r.get(g));E!==null&&p.set(g,E),i=i.add(g)}}),o.push(this.documentOverlayCache.saveOverlays(e,h,p))}return z.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,s){return AA(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):G1(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,s):this.getDocumentsMatchingCollectionQuery(e,n,r,s)}getNextDocuments(e,n,r,s){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,s).next(i=>{const o=s-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,s-i.size):z.resolve(Ts());let l=Pa,u=i;return o.next(h=>z.forEach(h,(f,p)=>(l<p.largestBatchId&&(l=p.largestBatchId),i.get(f)?z.resolve():this.remoteDocumentCache.getEntry(e,f).next(g=>{u=u.insert(f,g)}))).next(()=>this.populateOverlays(e,h,i)).next(()=>this.computeViews(e,u,h,ge())).next(f=>({batchId:l,changes:X1(f)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new te(n)).next(r=>{let s=Wo();return r.isFoundDocument()&&(s=s.insert(r.key,r)),s})}getDocumentsMatchingCollectionGroupQuery(e,n,r,s){const i=n.collectionGroup;let o=Wo();return this.indexManager.getCollectionParents(e,i).next(l=>z.forEach(l,u=>{const h=function(p,g){return new so(g,null,p.explicitOrderBy.slice(),p.filters.slice(),p.limit,p.limitType,p.startAt,p.endAt)}(n,u.child(i));return this.getDocumentsMatchingCollectionQuery(e,h,r,s).next(f=>{f.forEach((p,g)=>{o=o.insert(p,g)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,s){let i;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(i=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,i,s))).next(o=>{i.forEach((u,h)=>{const f=h.getKey();o.get(f)===null&&(o=o.insert(f,vt.newInvalidDocument(f)))});let l=Wo();return o.forEach((u,h)=>{const f=i.get(u);f!==void 0&&la(f.mutation,h,$t.empty(),Ne.now()),Kc(n,h)&&(l=l.insert(u,h))}),l})}}/**
2511 * @license
2512 * Copyright 2020 Google LLC
2513 *
2514 * Licensed under the Apache License, Version 2.0 (the "License");
2515 * you may not use this file except in compliance with the License.
2516 * You may obtain a copy of the License at
2517 *
2518 *   http://www.apache.org/licenses/LICENSE-2.0
2519 *
2520 * Unless required by applicable law or agreed to in writing, software
2521 * distributed under the License is distributed on an "AS IS" BASIS,
2522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2523 * See the License for the specific language governing permissions and
2524 * limitations under the License.
2525 */class PP{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return z.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,function(s){return{id:s.id,version:s.version,createTime:Un(s.createTime)}}(n)),z.resolve()}getNamedQuery(e,n){return z.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,function(s){return{name:s.name,query:xP(s.bundledQuery),readTime:Un(s.readTime)}}(n)),z.resolve()}}/**
2526 * @license
2527 * Copyright 2022 Google LLC
2528 *
2529 * Licensed under the Apache License, Version 2.0 (the "License");
2530 * you may not use this file except in compliance with the License.
2531 * You may obtain a copy of the License at
2532 *
2533 *   http://www.apache.org/licenses/LICENSE-2.0
2534 *
2535 * Unless required by applicable law or agreed to in writing, software
2536 * distributed under the License is distributed on an "AS IS" BASIS,
2537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2538 * See the License for the specific language governing permissions and
2539 * limitations under the License.
2540 */class jP{constructor(){this.overlays=new Me(te.comparator),this.Lr=new Map}getOverlay(e,n){return z.resolve(this.overlays.get(n))}getOverlays(e,n){const r=Ts();return z.forEach(n,s=>this.getOverlay(e,s).next(i=>{i!==null&&r.set(s,i)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((s,i)=>{this.bt(e,n,i)}),z.resolve()}removeOverlaysForBatchId(e,n,r){const s=this.Lr.get(r);return s!==void 0&&(s.forEach(i=>this.overlays=this.overlays.remove(i)),this.Lr.delete(r)),z.resolve()}getOverlaysForCollection(e,n,r){const s=Ts(),i=n.length+1,o=new te(n.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){const u=l.getNext().value,h=u.getKey();if(!n.isPrefixOf(h.path))break;h.path.length===i&&u.largestBatchId>r&&s.set(u.getKey(),u)}return z.resolve(s)}getOverlaysForCollectionGroup(e,n,r,s){let i=new Me((h,f)=>h-f);const o=this.overlays.getIterator();for(;o.hasNext();){const h=o.getNext().value;if(h.getKey().getCollectionGroup()===n&&h.largestBatchId>r){let f=i.get(h.largestBatchId);f===null&&(f=Ts(),i=i.insert(h.largestBatchId,f)),f.set(h.getKey(),h)}}const l=Ts(),u=i.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((h,f)=>l.set(h,f)),!(l.size()>=s)););return z.resolve(l)}bt(e,n,r){const s=this.overlays.get(r.key);if(s!==null){const o=this.Lr.get(s.largestBatchId).delete(r.key);this.Lr.set(s.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new XA(n,r));let i=this.Lr.get(n);i===void 0&&(i=ge(),this.Lr.set(n,i)),this.Lr.set(n,i.add(r.key))}}/**
2541 * @license
2542 * Copyright 2024 Google LLC
2543 *
2544 * Licensed under the Apache License, Version 2.0 (the "License");
2545 * you may not use this file except in compliance with the License.
2546 * You may obtain a copy of the License at
2547 *
2548 *   http://www.apache.org/licenses/LICENSE-2.0
2549 *
2550 * Unless required by applicable law or agreed to in writing, software
2551 * distributed under the License is distributed on an "AS IS" BASIS,
2552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2553 * See the License for the specific language governing permissions and
2554 * limitations under the License.
2555 */class DP{constructor(){this.sessionToken=dt.EMPTY_BYTE_STRING}getSessionToken(e){return z.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,z.resolve()}}/**
2556 * @license
2557 * Copyright 2017 Google LLC
2558 *
2559 * Licensed under the Apache License, Version 2.0 (the "License");
2560 * you may not use this file except in compliance with the License.
2561 * You may obtain a copy of the License at
2562 *
2563 *   http://www.apache.org/licenses/LICENSE-2.0
2564 *
2565 * Unless required by applicable law or agreed to in writing, software
2566 * distributed under the License is distributed on an "AS IS" BASIS,
2567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2568 * See the License for the specific language governing permissions and
2569 * limitations under the License.
2570 */class pm{constructor(){this.kr=new tt(rt.Kr),this.qr=new tt(rt.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const r=new rt(e,n);this.kr=this.kr.add(r),this.qr=this.qr.add(r)}$r(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Wr(new rt(e,n))}Qr(e,n){e.forEach(r=>this.removeReference(r,n))}Gr(e){const n=new te(new Te([])),r=new rt(n,e),s=new rt(n,e+1),i=[];return this.qr.forEachInRange([r,s],o=>{this.Wr(o),i.push(o.key)}),i}zr(){this.kr.forEach(e=>this.Wr(e))}Wr(e){this.kr=this.kr.delete(e),this.qr=this.qr.delete(e)}jr(e){const n=new te(new Te([])),r=new rt(n,e),s=new rt(n,e+1);let i=ge();return this.qr.forEachInRange([r,s],o=>{i=i.add(o.key)}),i}containsKey(e){const n=new rt(e,0),r=this.kr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class rt{constructor(e,n){this.key=e,this.Hr=n}static Kr(e,n){return te.comparator(e.key,n.key)||me(e.Hr,n.Hr)}static Ur(e,n){return me(e.Hr,n.Hr)||te.comparator(e.key,n.key)}}/**
2571 * @license
2572 * Copyright 2017 Google LLC
2573 *
2574 * Licensed under the Apache License, Version 2.0 (the "License");
2575 * you may not use this file except in compliance with the License.
2576 * You may obtain a copy of the License at
2577 *
2578 *   http://www.apache.org/licenses/LICENSE-2.0
2579 *
2580 * Unless required by applicable law or agreed to in writing, software
2581 * distributed under the License is distributed on an "AS IS" BASIS,
2582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2583 * See the License for the specific language governing permissions and
2584 * limitations under the License.
2585 */class OP{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Jr=new tt(rt.Kr)}checkEmpty(e){return z.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,s){const i=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new YA(i,n,r,s);this.mutationQueue.push(o);for(const l of s)this.Jr=this.Jr.add(new rt(l.key,i)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return z.resolve(o)}lookupMutationBatch(e,n){return z.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,s=this.Xr(r),i=s<0?0:s;return z.resolve(this.mutationQueue.length>i?this.mutationQueue[i]:null)}getHighestUnacknowledgedBatchId(){return z.resolve(this.mutationQueue.length===0?sm:this.Yn-1)}getAllMutationBatches(e){return z.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new rt(n,0),s=new rt(n,Number.POSITIVE_INFINITY),i=[];return this.Jr.forEachInRange([r,s],o=>{const l=this.Zr(o.Hr);i.push(l)}),z.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new tt(me);return n.forEach(s=>{const i=new rt(s,0),o=new rt(s,Number.POSITIVE_INFINITY);this.Jr.forEachInRange([i,o],l=>{r=r.add(l.Hr)})}),z.resolve(this.Yr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,s=r.length+1;let i=r;te.isDocumentKey(i)||(i=i.child(""));const o=new rt(new te(i),0);let l=new tt(me);return this.Jr.forEachWhile(u=>{const h=u.key.path;return!!r.isPrefixOf(h)&&(h.length===s&&(l=l.add(u.Hr)),!0)},o),z.resolve(this.Yr(l))}Yr(e){const n=[];return e.forEach(r=>{const s=this.Zr(r);s!==null&&n.push(s)}),n}removeMutationBatch(e,n){_e(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let r=this.Jr;return z.forEach(n.mutations,s=>{const i=new rt(s.key,n.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,s.key)}).next(()=>{this.Jr=r})}nr(e){}containsKey(e,n){const r=new rt(n,0),s=this.Jr.firstAfterOrEqual(r);return z.resolve(n.isEqual(s&&s.key))}performConsistencyCheck(e){return this.mutationQueue.length,z.resolve()}ei(e,n){return this.Xr(e)}Xr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Zr(e){const n=this.Xr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
2586 * @license
2587 * Copyright 2017 Google LLC
2588 *
2589 * Licensed under the Apache License, Version 2.0 (the "License");
2590 * you may not use this file except in compliance with the License.
2591 * You may obtain a copy of the License at
2592 *
2593 *   http://www.apache.org/licenses/LICENSE-2.0
2594 *
2595 * Unless required by applicable law or agreed to in writing, software
2596 * distributed under the License is distributed on an "AS IS" BASIS,
2597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2598 * See the License for the specific language governing permissions and
2599 * limitations under the License.
2600 */class LP{constructor(e){this.ti=e,this.docs=function(){return new Me(te.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,s=this.docs.get(r),i=s?s.size:0,o=this.ti(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-i,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 z.resolve(r?r.document.mutableCopy():vt.newInvalidDocument(n))}getEntries(e,n){let r=ur();return n.forEach(s=>{const i=this.docs.get(s);r=r.insert(s,i?i.document.mutableCopy():vt.newInvalidDocument(s))}),z.resolve(r)}
vendor: 9,663 bytes, lines 2600-2664
2600getDocumentsMatchingQuery(e,n,r,s){let i=ur();const o=n.path,l=new te(o.child("__id-9223372036854775808__")),u=this.docs.getIteratorFrom(l);for(;u.hasNext();){const{key:h,value:{document:f}}=u.getNext();if(!o.isPrefixOf(h.path))break;h.path.length>o.length+1||aA(oA(f),r)<=0||(s.has(f.key)||Kc(n,f))&&(i=i.insert(f.key,f.mutableCopy()))}return z.resolve(i)}getAllFromCollectionGroup(e,n,r,s){re(9500)}ni(e,n){return z.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new VP(this)}getSize(e){return z.resolve(this.size)}}class VP extends NP{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach((r,s)=>{s.isValidDocument()?n.push(this.Mr.addEntry(e,s)):this.Mr.removeEntry(r)}),z.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/**
2601 * @license
2602 * Copyright 2017 Google LLC
2603 *
2604 * Licensed under the Apache License, Version 2.0 (the "License");
2605 * you may not use this file except in compliance with the License.
2606 * You may obtain a copy of the License at
2607 *
2608 *   http://www.apache.org/licenses/LICENSE-2.0
2609 *
2610 * Unless required by applicable law or agreed to in writing, software
2611 * distributed under the License is distributed on an "AS IS" BASIS,
2612 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2613 * See the License for the specific language governing permissions and
2614 * limitations under the License.
2615 */class MP{constructor(e){this.persistence=e,this.ri=new qs(n=>am(n),lm),this.lastRemoteSnapshotVersion=ie.min(),this.highestTargetId=0,this.ii=0,this.si=new pm,this.targetCount=0,this.oi=Fi._r()}forEachTarget(e,n){return this.ri.forEach((r,s)=>n(s)),z.resolve()}getLastRemoteSnapshotVersion(e){return z.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return z.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),z.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.ii&&(this.ii=n),z.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new Fi(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,z.resolve()}updateTargetData(e,n){return this.lr(n),z.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,z.resolve()}removeTargets(e,n,r){let s=0;const i=[];return this.ri.forEach((o,l)=>{l.sequenceNumber<=n&&r.get(l.targetId)===null&&(this.ri.delete(o),i.push(this.removeMatchingKeysForTargetId(e,l.targetId)),s++)}),z.waitFor(i).next(()=>s)}getTargetCount(e){return z.resolve(this.targetCount)}getTargetData(e,n){const r=this.ri.get(n)||null;return z.resolve(r)}addMatchingKeys(e,n,r){return this.si.$r(n,r),z.resolve()}removeMatchingKeys(e,n,r){this.si.Qr(n,r);const s=this.persistence.referenceDelegate,i=[];return s&&n.forEach(o=>{i.push(s.markPotentiallyOrphaned(e,o))}),z.waitFor(i)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),z.resolve()}getMatchingKeysForTargetId(e,n){const r=this.si.jr(n);return z.resolve(r)}containsKey(e,n){return z.resolve(this.si.containsKey(n))}}/**
2616 * @license
2617 * Copyright 2017 Google LLC
2618 *
2619 * Licensed under the Apache License, Version 2.0 (the "License");
2620 * you may not use this file except in compliance with the License.
2621 * You may obtain a copy of the License at
2622 *
2623 *   http://www.apache.org/licenses/LICENSE-2.0
2624 *
2625 * Unless required by applicable law or agreed to in writing, software
2626 * distributed under the License is distributed on an "AS IS" BASIS,
2627 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2628 * See the License for the specific language governing permissions and
2629 * limitations under the License.
2630 */class vE{constructor(e,n){this._i={},this.overlays={},this.ai=new zc(0),this.ui=!1,this.ui=!0,this.ci=new DP,this.referenceDelegate=e(this),this.li=new MP(this),this.indexManager=new EP,this.remoteDocumentCache=function(s){return new LP(s)}(r=>this.referenceDelegate.hi(r)),this.serializer=new wP(n),this.Pi=new PP(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ui=!1,Promise.resolve()}get started(){return this.ui}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new jP,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this._i[e.toKey()];return r||(r=new OP(n,this.referenceDelegate),this._i[e.toKey()]=r),r}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,r){J("MemoryPersistence","Starting transaction:",e);const s=new FP(this.ai.next());return this.referenceDelegate.Ti(),r(s).next(i=>this.referenceDelegate.Ii(s).next(()=>i)).toPromise().then(i=>(s.raiseOnCommittedEvent(),i))}Ei(e,n){return z.or(Object.values(this._i).map(r=>()=>r.containsKey(e,n)))}}class FP extends uA{constructor(e){super(),this.currentSequenceNumber=e}}class mm{constructor(e){this.persistence=e,this.Ri=new pm,this.Ai=null}static Vi(e){return new mm(e)}get di(){if(this.Ai)return this.Ai;throw re(60996)}addReference(e,n,r){return this.Ri.addReference(r,n),this.di.delete(r.toString()),z.resolve()}removeReference(e,n,r){return this.Ri.removeReference(r,n),this.di.add(r.toString()),z.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),z.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach(s=>this.di.add(s.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(s=>{s.forEach(i=>this.di.add(i.toString()))}).next(()=>r.removeTargetData(e,n))}Ti(){this.Ai=new Set}Ii(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return z.forEach(this.di,r=>{const s=te.fromPath(r);return this.mi(e,s).next(i=>{i||n.removeEntry(s,ie.min())})}).next(()=>(this.Ai=null,n.apply(e)))}updateLimboDocument(e,n){return this.mi(e,n).next(r=>{r?this.di.delete(n.toString()):this.di.add(n.toString())})}hi(e){return 0}mi(e,n){return z.or([()=>z.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ei(e,n)])}}class oc{constructor(e,n){this.persistence=e,this.fi=new qs(r=>dA(r.path),(r,s)=>r.isEqual(s)),this.garbageCollector=kP(this,n)}static Vi(e,n){return new oc(e,n)}Ti(){}Ii(e){return z.resolve()}forEachTarget(e,n){return this.persistence.getTargetCache().forEachTarget(e,n)}dr(e){const n=this.pr(e);return this.persistence.getTargetCache().getTargetCount(e).next(r=>n.next(s=>r+s))}pr(e){let n=0;return this.mr(e,r=>{n++}).next(()=>n)}mr(e,n){return z.forEach(this.fi,(r,s)=>this.wr(e,r,s).next(i=>i?z.resolve():n(s)))}removeTargets(e,n,r){return this.persistence.getTargetCache().removeTargets(e,n,r)}removeOrphanedDocuments(e,n){let r=0;const s=this.persistence.getRemoteDocumentCache(),i=s.newChangeBuffer();return s.ni(e,o=>this.wr(e,o,n).next(l=>{l||(r++,i.removeEntry(o,ie.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),z.resolve()}removeTarget(e,n){const r=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),z.resolve()}removeReference(e,n,r){return this.fi.set(r,e.currentSequenceNumber),z.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),z.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=gu(e.data.value)),n}wr(e,n,r){return z.or([()=>this.persistence.Ei(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const s=this.fi.get(n);return z.resolve(s!==void 0&&s>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
2631 * @license
2632 * Copyright 2017 Google LLC
2633 *
2634 * Licensed under the Apache License, Version 2.0 (the "License");
2635 * you may not use this file except in compliance with the License.
2636 * You may obtain a copy of the License at
2637 *
2638 *   http://www.apache.org/licenses/LICENSE-2.0
2639 *
2640 * Unless required by applicable law or agreed to in writing, software
2641 * distributed under the License is distributed on an "AS IS" BASIS,
2642 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2643 * See the License for the specific language governing permissions and
2644 * limitations under the License.
2645 */class gm{constructor(e,n,r,s){this.targetId=e,this.fromCache=n,this.Ts=r,this.Is=s}static Es(e,n){let r=ge(),s=ge();for(const i of n.docChanges)switch(i.type){case 0:r=r.add(i.doc.key);break;case 1:s=s.add(i.doc.key)}return new gm(e,n.fromCache,r,s)}}/**
2646 * @license
2647 * Copyright 2023 Google LLC
2648 *
2649 * Licensed under the Apache License, Version 2.0 (the "License");
2650 * you may not use this file except in compliance with the License.
2651 * You may obtain a copy of the License at
2652 *
2653 *   http://www.apache.org/licenses/LICENSE-2.0
2654 *
2655 * Unless required by applicable law or agreed to in writing, software
2656 * distributed under the License is distributed on an "AS IS" BASIS,
2657 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2658 * See the License for the specific language governing permissions and
2659 * limitations under the License.
2660 */class UP{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
2661 * @license
2662 * Copyright 2019 Google LLC
2663 *
2664 * Licensed under the Apache License, Version 2.0 (the "License");
2665 * you may not use this file except in compliance with the License.
2666 * You may obtain a copy of the License at
2667 *
2668 *   http://www.apache.org/licenses/LICENSE-2.0
2669 *
2670 * Unless required by applicable law or agreed to in writing, software
2671 * distributed under the License is distributed on an "AS IS" BASIS,
2672 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2673 * See the License for the specific language governing permissions and
2674 * limitations under the License.
2675 */class $P{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=function(){return gC()?8:cA(xt())>0?6:4}()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,r,s){const i={result:null};return this.gs(e,n).next(o=>{i.result=o}).next(()=>{if(!i.result)return this.ps(e,n,s,r).next(o=>{i.result=o})}).next(()=>{if(i.result)return;const o=new UP;return this.ys(e,n,o).next(l=>{if(i.result=l,this.As)return this.ws(e,n,o,l.size)})}).next(()=>i.result)}ws(e,n,r,s){return r.documentReadCount<this.Vs?(ei()<=pe.DEBUG&&J("QueryEngine","SDK will not create cache indexes for query:",ti(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),z.resolve()):(ei()<=pe.DEBUG&&J("QueryEngine","Query:",ti(n),"scans",r.documentReadCount,"local documents and returns",s,"documents as results."),r.documentReadCount>this.ds*s?(ei()<=pe.DEBUG&&J("QueryEngine","The SDK decides to create cache indexes for query:",ti(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,Fn(n))):z.resolve())}gs(e,n){if(nv(n))return z.resolve(null);let r=Fn(n);return this.indexManager.getIndexType(e,r).next(s=>s===0?null:(n.limit!==null&&s===1&&(n=Af(n,null,"F"),r=Fn(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(i=>{const o=ge(...i);return this.fs.getDocuments(e,o).next(l=>this.indexManager.getMinOffset(e,r).next(u=>{const h=this.bs(n,l);return this.Ss(n,h,o,u.readTime)?this.gs(e,Af(n,null,"F")):this.Ds(e,h,n,u)}))})))}
2675ps(e,n,r,s){return nv(n)||s.isEqual(ie.min())?z.resolve(null):this.fs.getDocuments(e,r).next(i=>{const o=this.bs(n,i);return this.Ss(n,o,r,s)?z.resolve(null):(ei()<=pe.DEBUG&&J("QueryEngine","Re-using previous result from %s to execute query: %s",s.toString(),ti(n)),this.Ds(e,o,n,iA(s,Pa)).next(l=>l))})}bs(e,n){let r=new tt(Q1(e));return n.forEach((s,i)=>{Kc(e,i)&&(r=r.add(i))}),r}Ss(e,n,r,s){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const i=e.limitType==="F"?n.last():n.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(s)>0)}ys(e,n,r){return ei()<=pe.DEBUG&&J("QueryEngine","Using full collection scan to execute query:",ti(n)),this.fs.getDocumentsMatchingQuery(e,n,Xr.min(),r)}Ds(e,n,r,s){return this.fs.getDocumentsMatchingQuery(e,r,s).next(i=>(n.forEach(o=>{i=i.insert(o.key,o)}),i))}}/**
2676 * @license
2677 * Copyright 2020 Google LLC
2678 *
2679 * Licensed under the Apache License, Version 2.0 (the "License");
2680 * you may not use this file except in compliance with the License.
2681 * You may obtain a copy of the License at
2682 *
2683 *   http://www.apache.org/licenses/LICENSE-2.0
2684 *
2685 * Unless required by applicable law or agreed to in writing, software
2686 * distributed under the License is distributed on an "AS IS" BASIS,
2687 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2688 * See the License for the specific language governing permissions and
2689 * limitations under the License.
2690 */const ym="LocalStore",BP=3e8;class zP{constructor(e,n,r,s){this.persistence=e,this.Cs=n,this.serializer=s,this.vs=new Me(me),this.Fs=new qs(i=>am(i),lm),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(r)}Os(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new AP(this.xs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.xs.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.vs))}}function HP(t,e,n,r){return new zP(t,e,n,r)}async function _E(t,e){const n=ae(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let s;
2690return n.mutationQueue.getAllMutationBatches(r).next(i=>(s=i,n.Os(e),n.mutationQueue.getAllMutationBatches(r))).next(i=>{const o=[],l=[];let u=ge();for(const h of s){o.push(h.batchId);for(const f of h.mutations)u=u.add(f.key)}for(const h of i){l.push(h.batchId);for(const f of h.mutations)u=u.add(f.key)}return n.localDocuments.getDocuments(r,u).next(h=>({Ns:h,removedBatchIds:o,addedBatchIds:l}))})})}function WP(t,e){const n=ae(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const s=e.batch.keys(),i=n.xs.newChangeBuffer({trackRemovals:!0});return function(l,u,h,f){const p=h.batch,g=p.keys();let E=z.resolve();return g.forEach(N=>{E=E.next(()=>f.getEntry(u,N)).next(A=>{const P=h.docVersions.get(N);_e(P!==null,48541),A.version.compareTo(P)<0&&(p.applyToRemoteDocument(A,h),A.isValidDocument()&&(A.setReadTime(h.commitVersion),f.addEntry(A)))})}),E.next(()=>l.mutationQueue.removeMutationBatch(u,p))}(n,r,e,i).next(()=>i.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,s,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(l){let u=ge();for(let h=0;h<l.mutationResults.length;++h)l.mutationResults[h].transformResults.length>0&&(u=u.add(l.batch.mutations[h].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,s))})}function wE(t){const e=ae(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.li.getLastRemoteSnapshotVersion(n))}function qP(t,e){const n=ae(t),r=e.snapshotVersion;let s=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{const o=n.xs.newChangeBuffer({trackRemovals:!0});s=n.vs;const l=[];
vendor: 4,404 bytes, lines 2690-2694
2690e.targetChanges.forEach((f,p)=>{const g=s.get(p);if(!g)return;l.push(n.li.removeMatchingKeys(i,f.removedDocuments,p).next(()=>n.li.addMatchingKeys(i,f.addedDocuments,p)));let E=g.withSequenceNumber(i.currentSequenceNumber);e.targetMismatches.get(p)!==null?E=E.withResumeToken(dt.EMPTY_BYTE_STRING,ie.min()).withLastLimboFreeSnapshotVersion(ie.min()):f.resumeToken.approximateByteSize()>0&&(E=E.withResumeToken(f.resumeToken,r)),s=s.insert(p,E),function(A,P,_){return A.resumeToken.approximateByteSize()===0||P.snapshotVersion.toMicroseconds()-A.snapshotVersion.toMicroseconds()>=BP?!0:_.addedDocuments.size+_.modifiedDocuments.size+_.removedDocuments.size>0}(g,E,f)&&l.push(n.li.updateTargetData(i,E))});let u=ur(),h=ge();if(e.documentUpdates.forEach(f=>{e.resolvedLimboDocuments.has(f)&&l.push(n.persistence.referenceDelegate.updateLimboDocument(i,f))}),l.push(GP(i,o,e.documentUpdates).next(f=>{u=f.Bs,h=f.Ls})),!r.isEqual(ie.min())){const f=n.li.getLastRemoteSnapshotVersion(i).next(p=>n.li.setTargetsMetadata(i,i.currentSequenceNumber,r));l.push(f)}return z.waitFor(l).next(()=>o.apply(i)).next(()=>n.localDocuments.getLocalViewOfDocuments(i,u,h)).next(()=>u)}).then(i=>(n.vs=s,i))}function GP(t,e,n){let r=ge(),s=ge();return n.forEach(i=>r=r.add(i)),e.getEntries(t,r).next(i=>{let o=ur();return n.forEach((l,u)=>{const h=i.get(l);u.isFoundDocument()!==h.isFoundDocument()&&(s=s.add(l)),u.isNoDocument()&&u.version.isEqual(ie.min())?(e.removeEntry(l,u.readTime),o=o.insert(l,u)):!h.isValidDocument()||u.version.compareTo(h.version)>0||u.version.compareTo(h.version)===0&&h.hasPendingWrites?(e.addEntry(u),o=o.insert(l,u)):J(ym,"Ignoring outdated watch update for ",l,". Current version:",h.version," Watch version:",u.version)}),{Bs:o,Ls:s}})}function KP(t,e){const n=ae(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=sm),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function QP(t,e){const n=ae(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let s;return n.li.getTargetData(r,e).next(i=>i?(s=i,z.resolve(s)):n.li.allocateTargetId(r).next(o=>(s=new Pr(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.li.addTargetData(r,s).next(()=>s))))}).then(r=>{const s=n.vs.get(r.targetId);return(s===null||r.snapshotVersion.compareTo(s.snapshotVersion)>0)&&(n.vs=n.vs.insert(r.targetId,r),n.Fs.set(e,r.targetId)),r})}async function Lf(t,e,n){const r=ae(t),s=r.vs.get(e),i=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",i,o=>r.persistence.referenceDelegate.removeTarget(o,s))}catch(o){if(!ro(o))throw o;J(ym,`Failed to update sequence numbers for target ${e}: ${o}`)}r.vs=r.vs.remove(e),r.Fs.delete(s.target)}function mv(t,e,n){const r=ae(t);let s=ie.min(),i=ge();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,h,f){const p=ae(u),g=p.Fs.get(f);return g!==void 0?z.resolve(p.vs.get(g)):p.li.getTargetData(h,f)}(r,o,Fn(e)).next(l=>{if(l)return s=l.lastLimboFreeSnapshotVersion,r.li.getMatchingKeysForTargetId(o,l.targetId).next(u=>{i=u})}).next(()=>r.Cs.getDocumentsMatchingQuery(o,e,n?s:ie.min(),n?i:ge())).next(l=>(YP(r,DA(e),l),{documents:l,ks:i})))}function YP(t,e,n){let r=t.Ms.get(e)||ie.min();n.forEach((s,i)=>{i.readTime.compareTo(r)>0&&(r=i.readTime)}),t.Ms.set(e,r)}class gv{constructor(){this.activeTargetIds=UA()}Qs(e){this.activeTargetIds=this.activeTargetIds.add(e)}Gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class XP{constructor(){this.vo=new gv,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,r){this.Fo[e]=n}removeLocalQueryTarget(e){this.vo.Gs(e)}isLocalQueryTarget(e){return this.vo.activeTargetIds.has(e)}clearQueryState(e){delete this.Fo[e]}getAllActiveQueryTargets(){return this.vo.activeTargetIds}isActiveQueryTarget(e){return this.vo.activeTargetIds.has(e)}start(){return this.vo=new gv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
2691 * @license
2692 * Copyright 2019 Google LLC
2693 *
2694 * Licensed under the Apache License, Version 2.0 (the "License");
2695 * you may not use this file except in compliance with the License.
2696 * You may obtain a copy of the License at
2697 *
2698 *   http://www.apache.org/licenses/LICENSE-2.0
2699 *
2700 * Unless required by applicable law or agreed to in writing, software
2701 * distributed under the License is distributed on an "AS IS" BASIS,
2702 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2703 * See the License for the specific language governing permissions and
2704 * limitations under the License.
2705 */class JP{Mo(e){}shutdown(){}}/**
2706 * @license
2707 * Copyright 2019 Google LLC
2708 *
2709 * Licensed under the Apache License, Version 2.0 (the "License");
2710 * you may not use this file except in compliance with the License.
2711 * You may obtain a copy of the License at
2712 *
2713 *   http://www.apache.org/licenses/LICENSE-2.0
2714 *
2715 * Unless required by applicable law or agreed to in writing, software
2716 * distributed under the License is distributed on an "AS IS" BASIS,
2717 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2718 * See the License for the specific language governing permissions and
2719 * limitations under the License.
2720 */const yv="ConnectivityMonitor";class vv{constructor(){this.xo=()=>this.Oo(),this.No=()=>this.Bo(),this.Lo=[],this.ko()}Mo(e){this.Lo.push(e)}shutdown(){window.removeEventListener("online",this.xo),window.removeEventListener("offline",this.No)}ko(){window.addEventListener("online",this.xo),window.addEventListener("offline",this.No)}Oo(){J(yv,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){J(yv,"Network connectivity changed: UNAVAILABLE");for(const e of this.Lo)e(1)}static v(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
2721 * @license
2722 * Copyright 2023 Google LLC
2723 *
2724 * Licensed under the Apache License, Version 2.0 (the "License");
2725 * you may not use this file except in compliance with the License.
2726 * You may obtain a copy of the License at
2727 *
2728 *   http://www.apache.org/licenses/LICENSE-2.0
2729 *
2730 * Unless required by applicable law or agreed to in writing, software
2731 * distributed under the License is distributed on an "AS IS" BASIS,
2732 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2733 * See the License for the specific language governing permissions and
2734 * limitations under the License.
2735 */let Wl=null;function Vf(){return Wl===null?Wl=function(){return 268435456+Math.round(2147483648*Math.random())}():Wl++,"0x"+Wl.toString(16)}/**
2736 * @license
2737 * Copyright 2020 Google LLC
2738 *
2739 * Licensed under the Apache License, Version 2.0 (the "License");
2740 * you may not use this file except in compliance with the License.
2741 * You may obtain a copy of the License at
2742 *
2743 *   http://www.apache.org/licenses/LICENSE-2.0
2744 *
2745 * Unless required by applicable law or agreed to in writing, software
2746 * distributed under the License is distributed on an "AS IS" BASIS,
2747 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2748 * See the License for the specific language governing permissions and
2749 * limitations under the License.
2750 */const fd="RestConnection",ZP={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class e4{get Ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.qo=n+"://"+e.host,this.Uo=`projects/${r}/databases/${s}`,this.$o=this.databaseId.database===tc?`project_id=${r}`:`project_id=${r}&database_id=${s}`}Wo(e,n,r,s,i){const o=Vf(),l=this.Qo(e,n.toUriEncodedString());J(fd,`Sending RPC '${e}' ${o}:`,l,r);const u={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(u,s,i);const{host:h}=new URL(l),f=as(h);return this.zo(e,l,u,r,f).then(p=>(J(fd,`Received RPC '${e}' ${o}: `,p),p),p=>{throw Fs(fd,`RPC '${e}' ${o} failed with error: `,p,"url: ",l,"request:",r),p})}jo(e,n,r,s,i,o){return this.Wo(e,n,r,s,i)}Go(e,n,r){e["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+to}(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEac
2750h((s,i)=>e[i]=s),r&&r.headers.forEach((s,i)=>e[i]=s)}Qo(e,n){const r=ZP[e];let s=`${this.qo}/v1/${n}:${r}`;return this.databaseInfo.apiKey&&(s=`${s}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),s}terminate(){}}/**
2751 * @license
2752 * Copyright 2017 Google LLC
2753 *
2754 * Licensed under the Apache License, Version 2.0 (the "License");
2755 * you may not use this file except in compliance with the License.
2756 * You may obtain a copy of the License at
2757 *
2758 *   http://www.apache.org/licenses/LICENSE-2.0
2759 *
2760 * Unless required by applicable law or agreed to in writing, software
2761 * distributed under the License is distributed on an "AS IS" BASIS,
2762 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2763 * See the License for the specific language governing permissions and
2764 * limitations under the License.
2765 */class t4{constructor(e){this.Ho=e.Ho,this.Jo=e.Jo}Zo(e){this.Xo=e}Yo(e){this.e_=e}t_(e){this.n_=e}onMessage(e){this.r_=e}close(){this.Jo()}send(e){this.Ho(e)}i_(){this.Xo()}s_(){this.e_()}o_(e){this.n_(e)}__(e){this.r_(e)}}/**
2766 * @license
2767 * Copyright 2017 Google LLC
2768 *
2769 * Licensed under the Apache License, Version 2.0 (the "License");
2770 * you may not use this file except in compliance with the License.
2771 * You may obtain a copy of the License at
2772 *
2773 *   http://www.apache.org/licenses/LICENSE-2.0
2774 *
2775 * Unless required by applicable law or agreed to in writing, software
2776 * distributed under the License is distributed on an "AS IS" BASIS,
2777 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2778 * See the License for the specific language governing permissions and
2779 * limitations under the License.
2780 */const mt="WebChannelConnection",Lo=(t,e,n)=>{t.listen(e,r=>{try{n(r)}catch(s){setTimeout(()=>{throw s},0)}})};class Si extends e4{constructor(e){super(e),this.a_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static u_(){if(!Si.c_){const e=b1();Lo(e,I1.STAT_EVENT,n=>{n.stat===If.PROXY?J(mt,"STAT_EVENT: detected buffering proxy"):n.stat===If.NOPROXY&&J(mt,"STAT_EVENT: detected no buffering proxy")}),Si.c_=!0}}zo(e,n,r,s,i){const o=Vf();return new Promise((l,u)=>{const h=new E1;h.setWithCredentials(!0),h.listenOnce(T1.COMPLETE,()=>{try{switch(h.getLastErrorCode()){case mu.NO_ERROR:const p=h.getResponseJson();J(mt,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(p)),l(p);break;case mu.TIMEOUT:J(mt,`RPC '${e}' ${o} timed out`),u(new X($.DEADLINE_EXCEEDED,"Request time out"));break;case mu.HTTP_ERROR:const g=h.getStatus();if(J(mt,`RPC '${e}' ${o} failed with status:`,g,"response text:",h.getResponseText()),g>0){let E=h.getResponseJson();Array.isArray(E)&&(E=E[0]);const N=E==null?void 0:E.error;if(N&&N.status&&N.message){const A=function(_){const w=_.toLowerCase().replace(/_/g,"-");return Object.values($).indexOf(w)>=0?w:$.UNKNOWN}(N.status);u(new X(A,N.message))}else u(new X($.UNKNOWN,"Server responded with status "+h.getStatus()))}else u(new X($.UNAVAILABLE,"Connection failed."));break;default:re(9055,{l_:e,streamId:o,h_:h.getLastErrorCode(),P_:h.getLastError()})}}finally{J(mt,`RPC '${e}' ${o} completed.`)}});const f=JSON.stringify(s);J(mt,`RPC '${e}' ${o} sending request:`,s),h.send(n,"POST",f,r,15)})}T_(e,n,r){const s=Vf(),i=[this.qo,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=this.createWebChannelTransport(),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.useFetchStreams=!0),this.Go(l.initMessageHeaders,n,r),l.encodeInitMessageHeaders=!0;const h=i.join("");J(mt,`Creating RPC '${e}' stream ${s}: ${h}`,l);const f=o.createWebChannel(h,l);this.I_(f);let p=!1,g=!1;const E=new t4({Ho:N=>{g?J(mt,`Not sending because RPC '${e}' stream ${s} is closed:`,N):(p||(J(mt,`Opening RPC '${e}' stream ${s} transport.`),f.open(),p=!0),J(mt,`RPC '${e}' stream ${s} sending:`,N),f.send(N))},Jo:()=>f.close()});return Lo(f,Ho.EventType.OPEN,()=>{g||(J(mt,`RPC '${e}' stream ${s} transport opened.`),E.i_())}),Lo(f,Ho.EventType.CLOSE,()=>{g||(g=!0,J(mt,`RPC '${e}' stream ${s} transport closed`),E.o_(),this.E_(f))}
2780),Lo(f,Ho.EventType.ERROR,N=>{g||(g=!0,Fs(mt,`RPC '${e}' stream ${s} transport errored. Name:`,N.name,"Message:",N.message),E.o_(new X($.UNAVAILABLE,"The operation could not be completed")))}),Lo(f,Ho.EventType.MESSAGE,N=>{var A;if(!g){const P=N.data[0];_e(!!P,16349);const _=P,w=(_==null?void 0:_.error)||((A=_[0])==null?void 0:A.error);if(w){J(mt,`RPC '${e}' stream ${s} received error:`,w);const S=w.status;let j=function(T){const y=Ke[T];if(y!==void 0)return oE(y)}(S),V=w.message;S==="NOT_FOUND"&&V.includes("database")&&V.includes("does not exist")&&V.includes(this.databaseId.database)&&Fs(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),j===void 0&&(j=$.INTERNAL,V="Unknown error status: "+S+" with message "+w.message),g=!0,E.o_(new X(j,V)),f.close()}else J(mt,`RPC '${e}' stream ${s} received:`,P),E.__(P)}}),Si.u_(),setTimeout(()=>{E.s_()},0),E}terminate(){this.a_.forEach(e=>e.close()),this.a_=[]}I_(e){this.a_.push(e)}E_(e){this.a_=this.a_.filter(n=>n===e)}Go(e,n,r){super.Go(e,n,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return S1()}}/**
2781 * @license
2782 * Copyright 2020 Google LLC
2783 *
2784 * Licensed under the Apache License, Version 2.0 (the "License");
2785 * you may not use this file except in compliance with the License.
2786 * You may obtain a copy of the License at
2787 *
2788 *   http://www.apache.org/licenses/LICENSE-2.0
2789 *
2790 * Unless required by applicable law or agreed to in writing, software
2791 * distributed under the License is distributed on an "AS IS" BASIS,
2792 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2793 * See the License for the specific language governing permissions and
2794 * limitations under the License.
2795 */function n4(t){return new Si(t)}function pd(){return typeof document<"u"?document:null}/**
2796 * @license
2797 * Copyright 2020 Google LLC
2798 *
2799 * Licensed under the Apache License, Version 2.0 (the "License");
2800 * you may not use this file except in compliance with the License.
2801 * You may obtain a copy of the License at
2802 *
2803 *   http://www.apache.org/licenses/LICENSE-2.0
2804 *
2805 * Unless required by applicable law or agreed to in writing, software
2806 * distributed under the License is distributed on an "AS IS" BASIS,
2807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2808 * See the License for the specific language governing permissions and
2809 * limitations under the License.
2810 */function Jc(t){return new oP(t,!0)}/**
2811 * @license
2812 * Copyright 2017 Google LLC
2813 *
2814 * Licensed under the Apache License, Version 2.0 (the "License");
2815 * you may not use this file except in compliance with the License.
2816 * You may obtain a copy of the License at
2817 *
2818 *   http://www.apache.org/licenses/LICENSE-2.0
2819 *
2820 * Unless required by applicable law or agreed to in writing, software
2821 * distributed under the License is distributed on an "AS IS" BASIS,
2822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2823 * See the License for the specific language governing permissions and
2824 * limitations under the License.
2825 */Si.c_=!1;class xE{constructor(e,n,r=1e3,s=1.5,i=6e4){this.Ci=e,this.timerId=n,this.R_=r,this.A_=s,this.V_=i,this.d_=0,this.m_=null,this.f_=Date.now(),this.reset()}reset(){this.d_=0}g_(){this.d_=this.V_}p_(e){this.cancel();const n=Math.floor(this.d_+this.y_()),r=Math.max(0,Date.now()-this.f_),s=Math.max(0,n-r);s>0&&J("ExponentialBackoff",`Backing off for ${s} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,s,()=>(this.f_=Date.now(),e())),this.d_*=this.A_,this.d_<this.R_&&(this.d_=this.R_),this.d_>this.V_&&(this.d_=this.V_)}w_(){this.m_!==null&&(this.m_.skipDelay(),this.m_=null)}cancel(){this.m_!==null&&(this.m_.cancel(),this.m_=null)}y_(){return(Math.random()-.5)*this.d_}}/**
2826 * @license
2827 * Copyright 2017 Google LLC
2828 *
2829 * Licensed under the Apache License, Version 2.0 (the "License");
2830 * you may not use this file except in compliance with the License.
2831 * You may obtain a copy of the License at
2832 *
2833 *   http://www.apache.org/licenses/LICENSE-2.0
2834 *
2835 * Unless required by applicable law or agreed to in writing, softw
2835are
2836 * distributed under the License is distributed on an "AS IS" BASIS,
2837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2838 * See the License for the specific language governing permissions and
2839 * limitations under the License.
2840 */const _v="PersistentStream";class EE{constructor(e,n,r,s,i,o,l,u){this.Ci=e,this.b_=r,this.S_=s,this.connection=i,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=u,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new xE(e,n)}x_(){return this.state===1||this.state===5||this.O_()}O_(){return this.state===2||this.state===3}start(){this.F_=0,this.state!==4?this.auth():this.N_()}async stop(){this.x_()&&await this.close(0)}B_(){this.state=0,this.M_.reset()}L_(){this.O_()&&this.C_===null&&(this.C_=this.Ci.enqueueAfterDelay(this.b_,6e4,()=>this.k_()))}K_(e){this.q_(),this.stream.send(e)}async k_(){if(this.O_())return this.close(0)}q_(){this.C_&&(this.C_.cancel(),this.C_=null)}U_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,n){this.q_(),this.U_(),this.M_.cancel(),this.D_++,e!==4?this.M_.reset():n&&n.code===$.RESOURCE_EXHAUSTED?(lr(n.toString()),lr("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===$.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.W_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.t_(n)}W_(){}auth(){this.state=1;const e=this.Q_(this.D_),n=this.D_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,s])=>{this.D_===n&&this.G_(r,s)},r=>{e(()=>{const s=new X($.UNKNOWN,"Fetching auth token failed: "+r.message);return this.z_(s)})})}G_(e,n){const r=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo(()=>{r(()=>this.listener.Zo())}),this.stream.Yo(()=>{r(()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.S_,1e4,()=>(this.O_()&&(this.state=3),Promise.resolve())),this.listener.Yo()))}),this.stream.t_(s=>{r(()=>this.z_(s))}),this.stream.onMessage(s=>{r(()=>++this.F_==1?this.H_(s):this.onNext(s))})}N_(){this.state=5,this.M_.p_(async()=>{this.state=0,this.start()})}z_(e){return J(_v,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget(()=>this.D_===e?n():(J(_v,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class r4 extends EE{constructor(e,n,r,s,i,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}j_(e,n){return this.connection.T_("Listen",e,n)}H_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=uP(this.serializer,e),r=function(i){if(!("targetChange"in i))return ie.min();const o=i.targetChange;return o.targetIds&&o.targetIds.length?ie.min():o.readTime?Un(o.readTime):ie.min()}(e);return this.listener.J_(n,r)}Z_(e){const n={};n.database=Of(this.serializer),n.addTarget=function(i,o){let l;const u=o.target;if(l=Nf(u)?{documents:dP(i,u)}:{query:fP(i,u).ft},l.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){l.resumeToken=uE(i,o.resumeToken);const h=Pf(i,o.expectedCount);h!==null&&(l.expectedCount=h)}else if(o.snapshotVersion.compareTo(ie.min())>0){l.readTime=ic(i,o.snapshotVersion.toTimestamp());const h=Pf(i,o.expectedCount);h!==null&&(l.expectedCount=h)}return l}(this.serializer,e);const r=mP(this.serializer,e);r&&(n.labels=r),this.K_(n)}X_(e){const n={};n.database=Of(this.serializer),n.removeTarget=e,this.K_(n)}}class s4 extends EE{constructor(e,n,r,s,i,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,s,o),this.serializer=i}get Y_(){return this.F_>0}start(){this.lastStreamToken=void 0,super.start()}W_(){this.Y_&&this.ea([])}j_(e,n){return this.connection.T_("Write",e,n)}H_(e){return _e(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,_e(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){_e(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=hP(e.writeResults,e.commitTime),r=Un(e.commitTime);
2840return this.listener.na(r,n)}ra(){const e={};e.database=Of(this.serializer),this.K_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>cP(this.serializer,r))};this.K_(n)}}/**
2841 * @license
2842 * Copyright 2017 Google LLC
2843 *
2844 * Licensed under the Apache License, Version 2.0 (the "License");
2845 * you may not use this file except in compliance with the License.
2846 * You may obtain a copy of the License at
2847 *
2848 *   http://www.apache.org/licenses/LICENSE-2.0
2849 *
2850 * Unless required by applicable law or agreed to in writing, software
2851 * distributed under the License is distributed on an "AS IS" BASIS,
2852 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2853 * See the License for the specific language governing permissions and
2854 * limitations under the License.
2855 */class i4{}class o4 extends i4{constructor(e,n,r,s){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=s,this.ia=!1}sa(){if(this.ia)throw new X($.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,r,s){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,o])=>this.connection.Wo(e,jf(n,r),s,i,o)).catch(i=>{throw i.name==="FirebaseError"?(i.code===$.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),i):new X($.UNKNOWN,i.toString())})}jo(e,n,r,s,i){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,l])=>this.connection.jo(e,jf(n,r),s,o,l,i)).catch(o=>{throw o.name==="FirebaseError"?(o.code===$.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new X($.UNKNOWN,o.toString())})}terminate(){this.ia=!0,this.connection.terminate()}}function a4(t,e,n,r){return new o4(t,e,n,r)}class l4{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.oa=0,this._a=null,this.aa=!0}ua(){this.oa===0&&(this.ca("Unknown"),this._a=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this._a=null,this.la("Backend didn't respond within 10 seconds."),this.ca("Offline"),Promise.resolve())))}ha(e){this.state==="Online"?this.ca("Unknown"):(this.oa++,this.oa>=1&&(this.Pa(),this.la(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ca("Offline")))}set(e){this.Pa(),this.oa=0,e==="Online"&&(this.aa=!1),this.ca(e)}ca(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}la(e){const n=`Could not reach Cloud Firestore backend. ${e}
2856This 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.aa?(lr(n),this.aa=!1):J("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/**
2857 * @license
2858 * Copyright 2017 Google LLC
2859 *
2860 * Licensed under the Apache License, Version 2.0 (the "License");
2861 * you may not use this file except in compliance with the License.
2862 * You may obtain a copy of the License at
2863 *
2864 *   http://www.apache.org/licenses/LICENSE-2.0
2865 *
2866 * Unless required by applicable law or agreed to in writing, software
2867 * distributed under the License is distributed on an "AS IS" BASIS,
2868 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2869 * See the License for the specific language governing permissions and
2870 * limitations under the License.
2871 */const Us="RemoteStore";class u4{constructor(e,n,r,s,i){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.Ra=[],this.Aa=i,this.Aa.Mo(o=>{r.enqueueAndForget(async()=>{Gs(this)&&(J(Us,"Restarting streams for network reachability change."),await async function(u){const h=ae(u);h.Ea.add(4),await tl(h),h.Va.set("Unknown"),h.Ea.delete(4),await Zc(h)}(this))})}),this.Va=new l4(r,s)}}async function Zc(t){if(Gs(t))for(const e of t.Ra)await e(!0)}async function tl(t){for(const e of t.Ra)await e(!1)}function TE(t,e){const n=ae(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),xm(n)?wm(n):io(n).O_()&&_m(n,e))}function vm(t,e){const n=ae(t),r=io(n);n.Ia.delete(e),r.O_()&&IE(n,e),n.Ia.size===0&&(r.O_()?r.L_():Gs(n)&&n.Va.set("Unknown"))}function _m(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(ie.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}io(t).Z_(e)}function IE(t,e){t.da.$e(e),io(t).X_(e)}function wm(t){t.da=new nP({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),io(t).start(),t.Va.ua()}function xm(t){return Gs(t)&&!io(t).x_()&&t.Ia.size>0}function Gs(t){return ae(t).Ea.size===0}function bE(t){t.da=void 0}async function c4(t){t.Va.set("Online")}
2871async function h4(t){t.Ia.forEach((e,n)=>{_m(t,e)})}async function d4(t,e){bE(t),xm(t)?(t.Va.ha(e),wm(t)):t.Va.set("Unknown")}async function f4(t,e,n){if(t.Va.set("Online"),e instanceof lE&&e.state===2&&e.cause)try{await async function(s,i){const o=i.cause;for(const l of i.targetIds)s.Ia.has(l)&&(await s.remoteSyncer.rejectListen(l,o),s.Ia.delete(l),s.da.removeTarget(l))}(t,e)}catch(r){J(Us,"Failed to remove targets %s: %s ",e.targetIds.join(","),r),await ac(t,r)}else if(e instanceof _u?t.da.Xe(e):e instanceof aE?t.da.st(e):t.da.tt(e),!n.isEqual(ie.min()))try{const r=await wE(t.localStore);n.compareTo(r)>=0&&await function(i,o){const l=i.da.Tt(o);return l.targetChanges.forEach((u,h)=>{if(u.resumeToken.approximateByteSize()>0){const f=i.Ia.get(h);f&&i.Ia.set(h,f.withResumeToken(u.resumeToken,o))}}),l.targetMismatches.forEach((u,h)=>{const f=i.Ia.get(u);if(!f)return;i.Ia.set(u,f.withResumeToken(dt.EMPTY_BYTE_STRING,f.snapshotVersion)),IE(i,u);const p=new Pr(f.target,u,h,f.sequenceNumber);_m(i,p)}),i.remoteSyncer.applyRemoteEvent(l)}(t,n)}catch(r){J(Us,"Failed to raise snapshot:",r),await ac(t,r)}}async function ac(t,e,n){if(!ro(e))throw e;t.Ea.add(1),await tl(t),t.Va.set("Offline"),n||(n=()=>wE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{J(Us,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await Zc(t)})}function SE(t,e){return e().catch(n=>ac(t,n,e))}async function eh(t){const e=ae(t),n=ts(e);let r=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:sm;for(;p4(e);)try{const s=await KP(e.localStore,r);if(s===null){e.Ta.length===0&&n.L_();break}r=s.batchId,m4(e,s)}catch(s){await ac(e,s)}CE(e)&&kE(e)}function p4(t){return Gs(t)&&t.Ta.length<10}function m4(t,e){t.Ta.push(e);const n=ts(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function CE(t){return Gs(t)&&!ts(t).x_()&&t.Ta.length>0}function kE(t){ts(t).start()}async function g4(t){ts(t).ra()}async function y4(t){const e=ts(t);for(const n of t.Ta)e.ea(n.mutations)}async function v4(t,e,n){const r=t.Ta.shift(),s=hm.from(r,e,n);await SE(t,()=>t.remoteSyncer.applySuccessfulWrite(s)),await eh(t)}async function _4(t,e){e&&ts(t).Y_&&await async function(r,s){if(function(o){return ZA(o)&&o!==$.ABORTED}(s.code)){const i=r.Ta.shift();ts(r).B_(),await SE(r,()=>r.remoteSyncer.rejectFailedWrite(i.batchId,s)),await eh(r)}}(t,e),CE(t)&&kE(t)}async function wv(t,e){const n=ae(t);n.asyncQueue.verifyOperationInProgress(),J(Us,"RemoteStore received new credentials");const r=Gs(n);n.Ea.add(3),await tl(n),r&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await Zc(n)}async function w4(t,e){const n=ae(t);e?(n.Ea.delete(2),await Zc(n)):e||(n.Ea.add(2),await tl(n),n.Va.set("Unknown"))}function io(t){return t.ma||(t.ma=function(n,r,s){const i=ae(n);return i.sa(),new r4(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:c4.bind(null,t),Yo:h4.bind(null,t),t_:d4.bind(null,t),J_:f4.bind(null,t)}),t.Ra.push(async e=>{e?(t.ma.B_(),xm(t)?wm(t):t.Va.set("Unknown")):(await t.ma.stop(),bE(t))})),t.ma}function ts(t){return t.fa||(t.fa=function(n,r,s){const i=ae(n);return i.sa(),new s4(r,i.connection,i.authCredentials,i.appCheckCredentials,i.serializer,s)}(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:g4.bind(null,t),t_:_4.bind(null,t),ta:y4.bind(null,t),na:v4.bind(null,t)}),t.Ra.push(async e=>{e?(t.fa.B_(),await eh(t)):(await t.fa.stop(),t.Ta.length>0&&(J(Us,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))})),t.fa}/**
2872 * @license
2873 * Copyright 2017 Google LLC
2874 *
2875 * Licensed under the Apache License, Version 2.0 (the "License");
2876 * you may not use this file except in compliance with the License.
2877 * You may obtain a copy of the License at
2878 *
2879 *   http://www.apache.org/licenses/LICENSE-2.0
2880 *
2881 * Unless required by applicable law or agreed to in writing, software
2882 * distributed under the License is distributed on an "AS IS" BASIS,
2883 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2884 * See the License for the specific language governing permissions and
2885 * limitations under the License.
2886 */class Em{constructor(e,n,r,s,i){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=s,this.removalCallback=i,this.deferred=new Xn,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,s,i){const o=Date.now()+r,l=new Em(e,n,o,s,i);return l.start(r),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new X($.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 Tm(t,e){if(lr("AsyncQueue",`${e}: ${t}`),ro(t))return new X($.UNAVAILABLE,`${e}: ${t}`);throw t}/**
2887 * @license
2888 * Copyright 2017 Google LLC
2889 *
2890 * Licensed under the Apache License, Version 2.0 (the "License");
2891 * you may not use this file except in compliance with the License.
2892 * You may obtain a copy of the License at
2893 *
2894 *   http://www.apache.org/licenses/LICENSE-2.0
2895 *
2896 * Unless required by applicable law or agreed to in writing, software
2897 * distributed under the License is distributed on an "AS IS" BASIS,
2898 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2899 * See the License for the specific language governing permissions and
2900 * limitations under the License.
2901 */class Ci{static emptySet(e){return new Ci(e.comparator)}constructor(e){this.comparator=e?(n,r)=>e(n,r)||te.comparator(n.key,r.key):(n,r)=>te.comparator(n.key,r.key),this.keyedMap=Wo(),this.sortedSet=new Me(this.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 Ci)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const s=n.getNext().key,i=r.getNext().key;if(!s.isEqual(i))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
2902  `+e.join(`  
2903`)+`
2904)`}copy(e,n){const r=new Ci;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
2905 * @license
2906 * Copyright 2017 Google LLC
2907 *
2908 * Licensed under the Apache License, Version 2.0 (the "License");
2909 * you may not use this file except in compliance with the License.
2910 * You may obtain a copy of the License at
2911 *
2912 *   http://www.apache.org/licenses/LICENSE-2.0
2913 *
2914 * Unless required by applicable law or agreed to in writing, software
2915 * distributed under the License is distributed on an "AS IS" BASIS,
2916 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2917 * See the License for the specific language governing permissions and
2918 * limitations under the License.
2919 */class xv{constructor(){this.ga=new Me(te.comparator)}track(e){const n=e.doc.key,r=this.ga.get(n);r?e.type!==0&&r.type===3?this.ga=this.ga.insert(n,e):e.type===3&&r.type!==1?this.ga=this.ga.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.ga=this.ga.remove(n):e.type===1&&r.type===2?this.ga=this.ga.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):re(63341,{Vt:e,pa:r}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal((n,r)=>{e.push(r)}),e}}class Ui{constructor(e,n,r,s,i,o,l,u,h){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=s,this.mutatedKeys=i,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,n,r,s,i){const o=[];return n.forEach(l=>{o.push({type:0,doc:l})}),new Ui(e,n,Ci.emptySet(n),o,r,s,!0,!1,i)}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)&&Gc(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 s=0;s<n.length;s++)if(n[s].type!==r[s].type||!n[s].doc.isEqual(r[s].doc))return!1;return!0}}/**
2920 * @license
2921 * Copyright 2017 Google LLC
2922 *
2923 * Licensed under the Apache License, Version 2.0 (the "License");
2924 * you may not use this file except in compliance with the License.
2925 * You may obtain a copy of the License at
2926 *
2927 *   http://www.apache.org/licenses/LICENSE-2.0
2928 *
2929 * Unless required by applicable law or agreed to in writing, softw
2929are
2930 * distributed under the License is distributed on an "AS IS" BASIS,
2931 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2932 * See the License for the specific language governing permissions and
2933 * limitations under the License.
2934 */class x4{constructor(){this.wa=void 0,this.ba=[]}Sa(){return this.ba.some(e=>e.Da())}}class E4{constructor(){this.queries=Ev(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,r){const s=ae(n),i=s.queries;s.queries=Ev(),i.forEach((o,l)=>{for(const u of l.ba)u.onError(r)})})(this,new X($.ABORTED,"Firestore shutting down"))}}function Ev(){return new qs(t=>K1(t),Gc)}async function Im(t,e){const n=ae(t);let r=3;const s=e.query;let i=n.queries.get(s);i?!i.Sa()&&e.Da()&&(r=2):(i=new x4,r=e.Da()?0:1);try{switch(r){case 0:i.wa=await n.onListen(s,!0);break;case 1:i.wa=await n.onListen(s,!1);break;case 2:await n.onFirstRemoteStoreListen(s)}}catch(o){const l=Tm(o,`Initialization of query '${ti(e.query)}' failed`);return void e.onError(l)}n.queries.set(s,i),i.ba.push(e),e.va(n.onlineState),i.wa&&e.Fa(i.wa)&&Sm(n)}async function bm(t,e){const n=ae(t),r=e.query;let s=3;const i=n.queries.get(r);if(i){const o=i.ba.indexOf(e);o>=0&&(i.ba.splice(o,1),i.ba.length===0?s=e.Da()?0:1:!i.Sa()&&e.Da()&&(s=2))}switch(s){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 T4(t,e){const n=ae(t);let r=!1;for(const s of e){const i=s.query,o=n.queries.get(i);if(o){for(const l of o.ba)l.Fa(s)&&(r=!0);o.wa=s}}r&&Sm(n)}function I4(t,e,n){const r=ae(t),s=r.queries.get(e);if(s)for(const i of s.ba)i.onError(n);r.queries.delete(e)}function Sm(t){t.Ca.forEach(e=>{e.next()})}var Mf,Tv;(Tv=Mf||(Mf={})).Ma="default",Tv.Cache="cache";class Cm{constructor(e,n,r){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=r||{}}Fa(e){if(!this.options.includeMetadataChanges){const r=[];for(const s of e.docChanges)s.type!==3&&r.push(s);e=new Ui(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.Oa?this.Ba(e)&&(this.xa.next(e),n=!0):this.La(e,this.onlineState)&&(this.ka(e),n=!0),this.Na=e,n}onError(e){this.xa.error(e)}va(e){this.onlineState=e;let n=!1;return this.Na&&!this.Oa&&this.La(this.Na,e)&&(this.ka(this.Na),n=!0),n}La(e,n){if(!e.fromCache||!this.Da())return!0;const r=n!=="Offline";return(!this.options.Ka||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}Ba(e){if(e.docChanges.length>0)return!0;const n=this.Na&&this.Na.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}ka(e){e=Ui.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==Mf.Cache}}/**
2935 * @license
2936 * Copyright 2017 Google LLC
2937 *
2938 * Licensed under the Apache License, Version 2.0 (the "License");
2939 * you may not use this file except in compliance with the License.
2940 * You may obtain a copy of the License at
2941 *
2942 *   http://www.apache.org/licenses/LICENSE-2.0
2943 *
2944 * Unless required by applicable law or agreed to in writing, software
2945 * distributed under the License is distributed on an "AS IS" BASIS,
2946 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2947 * See the License for the specific language governing permissions and
2948 * limitations under the License.
2949 */class NE{constructor(e){this.key=e}}class RE{constructor(e){this.key=e}}class b4{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=ge(),this.mutatedKeys=ge(),this.eu=Q1(e),this.tu=new Ci(this.eu)}get nu(){return this.Za}ru(e,n){const r=n?n.iu:new xv,s=n?n.tu:this.tu;let i=n?n.mutatedKeys:this.mutatedKeys,o=s,l=!1;const u=this.query.limitType==="F"&&s.size===this.query.limit?s.last():null,h=this.query.limitType==="L"&&s.size===this.query.limit?s.first():null;if(e.inorderTraversal((f,p)=>{const g=s.get(f),E=Kc(this.query,p)?p:null,N=!!g&&this.mutatedKeys.has(g.key),A=!!E&&(E.hasLocalMutations||this.mutatedKeys.has(E.key)&&E.hasCommittedMutations);let P=!1;g&&E?g.data.isEqual(E.data)?N!==A&&(r.track({type:3,doc:E}),P=!0):this.su(g,E)||(r.track({type:2,doc:E}),P=!0,(u&&this.eu(E,u)>0||h&&this.eu(E,h)<0)&&(l=!0)):!g&&E?(r.track({type:0,doc:E}),P=!0):g&&!E&&(r.track({type:1,doc:g}),P=!0,(u||h)&&(l=!0)),P&&(E?(o=o.add(E),i=A?i.add(f):i.delete(f)):(o=o.delete(f),i=i.delete(f)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const f=this.query.limitType==="F"?o.last():o.first();o=o.delete(f.key),i=i.delete(f.key),r.track({type:1,doc:f})}return{tu:o,iu:r,Ss:l,mutatedKeys:i}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}
2949applyChanges(e,n,r,s){const i=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const o=e.iu.ya();o.sort((f,p)=>function(E,N){const A=P=>{switch(P){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return re(20277,{Vt:P})}};return A(E)-A(N)}(f.type,p.type)||this.eu(f.doc,p.doc)),this.ou(r),s=s??!1;const l=n&&!s?this._u():[],u=this.Ya.size===0&&this.current&&!s?1:0,h=u!==this.Xa;return this.Xa=u,o.length!==0||h?{snapshot:new Ui(this.query,e.tu,i,o,e.mutatedKeys,u===0,h,!1,!!r&&r.resumeToken.approximateByteSize()>0),au:l}:{au:l}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new xv,mutatedKeys:this.mutatedKeys,Ss:!1},!1)):{au:[]}}uu(e){return!this.Za.has(e)&&!!this.tu.has(e)&&!this.tu.get(e).hasLocalMutations}ou(e){e&&(e.addedDocuments.forEach(n=>this.Za=this.Za.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Za=this.Za.delete(n)),this.current=e.current)}_u(){if(!this.current)return[];const e=this.Ya;this.Ya=ge(),this.tu.forEach(r=>{this.uu(r.key)&&(this.Ya=this.Ya.add(r.key))});const n=[];return e.forEach(r=>{this.Ya.has(r)||n.push(new RE(r))}),this.Ya.forEach(r=>{e.has(r)||n.push(new NE(r))}),n}cu(e){this.Za=e.ks,this.Ya=ge();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Ui.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const km="SyncEngine";class S4{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class C4{constructor(e){this.key=e,this.hu=!1}}class k4{constructor(e,n,r,s,i,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=s,this.currentUser=i,this.maxConcurrentLimboResolutions=o,this.Pu={},this.Tu=new qs(l=>K1(l),Gc),this.Iu=new Map,this.Eu=new Set,this.Ru=new Me(te.comparator),this.Au=new Map,this.Vu=new pm,this.du={},this.mu=new Map,this.fu=Fi.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function N4(t,e,n=!0){const r=LE(t);let s;const i=r.Tu.get(e);return i?(r.sharedClientState.addLocalQueryTarget(i.targetId),s=i.view.lu()):s=await AE(r,e,n,!0),s}async function R4(t,e){const n=LE(t);await AE(n,e,!0,!1)}async function AE(t,e,n,r){const s=await QP(t.localStore,Fn(e)),i=s.targetId,o=t.sharedClientState.addLocalQueryTarget(i,n);let l;return r&&(l=await A4(t,e,i,o==="current",s.resumeToken)),t.isPrimaryClient&&n&&TE(t.remoteStore,s),l}async function A4(t,e,n,r,s){t.pu=(p,g,E)=>async function(A,P,_,w){let S=P.view.ru(_);S.Ss&&(S=await mv(A.localStore,P.query,!1).then(({documents:T})=>P.view.ru(T,S)));const j=w&&w.targetChanges.get(P.targetId),V=w&&w.targetMismatches.get(P.targetId)!=null,M=P.view.applyChanges(S,A.isPrimaryClient,j,V);return bv(A,P.targetId,M.au),M.snapshot}(t,p,g,E);const i=await mv(t.localStore,e,!0),o=new b4(e,i.ks),l=o.ru(i.documents),u=el.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",s),h=o.applyChanges(l,t.isPrimaryClient,u);bv(t,n,h.au);const f=new S4(e,n,o);return t.Tu.set(e,f),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),h.snapshot}async function P4(t,e,n){const r=ae(t),s=r.Tu.get(e),i=r.Iu.get(s.targetId);if(i.length>1)return r.Iu.set(s.targetId,i.filter(o=>!Gc(o,e))),void r.Tu.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(s.targetId),r.sharedCl
2949ientState.isActiveQueryTarget(s.targetId)||await Lf(r.localStore,s.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(s.targetId),n&&vm(r.remoteStore,s.targetId),Ff(r,s.targetId)}).catch(no)):(Ff(r,s.targetId),await Lf(r.localStore,s.targetId,!0))}async function j4(t,e){const n=ae(t),r=n.Tu.get(e),s=n.Iu.get(r.targetId);n.isPrimaryClient&&s.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),vm(n.remoteStore,r.targetId))}async function D4(t,e,n){const r=$4(t);try{const s=await function(o,l){const u=ae(o),h=Ne.now(),f=l.reduce((E,N)=>E.add(N.key),ge());let p,g;return u.persistence.runTransaction("Locally write mutations","readwrite",E=>{let N=ur(),A=ge();return u.xs.getEntries(E,f).next(P=>{N=P,N.forEach((_,w)=>{w.isValidDocument()||(A=A.add(_))})}).next(()=>u.localDocuments.getOverlayedDocuments(E,N)).next(P=>{p=P;const _=[];for(const w of l){const S=KA(w,p.get(w.key).overlayedDocument);S!=null&&_.push(new cs(w.key,S,U1(S.value.mapValue),rn.exists(!0)))}return u.mutationQueue.addMutationBatch(E,h,_,l)}).next(P=>{g=P;const _=P.applyToLocalDocumentSet(p,A);return u.documentOverlayCache.saveOverlays(E,P.batchId,_)})}).then(()=>({batchId:g.batchId,changes:X1(p)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(s.batchId),function(o,l,u){let h=o.du[o.currentUser.toKey()];h||(h=new Me(me)),h=h.insert(l,u),o.du[o.currentUser.toKey()]=h}(r,s.batchId,n),await nl(r,s.changes),await eh(r.remoteStore)}catch(s){const i=Tm(s,"Failed to persist write");n.reject(i)}}async function PE(t,e){const n=ae(t);try{const r=await qP(n.localStore,e);
2949e.targetChanges.forEach((s,i)=>{const o=n.Au.get(i);o&&(_e(s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size<=1,22616),s.addedDocuments.size>0?o.hu=!0:s.modifiedDocuments.size>0?_e(o.hu,14607):s.removedDocuments.size>0&&(_e(o.hu,42227),o.hu=!1))}),await nl(n,r,e)}catch(r){await no(r)}}function Iv(t,e,n){const r=ae(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const s=[];r.Tu.forEach((i,o)=>{const l=o.view.va(e);l.snapshot&&s.push(l.snapshot)}),function(o,l){const u=ae(o);u.onlineState=l;let h=!1;u.queries.forEach((f,p)=>{for(const g of p.ba)g.va(l)&&(h=!0)}),h&&Sm(u)}(r.eventManager,e),s.length&&r.Pu.J_(s),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function O4(t,e,n){const r=ae(t);r.sharedClientState.updateQueryState(e,"rejected",n);const s=r.Au.get(e),i=s&&s.key;if(i){let o=new Me(te.comparator);o=o.insert(i,vt.newNoDocument(i,ie.min()));const l=ge().add(i),u=new Xc(ie.min(),new Map,new Me(me),o,l);await PE(r,u),r.Ru=r.Ru.remove(i),r.Au.delete(e),Nm(r)}else await Lf(r.localStore,e,!1).then(()=>Ff(r,e,n)).catch(no)}async function L4(t,e){const n=ae(t),r=e.batch.batchId;try{const s=await WP(n.localStore,e);DE(n,r,null),jE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await nl(n,s)}catch(s){await no(s)}}async function V4(t,e,n){const r=ae(t);try{const s=await function(o,l){const u=ae(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",h=>{let f;return u.mutationQueue.lookupMutationBatch(h,l).next(p=>(_e(p!==null,37113),f=p.keys(),u.mutationQueue.removeMutationBatch(h,p))).next(()=>u.mutationQueue.performConsistencyCheck(h)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(h,f,l)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,f)).next(()=>u.localDocuments.getDocuments(h,f))})}(r.localStore,e);DE(r,e,n),jE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await nl(r,s)}catch(s){await no(s)}}function jE(t,e){(t.mu.get(e)||[]).forEach(n=>{n.resolve()}),t.mu.delete(e)}function DE(t,e,n){const r=ae(t);let s=r.du[r.currentUser.toKey()];if(s){const i=s.get(e);i&&(n?i.reject(n):i.resolve(),s=s.remove(e)),r.du[r.currentUser.toKey()]=s}}
2949function Ff(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Iu.get(e))t.Tu.delete(r),n&&t.Pu.yu(r,n);t.Iu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach(r=>{t.Vu.containsKey(r)||OE(t,r)})}function OE(t,e){t.Eu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(vm(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),Nm(t))}function bv(t,e,n){for(const r of n)r instanceof NE?(t.Vu.addReference(r.key,e),M4(t,r)):r instanceof RE?(J(km,"Document no longer in limbo: "+r.key),t.Vu.removeReference(r.key,e),t.Vu.containsKey(r.key)||OE(t,r.key)):re(19791,{wu:r})}function M4(t,e){const n=e.key,r=n.path.canonicalString();t.Ru.get(n)||t.Eu.has(r)||(J(km,"New document in limbo: "+n),t.Eu.add(r),Nm(t))}function Nm(t){for(;t.Eu.size>0&&t.Ru.size<t.maxConcurrentLimboResolutions;){const e=t.Eu.values().next().value;t.Eu.delete(e);const n=new te(Te.fromString(e)),r=t.fu.next();t.Au.set(r,new C4(n)),t.Ru=t.Ru.insert(n,r),TE(t.remoteStore,new Pr(Fn(qc(n.path)),r,"TargetPurposeLimboResolution",zc.ce))}}async function nl(t,e,n){const r=ae(t),s=[],i=[],o=[];r.Tu.isEmpty()||(r.Tu.forEach((l,u)=>{o.push(r.pu(u,e,n).then(h=>{var f;if((h||n)&&r.isPrimaryClient){const p=h?!h.fromCache:(f=n==null?void 0:n.targetChanges.get(u.targetId))==null?void 0:f.current;
2949r.sharedClientState.updateQueryState(u.targetId,p?"current":"not-current")}if(h){s.push(h);const p=gm.Es(u.targetId,h);i.push(p)}}))}),await Promise.all(o),r.Pu.J_(s),await async function(u,h){const f=ae(u);try{await f.persistence.runTransaction("notifyLocalViewChanges","readwrite",p=>z.forEach(h,g=>z.forEach(g.Ts,E=>f.persistence.referenceDelegate.addReference(p,g.targetId,E)).next(()=>z.forEach(g.Is,E=>f.persistence.referenceDelegate.removeReference(p,g.targetId,E)))))}catch(p){if(!ro(p))throw p;J(ym,"Failed to update sequence numbers: "+p)}for(const p of h){const g=p.targetId;if(!p.fromCache){const E=f.vs.get(g),N=E.snapshotVersion,A=E.withLastLimboFreeSnapshotVersion(N);f.vs=f.vs.insert(g,A)}}}(r.localStore,i))}async function F4(t,e){const n=ae(t);if(!n.currentUser.isEqual(e)){J(km,"User change. New user:",e.toKey());const r=await _E(n.localStore,e);n.currentUser=e,function(i,o){i.mu.forEach(l=>{l.forEach(u=>{u.reject(new X($.CANCELLED,o))})}),i.mu.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await nl(n,r.Ns)}}function U4(t,e){const n=ae(t),r=n.Au.get(e);if(r&&r.hu)return ge().add(r.key);{let s=ge();const i=n.Iu.get(e);if(!i)return s;for(const o of i){const l=n.Tu.get(o);s=s.unionWith(l.view.nu)}return s}}function LE(t){const e=ae(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=PE.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=U4.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=O4.bind(null,e),e.Pu.J_=T4.bind(null,e.eventManager),e.Pu.yu=I4.bind(null,e.eventManager),e}function $4(t){const e=ae(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=L4.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=V4.bind(null,e),e}class lc{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Jc(e.databaseInfo.databaseId),this.sharedClientState=this.Du(e),this.persistence=this.Cu(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Fu(e,this.localStore),this.indexBackfillerScheduler=this.Mu(e,this.localStore)}Fu(e,n){return null}Mu(e,n){return null}vu(e){return HP(this.persistence,new $P,e.initialUser,this.serializer)}Cu(e){return new vE(mm.Vi,this.serializer)}Du(e){return new XP}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}lc.provider={build:()=>new lc};class B4 extends lc{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){_e(this.persistence.referenceDelegate instanceof oc,46915);const r=this.persistence.referenceDelegate.garbageCollector;return new SP(r,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?Nt.withCacheSize(this.cacheSizeBytes):Nt.DEFAULT;return new vE(r=>oc.Vi(r,n),this.serializer)}}class Uf{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=>Iv(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=F4.bind(null,this.syncEngine),await w4(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new E4}()}createDatastore(e){const n=Jc(e.databaseInfo.databaseId),r=n4(e.databaseInfo);return a4(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,s,i,o,l){return new u4(r,s,i,o,l)}(this.localStore,this.datastore,e.asyncQueue,n=>Iv(this.syncEngine,n,0),function(){return vv.v()?new vv:new JP}())}createSyncEngine(e,n){return function(s,i,o,l,u,h,f){const p=new k4(s,i,o,l,u,h);return f&&(p.gu=!0),p}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(s){const i=ae(s);J(Us,"RemoteStore shutting down."),i.Ea.add(5),await tl(i),i.Aa.shutdown(),i.V
2949a.set("Unknown")}(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}Uf.provider={build:()=>new Uf};/**
2950 * @license
2951 * Copyright 2020 Google LLC
2952 *
2953 * Licensed under the Apache License, Version 2.0 (the "License");
2954 * you may not use this file except in compliance with the License.
2955 * You may obtain a copy of the License at
2956 *
2957 *   http://www.apache.org/licenses/LICENSE-2.0
2958 *
2959 * Unless required by applicable law or agreed to in writing, software
2960 * distributed under the License is distributed on an "AS IS" BASIS,
2961 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2962 * See the License for the specific language governing permissions and
2963 * limitations under the License.
2964 *//**
2965 * @license
2966 * Copyright 2017 Google LLC
2967 *
2968 * Licensed under the Apache License, Version 2.0 (the "License");
2969 * you may not use this file except in compliance with the License.
2970 * You may obtain a copy of the License at
2971 *
2972 *   http://www.apache.org/licenses/LICENSE-2.0
2973 *
2974 * Unless required by applicable law or agreed to in writing, software
2975 * distributed under the License is distributed on an "AS IS" BASIS,
2976 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2977 * See the License for the specific language governing permissions and
2978 * limitations under the License.
2979 */class Rm{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ou(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ou(this.observer.error,e):lr("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/**
2980 * @license
2981 * Copyright 2017 Google LLC
2982 *
2983 * Licensed under the Apache License, Version 2.0 (the "License");
2984 * you may not use this file except in compliance with the License.
2985 * You may obtain a copy of the License at
2986 *
2987 *   http://www.apache.org/licenses/LICENSE-2.0
2988 *
2989 * Unless required by applicable law or agreed to in writing, software
2990 * distributed under the License is distributed on an "AS IS" BASIS,
2991 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2992 * See the License for the specific language governing permissions and
2993 * limitations under the License.
2994 */const ns="FirestoreClient";class z4{constructor(e,n,r,s,i){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this._databaseInfo=s,this.user=gt.UNAUTHENTICATED,this.clientId=rm.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async o=>{J(ns,"Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(J(ns,"Received new app check token=",o),this.appCheckCredentialListener(o,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}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Xn;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=Tm(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function md(t,e){t.asyncQueue.verifyOperationInProgress(),J(ns,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async s=>{r.isEqual(s)||(await _E(e.localStore,s),r=s)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function Sv(t,e){t.asyncQueue.verifyOperationInProgress();const n=await H4(t);J(ns,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>wv(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,s)=>wv(e.remoteStore,s)),t._onlineComponents=e}async function H4(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){J(ns,"Using user provided OfflineComponentProvider");try{await md(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(s){return s.name==="FirebaseError"?s.code===$.FAILED_PRECONDITION||s.code===$.UNIMPLEMENT
2994ED:!(typeof DOMException<"u"&&s instanceof DOMException)||s.code===22||s.code===20||s.code===11}(n))throw n;Fs("Error using user provided cache. Falling back to memory cache: "+n),await md(t,new lc)}}else J(ns,"Using default OfflineComponentProvider"),await md(t,new B4(void 0));return t._offlineComponents}async function VE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(J(ns,"Using user provided OnlineComponentProvider"),await Sv(t,t._uninitializedComponentsProvider._online)):(J(ns,"Using default OnlineComponentProvider"),await Sv(t,new Uf))),t._onlineComponents}function W4(t){return VE(t).then(e=>e.syncEngine)}async function uc(t){const e=await VE(t),n=e.eventManager;return n.onListen=N4.bind(null,e.syncEngine),n.onUnlisten=P4.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=R4.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=j4.bind(null,e.syncEngine),n}function q4(t,e,n,r){const s=new Rm(r),i=new Cm(e,s,n);return t.asyncQueue.enqueueAndForget(async()=>Im(await uc(t),i)),()=>{s.Nu(),t.asyncQueue.enqueueAndForget(async()=>bm(await uc(t),i))}}function G4(t,e,n={}){const r=new Xn;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,u,h){const f=new Rm({next:g=>{f.Nu(),o.enqueueAndForget(()=>bm(i,p));const E=g.docs.has(l);!E&&g.fromCache?h.reject(new X($.UNAVAILABLE,"Failed to get document because the client is offline.")):E&&g.fromCache&&u&&u.source==="server"?h.reject(new X($.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.)')):h.resolve(g)},error:g=>h.reject(g)}),p=new Cm(qc(l.path),f,{includeMetadataChanges:!0,Ka:!0});return Im(i,p)}(await uc(t),t.asyncQueue,e,n,r)),r.promise}function K4(t,e,n={}){const r=new Xn;return t.asyncQueue.enqueueAndForget(async()=>function(i,o,l,u,h){const f=new Rm({next:g=>{f.Nu(),o.enqueueAndForget(()=>bm(i,p)),g.fromCache&&u.source==="server"?h.reject(new X($.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.)')):h.resolve(g)},error:g=>h.reject(g)}),p=new Cm(l,f,{includeMetadataChanges:!0,Ka:!0});return Im(i,p)}(await uc(t),t.asyncQueue,e,n,r)),r.promise}function Q4(t,e){const n=new Xn;return t.asyncQueue.enqueueAndForget(async()=>D4(await W4(t),e,n)),n.promise}/**
2995 * @license
2996 * Copyright 2023 Google LLC
2997 *
2998 * Licensed under the Apache License, Version 2.0 (the "License");
2999 * you may not use this file except in compliance with the License.
3000 * You may obtain a copy of the License at
3001 *
3002 *   http://www.apache.org/licenses/LICENSE-2.0
3003 *
3004 * Unless required by applicable law or agreed to in writing, software
3005 * distributed under the License is distributed on an "AS IS" BASIS,
3006 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3007 * See the License for the specific language governing permissions and
3008 * limitations under the License.
3009 */function ME(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
3010 * @license
3011 * Copyright 2020 Google LLC
3012 *
3013 * Licensed under the Apache License, Version 2.0 (the "License");
3014 * you may not use this file except in compliance with the License.
3015 * You may obtain a copy of the License at
3016 *
3017 *   http://www.apache.org/licenses/LICENSE-2.0
3018 *
3019 * Unless required by applicable law or agreed to in writing, software
3020 * distributed under the License is distributed on an "AS IS" BASIS,
3021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3022 * See the License for the specific language governing permissions and
3023 * limitations under the License.
3024 */const Y4="ComponentProvider",Cv=new Map;function X4(t,e,n,r,s){return new mA(t,e,n,s.host,s.ssl,s.experimentalForceLongPolling,s.experimentalAutoDetectLongPolling,ME(s.experimentalLongPollingOptions),s.useFetchStreams,s.isUsingEmulator,r)}/**
3025 * @license
3026 * Copyright 2020 Google LLC
3027 *
3028 * Licensed under the Apache License, Version 2.0 (the "License");
3029 * you may not use this file except in compliance with the License.
3030 * You may obtain a copy of the License at
3031 *
3032 *   http://www.apache.org/licenses/LICENSE-2.0
3033 *
3034 * Unless required by applicable law or agreed to in writing, software
3035 * distributed under the License is distributed on an "AS IS" BASIS,
3036 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3037 * See the License for the specific language governing permissions and
3038 * limitations under the License.
3039 */const FE="firestore.googleapis.com",kv=!0;class Nv{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new X($.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=FE,this.ssl=kv}else this.host=e.host,this.ssl=e.ssl??kv;if(this.isUsingEmulator=e.emulatorOptions!==void 0,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=yE;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<IP)throw new X($.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}sA("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=ME(e.experimentalLongPollingOptions??{}),function(r){if(r.timeoutSeconds!==void 0){if(isNaN(r.timeoutSeconds))throw new X($.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (must not be NaN)`);if(r.timeoutSeconds<5)throw new X($.INVALID_ARGUMENT,`invalid long polling timeout: ${r.timeoutSeconds} (minimum allowed value is 5)`);if(r.timeoutSeconds>30)throw new X($.INVALID_ARGUMENT,`invalid long polling timeout: ${r.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,s){return r.timeoutSeconds===s.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class th{constructor(e,n,r,s){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=s,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new Nv({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new X($.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!=="notTerminated"}_setSettings(e){if(this._settingsFrozen)throw new X($.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 Nv(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new KR;switch(r.type){case"firstParty":return new JR(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new X($.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=Cv.get(n);r&&(J(Y4,"Removing Datastore"),Cv.delete(n),r.terminate())}(this),Promise.resolve()}}function J4(t,e,n,r={}){var h;t=Lt(t,th);const s=as(e),i=t._getSettings(),o={...i,emulatorOptions:t._getEmulatorOptions()},l=`${e}:${n}`;s&&(zp(`https://${l}`),Hp("Firestore",!0)),i.host!==FE&&i.host!==l&&Fs("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const u={...i,host:l,ssl:s,emulatorOptions:r};if(!Os(u,o)&&(t._setSettings(u),r.mockUserToken)){let f,p;if(typeof r.mockUserToken=="string")f=r.mockUserToken,p=gt.MOCK_USER;else{f=Lx(r.mockUserToken,(h=t._app)==null?void 0:h.options.projectId);const g=r.mockUserToken.sub||r.mockUserToken.user_id;if(!g)throw new X($.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");p=new gt(g)}t._authCredentials=new QR(new k1(f,p))}}/**
3040 * @license
3041 * Copyright 2020 Google LLC
3042 *
3043 * Licensed under the Apache License, Version 2.0 (the "License");
3044 * you may not use this file except in compliance with the License.
3045 * You may obtain a copy of the License at
3046 *
3047 *   http://www.apache.org/licenses/LICENSE-2.0
3048 *
3049 * Unless required by applicable law or agreed to in writing, software
3050 * distributed under the License is distributed on an "AS IS" BASIS,
3051 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3052 * See the License for the specific language governing permissions and
3053 * limitations under the License.
3054 */class hs{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new hs(this.firestore,e,this._query)}}class ze{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 Wr(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new ze(this.firestore,e,this._key)}toJSON(){return{type:ze._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,r){if(Ja(n,ze._jsonSchema))return new ze(e,r||null,new te(Te.fromString(n.referencePath)))}}ze._jsonSchemaVersion="firestore/documentReference/1.0",ze._jsonSchema={type:Xe("string",ze._jsonSchemaVersion),referencePath:Xe("string")};class Wr extends hs{constructor(e,n,r){super(e,n,qc(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 ze(this.firestore,null,new te(e))}withConverter(e){return new Wr(this.firestore,e,this._path)}}function _t(t,e,...n){if(t=je(t),N1("collection","path",e),t instanceof th){const r=Te.fromString(e,...n);return B0(r),new Wr(t,null,r)}{if(!(t instanceof ze||t instanceof Wr))throw new X($.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Te.fromString(e,...n));return B0(r),new Wr(t.firestore,null,r)}}function Oe(t,e,...n){if(t=je(t),arguments.length===1&&(e=rm.newId()),N1("doc","path",e),t instanceof th){const r=Te.fromString(e,...n);return $0(r),new ze(t,null,new te(r))}{if(!(t instanceof ze||t instanceof Wr))throw new X($.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Te.fromString(e,...n));return $0(r),new ze(t.firestore,t instanceof Wr?t.converter:null,new te(r))}}/**
3055 * @license
3056 * Copyright 2020 Google LLC
3057 *
3058 * Licensed under the Apache License, Version 2.0 (the "License");
3059 * you may not use this file except in compliance with the License.
3060 * You may obtain a copy of the License at
3061 *
3062 *   http://www.apache.org/licenses/LICENSE-2.0
3063 *
3064 * Unless required by applicable law or agreed to in writing, software
3065 * distributed under the License is distributed on an "AS IS" BASIS,
3066 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3067 * See the License for the specific language governing permissions and
3068 * limitations under the License.
3069 */const Rv="AsyncQueue";class Av{constructor(e=Promise.resolve()){this.Yu=[],this.ec=!1,this.tc=[],this.nc=null,this.rc=!1,this.sc=!1,this.oc=[],this.M_=new xE(this,"async_queue_retry"),this._c=()=>{const r=pd();r&&J(Rv,"Visibility state changed to "+r.visibilityState),this.M_.w_()},this.ac=e;const n=pd();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this._c)}get isShuttingDown(){return this.ec}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.uc(),this.cc(e)}enterRestrictedMode(e){if(!this.ec){this.ec=!0,this.sc=e||!1;const n=pd();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise(()=>{});const n=new Xn;return this.cc(()=>this.ec&&this.sc?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Yu.push(e),this.lc()))}async lc(){if(this.Yu.length!==0){try{await this.Yu[0](),this.Yu.shift(),this.M_.reset()}catch(e){if(!ro(e))throw e;J(Rv,"Operation failed with retryable error: "+e)}this.Yu.length>0&&this.M_.p_(()=>this.lc())}}cc(e){const n=this.ac.then(()=>(this.rc=!0,e().catch(r=>{throw this.nc=r,this.rc=!1,lr("INTERNAL UNHANDLED ERROR: ",Pv(r)),r}).then(r=>(this.rc=!1,r))));return this.ac=n,n}enqueueAfterDelay(e,n,r){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const s=Em.createAndSchedule(this,e,n,r,i=>this.hc(i));return this.tc.push(s),s}uc(){this.nc&&re(47125,{Pc:Pv(this.nc)})}verifyOperationInProgress(){}async Tc(){let e;do e=this.ac,await e;while(e!==this.ac)}Ic(e){for(const n of this.tc)if(n.timerId===e)return!0;return!1}Ec(e){return this.Tc().then(()=>{this.tc.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.tc)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.Tc()})}Rc(e){this.oc.push(e)}hc(e){const n=this.tc.indexOf(e);this.tc.splice(n,1)}}function Pv(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
3070`+t.stack),e}class cr extends th{constructor(e,n,r,s){super(e,n,r,s),this.type="firestore",this._queue=new Av,this._persistenceKey=(s==null?void 0:s.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new Av(e),this._firestoreClient=void 0,await e}}}function Z4(t,e){const n=typeof t=="object"?t:Gp(),r=typeof t=="string"?t:tc,s=Vc(n,"firestore").getImmediate({identifier:r});if(!s._initialized){const i=jx("firestore");i&&J4(s,...i)}return s}function nh(t){if(t._terminated)throw new X($.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||ej(t),t._firestoreClient}function ej(t){var r,s,i,o;const e=t._freezeSettings(),n=X4(t._databaseId,((r=t._app)==null?void 0:r.options.appId)||"",t._persistenceKey,(s=t._app)==null?void 0:s.options.apiKey,e);t._componentsProvider||(i=e.localCache)!=null&&i._offlineComponentProvider&&((o=e.localCache)!=null&&o._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new z4(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&function(u){const h=u==null?void 0:u._online.build();return{_offline:u==null?void 0:u._offline.build(h),_online:h}}(t._componentsProvider))}/**
3071 * @license
3072 * Copyright 2020 Google LLC
3073 *
3074 * Licensed under the Apache License, Version 2.0 (the "License");
3075 * you may not use this file except in compliance with the License.
3076 * You may obtain a copy of the License at
3077 *
3078 *   http://www.apache.org/licenses/LICENSE-2.0
3079 *
3080 * Unless required by applicable law or agreed to in writing, software
3081 * distributed under the License is distributed on an "AS IS" BASIS,
3082 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3083 * See the License for the specific language governing permissions and
3084 * limitations under the License.
3085 */class Jt{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Jt(dt.fromBase64String(e))}catch(n){throw new X($.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Jt(dt.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)}toJSON(){return{type:Jt._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(Ja(e,Jt._jsonSchema))return Jt.fromBase64String(e.bytes)}}Jt._jsonSchemaVersion="firestore/bytes/1.0",Jt._jsonSchema={type:Xe("string",Jt._jsonSchemaVersion),bytes:Xe("string")};/**
3086 * @license
3087 * Copyright 2020 Google LLC
3088 *
3089 * Licensed under the Apache License, Version 2.0 (the "License");
3090 * you may not use this file except in compliance with the License.
3091 * You may obtain a copy of the License at
3092 *
3093 *   http://www.apache.org/licenses/LICENSE-2.0
3094 *
3095 * Unless required by applicable law or agreed to in writing, software
3096 * distributed under the License is distributed on an "AS IS" BASIS,
3097 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3098 * See the License for the specific language governing permissions and
3099 * limitations under the License.
3100 */class Am{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new X($.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new ut(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
3101 * @license
3102 * Copyright 2020 Google LLC
3103 *
3104 * Licensed under the Apache License, Version 2.0 (the "License");
3105 * you may not use this file except in compliance with the License.
3106 * You may obtain a copy of the License at
3107 *
3108 *   http://www.apache.org/licenses/LICENSE-2.0
3109 *
3110 * Unless required by applicable law or agreed to in writing, software
3111 * distributed under the License is distributed on an "AS IS" BASIS,
3112 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3113 * See the License for the specific language governing permissions and
3114 * limitations under the License.
3115 */class rh{constructor(e){this._methodName=e}}/**
3116 * @license
3117 * Copyright 2017 Google LLC
3118 *
3119 * Licensed under the Apache License, Version 2.0 (the "License");
3120 * you may not use this file except in compliance with the License.
3121 * You may obtain a copy of the License at
3122 *
3123 *   http://www.apache.org/licenses/LICENSE-2.0
3124 *
3125 * Unless required by applicable law or agreed to in writing, software
3126 * distributed under the License is distributed on an "AS IS" BASIS,
3127 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3128 * See the License for the specific language governing permissions and
3129 * limitations under the License.
3130 */class $n{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new X($.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new X($.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}_compareTo(e){return me(this._lat,e._lat)||me(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:$n._jsonSchemaVersion}}static fromJSON(e){if(Ja(e,$n._jsonSchema))return new $n(e.latitude,e.longitude)}}$n._jsonSchemaVersion="firestore/geoPoint/1.0",$n._jsonSchema={type:Xe("string",$n._jsonSchemaVersion),latitude:Xe("number"),longitude:Xe("number")};/**
3131 * @license
3132 * Copyright 2024 Google LLC
3133 *
3134 * Licensed under the Apache License, Version 2.0 (the "License");
3135 * you may not use this file except in compliance with the License.
3136 * You may obtain a copy of the License at
3137 *
3138 *   http://www.apache.org/licenses/LICENSE-2.0
3139 *
3140 * Unless required by applicable law or agreed to in writing, software
3141 * distributed under the License is distributed on an "AS IS" BASIS,
3142 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3143 * See the License for the specific language governing permissions and
3144 * limitations under the License.
3145 */class gn{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,s){if(r.length!==s.length)return!1;for(let i=0;i<r.length;++i)if(r[i]!==s[i])return!1;return!0}(this._values,e._values)}toJSON(){return{type:gn._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(Ja(e,gn._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(n=>typeof n=="number"))return new gn(e.vectorValues);throw new X($.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}gn._jsonSchemaVersion="firestore/vectorValue/1.0",gn._jsonSchema={type:Xe("string",gn._jsonSchemaVersion),vectorValues:Xe("object")};/**
3146 * @license
3147 * Copyright 2017 Google LLC
3148 *
3149 * Licensed under the Apache License, Version 2.0 (the "License");
3150 * you may not use this file except in compliance with the License.
3151 * You may obtain a copy of the License at
3152 *
3153 *   http://www.apache.org/licenses/LICENSE-2.0
3154 *
3155 * Unless required by applicable law or agreed to in writing, software
3156 * distributed under the License is distributed on an "AS IS" BASIS,
3157 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3158 * See the License for the specific language governing permissions and
3159 * limitations under the License.
3160 */const tj=/^__.*__$/;class nj{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new cs(e,this.data,this.fieldMask,n,this.fieldTransforms):new Za(e,this.data,n,this.fieldTransforms)}}class UE{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new cs(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function $E(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw re(40011,{dataSource:t})}}class Pm{constructor(e,n,r,s,i,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=s,i===void 0&&this.validatePath(),this.fieldTransforms=i||[],this.fieldMask=o||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new Pm({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePathSegment(e),r}childContextForFieldPath(e){var s;const n=(s=this.path)==null?void 0:s.child(e),r=this.contextWith({path:n,arrayElement:!1});return r.validatePath(),r}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return cc(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}validatePath(){if(this.path)for(let e=0;e<this.path.length;e++)this.validatePathSegment(this.path.get(e))}validatePathSegment(e){if(e.length===0)throw this.createError("Document fields must not be empty");if($E(this.dataSource)&&tj.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class rj{constructor(e,n,r){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=r||Jc(e)}createContext(e,n,r,s=!1){return new Pm({dataSource:e,methodName:n,targetDoc:r,path:ut.emptyPath(),arrayElement:!1,hasConverter:s},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function sh(t){const e=t._freezeSettings(),n=Jc(t._databaseId);return new rj(t._databaseId,!!e.ignoreUndefinedProperties,n)}function BE(t,e,n,r,s,i={}){const o=t.createContext(i.merge||i.mergeFields?2:0,e,n,s);Dm("Data must be an object, but it was:",o,r);const l=zE(r,o);let u,h;if(i.merge)u=new $t(o.fieldMask),h=o.fieldTransforms;else if(i.mergeFields){const f=[];for(const p of i.mergeFields){const g=$i(e,p,n);if(!o.contains(g))throw new X($.INVALID_ARGUMENT,`Field '${g}' is specified in your field mask but missing from your input data.`);qE(f,g)||f.push(g)}u=new $t(f),h=o.fieldTransforms.filter(p=>u.covers(p.field))}else u=null,h=o.fieldTransforms;return new nj(new At(l),u,h)}class ih extends rh{_toFieldTransform(e){if(e.dataSource!==2)throw e.dataSource===1?e.createError(`${this._methodName}() can only appear at the top level of your update data`):e.createError(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof ih}}class jm extends rh{_toFieldTransform(e){return new HA(e.path,new Va)}isEqual(e){return e instanceof jm}}function sj(t,e,n,r){const s=t.createContext(1,e,n);Dm("Data must be an object, but it was:",s,r);const i=[],o=At.empty();us(r,(u,h)=>{const f=WE(e,u,n);h=je(h);const p=s.childContextForFieldPath(f);if(h instanceof ih)i.push(f);else{const g=rl(h,p);g!=null&&(i.push(f),o.set(f,g))}});const l=new $t(i);return new UE(o,l,s.fieldTransforms)}function ij(t,e,n,r,s,i){const o=t.createContext(1,e,n),l=[$i(e,r,n)],u=[s];if(i.length%2!=0)throw new X($.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g<i.length;g+=2)l.push($i(e,i[g])),u.push(i[g+1]);const h=[],f=At.empty();for(let g=l.length-1;g>=0;--g)if(!qE(h,l[g])){const E=l[g];let N=u[g];N=je(N);const A=o.childContextForFieldPath(E);if(N instanceof ih)h.push(E);else{const P=rl(N,A);P!=null&&(h.push(E),f.set(E,P))}}const p=new $t(h);return new UE(f,p,o.fieldTransforms)}function oj(t,e,n,r=!1){return rl(n,t.createContext(r?4:3,e))}function rl(t,e){if(HE(t=je(t)))return Dm("Unsupported field value:",e,t),zE(t,e);if(t instanceof rh)return function(r,s){if(!$E(s.dataSource))throw s.createError(`${r._methodName}
3160() can only be used with update() and set()`);if(!s.path)throw s.createError(`${r._methodName}() is not currently supported inside arrays`);const i=r._toFieldTransform(s);i&&s.fieldTransforms.push(i)}(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.arrayElement&&e.dataSource!==4)throw e.createError("Nested arrays are not supported");return function(r,s){const i=[];let o=0;for(const l of r){let u=rl(l,s.childContextForArray(o));u==null&&(u={nullValue:"NULL_VALUE"}),i.push(u),o++}return{arrayValue:{values:i}}}(t,e)}return function(r,s){if((r=je(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return $A(s.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const i=Ne.fromDate(r);return{timestampValue:ic(s.serializer,i)}}if(r instanceof Ne){const i=new Ne(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:ic(s.serializer,i)}}if(r instanceof $n)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Jt)return{bytesValue:uE(s.serializer,r._byteString)};if(r instanceof ze){const i=s.databaseId,o=r.firestore._databaseId;if(!o.isEqual(i))throw s.createError(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${i.projectId}/${i.database}`);return{referenceValue:fm(r.firestore._databaseId||s.databaseId,r._key.path)}}if(r instanceof gn)return function(o,l){const u=o instanceof gn?o.toArray():o;return{mapValue:{fields:{[M1]:{stringValue:F1},[nc]:{arrayValue:{values:u.map(f=>{if(typeof f!="number")throw l.createError("VectorValues must only contain numeric values.");return um(l.serializer,f)})}}}}}}(r,s);if(gE(r))return r._toProto(s.serializer);throw s.createError(`Unsupported field value: ${Bc(r)}`)}(t,e)}function zE(t,e){const n={};return P1(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):us(t,(r,s)=>{const i=rl(s,e.childContextForField(r));i!=null&&(n[r]=i)}),{mapValue:{fields:n}}}function HE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ne||t instanceof $n||t instanceof Jt||t instanceof ze||t instanceof rh||t instanceof gn||gE(t))}function Dm(t,e,n){if(!HE(n)||!R1(n)){const r=Bc(n);throw r==="an object"?e.createError(t+" a custom object"):e.createError(t+" "+r)}}function $i(t,e,n){if((e=je(e))instanceof Am)return e._internalPath;if(typeof e=="string")return WE(t,e);throw cc("Field path arguments must be of type string or ",t,!1,void 0,n)}const aj=new RegExp("[~\\*/\\[\\]]");function WE(t,e,n){if(e.search(aj)>=0)throw cc(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new Am(...e.split("."))._internalPath}catch{throw cc(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function cc(t,e,n,r,s){const i=r&&!r.isEmpty(),o=s!==void 0;let l=`Function ${e}() called with invalid data`;n&&(l+=" (via `toFirestore()`)"),l+=". ";let u="";return(i||o)&&(u+=" (found",i&&(u+=` in field ${r}`),o&&(u+=` in document ${s}`),u+=")"),new X($.INVALID_ARGUMENT,l+t+u)}function qE(t,e){return t.some(n=>n.isEqual(e))}/**
3161 * @license
3162 * Copyright 2020 Google LLC
3163 *
3164 * Licensed under the Apache License, Version 2.0 (the "License");
3165 * you may not use this file except in compliance with the License.
3166 * You may obtain a copy of the License at
3167 *
3168 *   http://www.apache.org/licenses/LICENSE-2.0
3169 *
3170 * Unless required by applicable law or agreed to in writing, software
3171 * distributed under the License is distributed on an "AS IS" BASIS,
3172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3173 * See the License for the specific language governing permissions and
3174 * limitations under the License.
3175 */class lj{convertValue(e,n="none"){switch(es(e)){case 0:return null;case 1:return e.booleanValue;case 2:return qe(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(Zr(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 re(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return us(e,(s,i)=>{r[s]=this.convertValue(i,n)}),r}convertVectorValue(e){var r,s,i;const n=(i=(s=(r=e.fields)==null?void 0:r[nc].arrayValue)==null?void 0:s.values)==null?void 0:i.map(o=>qe(o.doubleValue));return new gn(n)}convertGeoPoint(e){return new $n(qe(e.latitude),qe(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Wc(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(ja(e));default:return null}}convertTimestamp(e){const n=Jr(e);return new Ne(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Te.fromString(e);_e(mE(r),9688,{name:e});const s=new Da(r.get(1),r.get(3)),i=new te(r.popFirst(5));return s.isEqual(n)||lr(`Document ${i} contains a document reference within a different database (${s.projectId}/${s.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),i}}/**
3176 * @license
3177 * Copyright 2024 Google LLC
3178 *
3179 * Licensed under the Apache License, Version 2.0 (the "License");
3180 * you may not use this file except in compliance with the License.
3181 * You may obtain a copy of the License at
3182 *
3183 *   http://www.apache.org/licenses/LICENSE-2.0
3184 *
3185 * Unless required by applicable law or agreed to in writing, software
3186 * distributed under the License is distributed on an "AS IS" BASIS,
3187 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3188 * See the License for the specific language governing permissions and
3189 * limitations under the License.
3190 */class Om extends lj{constructor(e){super(),this.firestore=e}convertBytes(e){return new Jt(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new ze(this.firestore,null,n)}}function An(){return new jm("serverTimestamp")}const jv="@firebase/firestore",Dv="4.12.0";/**
3191 * @license
3192 * Copyright 2017 Google LLC
3193 *
3194 * Licensed under the Apache License, Version 2.0 (the "License");
3195 * you may not use this file except in compliance with the License.
3196 * You may obtain a copy of the License at
3197 *
3198 *   http://www.apache.org/licenses/LICENSE-2.0
3199 *
3200 * Unless required by applicable law or agreed to in writing, software
3201 * distributed under the License is distributed on an "AS IS" BASIS,
3202 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3203 * See the License for the specific language governing permissions and
3204 * limitations under the License.
3205 */function Ov(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const s=n;for(const i of r)if(i in s&&typeof s[i]=="function")return!0;return!1}(t,["next","error","complete"])}/**
3206 * @license
3207 * Copyright 2020 Google LLC
3208 *
3209 * Licensed under the Apache License, Version 2.0 (the "License");
3210 * you may not use this file except in compliance with the License.
3211 * You may obtain a copy of the License at
3212 *
3213 *   http://www.apache.org/licenses/LICENSE-2.0
3214 *
3215 * Unless required by applicable law or agreed to in writing, software
3216 * distributed under the License is distributed on an "AS IS" BASIS,
3217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3218 * See the License for the specific language governing permissions and
3219 * limitations under the License.
3220 */class GE{constructor(e,n,r,s,i){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=s,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new ze(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new uj(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){var e;return((e=this._document)==null?void 0:e.data.clone().value.mapValue.fields)??void 0}get(e){if(this._document){const n=this._document.data.field($i("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class uj extends GE{data(){return super.data()}}/**
3221 * @license
3222 * Copyright 2020 Google LLC
3223 *
3224 * Licensed under the Apache License, Version 2.0 (the "License");
3225 * you may not use this file except in compliance with the License.
3226 * You may obtain a copy of the License at
3227 *
3228 *   http://www.apache.org/licenses/LICENSE-2.0
3229 *
3230 * Unless required by applicable law or agreed to in writing, software
3231 * distributed under the License is distributed on an "AS IS" BASIS,
3232 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3233 * See the License for the specific language governing permissions and
3234 * limitations under the License.
3235 */function KE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new X($.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class Lm{}class QE extends Lm{}function Jn(t,e,...n){let r=[];e instanceof Lm&&r.push(e),r=r.concat(n),function(i){const o=i.filter(u=>u instanceof Mm).length,l=i.filter(u=>u instanceof Vm).length;if(o>1||o>0&&l>0)throw new X($.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 s of r)t=s._apply(t);return t}class Vm extends QE{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new Vm(e,n,r)}_apply(e){const n=this._parse(e);return YE(e._query,n),new hs(e.firestore,e.converter,Rf(e._query,n))}_parse(e){const n=sh(e.firestore);return function(i,o,l,u,h,f,p){let g;
3235if(h.isKeyField()){if(f==="array-contains"||f==="array-contains-any")throw new X($.INVALID_ARGUMENT,`Invalid Query. You can't perform '${f}' queries on documentId().`);if(f==="in"||f==="not-in"){Vv(p,f);const N=[];for(const A of p)N.push(Lv(u,i,A));g={arrayValue:{values:N}}}else g=Lv(u,i,p)}else f!=="in"&&f!=="not-in"&&f!=="array-contains-any"||Vv(p,f),g=oj(l,o,p,f==="in"||f==="not-in");return Ye.create(h,f,g)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}class Mm extends Lm{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new Mm(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]:xn.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(s,i){let o=s;const l=i.getFlattenedFilters();for(const u of l)YE(o,u),o=Rf(o,u)}(e._query,n),new hs(e.firestore,e.converter,Rf(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}class Fm extends QE{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new Fm(e,n)}_apply(e){const n=function(s,i,o){if(s.startAt!==null)throw new X($.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(s.endAt!==null)throw new X($.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new La(i,o)}(e._query,this._field,this._direction);return new hs(e.firestore,e.converter,jA(e._query,n))}}function qr(t,e="asc"){const n=e,r=$i("orderBy",t);return Fm._create(r,n)}function Lv(t,e,n){if(typeof(n=je(n))=="string"){if(n==="")throw new X($.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!G1(e)&&n.indexOf("/")!==-1)throw new X($.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(Te.fromString(n));if(!te.isDocumentKey(r))throw new X($.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 Y0(t,new te(r))}if(n instanceof ze)return Y0(t,n._key);throw new X($.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Bc(n)}.`)}function Vv(t,e){if(!Array.isArray(t)||t.length===0)throw new X($.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function YE(t,e){const n=function(s,i){for(const o of s)for(const l of o.getFlattenedFilters())if(i.indexOf(l.op)>=0)return l.op;return null}(t.filters,function(s){switch(s){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 X($.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new X($.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function XE(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}class Go{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class Cs extends GE{constructor(e,n,r,s,i,o){super(e,n,r,s,o),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new wu(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($i("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new X($.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e=this._document,n={};return n.type=Cs._jsonSchemaVersion,n.bundle="",n.bundleSource="DocumentSnapshot",n.bundleName=this._key.toString(),!e||!e.isValidDocument()||!e.isFoundDocument()?n:(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),n.bundle=(this._firestore,this.ref.path,"NOT SUPPORTED"),n)}}Cs._jsonSchemaVersion="firestore/documentSnapshot/1.0",Cs._jsonSchema={type:Xe("string",Cs._jsonSchemaVersion),bundleSource:Xe("string","DocumentSnapshot"),bundleName:Xe("string"),bundle:Xe("string")};class wu extends Cs{data(e={}){return super.data(e)}}class ks{constructor(e,n,r,s){this._firestore=e,this._userDataWriter=n,this._snapshot=s,this.metadata=new Go(s.hasPendingWrites,s.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 wu(this._firestore,this._userDataWriter,r.key,r,new Go(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}
3235docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new X($.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(s,i){if(s._snapshot.oldDocs.isEmpty()){let o=0;return s._snapshot.docChanges.map(l=>{const u=new wu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new Go(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);return l.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=s._snapshot.oldDocs;return s._snapshot.docChanges.filter(l=>i||l.type!==3).map(l=>{const u=new wu(s._firestore,s._userDataWriter,l.doc.key,l.doc,new Go(s._snapshot.mutatedKeys.has(l.doc.key),s._snapshot.fromCache),s.query.converter);let h=-1,f=-1;return l.type!==0&&(h=o.indexOf(l.doc.key),o=o.delete(l.doc.key)),l.type!==1&&(o=o.add(l.doc),f=o.indexOf(l.doc.key)),{type:cj(l.type),doc:u,oldIndex:h,newIndex:f}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new X($.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=ks._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=rm.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],r=[],s=[];return this.docs.forEach(i=>{i._document!==null&&(n.push(i._document),r.push(this._userDataWriter.convertObjectMap(i._document.data.value.mapValue.fields,"previous")),s.push(i.ref.path))}),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function cj(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return re(61501,{type:t})}}/**
3236 * @license
3237 * Copyright 2022 Google LLC
3238 *
3239 * Licensed under the Apache License, Version 2.0 (the "License");
3240 * you may not use this file except in compliance with the License.
3241 * You may obtain a copy of the License at
3242 *
3243 *   http://www.apache.org/licenses/LICENSE-2.0
3244 *
3245 * Unless required by applicable law or agreed to in writing, software
3246 * distributed under the License is distributed on an "AS IS" BASIS,
3247 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3248 * See the License for the specific language governing permissions and
3249 * limitations under the License.
3250 */ks._jsonSchemaVersion="firestore/querySnapshot/1.0",ks._jsonSchema={type:Xe("string",ks._jsonSchemaVersion),bundleSource:Xe("string","QuerySnapshot"),bundleName:Xe("string"),bundle:Xe("string")};/**
3251 * @license
3252 * Copyright 2020 Google LLC
3253 *
3254 * Licensed under the Apache License, Version 2.0 (the "License");
3255 * you may not use this file except in compliance with the License.
3256 * You may obtain a copy of the License at
3257 *
3258 *   http://www.apache.org/licenses/LICENSE-2.0
3259 *
3260 * Unless required by applicable law or agreed to in writing, software
3261 * distributed under the License is distributed on an "AS IS" BASIS,
3262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3263 * See the License for the specific language governing permissions and
3264 * limitations under the License.
3265 */function Mv(t){t=Lt(t,ze);const e=Lt(t.firestore,cr),n=nh(e);return G4(n,t._key).then(r=>ZE(e,t,r))}function JE(t){t=Lt(t,hs);const e=Lt(t.firestore,cr),n=nh(e),r=new Om(e);return KE(t._query),K4(n,t._query).then(s=>new ks(e,r,t,s))}function Gr(t,e,n){t=Lt(t,ze);const r=Lt(t.firestore,cr),s=XE(t.converter,e,n),i=sh(r);return oh(r,[BE(i,"setDoc",t._key,s,t.converter!==null,n).toMutation(t._key,rn.none())])}function Rn(t,e,n,...r){t=Lt(t,ze);const s=Lt(t.firestore,cr),i=sh(s);let o;return o=typeof(e=je(e))=="string"||e instanceof Am?ij(i,"updateDoc",t._key,e,n,r):sj(i,"updateDoc",t._key,e),oh(s,[o.toMutation(t._key,rn.exists(!0))])}function hc(t){return oh(Lt(t.firestore,cr),[new cm(t._key,rn.none())])}function Um(t,e){const n=Lt(t.firestore,cr),r=Oe(t),s=XE(t.converter,e),i=sh(t.firestore);return oh(n,[BE(i,"addDoc",r._key,s,t.converter!==null,{}).toMutation(r._key,rn.exists(!1))]).then(()=>r)}function yn(t,...e){var h,f,p;t=je(t);let n={includeMetadataChanges:!1,source:"default"},r=0;typeof e[r]!="object"||Ov(e[r])||(n=e[r++]);const s={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(Ov(e[r])){const g=e[r];e[r]=(h=g.next)==null?void 0:h.bind(g),e[r+1]=(f=g.error)==null?void 0:f.bind(g),e[r+2]=(p=g.complete)==null?void 0:p.bind(g)}let i,o,l;if(t instanceof ze)o=Lt(t.firestore,cr),l=qc(t._key.path),i={next:g=>{e[r]&&e[r](ZE(o,t,g))},error:e[r+1],complete:e[r+2]};else{const g=Lt(t,hs);o=Lt(g.firestore,cr),l=g._query;const E=new Om(o);i={next:N=>{e[r]&&e[r](new ks(o,E,g,N))},error:e[r+1],complete:e[r+2]},KE(t._query)}const u=nh(o);return q4(u,l,s,i)}function oh(t,e){const n=nh(t);return Q4(n,e)}function ZE(t,e,n){const r=n.docs.get(e._key),s=new Om(t);return new Cs(t,s,e._key,r,new Go(n.hasPendingWrites,n.fromCache),e.converter)}(function(e,n=!0){GR(Hs),Ls(new Yr("firestore",(r,{instanceIdentifier:s,options:i})=>{const o=r.getProvider("app").getImmediate(),l=new cr(new YR(r.getProvider("auth-internal")),new ZR(o,r.getProvider("app-check-internal")),gA(o,s),o);return i={useFetchStreams:n,...i},l._setSettings(i),l},"PUBLIC").setMultipleInstances(!0)),Ln(jv,Dv,e),Ln(jv,Dv,"esm2020")})();var hj="firebase",dj="12.10.0";/**
3266 * @license
3267 * Copyright 2020 Google LLC
3268 *
3269 * Licensed under the Apache License, Version 2.0 (the "License");
3270 * you may not use this file except in compliance with the License.
3271 * You may obtain a copy of the License at
3272 *
3273 *   http://www.apache.org/licenses/LICENSE-2.0
3274 *
3275 * Unless required by applicable law or agreed to in writing, software
3276 * distributed under the License is distributed on an "AS IS" BASIS,
3277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3278 * See the License for the specific language governing permissions and
3279 * limitations under the License.
3280 */Ln(hj,dj,"app");/**
3281 * @license
3282 * Copyright 2017 Google LLC
3283 *
3284 * Licensed under the Apache License, Version 2.0 (the "License");
3285 * you may not use this file except in compliance with the License.
3286 * You may obtain a copy of the License at
3287 *
3288 *   http://www.apache.org/licenses/LICENSE-2.0
3289 *
3290 * Unless required by applicable law or agreed to in writing, software
3291 * distributed under the License is distributed on an "AS IS" BASIS,
3292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3293 * See the License for the specific language governing permissions and
3294 * limitations under the License.
3295 */const eT="firebasestorage.googleapis.com",tT="storageBucket",fj=2*60*1e3,pj=10*60*1e3;/**
3296 * @license
3297 * Copyright 2017 Google LLC
3298 *
3299 * Licensed under the Apache License, Version 2.0 (the "License");
3300 * you may not use this file except in compliance with the License.
3301 * You may obtain a copy of the License at
3302 *
3303 *   http://www.apache.org/licenses/LICENSE-2.0
3304 *
3305 * Unless required by applicable law or agreed to in writing, software
3306 * distributed under the License is distributed on an "AS IS" BASIS,
3307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3308 * See the License for the specific language governing permissions and
3309 * limitations under the License.
3310 */class We extends zn{constructor(e,n,r=0){super(gd(e),`Firebase Storage: ${n} (${gd(e)})`),this.status_=r,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,We.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return gd(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
3311${this.customData.serverResponse}`:this.message=this._baseMessage}}var He;(function(t){t.UNKNOWN="unknown",t.OBJECT_NOT_FOUND="object-not-found",t.BUCKET_NOT_FOUND="bucket-not-found",t.PROJECT_NOT_FOUND="project-not-found",t.QUOTA_EXCEEDED="quota-exceeded",t.UNAUTHENTICATED="unauthenticated",t.UNAUTHORIZED="unauthorized",t.UNAUTHORIZED_APP="unauthorized-app",t.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",t.INVALID_CHECKSUM="invalid-checksum",t.CANCELED="canceled",t.INVALID_EVENT_NAME="invalid-event-name",t.INVALID_URL="invalid-url",t.INVALID_DEFAULT_BUCKET="invalid-default-bucket",t.NO_DEFAULT_BUCKET="no-default-bucket",t.CANNOT_SLICE_BLOB="cannot-slice-blob",t.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",t.NO_DOWNLOAD_URL="no-download-url",t.INVALID_ARGUMENT="invalid-argument",t.INVALID_ARGUMENT_COUNT="invalid-argument-count",t.APP_DELETED="app-deleted",t.INVALID_ROOT_OPERATION="invalid-root-operation",t.INVALID_FORMAT="invalid-format",t.INTERNAL_ERROR="internal-error",t.UNSUPPORTED_ENVIRONMENT="unsupported-environment"})(He||(He={}));function gd(t){return"storage/"+t}function $m(){const t="An unknown error occurred, please check the error payload for server response.";return new We(He.UNKNOWN,t)}function mj(t){return new We(He.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function gj(t){return new We(He.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function yj(){const t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new We(He.UNAUTHENTICATED,t)}function vj(){return new We(He.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function _j(t){return new We(He.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function wj(){return new We(He.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function xj(){return new We(He.CANCELED,"User canceled the upload/download.")}function Ej(t){return new We(He.INVALID_URL,"Invalid URL '"+t+"'.")}function Tj(t){return new We(He.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function Ij(){return new We(He.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+tT+"' property when initializing the app?")}function bj(){return new We(He.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function Sj(){return new We(He.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function Cj(t){return new We(He.UNSUPPORTED_ENVIRONMENT,`${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`)}function $f(t){return new We(He.INVALID_ARGUMENT,t)}function nT(){return new We(He.APP_DELETED,"The Firebase app was deleted.")}function kj(t){return new We(He.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function ua(t,e){return new We(He.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function Vo(t){throw new We(He.INTERNAL_ERROR,"Internal error: "+t)}/**
3312 * @license
3313 * Copyright 2017 Google LLC
3314 *
3315 * Licensed under the Apache License, Version 2.0 (the "License");
3316 * you may not use this file except in compliance with the License.
3317 * You may obtain a copy of the License at
3318 *
3319 *   http://www.apache.org/licenses/LICENSE-2.0
3320 *
3321 * Unless required by applicable law or agreed to in writing, software
3322 * distributed under the License is distributed on an "AS IS" BASIS,
3323 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3324 * See the License for the specific language governing permissions and
3325 * limitations under the License.
3326 */class Bt{constructor(e,n){this.bucket=e,this.path_=n}get path(){return this.path_}get isRoot(){return this.path.length===0}fullServerUrl(){const e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,n){let r;try{r=Bt.makeFromUrl(e,n)}catch{return new Bt(e,"")}if(r.path==="")return r;throw Tj(e)}static makeFromUrl(e,n){let r=null;const s="([A-Za-z0-9.\\-_]+)";function i(j){j.path.charAt(j.path.length-1)==="/"&&(j.path_=j.path_.slice(0,-1))}const o="(/(.*))?$",l=new RegExp("^gs://"+s+o,"i"),u={bucket:1,path:3};function h(j){j.path_=decodeURIComponent(j.path)}const f="v[A-Za-z0-9_]+",p=n.replace(/[.]/g,"\\."),g="(/([^?#]*).*)?$",E=new RegExp(`^https?://${p}/${f}/b/${s}/o${g}`,"i"),N={bucket:1,path:3},A=n===eT?"(?:storage.googleapis.com|storage.cloud.google.com)":n,P="([^?#]*)",_=new RegExp(`^https?://${A}/${s}/${P}`,"i"),S=[{regex:l,indices:u,postModify:i},{regex:E,indices:N,postModify:h},{regex:_,indices:{bucket:1,path:2},postModify:h}];for(let j=0;j<S.length;j++){const V=S[j],M=V.regex.exec(e);if(M){const T=M[V.indices.bucket];let y=M[V.indices.path];y||(y=""),r=new Bt(T,y),V.postModify(r);break}}if(r==null)throw Ej(e);return r}}class Nj{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
3327 * @license
3328 * Copyright 2017 Google LLC
3329 *
3330 * Licensed under the Apache License, Version 2.0 (the "License");
3331 * you may not use this file except in compliance with the License.
3332 * You may obtain a copy of the License at
3333 *
3334 *   http://www.apache.org/licenses/LICENSE-2.0
3335 *
3336 * Unless required by applicable law or agreed to in writing, software
3337 * distributed under the License is distributed on an "AS IS" BASIS,
3338 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3339 * See the License for the specific language governing permissions and
3340 * limitations under the License.
3341 */function Rj(t,e,n){let r=1,s=null,i=null,o=!1,l=0;function u(){return l===2}let h=!1;function f(...P){h||(h=!0,e.apply(null,P))}function p(P){s=setTimeout(()=>{s=null,t(E,u())},P)}function g(){i&&clearTimeout(i)}function E(P,..._){if(h){g();return}if(P){g(),f.call(null,P,..._);return}if(u()||o){g(),f.call(null,P,..._);return}r<64&&(r*=2);let S;l===1?(l=2,S=0):S=(r+Math.random())*1e3,p(S)}let N=!1;function A(P){N||(N=!0,g(),!h&&(s!==null?(P||(l=2),clearTimeout(s),p(0)):P||(l=1)))}return p(0),i=setTimeout(()=>{o=!0,A(!0)},n),A}function Aj(t){t(!1)}/**
3342 * @license
3343 * Copyright 2017 Google LLC
3344 *
3345 * Licensed under the Apache License, Version 2.0 (the "License");
3346 * you may not use this file except in compliance with the License.
3347 * You may obtain a copy of the License at
3348 *
3349 *   http://www.apache.org/licenses/LICENSE-2.0
3350 *
3351 * Unless required by applicable law or agreed to in writing, software
3352 * distributed under the License is distributed on an "AS IS" BASIS,
3353 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3354 * See the License for the specific language governing permissions and
3355 * limitations under the License.
3356 */function Pj(t){return t!==void 0}function jj(t){return typeof t=="object"&&!Array.isArray(t)}function Bm(t){return typeof t=="string"||t instanceof String}function Fv(t){return zm()&&t instanceof Blob}function zm(){return typeof Blob<"u"}function Uv(t,e,n,r){if(r<e)throw $f(`Invalid value for '${t}'. Expected ${e} or greater.`);if(r>n)throw $f(`Invalid value for '${t}'. Expected ${n} or less.`)}/**
3357 * @license
3358 * Copyright 2017 Google LLC
3359 *
3360 * Licensed under the Apache License, Version 2.0 (the "License");
3361 * you may not use this file except in compliance with the License.
3362 * You may obtain a copy of the License at
3363 *
3364 *   http://www.apache.org/licenses/LICENSE-2.0
3365 *
3366 * Unless required by applicable law or agreed to in writing, software
3367 * distributed under the License is distributed on an "AS IS" BASIS,
3368 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3369 * See the License for the specific language governing permissions and
3370 * limitations under the License.
3371 */function ah(t,e,n){let r=e;return n==null&&(r=`https://${e}`),`${n}://${r}/v0${t}`}function rT(t){const e=encodeURIComponent;let n="?";for(const r in t)if(t.hasOwnProperty(r)){const s=e(r)+"="+e(t[r]);n=n+s+"&"}return n=n.slice(0,-1),n}var Ns;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(Ns||(Ns={}));/**
3372 * @license
3373 * Copyright 2022 Google LLC
3374 *
3375 * Licensed under the Apache License, Version 2.0 (the "License");
3376 * you may not use this file except in compliance with the License.
3377 * You may obtain a copy of the License at
3378 *
3379 *   http://www.apache.org/licenses/LICENSE-2.0
3380 *
3381 * Unless required by applicable law or agreed to in writing, software
3382 * distributed under the License is distributed on an "AS IS" BASIS,
3383 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3384 * See the License for the specific language governing permissions and
3385 * limitations under the License.
3386 */function Dj(t,e){const n=t>=500&&t<600,s=[408,429].indexOf(t)!==-1,i=e.indexOf(t)!==-1;return n||s||i}/**
3387 * @license
3388 * Copyright 2017 Google LLC
3389 *
3390 * Licensed under the Apache License, Version 2.0 (the "License");
3391 * you may not use this file except in compliance with the License.
3392 * You may obtain a copy of the License at
3393 *
3394 *   http://www.apache.org/licenses/LICENSE-2.0
3395 *
3396 * Unless required by applicable law or agreed to in writing, software
3397 * distributed under the License is distributed on an "AS IS" BASIS,
3398 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3399 * See the License for the specific language governing permissions and
3400 * limitations under the License.
3401 */class Oj{constructor(e,n,r,s,i,o,l,u,h,f,p,g=!0,E=!1){this.url_=e,this.method_=n,this.headers_=r,this.body_=s,this.successCodes_=i,this.additionalRetryCodes_=o,this.callback_=l,this.errorCallback_=u,this.timeout_=h,this.progressCallback_=f,this.connectionFactory_=p,this.retry=g,this.isUsingEmulator=E,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((N,A)=>{this.resolve_=N,this.reject_=A,this.start_()})}start_(){const e=(r,s)=>{if(s){r(!1,new ql(!1,null,!0));return}const i=this.connectionFactory_();this.pendingConnection_=i;const o=l=>{const u=l.loaded,h=l.lengthComputable?l.total:-1;this.progressCallback_!==null&&this.progressCallback_(u,h)};this.progressCallback_!==null&&i.addUploadProgressListener(o),i.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&i.removeUploadProgressListener(o),this.pendingConnection_=null;const l=i.getErrorCode()===Ns.NO_ERROR,u=i.getStatus();if(!l||Dj(u,this.additionalRetryCodes_)&&this.retry){const f=i.getErrorCode()===Ns.ABORT;r(!1,new ql(!1,null,f));return}const h=this.successCodes_.indexOf(u)!==-1;r(!0,new ql(h,i))})},n=(r,s)=>{const i=this.resolve_,o=this.reject_,l=s.connection;if(s.wasSuccessCode)try{const u=this.callback_(l,l.getResponse());Pj(u)?i(u):i()}catch(u){o(u)}else if(l!==null){const u=$m();u.serverResponse=l.getErrorText(),this.errorCallback_?o(this.errorCallback_(l,u)):o(u)}else if(s.canceled){const u=this.appDelete_?nT():xj();o(u)}else{const u=wj();o(u)}};this.canceled_?n(!1,new ql(!1,null,!0)):this.backoffId_=Rj(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&Aj(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class ql{constructor(e,n,r){this.wasSuccessCode=e,this.connection=n,this.canceled=!!r}}function Lj(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function Vj(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function Mj(t,e){e&&(t["X-Firebase-GMPID"]=e)}function Fj(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}
3401function Uj(t,e,n,r,s,i,o=!0,l=!1){const u=rT(t.urlParams),h=t.url+u,f=Object.assign({},t.headers);return Mj(f,e),Lj(f,n),Vj(f,i),Fj(f,r),new Oj(h,t.method,f,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,s,o,l)}/**
3402 * @license
3403 * Copyright 2017 Google LLC
3404 *
3405 * Licensed under the Apache License, Version 2.0 (the "License");
3406 * you may not use this file except in compliance with the License.
3407 * You may obtain a copy of the License at
3408 *
3409 *   http://www.apache.org/licenses/LICENSE-2.0
3410 *
3411 * Unless required by applicable law or agreed to in writing, software
3412 * distributed under the License is distributed on an "AS IS" BASIS,
3413 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3414 * See the License for the specific language governing permissions and
3415 * limitations under the License.
3416 */function $j(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function Bj(...t){const e=$j();if(e!==void 0){const n=new e;for(let r=0;r<t.length;r++)n.append(t[r]);return n.getBlob()}else{if(zm())return new Blob(t);throw new We(He.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function zj(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}/**
3417 * @license
3418 * Copyright 2021 Google LLC
3419 *
3420 * Licensed under the Apache License, Version 2.0 (the "License");
3421 * you may not use this file except in compliance with the License.
3422 * You may obtain a copy of the License at
3423 *
3424 *   http://www.apache.org/licenses/LICENSE-2.0
3425 *
3426 * Unless required by applicable law or agreed to in writing, software
3427 * distributed under the License is distributed on an "AS IS" BASIS,
3428 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3429 * See the License for the specific language governing permissions and
3430 * limitations under the License.
3431 */function Hj(t){if(typeof atob>"u")throw Cj("base-64");return atob(t)}/**
3432 * @license
3433 * Copyright 2017 Google LLC
3434 *
3435 * Licensed under the Apache License, Version 2.0 (the "License");
3436 * you may not use this file except in compliance with the License.
3437 * You may obtain a copy of the License at
3438 *
3439 *   http://www.apache.org/licenses/LICENSE-2.0
3440 *
3441 * Unless required by applicable law or agreed to in writing, software
3442 * distributed under the License is distributed on an "AS IS" BASIS,
3443 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3444 * See the License for the specific language governing permissions and
3445 * limitations under the License.
3446 */const Pn={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class yd{constructor(e,n){this.data=e,this.contentType=n||null}}function Wj(t,e){switch(t){case Pn.RAW:return new yd(sT(e));case Pn.BASE64:case Pn.BASE64URL:return new yd(iT(t,e));case Pn.DATA_URL:return new yd(Gj(e),Kj(e))}throw $m()}function sT(t){const e=[];for(let n=0;n<t.length;n++){let r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|r&63);else if((r&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{const i=r,o=t.charCodeAt(++n);r=65536|(i&1023)<<10|o&1023,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}else(r&64512)===56320?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|r&63)}return new Uint8Array(e)}function qj(t){let e;try{e=decodeURIComponent(t)}catch{throw ua(Pn.DATA_URL,"Malformed data URL.")}return sT(e)}function iT(t,e){switch(t){case Pn.BASE64:{const s=e.indexOf("-")!==-1,i=e.indexOf("_")!==-1;if(s||i)throw ua(t,"Invalid character '"+(s?"-":"_")+"' found: is it base64url encoded?");break}case Pn.BASE64URL:{const s=e.indexOf("+")!==-1,i=e.indexOf("/")!==-1;if(s||i)throw ua(t,"Invalid character '"+(s?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=Hj(e)}catch(s){throw s.message.includes("polyfill")?s:ua(t,"Invalid character found")}const r=new Uint8Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);return r}class oT{constructor(e){this.base64=!1,this.contentType=null;const n=e.match(/^data:([^,]+)?,/);if(n===null)throw ua(Pn.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const r=n[1]||null;r!=null&&(this.base64=Qj(r,";base64"),this.contentType=this.base64?r.substring(0,r.length-7):r),this.rest=e.substring(e.indexOf(",")+1)}}function Gj(t){const e=new oT(t);return e.base64?iT(Pn.BASE64,e.rest):qj(e.rest)}function Kj(t){return new oT(t).contentType}function Qj(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}/**
3447 * @license
3448 * Copyright 2017 Google LLC
3449 *
3450 * Licensed under the Apache License, Version 2.0 (the "License");
3451 * you may not use this file except in compliance with the License.
3452 * You may obtain a copy of the License at
3453 *
3454 *   http://www.apache.org/licenses/LICENSE-2.0
3455 *
3456 * Unless required by applicable law or agreed to in writing, software
3457 * distributed under the License is distributed on an "AS IS" BASIS,
3458 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3459 * See the License for the specific language governing permissions and
3460 * limitations under the License.
3461 */class Nr{constructor(e,n){let r=0,s="";Fv(e)?(this.data_=e,r=e.size,s=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),r=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),r=e.length),this.size_=r,this.type_=s}size(){return this.size_}type(){return this.type_}slice(e,n){if(Fv(this.data_)){const r=this.data_,s=zj(r,e,n);return s===null?null:new Nr(s)}else{const r=new Uint8Array(this.data_.buffer,e,n-e);return new Nr(r,!0)}}static getBlob(...e){if(zm()){const n=e.map(r=>r instanceof Nr?r.data_:r);return new Nr(Bj.apply(null,n))}else{const n=e.map(o=>Bm(o)?Wj(Pn.RAW,o).data:o.data_);let r=0;n.forEach(o=>{r+=o.byteLength});const s=new Uint8Array(r);let i=0;return n.forEach(o=>{for(let l=0;l<o.length;l++)s[i++]=o[l]}),new Nr(s,!0)}}uploadData(){return this.data_}}/**
3462 * @license
3463 * Copyright 2017 Google LLC
3464 *
3465 * Licensed under the Apache License, Version 2.0 (the "License");
3466 * you may not use this file except in compliance with the License.
3467 * You may obtain a copy of the License at
3468 *
3469 *   http://www.apache.org/licenses/LICENSE-2.0
3470 *
3471 * Unless required by applicable law or agreed to in writing, software
3472 * distributed under the License is distributed on an "AS IS" BASIS,
3473 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3474 * See the License for the specific language governing permissions and
3475 * limitations under the License.
3476 */function aT(t){let e;try{e=JSON.parse(t)}catch{return null}return jj(e)?e:null}/**
3477 * @license
3478 * Copyright 2017 Google LLC
3479 *
3480 * Licensed under the Apache License, Version 2.0 (the "License");
3481 * you may not use this file except in compliance with the License.
3482 * You may obtain a copy of the License at
3483 *
3484 *   http://www.apache.org/licenses/LICENSE-2.0
3485 *
3486 * Unless required by applicable law or agreed to in writing, software
3487 * distributed under the License is distributed on an "AS IS" BASIS,
3488 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3489 * See the License for the specific language governing permissions and
3490 * limitations under the License.
3491 */function Yj(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function Xj(t,e){const n=e.split("/").filter(r=>r.length>0).join("/");return t.length===0?n:t+"/"+n}function lT(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
3492 * @license
3493 * Copyright 2017 Google LLC
3494 *
3495 * Licensed under the Apache License, Version 2.0 (the "License");
3496 * you may not use this file except in compliance with the License.
3497 * You may obtain a copy of the License at
3498 *
3499 *   http://www.apache.org/licenses/LICENSE-2.0
3500 *
3501 * Unless required by applicable law or agreed to in writing, software
3502 * distributed under the License is distributed on an "AS IS" BASIS,
3503 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3504 * See the License for the specific language governing permissions and
3505 * limitations under the License.
3506 */function Jj(t,e){return e}class It{constructor(e,n,r,s){this.server=e,this.local=n||e,this.writable=!!r,this.xform=s||Jj}}let Gl=null;function Zj(t){return!Bm(t)||t.length<2?t:lT(t)}function uT(){if(Gl)return Gl;const t=[];t.push(new It("bucket")),t.push(new It("generation")),t.push(new It("metageneration")),t.push(new It("name","fullPath",!0));function e(i,o){return Zj(o)}const n=new It("name");n.xform=e,t.push(n);function r(i,o){return o!==void 0?Number(o):o}const s=new It("size");return s.xform=r,t.push(s),t.push(new It("timeCreated")),t.push(new It("updated")),t.push(new It("md5Hash",null,!0)),t.push(new It("cacheControl",null,!0)),t.push(new It("contentDisposition",null,!0)),t.push(new It("contentEncoding",null,!0)),t.push(new It("contentLanguage",null,!0)),t.push(new It("contentType",null,!0)),t.push(new It("metadata","customMetadata",!0)),Gl=t,Gl}function e5(t,e){function n(){const r=t.bucket,s=t.fullPath,i=new Bt(r,
3506s);return e._makeStorageReference(i)}Object.defineProperty(t,"ref",{get:n})}function t5(t,e,n){const r={};r.type="file";const s=n.length;for(let i=0;i<s;i++){const o=n[i];r[o.local]=o.xform(r,e[o.server])}return e5(r,t),r}function cT(t,e,n){const r=aT(e);return r===null?null:t5(t,r,n)}function n5(t,e,n,r){const s=aT(e);if(s===null||!Bm(s.downloadTokens))return null;const i=s.downloadTokens;if(i.length===0)return null;const o=encodeURIComponent;return i.split(",").map(h=>{const f=t.bucket,p=t.fullPath,g="/b/"+o(f)+"/o/"+o(p),E=ah(g,n,r),N=rT({alt:"media",token:h});return E+N})[0]}function r5(t,e){const n={},r=e.length;for(let s=0;s<r;s++){const i=e[s];i.writable&&(n[i.server]=t[i.local])}return JSON.stringify(n)}class Hm{constructor(e,n,r,s){this.url=e,this.method=n,this.handler=r,this.timeout=s,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
3507 * @license
3508 * Copyright 2017 Google LLC
3509 *
3510 * Licensed under the Apache License, Version 2.0 (the "License");
3511 * you may not use this file except in compliance with the License.
3512 * You may obtain a copy of the License at
3513 *
3514 *   http://www.apache.org/licenses/LICENSE-2.0
3515 *
3516 * Unless required by applicable law or agreed to in writing, software
3517 * distributed under the License is distributed on an "AS IS" BASIS,
3518 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3519 * See the License for the specific language governing permissions and
3520 * limitations under the License.
3521 */function hT(t){if(!t)throw $m()}function s5(t,e){function n(r,s){const i=cT(t,s,e);return hT(i!==null),i}return n}function i5(t,e){function n(r,s){const i=cT(t,s,e);return hT(i!==null),n5(i,s,t.host,t._protocol)}return n}function dT(t){function e(n,r){let s;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?s=vj():s=yj():n.getStatus()===402?s=gj(t.bucket):n.getStatus()===403?s=_j(t.path):s=r,s.status=n.getStatus(),s.serverResponse=r.serverResponse,s}return e}function fT(t){const e=dT(t);function n(r,s){let i=e(r,s);return r.getStatus()===404&&(i=mj(t.path)),i.serverResponse=s.serverResponse,i}return n}function o5(t,e,n){const r=e.fullServerUrl(),s=ah(r,t.host,t._protocol),i="GET",o=t.maxOperationRetryTime,l=ne
3521w Hm(s,i,i5(t,n),o);return l.errorHandler=fT(e),l}function a5(t,e){const n=e.fullServerUrl(),r=ah(n,t.host,t._protocol),s="DELETE",i=t.maxOperationRetryTime;function o(u,h){}const l=new Hm(r,s,o,i);return l.successCodes=[200,204],l.errorHandler=fT(e),l}function l5(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function u5(t,e,n){const r=Object.assign({},n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=l5(null,e)),r}function c5(t,e,n,r,s){const i=e.bucketOnlyServerUrl(),o={"X-Goog-Upload-Protocol":"multipart"};function l(){let S="";for(let j=0;j<2;j++)S=S+Math.random().toString().slice(2);return S}const u=l();o["Content-Type"]="multipart/related; boundary="+u;const h=u5(e,r,s),f=r5(h,n),p="--"+u+`\r
3522Content-Type: application/json; charset=utf-8\r
3523\r
3524`+f+`\r
3525--`+u+`\r
3526Content-Type: `+h.contentType+`\r
3527\r
3528`,g=`\r
3529--`+u+"--",E=Nr.getBlob(p,r,g);if(E===null)throw bj();const N={name:h.fullPath},A=ah(i,t.host,t._protocol),P="POST",_=t.maxUploadRetryTime,w=new Hm(A,P,s5(t,n),_);return w.urlParams=N,w.headers=o,w.body=E.uploadData(),w.errorHandler=dT(e),w}class h5{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=Ns.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=Ns.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=Ns.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,r,s,i){if(this.sent_)throw Vo("cannot .send() more than once");if(as(e)&&r&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(n,e,!0),i!==void 0)for(const o in i)i.hasOwnProperty(o)&&this.xhr_.setRequestHeader(o,i[o].toString());return s!==void 0?this.xhr_.send(s):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw Vo("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw Vo("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw Vo("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw Vo("cannot .getErrorText() before sending");return this.xhr_.statusText}abort(){this.xhr_.abort()}getResponseHeader(e){return this.xhr_.getResponseHeader(e)}addUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.addEventListener("progress",e)}removeUploadProgressListener(e){this.xhr_.upload!=null&&this.xhr_.upload.removeEventListener("progress",e)}}class d5 extends h5{initXhr(){this.xhr_.responseType="text"}}function Wm(){return new d5}/**
3530 * @license
3531 * Copyright 2019 Google LLC
3532 *
3533 * Licensed under the Apache License, Version 2.0 (the "License");
3534 * you may not use this file except in compliance with the License.
3535 * You may obtain a copy of the License at
3536 *
3537 *   http://www.apache.org/licenses/LICENSE-2.0
3538 *
3539 * Unless required by applicable law or agreed to in writing, software
3540 * distributed under the License is distributed on an "AS IS" BASIS,
3541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3542 * See the License for the specific language governing permissions and
3543 * limitations under the License.
3544 */class $s{constructor(e,n){this._service=e,n instanceof Bt?this._location=n:this._location=Bt.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new $s(e,n)}get root(){const e=new Bt(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return lT(this._location.path)}get storage(){return this._service}get parent(){const e=Yj(this._location.path);if(e===null)return null;const n=new Bt(this._location.bucket,e);return new $s(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw kj(e)}}function f5(t,e,n){t._throwIfRoot("uploadBytes");const r=c5(t.storage,t._location,uT(),new Nr(e,!0),n);return t.storage.makeRequestWithTokens(r,Wm).then(s=>({metadata:s,ref:t}))}function p5(t){t._throwIfRoot("getDownloadURL");const e=o5(t.storage,t._location,uT());return t.storage.makeRequestWithTokens(e,Wm).then(n=>{if(n===null)throw Sj();return n})}function m5(t){t._throwIfRoot("deleteObject");const e=a5(t.storage,t._location);return t.storage.makeRequestWithTokens(e,Wm)}function g5(t,e){const n=Xj(t._location.path,e),r=new Bt(t._location.bucket,n);return new $s(t.storage,r)}/**
3545 * @license
3546 * Copyright 2017 Google LLC
3547 *
3548 * Licensed under the Apache License, Version 2.0 (the "License");
3549 * you may not use this file except in compliance with the License.
3550 * You may obtain a copy of the License at
3551 *
3552 *   http://www.apache.org/licenses/LICENSE-2.0
3553 *
3554 * Unless required by applicable law or agreed to in writing, software
3555 * distributed under the License is distributed on an "AS IS" BASIS,
3556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3557 * See the License for the specific language governing permissions and
3558 * limitations under the License.
3559 */function y5(t){return/^[A-Za-z]+:\/\//.test(t)}function v5(t,e){return new $s(t,e)}function pT(t,e){if(t instanceof qm){const n=t;if(n._bucket==null)throw Ij();const r=new $s(n,n._bucket);return e!=null?pT(r,e):r}else return e!==void 0?g5(t,e):t}function _5(t,e){if(e&&y5(e)){if(t instanceof qm)return v5(t,e);throw $f("To use ref(service, url), the first argument must be a Storage instance.")}else return pT(t,e)}function $v(t,e){const n=e==null?void 0:e[tT];return n==null?null:Bt.makeFromBucketSpec(n,t)}function w5(t,e,n,r={}){t.host=`${e}:${n}`;const s=as(e);s&&(zp(`https://${t.host}/b`),Hp("Storage",!0)),t._isUsingEmulator=!0,t._protocol=s?"https":"http";const{mockUserToken:i}=r;i&&(t._overrideAuthToken=typeof i=="string"?i:Lx(i,t.app.options.projectId))}class qm{constructor(e,n,r,s,i,o=!1){this.app=e,this._authProvider=n,this._appCheckProvider=r,this._url=s,this._firebaseVersion=i,this._isUsingEmulator=o,this._bucket=null,this._host=eT,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=fj,this._maxUploadRetryTime=pj,this._requests=new Set,s!=null?this._bucket=Bt.makeFromBucketSpec(s,this._host):this._bucket=$v(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Bt.makeFromBucketSpec(this._url,e):this._bucket=$v(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){Uv("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){Uv("time",0,Number.POSITIVE_INFINITY,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;const e=this._authProvider.getImmediate({optional:!0});if(e){const n=await e.getToken();if(n!==null)return n.accessToken}return null}async _getAppCheckToken(){if(Xt(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new $s(this,e)}_makeRequest(e,n,r,s,i=!0){if(this._deleted)return new Nj(nT());{const o=Uj(e,this._appId,r,s,n,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(o),o.getPromise().then(()=>this._requests.delete(o),()=>this._requests.delete(o)),o}}async makeRequestWithTokens(e,n){const[r,s]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,r,s).getPromise()}}const Bv="@firebase/storage",zv="0.14.1";/**
3560 * @license
3561 * Copyright 2020 Google LLC
3562 *
3563 * Licensed under the Apache License, Version 2.0 (the "License");
3564 * you may not use this file except in compliance with the License.
3565 * You may obtain a copy of the License at
3566 *
3567 *   http://www.apache.org/licenses/LICENSE-2.0
3568 *
3569 * Unless required by applicable law or agreed to in writing, software
3570 * distributed under the License is distributed on an "AS IS" BASIS,
3571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3572 * See the License for the specific language governing permissions and
3573 * limitations under the License.
3574 */const mT="storage";function Bi(t,e,n){return t=je(t),f5(t,e,n)}function zi(t){return t=je(t),p5(t)}function Hi(t){return t=je(t),m5(t)}function en(t,e){return t=je(t),_5(t,e)}function x5(t=Gp(),e){t=je(t);const r=Vc(t,mT).getImmediate({identifier:e}),s=jx("storage");return s&&E5(r,...s),r}function E5(t,e,n,r={}){w5(t,e,n,r)}function T5(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),s=t.getProvider("app-check-internal");return new qm(n,r,s,e,Hs)}function I5(){Ls(new Yr(mT,T5,"PUBLIC").setMultipleInstances(!0)),Ln(Bv,zv,""),Ln(Bv,zv,"esm2020")}I5();const b5={apiKey:"AIzaSyDY8UlFG0JDwvVT8x1hQdjgreleF6xFNsg",authDomain:"tenwells.firebaseapp.com",projectId:"tenwells",storageBucket:"tenwells.firebasestorage.app",messagingSenderId:"1036136211340",appId:"1:1036136211340:web:63f3220381646d9c38aca9"},Gm=Fx(b5),ce=Z4(Gm),tn=x5(Gm),Kl=WR(Gm);function dc(t){return(t||"").trim().toLowerCase()}
3574function S5(t){return t.split(",").map(dc).filter(Boolean)}const gT=S5("[email protected]");function Hv(t){return gT.includes(dc(t))}const yT=C.createContext(null);function C5({children:t}){const[e,n]=C.useState(null),[r,s]=C.useState(!1),[i,o]=C.useState(!0);C.useEffect(()=>{let h=!0;const f=async(g,{bootstrapIfAllowed:E=!1}={})=>{if(!g)return h&&(n(null),s(!1)),!1;const N=Oe(ce,"admins",g.uid);let P=(await Mv(N)).exists();return!P&&E&&Hv(g.email)&&(await Gr(N,{email:dc(g.email),role:"admin",grantedAt:An(),updatedAt:An()},{merge:!0}),P=!0),h&&(n(g),s(P)),P},p=DN(Kl,async g=>{try{await f(g,{bootstrapIfAllowed:!0})}catch(E){console.error("Failed to resolve admin status",E),h&&(n(g),s(!1))}finally{h&&o(!1)}});return()=>{h=!1,p()}},[]);const l=async(h,f)=>{const p=await AN(Kl,h,f),g=Oe(ce,"admins",p.user.uid),E=await Mv(g);if(!E.exists()&&Hv(p.user.email))return await Gr(g,{email:dc(p.user.email),role:"admin",grantedAt:An(),updatedAt:An()},{merge:!0}),n(p.user),s(!0),p.user;if(!E.exists())throw await k0(Kl),new Error("此帳號沒有後台權限。");return n(p.user),s(!0),p.user},u=async()=>{n(null),s(!1),await k0(Kl)};return i?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:c.jsx("div",{className:"w-6 h-6 border-2 border-gray-300 border-t-gray-800 rounded-full animate-spin"})}):c.jsx(yT.Provider,{value:{user:e,isAdmin:r,loading:i,login:l,logout:u},children:t})}const Km=()=>C.useContext(yT),Ue={name:"天偉金屬家具有限公司",logoUrl:"/tenwells-logo-transparent.png",contact:{taxId:"84176925",phone:"04-25320436~8",fax:"04-25354507",address:"台中市豐原區三和路525號",businessHours:"周一~周五 AM8:00~PM5:00",nonBusinessHours:"非營業時間,請留言至官方line,小幫手會儘早回覆您",lineId:"@026rbkby"},lineQrCode:"/images/line-qr.png",bannerImages:[{id:"b1",url:"/images/banner-1.png",title:"打造專屬您的完美空間"},{id:"b2",url:"/images/banner-2.png",title:"堅固耐用,品味不凡"},{id:"b3",url:"/images/banner-3.png",title:"天偉金屬,您的最佳選擇"}]},vd=[{id:"bar-chairs",title:"吧檯椅系列",image:"/images/1.jpg"},{id:"dining-chairs",title:"餐椅系列",image:"/images/3.jpg"},{id:"clearance",title:"出清系列",image:"/images/4.jpg"}],k5=[{id:"item-8426-1",categoryId:"bar-chairs",title:"型號8426",description:"",image:"/images/1.jpg"},{id:"item-8426-1-1",categoryId:"bar-chairs",title:"型號8426",description:"",image:"/images/1-1.jpg"},{id:"item-8426-1-2",categoryId:"bar-chairs",title:"型號8426",description:"",image:"/images/1-2.jpg"},{id:"item-8426-1-3",categoryId:"bar-chairs",title:"型號8426",description:"",image:"/images/1-3.jpg"},{id:"item-8426-1-4",categoryId:"bar-chairs",title:"型號8426",description:"",image:"/images/1-4.jpg"},{id:"item-9251-2",categoryId:"bar-chairs",title:"型號9251",description:"",image:"/images/2.jpg"},{id:"item-9251-2-1",categoryId:"bar-chairs",title:"型號9251",description:"",image:"/images/2-1.jpg"},{id:"item-9251-2-2",categoryId:"bar-chairs",title:"型號9251",description:"",image:"/images/2-2.jpg"},{id:"item-9251-2-3",categoryId:"bar-chairs",title:"型號9251",description:"",image:"/images/2-3.jpg"},{id:"item-CH0256-3",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3.jpg"},{id:"item-CH0256-3-1",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-1.jpg"},{id:"item-CH0256-3-2",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-2.jpg"},{id:"item-CH0256-3-3",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-3.jpg"},{id:"item-CH0256-3-4",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-4.jpg"},{id:"item-CH0256-3-5",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-5.jpg"},{id:"item-CH0256-3-6",categoryId:"dining-chairs",title:"型號CH0256",description:"",image:"/images/3-6.jpg"},{id:"item-8888-4",categoryId:"dining-chairs",title:"型號8888",description:"",image:"/images/4.jpg"},{id:"item-8888-4-1",categoryId:"dining-chairs",title:"型號8888",description:"",image:"/images/4-1.jpg"},{id:"item-8888-4-2",categoryId:"dining-chairs",title:"型號8888",description:"",image:"/images/4-2.jpg"},{id:"item-8888-4-3",categoryId:"dining-chairs",title:"型號8888",description:"",image:"/images/4-3.jpg"}];function N5(){const t=`https://line.me/R/ti/p/${Ue.contact.lineId}`;return c.jsx("div",{className:"fixed bottom-4 right-4 md:bottom-6 md:right-6 z-50 flex items-center gap-3 safe-bottom",children:c.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"w-14 h-14 md:w-16 md:h-16 rounded-full bg-[#06C755] shadow-lg hover:shadow-xl flex items-center justify-center hover:scale-110 active:scale-95 transition-transform duration-300 shrink-0","aria-label":"LINE",children:c.jsxs("svg",{viewBox:"0 0 120 120",className:"w-9 h-9 md:w-11 md:h-11",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M60 15C33.5 15 12 32.3 12 53.5c0 19 16.8 34.9 39.5 37.9 1.5.3 3.6 1 4.1 2.4.5 1.2.3 3.1.2 4.3 0 0-.6 3.3-.7 4-.2 1.2
3574-1 5.2 4.6 2.8 5.5-2.3 30-17.6 40.9-30.2h0C108.5 66 108 58.5 108 53.5 108 32.3 86.5 15 60 15z",fill:"white"}),c.jsx("text",{x:"60",y:"62",textAnchor:"middle",fontFamily:"Arial, Helvetica, sans-serif",fontWeight:"900",fontSize:"28",fill:"#06C755",letterSpacing:"1",children:"LINE"})]})})})}/**
3575 * @license lucide-react v0.575.0 - ISC
3576 *
3577 * This source code is licensed under the ISC license.
3578 * See the LICENSE file in the root directory of this source tree.
3579 */const vT=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
3580 * @license lucide-react v0.575.0 - ISC
3581 *
3582 * This source code is licensed under the ISC license.
3583 * See the LICENSE file in the root directory of this source tree.
3584 */const R5=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();/**
3585 * @license lucide-react v0.575.0 - ISC
3586 *
3587 * This source code is licensed under the ISC license.
3588 * See the LICENSE file in the root directory of this source tree.
3589 */const A5=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,r)=>r?r.toUpperCase():n.toLowerCase());/**
3590 * @license lucide-react v0.575.0 - ISC
3591 *
3592 * This source code is licensed under the ISC license.
3593 * See the LICENSE file in the root directory of this source tree.
3594 */const Wv=t=>{const e=A5(t);return e.charAt(0).toUpperCase()+e.slice(1)};/**
3595 * @license lucide-react v0.575.0 - ISC
3596 *
3597 * This source code is licensed under the ISC license.
3598 * See the LICENSE file in the root directory of this source tree.
3599 */var P5={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
3600 * @license lucide-react v0.575.0 - ISC
3601 *
3602 * This source code is licensed under the ISC license.
3603 * See the LICENSE file in the root directory of this source tree.
3604 */const j5=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0;return!1};/**
3605 * @license lucide-react v0.575.0 - ISC
3606 *
3607 * This source code is licensed under the ISC license.
3608 * See the LICENSE file in the root directory of this source tree.
3609 */const D5=C.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},u)=>C.createElement("svg",{ref:u,...P5,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:vT("lucide",s),...!i&&!j5(l)&&{"aria-hidden":"true"},...l},[...o.map(([h,f])=>C.createElement(h,f)),...Array.isArray(i)?i:[i]]));/**
3610 * @license lucide-react v0.575.0 - ISC
3611 *
3612 * This source code is licensed under the ISC license.
3613 * See the LICENSE file in the root directory of this source tree.
3614 */const we=(t,e)=>{const n=C.forwardRef(({className:r,...s},i)=>C.createElement(D5,{ref:i,iconNode:e,className:vT(`lucide-${R5(Wv(t))}`,`lucide-${t}`,r),...s}));return n.displayName=Wv(t),n};/**
3615 * @license lucide-react v0.575.0 - ISC
3616 *
3617 * This source code is licensed under the ISC license.
3618 * See the LICENSE file in the root directory of this source tree.
3619 */const O5=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],_T=we("arrow-down",O5);/**
3620 * @license lucide-react v0.575.0 - ISC
3621 *
3622 * This source code is licensed under the ISC license.
3623 * See the LICENSE file in the root directory of this source tree.
3624 */const L5=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],oo=we("arrow-left",L5);/**
3625 * @license lucide-react v0.575.0 - ISC
3626 *
3627 * This source code is licensed under the ISC license.
3628 * See the LICENSE file in the root directory of this source tree.
3629 */const V5=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],qv=we("arrow-right",V5);/**
3630 * @license lucide-react v0.575.0 - ISC
3631 *
3632 * This source code is licensed under the ISC license.
3633 * See the LICENSE file in the root directory of this source tree.
3634 */const M5=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],wT=we("arrow-up",M5);/**
3635 * @license lucide-react v0.575.0 - ISC
3636 *
3637 * This source code is licensed under the ISC license.
3638 * See the LICENSE file in the root directory of this source tree.
3639 */const F5=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Qm=we("chevron-down",F5);/**
3640 * @license lucide-react v0.575.0 - ISC
3641 *
3642 * This source code is licensed under the ISC license.
3643 * See the LICENSE file in the root directory of this source tree.
3644 */const U5=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fc=we("chevron-left",U5);/**
3645 * @license lucide-react v0.575.0 - ISC
3646 *
3647 * This source code is licensed under the ISC license.
3648 * See the LICENSE file in the root directory of this source tree.
3649 */const $5=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],pc=we("chevron-right",$5);/**
3650 * @license lucide-react v0.575.0 - ISC
3651 *
3652 * This source code is licensed under the ISC license.
3653 * See the LICENSE file in the root directory of this source tree.
3654 */const B5=[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]],xT=we("chevron-up",B5);/**
3655 * @license lucide-react v0.575.0 - ISC
3656 *
3657 * This source code is licensed under the ISC license.
3658 * See the LICENSE file in the root directory of this source tree.
3659 */const z5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],sl=we("credit-card",z5);/**
3660 * @license lucide-react v0.575.0 - ISC
3661 *
3662 * This source code is licensed under the ISC license.
3663 * See the LICENSE file in the root directory of this source tree.
3664 */const H5=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Ym=we("folder-open",H5);/**
3665 * @license lucide-react v0.575.0 - ISC
3666 *
3667 * This source code is licensed under the ISC license.
3668 * See the LICENSE file in the root directory of this source tree.
3669 */const W5=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]],Zn=we("image",W5);/**
3670 * @license lucide-react v0.575.0 - ISC
3671 *
3672 * This source code is licensed under the ISC license.
3673 * See the LICENSE file in the root directory of this source tree.
3674 */const q5=[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]],G5=we("layout-dashboard",q5);/**
3675 * @license lucide-react v0.575.0 - ISC
3676 *
3677 * This source code is licensed under the ISC license.
3678 * See the LICENSE file in the root directory of this source tree.
3679 */const K5=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ht=we("loader-circle",K5);/**
3680 * @license lucide-react v0.575.0 - ISC
3681 *
3682 * This source code is licensed under the ISC license.
3683 * See the LICENSE file in the root directory of this source tree.
3684 */const Q5=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],Y5=we("log-out",Q5);/**
3685 * @license lucide-react v0.575.0 - ISC
3686 *
3687 * This source code is licensed under the ISC license.
3688 * See the LICENSE file in the root directory of this source tree.
3689 */const X5=[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]],J5=we("map-pin",X5);/**
3690 * @license lucide-react v0.575.0 - ISC
3691 *
3692 * This source code is licensed under the ISC license.
3693 * See the LICENSE file in the root directory of this source tree.
3694 */const Z5=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],eD=we("menu",Z5);/**
3695 * @license lucide-react v0.575.0 - ISC
3696 *
3697 * This source code is licensed under the ISC license.
3698 * See the LICENSE file in the root directory of this source tree.
3699 */const tD=[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]],mc=we("package",tD);/**
3700 * @license lucide-react v0.575.0 - ISC
3701 *
3702 * This source code is licensed under the ISC license.
3703 * See the LICENSE file in the root directory of this source tree.
3704 */const nD=[["path",{d:"M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z",key:"e79jfc"}],["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}]],rD=we("palette",nD);/**
3705 * @license lucide-react v0.575.0 - ISC
3706 *
3707 * This source code is licensed under the ISC license.
3708 * See the LICENSE file in the root directory of this source tree.
3709 */const sD=[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],ET=we("pen-line",sD);/**
3710 * @license lucide-react v0.575.0 - ISC
3711 *
3712 * This source code is licensed under the ISC license.
3713 * See the LICENSE file in the root directory of this source tree.
3714 */const iD=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]],oD=we("pen",iD);/**
3715 * @license lucide-react v0.575.0 - ISC
3716 *
3717 * This source code is licensed under the ISC license.
3718 * See the LICENSE file in the root directory of this source tree.
3719 */const aD=[["path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 
37190 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384",key:"9njp5v"}]],lD=we("phone",aD);/**
3720 * @license lucide-react v0.575.0 - ISC
3721 *
3722 * This source code is licensed under the ISC license.
3723 * See the LICENSE file in the root directory of this source tree.
3724 */const uD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Is=we("plus",uD);/**
3725 * @license lucide-react v0.575.0 - ISC
3726 *
3727 * This source code is licensed under the ISC license.
3728 * See the LICENSE file in the root directory of this source tree.
3729 */const cD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],il=we("rotate-ccw",cD);/**
3730 * @license lucide-react v0.575.0 - ISC
3731 *
3732 * This source code is licensed under the ISC license.
3733 * See the LICENSE file in the root directory of this source tree.
3734 */const hD=[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]],ol=we("shopping-cart",hD);/**
3735 * @license lucide-react v0.575.0 - ISC
3736 *
3737 * This source code is licensed under the ISC license.
3738 * See the LICENSE file in the root directory of this source tree.
3739 */const dD=[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}
3739],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],gc=we("sparkles",dD);/**
3740 * @license lucide-react v0.575.0 - ISC
3741 *
3742 * This source code is licensed under the ISC license.
3743 * See the LICENSE file in the root directory of this source tree.
3744 */const fD=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],er=we("trash-2",fD);/**
3745 * @license lucide-react v0.575.0 - ISC
3746 *
3747 * This source code is licensed under the ISC license.
3748 * See the LICENSE file in the root directory of this source tree.
3749 */const pD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],lh=we("triangle-alert",pD);/**
3750 * @license lucide-react v0.575.0 - ISC
3751 *
3752 * This source code is licensed under the ISC license.
3753 * See the LICENSE file in the root directory of this source tree.
3754 */const mD=[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]],al=we("truck",mD);/**
3755 * @license lucide-react v0.575.0 - ISC
3756 *
3757 * This source code is licensed under the ISC license.
3758 * See the LICENSE file in the root directory of this source tree.
3759 */const gD=[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z",key:"1ngwbx"}]],ll=we("wrench",gD);/**
3760 * @license lucide-react v0.575.0 - ISC
3761 *
3762 * This source code is licensed under the ISC license.
3763 * See the LICENSE file in the root directory of this source tree.
3764 */const yD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],ca=we("x",yD),vD="https://tenwells.web.app";function Zs(t,e){let n=document.head.querySelector(t);n||(n=document.createElement("meta"),document.head.appendChild(n)),Object.entries(e).forEach(([r,s])=>{n.setAttribute(r,s)})}function _D(t){let e=document.head.querySelector('link[rel="canonical"]');e||(e=document.createElement("link"),e.setAttribute("rel","canonical"),document.head.appendChild(e)),e.setAttribute("href",t)}function _d(t=""){try{return decodeURIComponent(t)}catch{return t}}function wD(t=[]){const e=new Map;return t.forEach(n=>{const r=n.title||n.id;e.has(r)||e.set(r,{id:n.id,categoryId:n.categoryId,title:n.title,description:n.description,specs:n.specs})}),Array.from(e.values())}function xD(t){return typeof t=="string"?t.trim():Array.isArray(t)?t.map(e=>`${e.name||""} ${e.value||""}`.trim()).filter(Boolean).join(","):""}function ED(t,e=[],n=[]){const r=t.match(/^\/category\/([^/]+)$/),s=t.match(/^\/category\/([^/]+)\/product\/([^/]+)$/),i=wD(n);let o="天偉金屬家具 | 專業金屬家具訂製與線上DM - 台中",l="天偉金屬家具專營高品質金屬家具訂製、空間規劃與線上DM展示。位於台中,提供客製化吧檯椅、層架等各式金屬家具解決方案,歡迎立即瀏覽我們的產品型錄。";if(t==="/new-arrivals")o="新品上市 | 天偉金屬家具",l="查看天偉金屬家具最新上架商品,快速瀏覽新品與熱門款式,找到適合空間的金屬家具方案。";else if(t==="/shipping-info")o="訂購相關說明 | 天偉金屬家具",l="了解天偉金屬家具的訂購流程、付款方式、配送安排、退換貨規則與客製化服務說明。";else if(t==="/customization")o="客製化服務 | 天偉金屬家具",l="天偉金屬家具提供尺寸、材質、顏色與空間搭配的客製化服務,歡迎洽詢專屬訂製需求。";else if(t==="/about")o="關於我們 | 天偉金屬家具",l="認識天偉金屬家具的品牌理念、製造經驗與服務內容,了解我們如何打造高品質金屬家具。";else if(s){const u=_d(s[1]),h=_d(s[2]),f=i.find(E=>E.id===h||E.title===h),p=e.find(E=>E.id===((f==null?void 0:f.categoryId)||u)),g=xD(f==null?void 0:f.specs);o=f!=null&&f.title?`${f.title} | ${(p==null?void 0:p.title)||"商品介紹"} | 天偉金屬家具`:"商品介紹 | 天偉金屬家具",l=f!=null&&f.title?`${f.title}${p!=null&&p.title?`,分類為${p.title}`:""}。${g||"查看商品細節、規格與圖片,歡迎洽詢天偉金屬家具。"}`:"查看天偉金屬家具商品細節、規格與圖片,歡迎洽詢更多產品資訊。"}else if(r){const u=_d(r[1]),h=e.find(f=>f.id===u);o=h!=null&&h.title?`${h.title} | 天偉金屬家具`:"商品分類 | 天偉金屬家具",l=h!=null&&h.title?`瀏覽天偉金屬家具「${h.title}」分類商品,查看各式款式、規格與空間搭配靈感。`:"瀏覽天偉金屬家具各式商品分類,包含新品、客製化款式與多元空間應用家具。"}return{title:o,description:l,absoluteUrl:`${vD}${t}`}}function TD(){const t=ln(),e=os(),[n,r]=C.useState(!1),[s,i]=C.useState([]),[o,l]=C.useState([]),[u,h]=C.useState(Ue.bannerImages),[f,p]=C.useState(!1),[g,E]=C.useState(!1),[N,A]=C.useState(!1),[P,_]=C.useState(!1),[w,S]=C.useState(56),[j,V]=C.useState(0),M=C.useRef(null);C.useEffect(()=>{const b=()=>{A(v=>!v&&window.scrollY>120?!0:v&&window.scrollY<20?!1:v)};return window.addEventListener("scroll",b,{passive:!0}),()=>window.removeEventListener("scroll",b)},[]),C.useEffect(()=>{const b=Jn(_t(ce,"tianwei-categories"),qr("order","asc")),v=Jn(_t(ce,"tianwei-items"),qr("createdAt","desc"));let U=!1,O=!1;const G=yn(b,W=>{W.size>0?i(W.docs.map(Y=>({id:Y.id,...Y.data()}))):!W.metadata.fromCache&&W.empty,U=!0,O&&E(!0)},()=>{U=!0,O&&E(!0)}),Q=yn(v,W=>{W.size>0?l(W.docs.map(Y=>({id:Y.id,...Y.data()}
3764))):!W.metadata.fromCache&&W.empty,O=!0,U&&E(!0)},()=>{O=!0,U&&E(!0)}),F=Jn(_t(ce,"tianwei-banners"),qr("order","asc")),B=yn(F,W=>{W.size>0&&h(W.docs.map(Y=>({id:Y.id,...Y.data()})))},()=>{});return()=>{G(),Q(),B()}},[]),C.useEffect(()=>{r(!1),t.hash||window.scrollTo(0,0)},[t.pathname,t.hash]),C.useEffect(()=>(document.body.style.overflow=n?"hidden":"",()=>{document.body.style.overflow=""}),[n]),C.useEffect(()=>{if(!n){_(!1),V(0);return}const b=()=>{const O=M.current;if(!O)return;const{scrollHeight:G,clientHeight:Q,scrollTop:F}=O,B=G-Q>8;if(_(B),!B){V(0);return}const W=Q,Y=Math.max(56,Q/G*W),oe=Math.max(0,W-Y),be=Math.max(1,G-Q),Se=F/be*oe;S(Y),V(Se)};b();const v=M.current;v==null||v.addEventListener("scroll",b,{passive:!0}),window.addEventListener("resize",b);const U=window.requestAnimationFrame(b);return()=>{v==null||v.removeEventListener("scroll",b),window.removeEventListener("resize",b),window.cancelAnimationFrame(U)}},[n,s.length,o.length]),C.useEffect(()=>{const b=t.pathname||"/",{title:v,description:U,absoluteUrl:O}=ED(b,s,o);document.title=v,_D(O),Zs('meta[name="description"]',{name:"description",content:U}),Zs('meta[name="robots"]',{name:"robots",content:"index,follow,max-image-preview:large"}),Zs('meta[name="googlebot"]',{name:"googlebot",content:"index,follow,max-image-preview:large"}),Zs('meta[property="og:title"]',{property:"og:title",content:v}),Zs('meta[property="og:description"]',{property:"og:description",content:U}),Zs('meta[property="og:url"]',{property:"og:url",content:O})},[t.pathname,s,o]);const T=`https://line.me/R/ti/p/${Ue.contact.lineId}`,y=b=>t.pathname===b,I=s.filter(b=>b.title!=="特惠商品"),k=s.find(b=>b.title==="特惠商品"),R=[{to:"/",label:"品牌首頁"},{to:"/new-arrivals",label:"新品上市",highlight:!0},...I.map(b=>({to:`/category/${b.id}`,label:b.title})),...k?[{to:`/category/${k.id}`,label:k.title,isSpecialSale:!0}]:[],{to:"/customization",label:"客製化服務"},{to:"/shipping-info",label:"訂購相關說明"},{to:"/about",label:"關於我們"}];return c.jsxs("div",{className:"min-h-screen flex flex-col bg-white text-gray-800 font-sans",children:[c.jsxs("header",{className:`sticky top-0 z-50 bg-white/95 backdrop-blur-md w-full flex flex-col items-center shadow-sm transition-all duration-300 ${N?"py-1":""}`,children:[c.jsx("div",{className:`max-w-7xl mx-auto px-4 lg:px-12 w-full transition-all duration-300 ${N?"pt-2 pb-1":"pt-4 pb-2 md:pt-8 md:pb-4"}`,children:c.jsxs("div",{className:"flex items-center md:justify-center relative",children:[c.jsx("button",{onClick:()=>r(!0),className:"md:hidden p-2 -ml-2 mr-3 text-gray-600 hover:text-gray-900 transition-colors","aria-label":"開啟選單",children:c.jsx(eD,{size:22})}),c.jsx(Be,{to:"/",className:"flex items-center",children:c.jsx("img",{src:Ue.logoUrl,alt:Ue.name,className:`w-auto object-contain transition-all duration-300 ${N?"h-8 sm:h-10 md:h-12":"h-12 sm:h-14 md:h-24"}`})})]})}),c.jsx("nav",{className:`hidden md:flex flex-wrap items-center justify-center w-full max-w-7xl px-4 transition-all duration-300 ${N?"gap-x-4 lg:gap-x-6 gap-y-1 pb-1":"gap-x-5 lg:gap-x-7 gap-y-2 pb-3"}`,children:R.map(b=>{const v=O=>{const G=b.to.indexOf("#");if(G!==-1){O.preventDefault();const Q=b.to.substring(0,G)||t.pathname,F=b.to.substring(G+1),B=()=>{let W=0;const Y=()=>{var be;const oe=document.getElementById(F);if(oe){const Se=((be=document.querySelector("header"))==null?void 0:be.offsetHeight)||130,Et=oe.getBoundingClientRect().top+window.pageYOffset-Se-16;window.scrollTo({top:Math.max(0,Et),behavior:"smooth"})}else W<10&&(W++,setTimeout(Y,100))};setTimeout(Y,50)};Q&&Q!==t.pathname?(e(Q),setTimeout(B,300)):B()}},U=`text-[13.5px] tracking-[0.05em] whitespace-nowrap pb-2 transition-all hover:text-gray-900 ${b.isSpecialSale?"!text-red-500 hover:!text-red-600":""} ${y(b.to)?b.isSpecialSale?"font-semibold border-b-[2.5px] border-red-500":"text-gray-900 font-semibold border-b-[2.5px] border-gray-900":"text-gray-400 border-b-[2.5px] border-transparent"}`;return b.isExternal?c.jsx("a",{href:b.to,target:"_blank",rel:"noopener noreferrer",className:U,children:b.label},b.to):c.jsx(Be,{to:b.to,onClick:v,className:U,children:b.label},b.to)})}),c.jsx("div",{className:"w-full h-[1px] bg-gradient-to-r from-transparent via-gray-200 to-transparent"})]}),n&&c.jsxs("div",{className:"fixed inset-0 z-[999]",children:[c.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-sm",onClick:()=>r(!1)}),c.jsxs("div",{className:"absolute top-0 left-0 h-full w-72 bg-white shadow-2xl flex flex-col min-h-0 animate-slide-in-left",children:[c.jsxs("div",{className:"flex items-center justify-between p-5 border-b border-gray-100 bg-white",children:[c.jsx("img",{src:Ue.logoUrl,alt:Ue.name,className:"h-12 w-auto object-contain"}),c.jsx("button",{onClick:()=>r(!1),className:"p-1 text-gray-400 hover:text-gray-700 transition-colors",children:c.jsx(ca,{size:20})})]}),c.jsxs("div",{className:"relative flex-1 min-h-0",children:[c.jsxs("div",{ref:M,className:"drawer-scrollable h-full min-h-0 overflow-y-auto overscroll-contain drawer-scrollbar pr-5",children:[c.jsx("nav",{className:"py-4",children:R.map(b=>{const v=U=>{const O=b.to.indexOf("#");if(O!==-1){U.preventDefault();const G=b.to.substring(0,O)||t.pathname,Q=b.to.substring(O+1);r(!1);const F=()=>{setTimeout(()=>{const B=document.getElementById(Q);if(B){const W=B.getBoundingClientRect().top+window.pageYOffset-16;window.scrollTo({top:Math.max(0,W),behavior:"smooth"})}},400)};G!==t.pathname?(e(G),setTimeout(F,100)):F()}else U.preventDefault(),r(!1),b.to!==t.pathname&&(e(b.to),window.scrollTo(0,0))};return b.isExternal?c.jsx("a",{href:b.to,target:"_blank",rel:"noopener noreferrer",onClick:()=>r(!1),className:"block px-6 py-3.5 text-sm tracking-wider transition-colors text-gray-500 hover:text-gray-900 hover:bg-gray-50",children:b.label},b.to):c.jsx(Be,{to:b.to,onClick:v,className:`block px-6 py-3.5 text-sm tracking-wider transition-colors ${b.highlight?"text-amber-600 font-bold":b.isSpecialSale?"!text-red-500 font-bold":""} ${y(b.to)?"text-gray-900 font-bold bg-gray-50":b.highlight||b.isSpecialSale?"":"text-gray-500 hover:text-gray-900 hover:bg-gray-50"}`,children:b.label},b.to)})}),c.jsxs("div",{className:"px-5 py-4 border-t border-gray-100 flex flex-col items-center gap-2.5",children:[c.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"flex min-h-[54px] w-full max-w-[230px] items-center justify-center gap-2 rounded-full bg-[#06C755] px-4 py-3 text-[14px] font-semibold tracking-[0.04em] text-white shadow-md transition-colors hover:bg-[#05a64a]",children:[c.jsxs("svg",{viewBox:"0 0 120 120",className:"w-5 h-5 flex-shrink-0",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M60 15C33.5 15 12 32.3 12 53.5c0 19 16.8 34.9 39.5 37.9 1.5.3 3.6 1 4.1 2.4.5 1.2.3 3.1.2 4.3 0 0-.6 3.3-.7 4-.2 1.2
3764-1 5.2 4.6 2.8 5.5-2.3 30-17.6 40.9-30.2h0C108.5 66 108 58.5 108 53.5 108 32.3 86.5 15 60 15z",fill:"white"}),c.jsx("text",{x:"60",y:"62",textAnchor:"middle",fontFamily:"Arial",fontWeight:"900",fontSize:"28",fill:"#06C755",letterSpacing:"1",children:"LINE"})]}),c.jsx("span",{className:"whitespace-nowrap",children:"加入官方Line洽詢"})]}),c.jsxs("div",{className:"w-full mt-2 pt-3 border-t border-gray-100 space-y-1.5 text-center",children:[c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-xs text-gray-500",children:[c.jsx(lD,{className:"w-3 h-3"}),c.jsx("span",{children:Ue.contact.phone})]}),c.jsxs("div",{className:"flex items-center justify-center gap-1.5 text-xs text-gray-500",children:[c.jsx(J5,{className:"w-3 h-3"}),c.jsx("span",{children:Ue.contact.address})]})]})]})]}),P&&c.jsx("div",{className:"pointer-events-none absolute right-2 top-3 bottom-3 w-1.5",children:c.jsx("div",{className:"absolute inset-x-0 rounded-full bg-black/18",style:{height:`${w}px`,transform:`translateY(${j}px)`}})})]})]})]}),c.jsx("main",{className:"flex-1 max-w-7xl mx-auto w-full px-4 md:px-8 lg:px-12 py-6 md:py-10",children:g?c.jsx(Ix,{context:{categories:s,items:o,banners:u,company:Ue}}):c.jsx("div",{className:"flex items-center justify-center py-32",children:c.jsx("div",{className:"w-8 h-8 rounded-full border-2 border-gray-200 border-t-gray-800 animate-spin"})})}),c.jsxs("footer",{className:"bg-gray-950 text-gray-400 mt-auto",children:[c.jsx("div",{id:"about",className:"max-w-4xl mx-auto px-6 pt-12 pb-8",children:c.jsxs("div",{className:"flex flex-col md:flex-row md:items-start md:justify-between gap-8",children:[c.jsxs("div",{className:"flex flex-col items-start gap-4 text-left flex-1",children:[c.jsx("h2",{className:"text-xl font-bold tracking-wider text-white mb-2",children:"關於我們"}),c.jsxs("div",{className:"flex flex-col gap-2 text-sm text-gray-300 tracking-wider leading-relaxed text-left w-full",children:[c.jsxs("span",{children:["公司統編:",Ue.contact.taxId]}),c.jsx("span",{className:"font-semibold text-gray-200 text-base",children:Ue.name}),c.jsxs("span",{children:["電話:",Ue.contact.phone]}),c.jsxs("span",{children:["傳真:",Ue.contact.fax]}),c.jsxs("span",{children:["地址:",Ue.contact.address]}),c.jsxs("span",{className:"mt-2 text-gray-300",children:["公司營業時間:",Ue.contact.businessHours]}),c.jsx("span",{className:"text-gray-300",children:Ue.contact.nonBusinessHours})]})]}),t.pathname==="/"&&c.jsxs("div",{className:"flex flex-col items-center gap-4 text-center md:min-w-[200px]",children:[c.jsx("img",{src:"https://qr-official.line.me/gs/M_026rbkby_GW.png?oat_content=qr",alt:"LINE QR Code",className:"w-36 h-36 md:w-44 md:h-44 rounded-xl bg-white p-2 shadow-lg"}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-base md:text-lg font-bold tracking-wider mb-1 text-white",children:"加入官方Line洽詢"}),c.jsxs("p",{className:"text-gray-400 text-xs tracking-wide mb-1",children:["掃描 QR Code 或搜尋 ",c.jsx("span",{className:"text-[#06C755] font-semibold",children:Ue.contact.lineId})]}),c.jsx("p",{className:"text-gray-400 text-xs tracking-wide mb-4",children:"享受專屬優惠、新品資訊與即時客服"}),c.jsxs("a",{href:T,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 bg-[#06C755] hover:bg-[#05a64a] text-white font-semibold px-5 py-2.5 rounded-full transition-colors text-sm tracking-wide shadow-lg shadow-[#06C755]/30",children:[c.jsxs("svg",{viewBox:"0 0 120 120",className:"w-4 h-4",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M60 15C33.5 15 12 32.3 12 53.5c0 19 16.8 34.9 39.5 37.9 1.5.3 3.6 1 4.1 2.4.5 1.2.3 3.1.2 4.3 0 0-.6 3.3-.7 4-.2 1.2-1 5.2 4.6 2.8 5.5-2.3 30-17.6 40.9-30.2h0C108.5 66 108 58.5 108 53.5 108 32.3 86.5 15 60 15z",fill:"white"}),c.jsx("text",{x:"60",y:"62",textAnchor:"middle",fontFamily:"Arial",fontWeight:"900",fontSize:"28",fill:"#06C755",letterSpacing:"1",children:"LINE"})]}),"加入官方Line洽詢"]})]})]})]})}),c.jsx("div",{className:"h-px bg-gray-700/50"}),c.jsx("div",{className:"max-w-7xl mx-auto px-6 md:px-12 py-6 md:py-8",children:c.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[c.jsxs("div",{className:"text-[11px] text-gray-600",children:["© ",new Date().getFullYear()," ",Ue.name,". All rights reserved."]}),c.jsxs("button",{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),className:"text-xs text-gray-400 border border-gray-600 rounded-full px-5 py-2 hover:bg-white hover:text-gray-900 hover:border-white transition-all flex items-center gap-1.5",children:[c.jsx("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:c.jsx("path",{d:"M12 19V5M5 12l7-7 7 7"})}),"回到頂部"]})]})})]}),c.jsx(N5,{})]})}function ID(){const t=os(),e=ln(),{logout:n}=Km(),r=async()=>{try{await n(),t("/")}catch(o){console.error("Logout failed",o)}},s=[{to:"/admin",icon:G5,label:"總覽",exact:!0},{to:"/admin/categories",icon:Ym,label:"分類管理"},{to:"/admin/items",icon:mc,label:"商品管理"},{to:"/admin/banners",icon:Zn,label:"Banner 管理"}
3764,{to:"/admin/customization",icon:rD,label:"客製化管理"}],i=(o,l)=>l?e.pathname===o:e.pathname.startsWith(o);return c.jsxs("div",{className:"min-h-screen flex bg-[#fafafa] font-sans text-gray-900",children:[c.jsxs("aside",{className:"w-64 bg-white border-r border-gray-100 flex flex-col shadow-sm shrink-0",children:[c.jsx("div",{className:"h-20 flex items-center px-8 border-b border-gray-50",children:c.jsxs(Be,{to:"/",className:"text-xl font-bold tracking-widest flex items-center gap-3 hover:text-gray-500 transition-colors uppercase",children:[c.jsx("span",{className:"w-8 h-8 bg-black flex items-center justify-center text-white text-sm rounded-sm",children:"天"}),c.jsx("span",{className:"text-base",children:"後台管理"})]})}),c.jsx("nav",{className:"flex-1 p-6 space-y-1.5",children:s.map(o=>c.jsxs(Be,{to:o.to,className:`flex items-center gap-3 px-4 py-3 rounded-xl text-sm font-medium transition-colors ${i(o.to,o.exact)?"bg-gray-900 text-white":"text-gray-500 hover:bg-gray-50 hover:text-gray-900"}`,children:[c.jsx(o.icon,{className:"w-5 h-5"}),o.label]},o.to))}),c.jsxs("div",{className:"p-6 space-y-2",children:[c.jsxs(Be,{to:"/",className:"flex items-center justify-center gap-2 w-full px-4 py-2.5 text-sm font-medium rounded-xl text-gray-400 hover:text-gray-700 hover:bg-gray-50 transition-colors",children:[c.jsx(oo,{className:"w-4 h-4"}),"返回前台"]}),c.jsxs("button",{onClick:r,className:"flex items-center justify-center gap-2 w-full px-4 py-2.5 text-sm font-medium rounded-xl text-gray-400 hover:text-red-600 hover:bg-red-50 transition-colors",children:[c.jsx(Y5,{className:"w-4 h-4"}),"登出"]})]})]}),c.jsx("main",{className:"flex-1 overflow-x-hidden overflow-y-auto",children:c.jsx(Ix,{})})]})}function Bf(t={}){const e=C.useRef(null);return C.useEffect(()=>{const n=e.current;if(!n)return;if(window.matchMedia("(prefers-reduced-motion: reduce)").matches){n.classList.add("revealed");return}const s=new IntersectionObserver(i=>{i.forEach(o=>{o.isIntersecting&&(o.target.classList.add("revealed"),o.target.querySelectorAll(".scroll-reveal").forEach(l=>l.classList.add("revealed")),s.unobserve(o.target))})},{threshold:t.threshold||.1,rootMargin:t.rootMargin||"0px 0px -40px 0px"});return s.observe(n),()=>s.disconnect()},[]),e}function Wi(){const t=C.useRef(null);return C.useEffect(()=>{const e=t.current;if(!e)return;const n=window.matchMedia("(prefers-reduced-motion: reduce)").matches,r=e.querySelectorAll(".scroll-reveal");if(n){r.forEach(i=>i.classList.add("revealed"));return}const s=new IntersectionObserver(i=>{i.forEach(o=>{o.isIntersecting&&(o.target.classList.add("revealed"),s.unobserve(o.target))})},{threshold:.1,rootMargin:"0px 0px -30px 0px"});return r.forEach(i=>s.observe(i)),()=>s.disconnect()},[]),t}const bD=[{icon:ol,title:"訂購方式",desc:"請加入官方Line或致電04-25320436~8洽詢,商品完成付款後,請提供帳號後五碼查詢,並提供寄送相關資訊(例如:姓名、電話、地址⋯寄送注意事項)。"},{icon:sl,title:"付款方式",desc:"支援銀行匯款、網銀轉帳、貨到付款,歡迎來電洽詢。"},{icon:al,title:"運送方式",desc:"配合專業物流車隊,全省皆可配送(偏遠地區/外島除外),配送時程依地區不同約需3-7個工作天。"},{icon:il,title:"退貨方式",desc:"收到商品鑒賞期7天內如有瑕疵可申請退換貨,請保持原包裝完整,若非品質瑕疵問題鑒賞期間內退貨,需酌收物流處理費於退費中扣除,退款將於收到商品後約3~5天退回您的指定帳戶,請注意客製化商品恕不退換。"},{icon:ll,title:"客製化服務",desc:null}];function SD(){var P;const{categories:t,items:e,banners:n,company:r}=Ji(),[s,i]=C.useState(0),o=`https://line.me/R/ti/p/${((P=r==null?void 0:r.contact)==null?void 0:P.lineId)||"@zta7959m"}`,l=Bf(),u=Bf(),h=Wi(),f=Wi();C.useEffect(()=>{if(!n||n.length===0)return;const _=setInterval(()=>i(w=>(w+1)%n.length),5e3);return()=>clearInterval(_)},[n==null?void 0:n.length]);const p=()=>i(_=>(_+1)%n.length),g=()=>i(_=>(_-1+n.length)%n.length),E=C.useRef(null),N=_=>{E.current=_.touches[0].clientX},A=_=>{if(E.current===null)return;const w=E.current-_.changedTouches[0].clientX;Math.abs(w)>50&&(w>0?p():g()),E.current=null};return c.jsxs("div",{className:"page-enter -mt-6 md:-mt-12",children:[c.jsxs("div",{className:"banner-section relative w-[calc(100%+2rem)] md:w-[calc(100%+6rem)] -ml-4 md:-ml-12 h-[50vh] md:aspect-[21/9] md:h-auto overflow-hidden group mb-8 md:mb-24",onTouchStart:N,onTouchEnd:A,children:[n.map((_,w)=>c.jsxs("div",{className:`absolute inset-0 transition-all duration-1000 ease-in-out ${w===s?"opacity-100 z-10 scale-100":"opacity-0 z-0 scale-105"}`,children:[c.jsx("img",{src:_.url,alt:_.title,className:"w-full h-full object-cover"}),c.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 via-black/10 to-transparent flex justify-center items-center",children:c.jsx("h2",{className:"text-xl sm:text-2xl md:text-5xl font-light text-white px-6 md:px-8 text-center tracking-[0.1em] md:tracking-[0.2em] leading-relaxed md:leading-[1.4] drop-shadow-lg",style:{fontFamily:"'Georgia', serif"},children:_.title})})]},_.id)),c.jsx("button",{onClick:g,className:"absolute left-3 md:left-8 top-1/2 -translate-y-1/2 z-20 w-10 h-10 md:w-12 md:h-12 rounded-full bg-white/20 backdrop-blur-md flex items-center justify-center text-white hover:bg-white/40 transition-colors opacity-70 md:opacity-0 md:group-hover:opacity-100","aria-label":"Previous",children:c.jsx(fc,{className:"w-5 h-5 md:w-6 md:h-6"})}),c.jsx("button",{onClick:p,className:"absolute right-3 md:right-8 top-1/2 -translate-y-1/2 z-20 w-10 h-10 md:w-12 md:h-12 rounded-full bg-white/20 backdrop-blur-md flex items-center justify-center text-white hover:bg-white/40 transition-colors opacity-70 md:opacity-0 md:group-hover:opacity-100","aria-label":"Next",children:c.jsx(pc,{className:"w-5 h-5 md:w-6 md:h-6"})}),c.jsx("div",{className:"absolute bottom-6 md:bottom-10 left-1/2 -translate-x-1/2 z-20 flex gap-3 md:gap-4",children:n.map((_,w)=>c.jsx("button",{onClick:()=>i(w),className:`h-[2px] transition-all duration-500 ${w===s?"bg-white w-8 md:w-12":"bg-white/40 w-4 md:w-6 hover:bg-white/80"}`,"aria-label":`slide ${w+1}`},w))})]}),(()=>{var T;const _=e||[],w=_.filter(y=>y.showOnHomepage),S=_.filter(y=>y.isNewArrival),j=w.length>0?w:S.length>0?S:_,V=new Map;for(const y of j){const I=y.title||y.id;V.has(I)||V.set(I,{id:y.id,title:y.title,order:y.order,specs:y.specs,images:[],categoryId:y.categoryId}),y.image&&V.get(I).images.push(y.image),y.images&&Array.isArray(y.images)&&V.get(I).images.push(...y.images),y.specs&&y.specs.length>0&&!((T=V.get(I).specs)!=null&&T.length)&&(V.get(I).specs=y.specs)}const M=Array.from(V.values()).sort((y,I)=>(y.order??0)-(I.order??0)).slice(0,4);return M.length===0?null:c.jsxs("div",{ref:u,className:"scroll-reveal mb-12 md:mb-24",children:[c.jsxs("div",{className:"flex items-center justify-center gap-4 mb-8 md:mb-10",children:[c.jsx("div",{className:"flex-1 h-px bg-gray-200"}),c.jsx("h2",{className:"text-lg md:text-2xl font-bold text-gray-900 tracking-[0.15em]",style:{fontFamily:"'Georgia', serif"},children:"新品上市"}),c.jsx("div",{className:"flex-1 h-px bg-gray-200"})]}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3 md:gap-6",children:M.map((y,I)=>{var k;return c.jsxs(Be,{to:`/category/${y.categoryId}/product/${y.id}`,className:"group flex flex-col items-center text-center",children:[c.jsxs("div",{className:"relative w-full aspect-[4/5] bg-white rounded-xl mb-4 overflow-hidden transition-all duration-500 group-hover:shadow-[0_8px_30px_rgb(0,0,0,0.06)] group-hover:-translate-y-1",children:[y.images[0]&&c.jsx("img",{src:y.images[0],alt:y.title,className:"w-full h-full object-contain mix-blend-multiply transition-transform duration-700 ease-out group-hover:scale-110",loading:"lazy"}),c.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/[0.02] transition-colors duration-500"})]}),c.jsxs("div",{className:"px-2 w-full",children:[c.jsx("h3",{className:"text-[15px] font-semibold text-gray-800 tracking-wide group-hover:text-[#C39D6F] transition-colors line-clamp-1",children:(k=y.title)!=null&&k.startsWith("型號")?y.title.replace(/^型號\s*/,"型號 "):`型號 ${y.title}`}),(()=>{var U,O;const R=(U=y.specs)==null?void 0:U.find(G=>G.name==="NT$"),b=(R==null?void 0:R.value)||"",v=((O=t==null?void 0:t.find(G=>
3764G.id===y.categoryId))==null?void 0:O.title)==="特惠商品";return b?c.jsxs("p",{className:`text-[15px] font-semibold mt-1 tracking-wide ${v?"text-red-500":"text-[#C39D6F]"}`,children:["NT$ ",b]}):null})(),c.jsx("div",{className:"mt-2.5 w-6 h-[1.5px] bg-gray-200 mx-auto transition-all duration-500 group-hover:w-16 group-hover:bg-gray-400"})]})]},y.title||I)})}),c.jsx("div",{className:"text-center mt-6 md:mt-8",children:c.jsxs(Be,{to:"/new-arrivals",className:"inline-flex items-center gap-1.5 border-b border-gray-500 pb-0.5 text-[15px] font-semibold tracking-[0.12em] text-gray-700 transition-colors hover:border-gray-950 hover:text-gray-950",children:["查看更多新品",c.jsx(qv,{className:"w-3.5 h-3.5"})]})})]})})(),c.jsx("div",{ref:l,className:"scroll-reveal max-w-2xl mx-auto px-6 text-center mb-12 md:mb-24",children:c.jsxs("p",{className:"text-gray-600 text-sm md:text-base leading-[2.2] md:leading-[3] tracking-[0.12em] md:tracking-[0.2em]",style:{fontFamily:"'Georgia', serif"},children:["不只是生活,",c.jsx("br",{}),"而是被細心挑選的時光。",c.jsx("br",{}),c.jsx("br",{}),"我們不追求更多,",c.jsx("br",{}),"我們選擇更清晰,",c.jsx("br",{}),"更接近自己。"]})}),c.jsx("div",{className:"max-w-7xl mx-auto px-4 md:px-12",ref:h,children:c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 md:gap-8 mb-16 md:mb-32 scroll-reveal-stagger",children:t.map(_=>c.jsxs(Be,{to:`/category/${_.id}`,className:"scroll-reveal group block flex flex-col items-center active:scale-[0.97] transition-transform duration-200",children:[c.jsxs("div",{className:"img-zoom relative aspect-square bg-gray-50 mb-4 w-full rounded-xl shadow-sm",children:[c.jsx("img",{src:_.image,alt:_.title,loading:"lazy",className:"w-full h-full object-cover rounded-xl"}),c.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/5 transition-colors duration-500 rounded-xl"})]}),c.jsx("div",{className:"text-center w-full px-2",children:c.jsx("span",{className:"block text-sm md:text-[15px] text-gray-900 tracking-[0.1em] group-hover:text-gray-500 transition-colors uppercase font-medium",children:_.title})})]},_.id))})}),c.jsx("div",{className:"max-w-7xl mx-auto px-4 md:px-12 mb-12 md:mb-24",children:c.jsxs(Be,{to:"/customization",className:"group relative flex items-center w-full h-32 sm:h-36 md:h-44 rounded-xl md:rounded-2xl overflow-hidden shadow-sm hover:shadow-lg transition-all duration-500",children:[c.jsx("img",{src:"/images/customization-banner.jpg",alt:"客製化服務",className:"absolute inset-0 w-full h-full object-cover transition-transform duration-700 group-hover:scale-105"}),c.jsx("div",{className:"absolute inset-0 bg-black/35 group-hover:bg-black/45 transition-colors duration-500"}),c.jsxs("div",{className:"relative z-10 flex items-center justify-between w-full px-6 md:px-12",children:[c.jsxs("div",{children:[c.jsx("span",{className:"text-[10px] md:text-xs tracking-[0.25em] text-white/80 uppercase font-semibold",children:"Customization"}),c.jsx("h2",{className:"text-xl md:text-2xl font-medium text-white tracking-widest mt-1 drop-shadow-sm",style:{fontFamily:"'Georgia', serif"},children:"專屬客製化服務"})]}),c.jsxs("div",{className:"flex items-center gap-2 text-xs md:text-sm font-bold tracking-wider bg-white/20 backdrop-blur-sm px-5 py-2.5 rounded-full border border-white/30 text-white group-hover:bg-white group-hover:text-gray-900 transition-all duration-500 shrink-0",children:["探索更多 ",c.jsx(qv,{className:"w-3.5 h-3.5 transition-transform group-hover:translate-x-1"})]})]})]})}),c.jsx("div",{id:"shipping-info",className:"max-w-7xl mx-auto px-4 md:px-12 mb-12 md:mb-20",ref:f,children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4 md:gap-5",children:bD.map((_,w)=>{const S=_.title==="客製化服務",j=S?"a":Be,V=S?{href:o,target:"_blank",rel:"noopener noreferrer"}:{to:"/shipping-info"};return c.jsxs(j,{...V,className:"scroll-reveal card-hover-lift flex gap-3.5 items-start p-4 md:p-5 rounded-xl bg-gray-50/80 border border-gray-100/80 hover:bg-white transition-colors cursor-pointer group",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center shrink-0 shadow-sm group-hover:shadow transition-shadow",children:c.jsx(_.icon,{size:18,className:"text-gray-500 group-hover:text-gray-900 transition-colors"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-800 mb
3764-1 tracking-wide group-hover:text-gray-900 transition-colors",children:_.title}),c.jsx("p",{className:"text-xs text-gray-500 leading-relaxed group-hover:text-gray-600 transition-colors",children:_.desc||c.jsxs(c.Fragment,{children:["提供尺寸、材質、顏色客製化服務,歡迎",c.jsx("span",{className:"text-[#06C755] font-semibold underline underline-offset-2",children:"加入 LINE"})," 與我們討論您的需求。"]})})]})]},w)})})})]})}function TT({images:t,title:e,description:n,detailUrl:r,specs:s,isSpecialSale:i}){const o=t[0],l=s==null?void 0:s.find(p=>p.name==="NT$"),u=(l==null?void 0:l.value)||"",h=r?Be:"div",f=r?{to:r}:{};return c.jsxs(h,{...f,className:"group flex flex-col items-center text-center cursor-pointer",children:[c.jsxs("div",{className:"relative w-full overflow-hidden aspect-[4/5] mb-4 md:mb-5 bg-white rounded-xl transition-all duration-500 group-hover:shadow-[0_8px_30px_rgb(0,0,0,0.06)] group-hover:-translate-y-1",children:[o&&c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx("img",{src:o,alt:e,className:"w-full h-full object-contain mix-blend-multiply transition-transform duration-700 ease-out group-hover:scale-110",loading:"lazy",draggable:!1})}),c.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/[0.02] transition-colors duration-500 pointer-events-none"})]}),c.jsxs("div",{className:"px-2 w-full flex flex-col items-center",children:[c.jsx("h3",{className:"text-[15px] font-semibold text-gray-800 tracking-[0.08em] md:tracking-[0.1em] group-hover:text-[#C39D6F] transition-colors",children:e!=null&&e.startsWith("型號")?e.replace(/^型號\s*/,"型號 "):`型號 ${e}`}),u&&c.jsxs("p",{className:`text-[15px] font-semibold mt-1 tracking-wide ${i?"text-red-500":"text-[#C39D6F]"}`,children:["NT$ ",u]}),n&&c.jsx("p",{className:"text-gray-500 text-[13px] leading-[1.8] tracking-[0.1em] whitespace-pre-wrap mt-1",children:n}),c.jsx("div",{className:"mt-3 w-6 h-[1.5px] bg-gray-200 mx-auto transition-all duration-500 group-hover:w-16 group-hover:bg-gray-400"})]})]})}function CD(t){var n;const e=new Map;for(const r of t){const s=r.title||r.id;e.has(s)||e.set(s,{id:r.id,title:r.title,description:r.description,specs:r.specs,order:r.order,images:[]}),r.image&&e.get(s).images.push(r.image),r.images&&Array.isArray(r.images)&&e.get(s).images.push(...r.images),r.specs&&r.specs.length>0&&!((n=e.get(s).specs)!=null&&n.length)&&(e.get(s).specs=r.specs)}return Array.from(e.values()).sort((r,s)=>(r.order??0)-(s.order??0))}function kD(){const{id:t}=_x(),{categories:e,items:n,company:r}=Ji(),s=`https://line.me/R/ti/p/${r.contact.lineId}`,i=e==null?void 0:e.find(h=>h.id===t),o=C.useMemo(()=>(n||[]).filter(h=>h.categoryId===t),[n,t]),l=C.useMemo(()=>CD(o),[o]),u=Wi();return c.jsxs("div",{className:"flex flex-col md:flex-row gap-6 md:gap-12 lg:gap-24 page-enter",children:[c.jsx("aside",{className:"hidden md:block w-48 shrink-0",children:c.jsxs("div",{className:"sticky top-40 space-y-6",children:[c.jsx("h3",{className:"text-xs font-semibold text-gray-400 tracking-[0.2em] uppercase mb-8",children:"分類導覽"}),c.jsxs("ul",{className:"space-y-4",children:[c.jsx("li",{children:c.jsx(Be,{to:"/",className:"text-sm tracking-[0.1em] text-gray-500 hover:text-black transition-colors",children:"品牌首頁"})}),e==null?void 0:e.map(h=>c.jsx("li",{children:c.jsx(Be,{to:`/category/${h.id}`,className:`text-sm tracking-[0.1em] transition-colors block ${h.id===t?"text-black font-semibold":"text-gray-500 hover:text-black"}`,children:h.title})},h.id))]})]})}),c.jsxs("div",{className:"flex-1 space-y-8 md:space-y-12",children:[c.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-3 md:gap-6 border-b border-gray-100 pb-4 md:pb-8",children:[c.jsxs("div",{className:"space-y-2 md:space-y-4",children:[c.jsxs(Be,{to:"/",className:"md:hidden inline-flex items-center text-xs font-semibold text-gray-400 hover:text-gray-900 transition-colors uppercase tracking-widest py-1",children:[c.jsx(oo,{className:"w-3.5 h-3.5 mr-1.5"}),"返回首頁"]}),c.jsx("h1",{className:"text-2xl md:text-5xl tracking-[0.1em] md:tracking-[0.15em] text-gray-900 uppercase",style:{fontFamily:"'Georgia', serif",fontWeight:700},children:i?i.title:"載入中..."})]}),l.length>0&&c.jsxs("div",{className:"text-gray-400 text-xs tracking-[0.2em] uppercase",children:["共 ",l.length," 款商品"]})]}),l.length===0?c.jsx("div",{className:"text-center py-20 bg-gray-50 border border-gray-100 w-full text-gray-400 text-sm tracking-widest uppercase rounded-lg",children:"此分類下尚無任何商品"}):c.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-x-3 md:gap-x-6 gap-y-6 md:gap-y-12",children:l.map((h,f)=>
3764c.jsx(TT,{images:h.images,title:h.title,description:h.description,specs:h.specs,detailUrl:`/category/${t}/product/${h.id}`,isSpecialSale:(i==null?void 0:i.title)==="特惠商品"},h.title||f))}),c.jsx("div",{className:"mt-8 md:mt-16 pt-8 md:pt-12 border-t border-gray-100",ref:u,children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 md:gap-6",children:[{icon:ol,title:"訂購方式",desc:"請加入官方Line或致電04-25320436~8洽詢,商品完成付款後,請提供帳號後五碼查詢,並提供寄送相關資訊(例如:姓名、電話、地址⋯寄送注意事項)。"},{icon:sl,title:"付款方式",desc:"支援銀行匯款、網銀轉帳、貨到付款,歡迎來電洽詢。"},{icon:al,title:"運送方式",desc:"配合專業物流車隊,全省皆可配送(偏遠地區/外島除外),配送時程依地區不同約需3-7個工作天。"},{icon:il,title:"退貨方式",desc:"收到商品鑒賞期7天內如有瑕疵可申請退換貨,請保持原包裝完整,若非品質瑕疵問題鑒賞期間內退貨,需酌收物流處理費於退費中扣除,退款將於收到商品後約3~5天退回您的指定帳戶,請注意客製化商品恕不退換。"},{icon:ll,title:"客製化服務",desc:null}].map((h,f)=>{const p=h.title==="客製化服務",g=p?"a":Be,E=p?{href:s,target:"_blank",rel:"noopener noreferrer"}:{to:"/shipping-info"};return c.jsxs(g,{...E,className:"scroll-reveal card-hover-lift flex gap-3.5 items-start p-4 rounded-xl bg-gray-50/80 border border-gray-100/80 hover:bg-white transition-colors cursor-pointer group",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center shrink-0 shadow-sm group-hover:shadow transition-shadow",children:c.jsx(h.icon,{size:18,className:"text-gray-500 group-hover:text-gray-900 transition-colors"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-800 mb-1 tracking-wide group-hover:text-gray-900 transition-colors",children:h.title}),c.jsx("p",{className:"text-xs text-gray-500 leading-relaxed group-hover:text-gray-600 transition-colors",children:h.desc||c.jsxs(c.Fragment,{children:["提供尺寸、材質、顏色客製化服務,歡迎",c.jsx("span",{className:"text-[#06C755] font-semibold underline underline-offset-2",children:"加入 LINE"}
3764)," 與我們討論您的需求。"]})})]})]},f)})})})]})]})}function ND(){var R,b;const{id:t,productId:e}=_x(),{categories:n,items:r,company:s}=Ji(),i=os(),o=`https://line.me/R/ti/p/${s.contact.lineId}`,l=C.useMemo(()=>{const v=new Map;for(const U of r||[]){const O=U.title||U.id;v.has(O)||v.set(O,{id:U.id,categoryId:U.categoryId,title:U.title,description:U.description,specs:U.specs,order:U.order,note:U.note||"",images:[],introImages:[]}),U.image&&v.get(O).images.push(U.image),U.images&&Array.isArray(U.images)&&v.get(O).images.push(...U.images),U.introImages&&Array.isArray(U.introImages)&&v.get(O).introImages.push(...U.introImages)}return Array.from(v.values()).sort((U,O)=>(U.order??0)-(O.order??0))},[r]),u=l.find(v=>v.id===e)||l.find(v=>encodeURIComponent(v.title)===e),h=u?u.categoryId:t,f=n==null?void 0:n.find(v=>v.id===h),[p,g]=C.useState(0),E=C.useRef(null),N=C.useRef(null),A=C.useRef(null),P=C.useRef(null),_=((R=u==null?void 0:u.images)==null?void 0:R.length)||0,w=()=>g(v=>(v-1+_)%_),S=()=>g(v=>(v+1)%_),j=v=>{A.current=v.touches[0].clientX},V=v=>{P.current=v.touches[0].clientX},M=()=>{if(A.current===null||P.current===null)return;const v=A.current-P.current;Math.abs(v)>40&&(v>0?S():w()),A.current=null,P.current=null};C.useEffect(()=>{const v=N.current;v&&v.children[p]&&v.children[p].scrollIntoView({behavior:"smooth",inline:"center",block:"nearest"})},[p]);const T=Wi();if(!u)return c.jsxs("div",{className:"text-center py-20 text-gray-400",children:["商品不存在",c.jsx("br",{}),c.jsx(Be,{to:"/",className:"text-sm text-gray-500 hover:text-gray-900 mt-4 inline-block underline",children:"回到首頁"})]});const y=u.specs&&u.specs.length>0?u.specs.map(v=>{let U=v.name;return U==="製造材質"&&(U="包覆材質"),U==="面料顏色"&&(U="底座"),{...v,name:U}}):[{name:"NT$",value:""},{name:"包覆材質",value:u.description||""},{name:"底座",value:""},{name:"規格尺寸",value:""}],I=v=>{if(!v)return!1;const U=v.split("?")[0].toLowerCase();return U.endsWith(".mp4")||U.endsWith(".webm")||U.endsWith(".mov")||U.endsWith(".m4v")},k=u.introImages&&u.introImages.length>0?c.jsx("div",{className:"w-full max-w-5xl mx-auto space-y-4 md:space-y-8 flex flex-col items-center",children:u.introImages.map((v,U)=>I(v)?c.jsx("video",{src:v,controls:!0,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,className:"w-full h-auto rounded-xl shadow-sm"},U):c.jsx("img",{src:v,alt:`商品介紹 ${U+1}`,className:"w-full h-auto rounded-xl shadow-sm"},U))}):null;return c.jsxs("div",{className:"page-enter pb-8",children:[c.jsxs("div",{className:"flex flex-col lg:flex-row gap-6 lg:gap-12",children:[c.jsxs("div",{className:"lg:w-[50%]",children:[c.jsxs("div",{ref:E,className:"group relative overflow-hidden aspect-[4/5] lg:aspect-video bg-white rounded-xl select-none mb-3 scroll-mt-[200px]",onTouchStart:j,onTouchMove:V,onTouchEnd:M,children:[c.jsx("div",{className:"relative w-full h-full",children:u.images.map((v,U)=>c.jsx("div",{className:`absolute inset-0 w-full h-full overflow-hidden flex items-center justify-center transition-opacity duration-300 ease-in-out ${U===p?"opacity-100 z-10":"opacity-0 z-0"}`,children:c.jsx("img",{src:v,alt:`${u.title} - ${U+1}`,className:"w-full h-full object-contain mix-blend-multiply",draggable:!1})},U))}),_>1&&c.jsxs(c.Fragment,{children:[c.jsx("button",{onClick:v=>{v.preventDefault(),w()},className:"hidden lg:flex absolute left-3 top-1/2 -translate-y-1/2 z-10 w-10 h-10 rounded-full bg-white/80 backdrop-blur shadow-sm items-center justify-center text-gray-700 hover:bg-white transition opacity-0 hover:opacity-100 group-hover:opacity-100","aria-label":"上一張",children:c.jsx(fc,{className:"w-6 h-6"})}),c.jsx("button",{onClick:v=>{v.preventDefault(),S()},className:"hidden lg:flex absolute right-3 top-1/2 -translate-y-1/2 z-10 w-10 h-10 rounded-full bg-white/80 backdrop-blur shadow-sm items-center justify-center text-gray-700 hover:bg-white transition opacity-0 hover:opacity-100 group-hover:opacity-100","aria-label":"下一張",children:c.jsx(pc,{className:"w-6 h-6"})})]}),_>1&&c.jsxs("div",{className:"absolute top-3 right-3 z-10 bg-black/50 text-white text-xs tracking-wider px-2.5 py-1 rounded-full",children:[p+1," / ",_]})]}),_>1&&c.jsxs("div",{className:"relative flex items-center gap-1.5",children:[c.jsx("button",{onClick:w,className:"shrink-0 w-8 h-8 lg:w-9 lg:h-9 rounded-full bg-gray-100 border border-gray-200 shadow-sm flex items-center justify-center text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-all","aria-label":"上一張",children:c.jsx(fc,{className:"w-4 h-4 lg:w-5 lg:h-5"})}),c.jsx("div",{ref:N,className:"flex gap-2 overflow-x-auto scrollbar-hide pb-1 flex-1",children:u.images.map((v,U)=>c.jsx("button",{onClick:()=>{g(U),window.innerWidth>=1024&&window.scrollTo({top:0,behavior:"smooth"})},className:`w-16 h-16 md:w-20 md:h-20 shrink-0 rounded-lg overflow-hidden border-2 transition-all bg-white ${U===p?"border-gray-900 shadow-md":"border-transparent opacity-60 hover:opacity-100"}`,children:c.jsx("img",{src:v,alt:`縮圖 ${U+1}`,className:"w-full h-full object-contain mix-blend-multiply p-1"})},U))}),c.jsx("button",{onClick:S,className:"shrink-0 w-8 h-8 lg:w-9 lg:h-9 rounded-full bg-gray-100 border border-gray-200 shadow-sm flex items-center justify-center text-gray-600 hover:bg-gray-200 hover:text-gray-900 transition-all","aria-label":"下一張",children:c.jsx(pc,{className:"w-4 h-4 lg:w-5 lg:h-5"})})]}),k&&c.jsx("div",{className:"mt-6 md:hidden",children:k})]}),c.jsxs("div",{className:"lg:w-[50%] lg:sticky lg:top-32 lg:self-start",children:[c.jsx("div",{className:"border-b border-gray-100 pb-4 mb-0",children:c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("span",{className:"w-24 text-sm text-gray-500 tracking-wider shrink-0",children:"型號"}),c.jsx("h1",{className:"text-xl md:text-2xl font-bold text-gray-900 tracking-wide",children:(b=u.title)!=null&&b.startsWith("型號")?u.title.replace(/^型號\s*/,""):u.title})]})}),c.jsxs("div",{children:[(()=>{const v=y.filter(O=>O.name),U=[];return v.forEach(O=>{if(O.name==="規格尺寸"){const G=U[U.length-1];G&&G.name==="規格尺寸"?G.values.push(O.value):U.push({name:O.name,values:[O.value]})}else U.push({name:O.name,values:[O.value]})}),U.map((O,G)=>{const Q=O.name==="NT$",F=(f==null?void 0:f.title)==="特惠商品";return c.jsxs("div",{className:`flex ${Q?"items-center":"items-start"} border-b border-gray-100 py-4 gap-2`,children:[c.jsx("span",{className:`w-24 text-sm text-gray-500 tracking-wider shrink-0 ${Q?"":"mt-0.5"}`,children:O.name}),c.jsx("div",{className:"flex-1 space-y-2",children:O.values.map((B,W)=>c.jsx("div",{className:Q?`text-xl md:text-2xl font-bold tracking-wide ${F?"text-red-500":"text-[#C39D6F]"}`:"text-sm text-gray-800 leading-relaxed",children:B||"請洽詢客服"},W))})]},G)})})(),u.note&&c.jsxs("div",{className:"flex items-start border-b border-gray-100 py-3.5 gap-2",children:[c.jsx("span",{className:"w-24 text-sm text-gray-500 tracking-wider shrink-0",children:"備註"}),c.jsx("span",{className:"text-sm text-gray-800 flex-1 leading-relaxed",children:u.note})]})]}),c.jsxs("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-2.5 mt-8 w-full bg-[#06C755] text-white font-semibold py-3.5 rounded-xl hover:bg-[#05a64a] active:scale-[0.98] transition-all text-sm tracking-wide shadow-lg shadow-[#06C755]/20",children:[c.jsxs("svg",{viewBox:"0 0 120 120",className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M60 15C33.5 15 12 32.3 12 53.5c0 19 16.8 34.9 39.5 37.9 1.5.3 3.6 1 4.1 2.4.5 1.2.3 3.1.2 4.3 0 0-.6 3.3-.7 4-.2 1.2
3764-1 5.2 4.6 2.8 5.5-2.3 30-17.6 40.9-30.2h0C108.5 66 108 58.5 108 53.5 108 32.3 86.5 15 60 15z",fill:"white"}),c.jsx("text",{x:"60",y:"62",textAnchor:"middle",fontFamily:"Arial",fontWeight:"900",fontSize:"28",fill:"#06C755",letterSpacing:"1",children:"LINE"})]}),"LINE 詢問此商品"]}),c.jsxs("button",{onClick:()=>i(-1),className:"flex items-center justify-center gap-1.5 mt-5 w-full text-gray-400 text-xs tracking-wider hover:text-gray-700 transition-colors py-2.5 border border-gray-100 rounded-xl hover:border-gray-300",children:[c.jsx(oo,{className:"w-3.5 h-3.5"})," 返回上一頁"]})]})]}),k&&c.jsx("div",{className:"hidden md:block mt-12 md:mt-24",children:k}),c.jsx("div",{className:"mt-16 md:mt-24 pt-8 md:pt-12 border-t border-gray-100",ref:T,children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 md:gap-6",children:[{icon:ol,title:"訂購方式",desc:"請加入官方Line或致電04-25320436~8洽詢,商品完成付款後,請提供帳號後五碼查詢,並提供寄送相關資訊(例如:姓名、電話、地址⋯寄送注意事項)。"},{icon:sl,title:"付款方式",desc:"支援銀行匯款、網銀轉帳、貨到付款,歡迎來電洽詢。"},{icon:al,title:"運送方式",desc:"配合專業物流車隊,全省皆可配送(偏遠地區/外島除外),配送時程依地區不同約需3-7個工作天。"},{icon:il,title:"退貨方式",desc:"收到商品鑒賞期7天內如有瑕疵可申請退換貨,請保持原包裝完整,若非品質瑕疵問題鑒賞期間內退貨,需酌收物流處理費於退費中扣除,退款將於收到商品後約3~5天退回您的指定帳戶,請注意客製化商品恕不退換。"},{icon:ll,title:"客製化服務",desc:null}].map((v,U)=>{const O=v.title==="客製化服務",G=O?"a":Be,Q=O?{href:o,target:"_blank",rel:"noopener noreferrer"}:{to:"/shipping-info"};return c.jsxs(G,{...Q,className:"scroll-reveal card-hover-lift flex gap-3.5 items-start p-4 rounded-xl bg-gray-50/80 border border-gray-100/80 hover:bg-white transition-colors cursor-pointer group",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center shrink-0 shadow-sm group-hover:shadow transition-shadow",children:c.jsx(v.icon,{size:18,className:"text-gray-500 group-hover:text-gray-900 transition-colors"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-800 mb-1 tracking-wide group-hover:text-gray-900 transition-colors",children:v.title}),c.jsx("p",{className:"text-xs text-gray-500 leading-relaxed group-hover:text-gray-600 transition-colors",children:v.desc||c.jsxs(c.Fragment,{children:["提供尺寸、材質、顏色客製化服務,歡迎",c.jsx("span",{className:"text-[#06C755] font-semibold underline underline-offset-2",children:"加入 LINE"}
3764)," 與我們討論您的需求。"]})})]})]},U)})})})]})}function RD(t){var n;const e=new Map;for(const r of t){const s=r.title||r.id;e.has(s)||e.set(s,{id:r.id,title:r.title,description:r.description,specs:r.specs,categoryId:r.categoryId,order:r.order,images:[]}),r.image&&e.get(s).images.push(r.image),r.images&&Array.isArray(r.images)&&e.get(s).images.push(...r.images),r.specs&&r.specs.length>0&&!((n=e.get(s).specs)!=null&&n.length)&&(e.get(s).specs=r.specs)}return Array.from(e.values()).sort((r,s)=>(r.order??0)-(s.order??0))}function AD(){const{categories:t,items:e,company:n}=Ji(),r=`https://line.me/R/ti/p/${n.contact.lineId}`,s=C.useMemo(()=>(e||[]).filter(l=>l.isNewArrival),[e]),i=C.useMemo(()=>RD(s),[s]),o=Wi();return c.jsxs("div",{className:"page-enter",children:[c.jsxs("div",{className:"flex flex-col md:flex-row md:items-end justify-between gap-3 md:gap-6 border-b border-gray-100 pb-4 md:pb-8 mb-8 md:mb-12",children:[c.jsxs("div",{className:"space-y-2 md:space-y-4",children:[c.jsxs(Be,{to:"/",className:"inline-flex items-center text-xs font-semibold text-gray-400 hover:text-gray-900 transition-colors uppercase tracking-widest py-1",children:[c.jsx(oo,{className:"w-3.5 h-3.5 mr-1.5"}),"返回首頁"]}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(gc,{className:"w-6 h-6 md:w-8 md:h-8 text-amber-500"}),c.jsx("h1",{className:"text-2xl md:text-5xl tracking-[0.1em] md:tracking-[0.15em] text-gray-900 uppercase",style:{fontFamily:"'Georgia', serif",fontWeight:700},children:"新品上市"})]}),c.jsx("p",{className:"text-sm text-gray-400 tracking-wider",children:"嚴選最新到貨商品,搶先體驗"})]}),i.length>0&&c.jsxs("div",{className:"text-gray-400 text-xs tracking-[0.2em] uppercase",children:["共 ",i.length," 款商品"]})]}),i.length===0?c.jsxs("div",{className:"text-center py-20 bg-gray-50 border border-gray-100 w-full text-gray-400 text-sm tracking-widest rounded-lg",children:[c.jsx(gc,{className:"w-10 h-10 mx-auto mb-3 text-gray-200"}),c.jsx("p",{children:"目前尚無新品,敬請期待"})]}):c.jsx("div",{className:"grid grid-cols-2 lg:grid-cols-3 gap-x-3 md:gap-x-6 gap-y-6 md:gap-y-12",children:i.map((l,u)=>{var h;return c.jsx(TT,{images:l.images,title:l.title,description:l.description,specs:l.specs,detailUrl:`/category/${l.categoryId}/product/${l.id}`,isSpecialSale:((h=t==null?void 0:t.find(f=>f.id===l.categoryId))==null?void 0:h.title)==="特惠商品"},l.title||u)})}),c.jsx("div",{className:"mt-8 md:mt-16 pt-8 md:pt-12 border-t border-gray-100",ref:o,children:c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-5 md:gap-6",children:[{icon:ol,title:"訂購方式",desc:"請加入官方Line或致電04-25320436~8洽詢,商品完成付款後,請提供帳號後五碼查詢,並提供寄送相關資訊(例如:姓名、電話、地址⋯寄送注意事項)。"},{icon:sl,title:"付款方式",desc:"支援銀行匯款、網銀轉帳、貨到付款,歡迎來電洽詢。"},{icon:al,title:"運送方式",desc:"配合專業物流車隊,全省皆可配送(偏遠地區/外島除外),配送時程依地區不同約需3-7個工作天。"},{icon:il,title:"退貨方式",desc:"收到商品鑒賞期7天內如有瑕疵可申請退換貨,請保持原包裝完整,若非品質瑕疵問題鑒賞期間內退貨,需酌收物流處理費於退費中扣除,退款將於收到商品後約3~5天退回您的指定帳戶,請注意客製化商品恕不退換。"},{icon:ll,title:"客製化服務",desc:null}].map((l,u)=>{const h=l.title==="客製化服務",f=h?"a":Be,p=h?{href:r,target:"_blank",rel:"noopener noreferrer"}:{to:"/shipping-info"};return c.jsxs(f,{...p,className:"scroll-reveal card-hover-lift flex gap-3.5 items-start p-4 rounded-xl bg-gray-50/80 border border-gray-100/80 hover:bg-white transition-colors cursor-pointer group",children:[c.jsx("div",{className:"w-10 h-10 rounded-xl bg-white flex items-center justify-center shrink-0 shadow-sm group-hover:shadow transition-shadow",children:c.jsx(l.icon,{size:18,className:"text-gray-500 group-hover:text-gray-900 transition-colors"})}),c.jsxs("div",{children:[c.jsx("h4",{className:"text-sm font-semibold text-gray-800 mb
3764-1 tracking-wide group-hover:text-gray-900 transition-colors",children:l.title}),c.jsx("p",{className:"text-xs text-gray-500 leading-relaxed group-hover:text-gray-600 transition-colors",children:l.desc||c.jsxs(c.Fragment,{children:["提供尺寸、材質、顏色客製化服務,歡迎",c.jsx("span",{className:"text-[#06C755] font-semibold underline underline-offset-2",children:"加入 LINE"})," 與我們討論您的需求。"]})})]})]},u)})})})]})}function PD(){const t=Bf();return C.useEffect(()=>{window.scrollTo(0,0)},[]),c.jsx("div",{className:"-mx-4 md:-mx-8 lg:-mx-12 -my-6 md:-my-10 overflow-hidden bg-[#faf8f4]",children:c.jsxs("section",{className:"relative overflow-hidden px-5 py-16 md:px-10 md:py-24 lg:px-16",children:[c.jsxs("div",{className:"absolute inset-0 pointer-events-none",children:[c.jsx("div",{className:"absolute left-[8%] top-[10%] h-16 w-16 rounded-[50%_0_50%_50%] bg-[#f1d7df] opacity-80 blur-[1px] rotate-12 md:h-20 md:w-20"}),c.jsx("div",{className:"absolute left-[4%] top-[36%] h-8 w-8 rounded-[50%_0_50%_50%] bg-[#e8c5cf] opacity-70 blur-[1px] -rotate-12 md:h-10 md:w-10"}),c.jsx("div",{className:"absolute right-[10%] top-[14%] h-14 w-14 rounded-[50%_0_50%_50%] bg-[#eddcc7] opacity-80 blur-[1px] rotate-[110deg] md:h-16 md:w-16"}),c.jsx("div",{className:"absolute right-[6%] bottom-[18%] h-10 w-10 rounded-[50%_0_50%_50%] bg-[#efd6de] opacity-70 blur-[1px] rotate-[82deg] md:h-12 md:w-12"}),c.jsx("div",{className:"absolute bottom-[12%] left-[14%] h-12 w-12 rounded-[50%_0_50%_50%] bg-[#f3e5cf] opacity-70 blur-[1px] rotate-[28deg] md:h-14 md:w-14"}),c.jsx("div",{className:"absolute left-0 top-0 h-56 w-56 rounded-full bg-[#f6ebe2] blur-3xl md:h-72 md:w-72"}),c.jsx("div",{className:"absolute bottom-0 right-0 h-72 w-72 rounded-full bg-[#f1e8df] blur-3xl md:h-96 md:w-96"})]}),c.jsxs("div",{ref:t,className:"scroll-reveal relative mx-auto max-w-4xl rounded-[2rem] border border-white/70 bg-[linear-gradient(180deg,rgba(255,255,255,0.92),rgba(249,243,236,0.92))] p-8 shadow-[0_20px_60px_rgba(120,99,79,0.08)] backdrop-blur-sm md:p-12",children:[c.jsx("h1",{className:"text-[2.45rem] font-semibold leading-tight tracking-[0.08em] text-[#2f221c] md:text-[3.4rem]",children:"關於我們"}),c.jsxs("div",{className:"mt-6 flex items-center gap-3",children:[c.jsx("div",{className:"h-px w-20 bg-[#cfaf95]"}),c.jsx("div",{className:"h-2.5 w-2.5 rounded-full bg-[#e5c3cf]"})]}),c.jsxs("div",{className:"mt-8 space-y-6 text-[18.5px] leading-9 text-[#65554b]",children:[c.jsxs("p",{children:[c.jsx("span",{className:"text-[20.5px] font-semibold text-[#4a3930] md:text-[24px]",children:"天偉金屬家具"}),"座落於",c.jsx("span",{className:"border-none bg-transparent no-underline decoration-transparent shadow-none","x-apple-data-detectors":"false",children:"台中市豐原區"}),",成立於1980年至今,我們有著豐富多年的製造經驗,是專業的金屬家具製造工廠,我們專注於「鐵管工藝」與「曲木美學」的創新結合,以家具製造為核心,提供研發設計、生產製造、全台物流配送、安裝與保å›
3764ºç¶­ä¿®çš„專業服務。"]}),c.jsx("p",{children:"客戶群主要為家具店與各設計公司,以及外銷廠商來台採購訂製產品,案件遍及餐廳、商業場所,百貨公司、學校與飯店..等,我們提供「自有產品」與「客製化服務」,對於產品諮詢、報價流程或售後服務,我們都要求迅速與確實,讓每一位客戶都能享受到高品質服務與體驗。"})]})]})]})})}function jD(){const[t,e]=C.useState(""),[n,r]=C.useState(""),[s,i]=C.useState(""),[o,l]=C.useState(!1),{user:u,isAdmin:h,login:f}=Km(),p=os();C.useEffect(()=>{u&&h&&p("/admin",{replace:!0})},[u,h,p]);const g=async E=>{E.preventDefault(),i(""),l(!0);try{await f(t,n),p("/admin")}catch(N){i(N.message||"帳號或密碼錯誤")}finally{l(!1)}};return c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50 px-4",children:c.jsxs("div",{className:"w-full max-w-sm",children:[c.jsxs("div",{className:"text-center mb-10",children:[c.jsx("div",{className:"inline-flex items-center justify-center w-12 h-12 bg-black text-white text-lg font-bold rounded-lg mb-4",children:"天"}),c.jsx("h1",{className:"text-2xl font-bold tracking-tight text-gray-900",children:"後台管理"}),c.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"天偉金屬家具有限公司"}),c.jsx("p",{className:"text-xs text-gray-300 mt-3",children:"請使用 Firebase 管理員帳號登入"})]}),c.jsxs("form",{onSubmit:g,className:"bg-white rounded-2xl shadow-sm border border-gray-100 p-8 space-y-5",children:[s&&c.jsx("div",{className:"text-sm text-red-600 bg-red-50 border border-red-100 rounded-xl px-4 py-3",children:s}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5 tracking-wide",children:"帳號"}),c.jsx("input",{type:"text",value:t,onChange:E=>e(E.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-shadow",placeholder:"[email protected]",required:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5 tracking-wide",children:"密碼"}),c.jsx("input",{type:"password",value:n,onChange:E=>r(E.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900 focus:border-transparent transition-shadow",placeholder:"••••••••",required:!0})]}),c.jsx("button",{type:"submit",disabled:o,className:"w-full py-3 bg-gray-900 text-white text-sm font-semibold rounded-xl hover:bg-black transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:o?"登入中...":"登入"})]}),gT.length===0&&c.jsx("div",{className:"mt-4 rounded-xl border border-amber-200 bg-amber-50 px-4 py-3 text-xs leading-6 text-amber-800",children:"尚未設定管理員 email allowlist。請先在 `.env.local` 設定 `VITE_ADMIN_EMAILS`。"})]})})}async function DD(){try{if((await JE(_t(ce,"tianwei-categories"))).size>0)return!1;console.log("[Migration] Importing static data to Firestore...");for(let r=0;r<vd.length;r++){const s=vd[r];await Gr(Oe(ce,"tianwei-categories",s.id),{title:s.title,image:s.image,order:r,createdAt:An()})}const e=new Map;for(const r of k5){const s=`${r.categoryId}-${r.title}`;e.has(s)||e.set(s,{categoryId:r.categoryId,title:r.title,description:r.description||"",images:[]}),r.image&&e.get(s).images.push(r.image)}let n=0;for(const[r,s]of e){const i=r.replace(/[^a-zA-Z0-9-]/g,"-");await Gr(Oe(ce,"tianwei-items",i),{categoryId:s.categoryId,title:s.title,description:s.description,image:s.images[0]||"",images:s.images.slice(1),order:n++,createdAt:An()})}for(let r=0;r<Ue.bannerImages.length;r++){const s=Ue.bannerImages[r];await Gr(Oe(ce,"tianwei-banners",s.id),{title:s.title,url:s.url,order:r,createdAt:An()})}return console.log("[Migration] Done! Imported",vd.length,"categories,",e.size,"items, and",Ue.bannerImages.length,"banners."),!0}catch(t){return console.error("[Migration] Failed:",t),!1}}function OD(){const[t,e]=C.useState(0),[n,r]=C.useState(0),[s,i]=C.useState(!0);C.useEffect(()=>{DD().then(()=>{i(!1)});const l=yn(_t(ce,"tianwei-categories"),h=>e(h.size)),u=yn(_t(ce,"tianwei-items"),h=>r(h.size));return()=>{l(),u()}},[]);const o=[{label:"分類數量",value:t,icon:Ym,color:"bg-blue-50 text-blue-600"},{label:"商品數量",value:n,icon:mc,color:"bg-emerald-50 text-emerald-600"}];return c.jsxs("div",{className:"p-10 max-w-5xl mx-auto",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight mb-8",children:"總覽"}),s&&c.jsxs("div",{className:"flex items-center gap-3 bg-blue-50 text-blue-700 px-5 py-3 rounded-xl text-sm mb-6",children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"正在匯入現有資料..."]}),c.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-6",children:o.map(l
3764=>c.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm p-6 flex items-center gap-5",children:[c.jsx("div",{className:`w-12 h-12 rounded-xl flex items-center justify-center ${l.color}`,children:c.jsx(l.icon,{className:"w-6 h-6"})}),c.jsxs("div",{children:[c.jsx("div",{className:"text-3xl font-bold",children:l.value}),c.jsx("div",{className:"text-sm text-gray-400",children:l.label})]})]},l.label))})]})}function LD(){const[t,e]=C.useState([]),[n,r]=C.useState(!0),[s,i]=C.useState(!1),[o,l]=C.useState(null),[u,h]=C.useState(""),[f,p]=C.useState(null),[g,E]=C.useState(null),[N,A]=C.useState(!1),[P,_]=C.useState(null),[w,S]=C.useState(!1),[j,V]=C.useState(!1);C.useEffect(()=>{const b=Jn(_t(ce,"tianwei-categories"),qr("order","asc"));return yn(b,U=>{e(U.docs.map(O=>({id:O.id,...O.data()}))),r(!1)})},[]);const M=b=>{const v=b.target.files[0];v&&(p(v),E(URL.createObjectURL(v)))},T=()=>{l(null),h(""),p(null),E(null),i(!1)},y=b=>{l(b),h(b.title),p(null),E(b.image||null),i(!0)},I=async b=>{if(b.preventDefault(),!!u.trim()){A(!0);try{let v=o?o.image:"";if(f){const U=en(tn,`tianwei/categories/${Date.now()}-${f.name}`),O=await Bi(U,f);v=await zi(O.ref)}o?await Rn(Oe(ce,"tianwei-categories",o.id),{title:u.trim(),image:v}):await Um(_t(ce,"tianwei-categories"),{title:u.trim(),image:v,order:t.length,createdAt:An()}),T()}catch(v){alert("儲存失敗: "+v.message)}finally{A(!1)}}},k=async()=>{if(P){S(!0);try{const v=(await JE(Jn(_t(ce,"tianwei-items")))).docs.filter(U=>U.data().categoryId===P.id);for(const U of v){const O=U.data(),G=[O.image,...O.images||[]].filter(Boolean);for(const Q of G)try{if(Q.includes("firebasestorage")){const F=en(tn,Q);await Hi(F)}}catch{}await hc(Oe(ce,"tianwei-items",U.id))}if(P.image&&P.image.includes("firebasestorage"))try{const U=en(tn,P.image);await Hi(U)}catch{}await hc(Oe(ce,"tianwei-categories",P.id)),_(null)}catch(b){alert("刪除失敗: "+b.message)}finally{S(!1)}}},R=async(b,v)=>{if(j)return;const U=b+v;if(!(U<0||U>=t.length)){V(!0);try{const O=t[b],G=t[U];await Rn(Oe(ce,"tianwei-categories",O.id),{order:G.order??U}),await Rn(Oe(ce,"tianwei-categories",G.id),{order:O.order??b})}catch(O){alert("排序失敗: "+O.message)}finally{V(!1)}}};return c.jsxs("div",{className:"p-10 max-w-5xl mx-auto",children:[c.jsxs("div",{className:"flex items-center justify-between mb-8",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"分類管理"}),c.jsxs("button",{onClick:()=>{T(),i(!0)},className:"flex items-center gap-2 px-5 py-2.5 bg-gray-900 text-white text-sm font-medium rounded-xl hover:bg-black transition-colors",children:[c.jsx(Is,{className:"w-4 h-4"}),"新增分類"]})]}),s&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!N&&i(!1),children:c.jsxs("form",{onClick:b=>b.stopPropagation(),onSubmit:I,className:"bg-white rounded-2xl shadow-2xl w-full max-w-md p-8 space-y-5",children:[c.jsxs("div",{className:"flex justify-between items-center",children:[c.jsx("h2",{className:"text-lg font-bold",children:o?"編輯分類":"新增分類"}),c.jsx("button",{type:"button",onClick:T,className:"text-gray-400 hover:text-gray-600",children:c.jsx(ca,{className:"w-5 h-5"})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"分類名稱"}),c.jsx("input",{type:"text",value:u,onChange:b=>h(b.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"例:吧檯椅系列",required:!0,autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"代表圖片"}),g?c.jsxs("div",{className:"relative group",children:[c.jsx("img",{src:g,alt:"preview",className:"w-full h-40 object-cover rounded-xl"}),c.jsx("button",{type:"button",onClick:()=>{p(null),E(null)},className:"absolute top-2 right-2 bg-black/60 text-white p-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(er,{className:"w-4 h-4"})})]}):c.jsxs("label",{className:"flex flex-col items-center justify-center h-40 border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 transition-colors",children:[c.jsx(Zn,{className:"w-8 h-8 text-gray-300 mb-2"}),c.jsx("span",{className:"text-xs text-gray-400",children:"點擊上傳圖片"}),c.jsx("input",{type:"file",accept:"image/*",onChange:M,className:"hidden"})]})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx("button",{type:"button",onClick:T,disabled:N,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50 transition-colors",children:"取消"}),c.jsx("button",{type:"submit",disabled:N,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-gray-900 text-white hover:bg-black transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:N?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"儲存中..."]}):o?"更新儲存":"確認新增"})]})]})}),P&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!w&&_(null),children:c.jsxs("div",{onClick:b=>b.stopPropagation(),className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm p-8 text-center space-y-5",children:[c.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-red-50 rounded-2xl",children:c.jsx(lh,{className:"w-7 h-7 text-red-500"})}),c.jsx("h2",{className:"text-lg font-bold",children:"確認刪除"}),c.jsxs("p",{className:"text-sm text-gray-500",children:["刪除「",P.title,"」後,所有該分類下的商品也會一併刪除,此操作無法復原。"]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:()=>_(null),disabled:w,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50",children:"取消"}),c.jsx("button",{onClick:k,disabled:w,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 flex items-center justify-center gap-2",children:w?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"刪除中..."]}):"確認刪除"})]})]})}),n?c.jsx("div",{className:"flex items-center justify-center py-20",children:c.jsx(Ht,{className:"w-6 h-6 animate-spin text-gray-400"})}):t.length===0?c.jsxs("div",{className:"text-center py-20 text-gray-400",children:[c.jsx(Ym,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:"尚無分類,請點擊「新增分類」"})]}):c.jsx("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden",children:c.jsxs("table",{className:"w-full text-sm",children:[c.jsx("thead",{children:c.jsxs("tr",{className:"border-b border-gray-100",children:[c.jsx("th",{className:"text-left px-6 py-4 font-medium text-gray-400 text-xs tracking-wider",children:"圖片"}),c.jsx("th",{className:"text-left px-6 py-4 font-medium text-gray-400 text-xs tracking-wider",children:"分類名稱"}),c.jsx("th",{className:"text-left px-6 py-4 font-medium text-gray-400 text-xs tracking-wider",children:"排序"}),c.jsx("th",{className:"text-right px-6 py-4 font-medium text-gray-400 text-xs tracking-wider",children:"操作"})]})}),c.jsx("tbody",{children:t.map(b=>c.jsxs("tr",{className:"border-b border-gray-50 last:border-0 hover:bg-gray-50/50 transition-colors",children:[c.jsx("td",{className:"px-6 py-4",children:b.image?c.jsx("img",{src:b.image,alt:b.title,className:"w-14 h-14 object-cover rounded-xl"}):c.jsx("div",{className:"w-14 h-14 bg-gray-100 rounded-xl flex items-center justify-center",children:c.jsx(Zn,{className:"w-5 h-5 text-gray-300"})})}),c.jsx("td",{className:"px-6 py-4 font-medium",children:b.title}),c.jsx("td",{className:"px-6 py-4",children:c.jsxs("div",{className:"flex items-center gap-1",children:[c.jsx("button",{onClick:()=>R(t.indexOf(b),-1),disabled:j||t.indexOf(b)===0,className:"text-gray-400 hover:text-gray-700 transition-colors p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-20 disabled:cursor-not-allowed",title:"上移",children:c.jsx(wT,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>R(t.indexOf(b),1),disabled:j||t.indexOf(b)===t.length-1,className:"text-gray-400 hover:text-gray-700 transition-colors p-1.5 rounded-lg hover:bg-gray-100 disabled:opacity-20 disabled:cursor-not-allowed",title:"下移",children:c.jsx(_T,{className:"w-4 h-4"})})]})}),c.jsx("td",{className:"px-6 py-4 text-right",children:c.jsxs("div",{className:"flex items-center justify-end gap-1",children:[c.jsx("button",{onClick:()=>y(b),className:"text-gray-400 hover:text-gray-700 transition-colors p-2 rounded-lg hover:bg-gray-100",title:"編輯",children:c.jsx(ET,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>_(b),className:"text-gray-400 hover:text-red-500 transition-colors p-2 rounded-lg hover:bg-red-50",title:"刪除",children:c.jsx(er,{className:"w-4 h-4"})})]})})]},b.id))})]})})]})}function VD(){const[t,e]=C.useState([]),[n,r]=C.useState([]),[s,i]=C.useState(!0),[o,l]=C.useState("all"),[u,h]=C.useState(!1),[f,p]=C.useState(null),[g,E]=C.useState(null),[N,A]=C.useState(!1),[P,_]=C.useState(""),[w,S]=C.useState(""),[j,V]=C.useState(""),[M,T]=C.useState([]),[y,I]=C.useState([]),[k,R]=C.useState(!1),[b,v]=C.useState(!1),[U,O]=C.useState(""),G=[{name:"NT$",value:""},{name:"面料材質",value:""},{name:"底座",value:""},{name:"顏色",value:""},{name:"規格尺寸",value:""}],[Q,F]=C.useState(G),[B,W]=C.useState(!1);C.useEffect(()=>{const H=Jn(_t(ce,"tianwei-categories"),qr("order","asc")),se=yn(H,he=>{const fe=he.docs.map(Tn=>({id:Tn.id,...Tn.data()}));r(fe),!j&&fe.length>0&&V(fe[0].id)}),le=Jn(_t(ce,"tianwei-items"),qr("createdAt","desc")),ee=yn(le,he=>{e(he.docs.map(fe=>({id:fe.id,...fe.data()}))),i(!1)});return()=>{se(),ee()}},[]);const Y=()=>{var H;_(""),S(""),V(((H=n[0])==null?void 0:H.id)||""),T([]),I([]),R(!1),v(!1),O(""),F(G.map(se=>({...se}))),p(null)},oe=()=>{Y(),h(!0)},be=H=>{p(H),_(H.title),S(H.description||""),V(H.categoryId),R(!!H.isNewArrival),v(!!H.showOnHomepage),O(H.note||""),H.specs&&H.specs.length>0?F(H.specs.map(ee=>{let he=ee.name;return(he==="製造材質"||he==="包覆材質")&&(he="面料材質"),he==="面料顏色"&&(he="底座"),{...ee,name:he}}
3764)):F(G.map(ee=>({...ee})));const se=[H.image,...H.images||[]].filter(Boolean);T(se.map(ee=>({url:ee,preview:ee})));const le=H.introImages||[];I(le.map(ee=>({url:ee,preview:ee}))),h(!0)},Se=H=>{const le=Array.from(H.target.files).map(ee=>({file:ee,url:null,preview:URL.createObjectURL(ee)}));T(ee=>[...ee,...le])},Et=H=>{T(se=>se.filter((le,ee)=>ee!==H))},Vt=H=>{const le=Array.from(H.target.files).map(ee=>({file:ee,url:null,preview:URL.createObjectURL(ee)}));I(ee=>[...ee,...le])},En=H=>{I(se=>se.filter((le,ee)=>ee!==H))},ao=async H=>{if(H.preventDefault(),!P.trim()||!j)return;const se=t.filter(le=>le.showOnHomepage&&le.id!==(f==null?void 0:f.id)).length;if(b&&se>=4){alert("首頁新品區塊最多只能指定 4 款商品,請先取消其他商品的首頁顯示。");return}W(!0);try{const le=[];for(const fe of M)if(fe.file){const Tn=en(tn,`tianwei/items/${Date.now()}-${fe.file.name}`),Ks={contentType:fe.file.type||"application/octet-stream"},uo=await Bi(Tn,fe.file,Ks);le.push(await zi(uo.ref))}else le.push(fe.url);const ee=[];for(const fe of y)if(fe.file){const Tn=en(tn,`tianwei/items/${Date.now()}-intro-${fe.file.name}`),Ks={contentType:fe.file.type||"application/octet-stream"},uo=await Bi(Tn,fe.file,Ks);ee.push(await zi(uo.ref))}else ee.push(fe.url);const he={title:P.trim(),description:w.trim(),categoryId:j,image:le[0]||"",images:le.slice(1),introImages:ee,isNewArrival:k,showOnHomepage:b,note:U.trim(),specs:Q.map(fe=>({name:fe.name.trim(),value:fe.value.trim()}))};if(f)await Rn(Oe(ce,"tianwei-items",f.id),he);else{const fe=t.length>0?Math.min(...t.map(Tn=>Tn.order??0)):0;await Um(_t(ce,"tianwei-items"),{...he,order:fe-1,createdAt:An()})}h(!1),Y()}catch(le){alert("儲存失敗: "+le.message)}finally{W(!1)}},ul=async()=>{if(g){A(!0);try{const H=[g.image,...g.images||[],...g.introImages||[]].filter(Boolean);for(const se of H)try{se.includes("firebasestorage")&&await Hi(en(tn,se))}catch{}await hc(Oe(ce,"tianwei-items",g.id)),E(null)}catch(H){alert("刪除失敗: "+H.message)}finally{A(!1)}}},dr=o==="all"?t:t.filter(H=>H.categoryId===o).sort((H,se)=>(H.order??0)-(se.order??0)),uh=async H=>{if(H===0)return;const se=dr,le=se[H],ee=se[H-1];let he=le.order??H,fe=ee.order??H-1;he===fe&&(he=fe+1),await Rn(Oe(ce,"tianwei-items",le.id),{order:fe}),await Rn(Oe(ce,"tianwei-items",ee.id),{order:he})},cl=async H=>{if(H===dr.length-1)return;const se=dr,le=se[H],ee=se[H+1];let he=le.order??H,fe=ee.order??H+1;he===fe&&(he=fe-1),await Rn(Oe(ce,"tianwei-items",le.id),{order:fe}),await Rn(Oe(ce,"tianwei-items",ee.id),{order:he})},lo=H=>{var se;return((se=n.find(le=>le.id===H))==null?void 0:se.title)||"未分類"},hh=t.filter(H=>H.showOnHomepage).length+(b&&!(f!=null&&f.showOnHomepage)?1:0)-(!b&&(f!=null&&f.showOnHomepage)?1:0);return c.jsxs("div",{className:"p-10 max-w-6xl mx-auto",children:[c.jsxs("div",{className:"flex items-center justify-between mb-8 flex-wrap gap-4",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"商品管理"}),c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsxs("div",{className:"relative",children:[c.jsxs("select",{value:o,onChange:H=>l(H.target.value),className:"appearance-none bg-white border border-gray-200 rounded-xl px-4 py-2.5 pr-9 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",children:[c.jsx("option",{value:"all",children:"全部分類"}),n.map(H=>c.jsx("option",{value:H.id,children:H.title},H.id))]}),c.jsx(Qm,{className:"absolute right-3 top-1/2 -translate-y-1/2 w-4 h-4 text-gray-400 pointer-events-none"})]}),c.jsxs("button",{onClick:oe,className:"flex items-center gap-2 px-5 py-2.5 bg-gray-900 text-white text-sm font-medium rounded-xl hover:bg-black transition-colors",children:[c.jsx(Is,{className:"w-4 h-4"}),"新增商品"]})]})]}),u&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-start justify-center p-4 pt-8 overflow-y-auto",onClick:()=>!B&&(h(!1),Y()),children:c.jsxs("form",{onClick:H=>H.stopPropagation(),onSubmit:ao,className:"bg-white rounded-2xl shadow-2xl w-full max-w-lg p-8 space-y-5 my-8 max-h-[90vh] overflow-y-auto",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsx("h2",{className:"text-lg font-bold",children:f?"編輯商品":"新增商品"}),c.jsx("button",{type:"button",onClick:()=>{h(!1),Y()},className:"p-1 text-gray-400 hover:text-gray-600",children:c.jsx(ca,{className:"w-5 h-5"})})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"所屬分類"}),c.jsx("select",{value:j,onChange:H=>V(H.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",required:!0,children:n.map(H=>c.jsx("option",{value:H.id,children:H.title},H.id))})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"商品名稱 / 型號"}),c.jsx("input",{type:"text",value:P,onChange:H=>_(H.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"ä¾
3764‹ï¼šåž‹è™Ÿ8426",required:!0,autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5 flex items-center gap-2",children:"商品詳細規格"}),c.jsx("div",{className:"space-y-3 p-4 bg-gray-50/50 rounded-xl border border-gray-100",children:Q.map((H,se)=>c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsx("input",{type:"text",value:H.name,onChange:le=>{const ee=[...Q];ee[se].name=le.target.value,F(ee)},className:"w-2/5 px-3 py-2.5 bg-white rounded-lg border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"規格名稱 (例如: NT$)"}),c.jsx("input",{type:"text",value:H.value,onChange:le=>{const ee=[...Q];ee[se].value=le.target.value,F(ee)},className:"flex-1 px-3 py-2.5 bg-white rounded-lg border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:H.name==="規格尺寸"?"範例:全長 80cm":"對應內容"}),c.jsx("button",{type:"button",title:"移除欄位",onClick:()=>F(Q.filter((le,ee)=>ee!==se)),className:"p-2.5 text-gray-400 hover:text-red-500 transition-colors bg-white border border-gray-200 rounded-lg hover:border-red-200 hover:bg-red-50",children:c.jsx(er,{className:"w-4 h-4"})})]},se))}),Q.filter(H=>H.name==="規格尺寸").length<4&&c.jsxs("button",{type:"button",onClick:()=>F([...Q,{name:"規格尺寸",value:""}]),className:"mt-3 flex items-center justify-center gap-1.5 w-full py-2 border-2 border-dashed border-gray-200 text-blue-500 text-sm font-medium rounded-xl hover:border-blue-300 hover:text-blue-600 hover:bg-blue-50 transition-colors",children:[c.jsx(Is,{className:"w-4 h-4"})," 新增規格尺寸"]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"商品圖片(第一張為主圖)"}),c.jsx("p",{className:"mb-2 text-xs text-gray-400",children:"依目前已上傳主圖比例,建議使用正方形 1000 x 1000 px;若要更清楚可用 1200 x 1200 px。"}),c.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[M.map((H,se)=>c.jsxs("div",{className:"relative group aspect-square rounded-xl border border-gray-200/50 shadow-sm overflow-hidden bg-gray-50",children:[c.jsx("img",{src:H.preview,alt:"",className:"w-full h-full object-cover"}),se===0&&c.jsx("span",{className:"absolute top-2 left-2 bg-black/60 backdrop-blur-sm text-white text-[10px] tracking-wider px-2 py-1 rounded z-10",children:"主圖"}),c.jsx("button",{type:"button",onClick:()=>Et(se),className:"absolute top-2 right-2 w-8 h-8 bg-black/50 hover:bg-red-500 backdrop-blur-sm text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all z-10",title:"移除圖片",children:c.jsx(ca,{className:"w-4 h-4"})})]},se)),c.jsxs("label",{className:"flex flex-col items-center justify-center aspect-square border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 hover:bg-gray-50 transition-colors",children:[c.jsx(Is,{className:"w-6 h-6 text-gray-300"}),c.jsx("span",{className:"mt-1 px-2 text-center text-[10px] leading-tight text-gray-400 tracking-wider",children:"點擊上傳"}),c.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:Se,className:"hidden"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"商品介紹圖片 / 影片(顯示於規格下方)"}),c.jsx("p",{className:"mb-2 text-xs text-gray-400",children:"支援上傳圖片與影片。圖片建議使用直式長圖 1200 x 3000 px 左右;影片支援 MP4、MOV、WebM 格式,建議檔案大小不超過 50MB。"}),c.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[y.map((H,se)=>{const le=H.file?H.file.type.startsWith("video/"):H.url&&/\.(mp4|webm|mov|m4v)(\?|$)/i.test(H.url.toLowerCase());return c.jsxs("div",{className:"relative group aspect-[3/4] rounded-xl border border-gray-200/50 shadow-sm overflow-hidden bg-gray-50",children:[le?c.jsx("video",{src:H.preview,controls:!0,className:"w-full h-full object-cover"}):c.jsx("img",{src:H.preview,alt:"",className:"w-full h-full object-cover"}),c.jsx("button",{type:"button",onClick:()=>En(se),className:"absolute top-2 right-2 w-8 h-8 bg-black/50 hover:bg-red-500 backdrop-blur-sm text-white rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-all z-10",title:"移除圖片",children:c.jsx(ca,{className:"w-4 h-4"})})]},se)}),c.jsxs("label",{className:"flex flex-col items-center justify-center aspect-[3/4] border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 hover:bg-gray-50 transition-colors",children:[c.jsx(Is,{className:"w-6 h-6 text-gray-300"}),c.jsx("span",{className:"mt-1 px-2 text-center text-[10px] leading-tight text-gray-400 tracking-wider",children:"點擊上傳"}),c.jsx("input",{type:"file",accept:"image/*,video/*",multiple:!0,onChange:Vt,className:"hidden"})]})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-2",children:"備註"}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[c.jsx("button",{type:"button",onClick:()=>O("可客製化商品,請點擊右下角加入官方Line洽詢!"),className:`px-3 py-2 text-xs rounded-lg border transition-all ${U==="可客製化商品,請點擊右下角加入官方Line洽詢!"?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-600 border-gray-200 hover:border-gray-400"}`,children:"可客製化"}),c.jsx("button",{type:"button",onClick:()=>O("無法提供客製化服務"),className:`px-3 py-2 text-xs rounded-lg border transition-all ${U==="無法提供客製化服務"?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-600 border-gray-200 hover:border-gray-400"}`,children:"無法客製化"}),c.jsx("button",{type:"button",onClick:()=>{O(U!=="可客製化商品,請點擊右下角加入官方Line洽詢!"&&U!=="無法提供客製化服務"?"":" ")},className:`px-3 py-2 text-xs rounded-lg border transition-all ${U&&U!=="可客製化商品,請點擊右下角加入官方Line洽詢!"&&U!=="無法提供客製化服務"?"bg-gray-900 text-white border-gray-900":"bg-white text-gray-600 border-gray-200 hover:border-gray-400"}`,children:"自訂"}),U&&c.jsx("button",{type:"button",onClick:()=>O(""),className:"px-3 py-2 text-xs rounded-lg border border-gray-200 text-gray-400 hover:text-red-500 hover:border-red-200 transition-all",children:"清除"})]}),U&&U!=="可客製化商品,請點擊右下角加入官方Line洽詢!"&&U!=="無法提供客製化服務"&&c.jsx("input",{type:"text",value:U.trim()===""?"":U,onChange:H=>O(H.target.value||" "),className:"mt-2 w-full px-3 py-2.5 rounded-lg border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"請輸入自訂備註內容",autoFocus:!0}),U&&U.trim()&&(U==="可客製化商品,請點擊右下角加入官方Line洽詢!"||U==="無法提供客製化服務")&&c.jsx("p",{className:"mt-2 text-xs text-gray-400 bg-gray-50 px-3 py-2 rounded-lg",children:U})]}),c.jsxs("div",{className:"space-y-3 pt-1",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>R(!k),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${k?"bg-amber-500":"bg-gray-200"}
3764`,children:c.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform shadow-sm ${k?"translate-x-6":"translate-x-1"}`})}),c.jsxs("label",{className:"text-sm text-gray-600 flex items-center gap-1.5 cursor-pointer",onClick:()=>R(!k),children:[c.jsx(gc,{className:"w-4 h-4 text-amber-500"}),"標記為新品上市"]})]}),c.jsxs("div",{className:"rounded-xl border border-gray-200 bg-gray-50/70 px-4 py-3",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{type:"button",onClick:()=>v(!b),className:`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${b?"bg-gray-900":"bg-gray-200"}`,children:c.jsx("span",{className:`inline-block h-4 w-4 rounded-full bg-white transition-transform shadow-sm ${b?"translate-x-6":"translate-x-1"}`})}),c.jsxs("label",{className:"text-sm text-gray-700 flex items-center gap-1.5 cursor-pointer",onClick:()=>v(!b),children:[c.jsx(mc,{className:"w-4 h-4 text-gray-700"}),"顯示於首頁新品區塊"]})]}),c.jsxs("p",{className:"mt-2 text-xs text-gray-500",children:["首頁固定顯示 4 款,後台最多可指定 4 款。現在已選 ",hh,"/4。"]})]})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx("button",{type:"button",onClick:()=>{h(!1),Y()},disabled:B,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50",children:"取消"}),c.jsx("button",{type:"submit",disabled:B,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-gray-900 text-white hover:bg-black disabled:opacity-50 flex items-center justify-center gap-2",children:B?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"儲存中..."]}):f?"更新商品":"確認新增"})]})]})}),g&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!N&&E(null),children:c.jsxs("div",{onClick:H=>H.stopPropagation(),className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm p-8 text-center space-y-5",children:[c.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-red-50 rounded-2xl",children:c.jsx(lh,{className:"w-7 h-7 text-red-500"})}),c.jsx("h2",{className:"text-lg font-bold",children:"確認刪除商品"}),c.jsxs("p",{className:"text-sm text-gray-500",children:["確定要刪除「",g.title,"」嗎?此操作無法復原。"]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:()=>E(null),disabled:N,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50",children:"取消"}),c.jsx("button",{onClick:ul,disabled:N,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 flex items-center justify-center gap-2",children:N?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"刪除中..."]}):"確認刪除"})]})]})}),s?c.jsx("div",{className:"flex items-center justify-center py-20",children:c.jsx(Ht,{className:"w-6 h-6 animate-spin text-gray-400"})}):dr.length===0?c.jsxs("div",{className:"text-center py-20 text-gray-400",children:[c.jsx(mc,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:o==="all"?"尚無商品,請點擊「新增商品」":"此分類下尚無商品"})]}):c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:dr.map((H,se)=>{var le;return c.jsxs("div",{className:"bg-white rounded-xl border border-gray-100 shadow-sm overflow-hidden group hover:shadow-md transition-shadow",children:[c.jsxs("div",{className:"aspect-[4/3] bg-gray-50 relative overflow-hidden",children:[H.image?c.jsx("img",{src:H.image,alt:H.title,className:"w-full h-full object-cover"}):c.jsx("div",{className:"w-full h-full flex items-center justify-center",children:c.jsx(Zn,{className:"w-10 h-10 text-gray-200"})}),((le=H.images)==null?void 0:le.length)>0&&c.jsxs("span",{className:"absolute top-2 left-2 bg-black/60 text-white text-[10px] px-2 py-0.5 rounded-md",children:["+",H.images.length," 張"]}),H.isNewArrival&&c.jsxs("span",{className:"absolute top-2 right-2 bg-amber-500 text-white text-[10px] px-2 py-0.5 rounded-md flex items-center gap-1",children:[c.jsx(gc,{className:"w-3 h-3"})," NEW"]}),H.showOnHomepage&&c.jsx("span",{className:`absolute ${H.isNewArrival?"top-8 right-2":"top-2 right-2"} bg-gray-900 text-white text-[10px] px-2 py-0.5 rounded-md`,children:"首頁"})]}),c.jsxs("div",{className:"p-4",children:[c.jsx("div",{className:"text-xs text-gray-400 mb-1",children:lo(H.categoryId)}),c.jsx("div",{className:"font-medium text-sm",children:H.title}),c.jsxs("div",{className:"flex items-center gap-2 mt-3 pt-3 border-t border-gray-50",children:[o!=="all"&&c.jsxs("div",{className:"flex items-center gap-1 mr-auto bg-gray-100 rounded-lg p-0.5",children:[c.jsx("button",{onClick:()=>uh(se),className:"p-1.5 rounded-md hover:bg-white hover:shadow-sm text-gray-600 disabled:opacity-30",disabled:se===0,title:"上移",children:c.jsx(wT,{className:"w-3.5 h-3.5"})}),c.jsx("button",{onClick:()=>cl(se),className:"p-1.5 rounded-md hover:bg-white hover:shadow-sm text-gray-600 disabled:opacity-30",disabled:se===dr.length-1,title:"下移",children:c.jsx(_T,{className:"w-3.5 h-3.5"})})]}),c.jsxs("button",{onClick:()=>be(H),className:`flex items-center gap-1.5 text-xs text-gray-400 hover:text-gray-700 transition-colors ${o==="all"?"":"ml-auto"}`,children:[c.jsx(ET,{className:"w-3.5 h-3.5"})," 編輯"]}),c.jsxs("button",{onClick:()=>E(H),className:`flex items-center gap-1.5 text-xs text-gray-400 hover:text-red-500 transition-colors ${o==="all"?"ml-auto":""}`,children:[c.jsx(er,{className:"w-3.5 h-3.5"})," 刪除"]})]})]})]},H.id)})})]})}function MD(){const[t,e]=C.useState([]),[n,r]=C.useState(!0),[s,i]=C.useState(!1),[o,l]=C.useState(""),[u,h]=C.useState(null),[f,p]=C.useState(null),[g,E]=C.useState(!1),[N,A]=C.useState(null),[P,_]=C.useState(!1);C.useEffect(()=>{const M=Jn(_t(ce,"tianwei-banners"),qr("order","asc"));return yn(M,y=>{e(y.docs.map(I=>({id:I.id,...I.data()}))),r(!1)})},[]);const w=M=>{const T=M.target.files[0];T&&(h(T),p(URL.createObjectURL(T)))},S=async M=>{if(M.preventDefault(),!(!o.trim()||!u)){E(!0);try{const T=en(tn,`tianwei/banners/${Date.now()}-${u.name}`),y=await Bi(T,u),I=await zi(y.ref);await Um(_t(ce,"tianwei-banners"),{title:o.trim(),url:I,order:t.length,createdAt:An()}),l(""),h(null),p(null),i(!1)}catch(T){alert("新增失敗: "+T.message)}finally{E(!1)}}},j=async()=>
3764{if(N){_(!0);try{if(N.url&&N.url.includes("firebasestorage"))try{await Hi(en(tn,N.url))}catch{}await hc(Oe(ce,"tianwei-banners",N.id)),A(null)}catch(M){alert("刪除失敗: "+M.message)}finally{_(!1)}}},V=async(M,T)=>{const y=t[M],I=t[M+T];if(!(!y||!I))try{await Rn(Oe(ce,"tianwei-banners",y.id),{order:I.order??M+T}),await Rn(Oe(ce,"tianwei-banners",I.id),{order:y.order??M})}catch(k){console.error("排序失敗:",k)}};return c.jsxs("div",{className:"p-10 max-w-5xl mx-auto",children:[c.jsxs("div",{className:"flex items-center justify-between mb-8",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Banner 管理"}),c.jsxs("button",{onClick:()=>i(!0),className:"flex items-center gap-2 px-5 py-2.5 bg-gray-900 text-white text-sm font-medium rounded-xl hover:bg-black transition-colors",children:[c.jsx(Is,{className:"w-4 h-4"}),"新增 Banner"]})]}),s&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!g&&i(!1),children:c.jsxs("form",{onClick:M=>M.stopPropagation(),onSubmit:S,className:"bg-white rounded-2xl shadow-2xl w-full max-w-md p-8 space-y-5",children:[c.jsx("h2",{className:"text-lg font-bold",children:"新增 Banner"}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"標題文字"}),c.jsx("input",{type:"text",value:o,onChange:M=>l(M.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"例:打造專屬您的完美空間",required:!0,autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"Banner 圖片"}),f?c.jsxs("div",{className:"relative group",children:[c.jsx("img",{src:f,alt:"preview",className:"w-full h-48 object-cover rounded-xl"}),c.jsx("button",{type:"button",onClick:()=>{h(null),p(null)},className:"absolute top-2 right-2 bg-black/60 text-white p-1.5 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(er,{className:"w-4 h-4"})})]}):c.jsxs("label",{className:"flex flex-col items-center justify-center h-48 border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 transition-colors",children:[c.jsx(Zn,{className:"w-8 h-8 text-gray-300 mb-2"}),c.jsx("span",{className:"text-xs text-gray-400",children:"點擊上傳圖片(建議 1920×800)"}),c.jsx("input",{type:"file",accept:"image/*",onChange:w,className:"hidden"})]})]}),c.jsxs("div",{className:"flex gap-3 pt-2",children:[c.jsx("button",{type:"button",onClick:()=>i(!1),disabled:g,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50 transition-colors",children:"取消"}),c.jsx("button",{type:"submit",disabled:g||!u,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-gray-900 text-white hover:bg-black transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:g?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"上傳中..."]}):"確認新增"})]})]})}),N&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!P&&A(null),children:c.jsxs("div",{onClick:M=>M.stopPropagation(),className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm p-8 text-center space-y-5",children:[c.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-red-50 rounded-2xl",children:c.jsx(lh,{className:"w-7 h-7 text-red-500"})}),c.jsx("h2",{className:"text-lg font-bold",children:"確認刪除"}),c.jsxs("p",{className:"text-sm text-gray-500",children:["確定要刪除「",N.title,"」Banner 嗎?此操作無法復原。"]}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:()=>A(null),disabled:P,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-500 hover:bg-gray-50",children:"取消"}),c.jsx("button",{onClick:j,disabled:P,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 flex items-center justify-center gap-2",children:P?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"刪除中..."]}):"確認刪除"})]})]})}),n?c.jsx("div",{className:"flex items-center justify-center py-20",children:c.jsx(Ht,{className:"w-6 h-6 animate-spin text-gray-400"})}):t.length===0?c.jsxs("div",{className:"text-center py-20 text-gray-400",children:[c.jsx(Zn,{className:"w-12 h-12 mx-auto mb-3 opacity-30"}),c.jsx("p",{className:"text-sm",children:"尚無 Banner,請點擊「新增 Banner」"})]}):c.jsx("div",{className:"space-y-4",children:t.map((M,T)=>c.jsxs("div",{className:"bg-white rounded-2xl border border-gray-100 shadow-sm overflow-hidden flex items-center gap-4 pr-4",children:[c.jsx("img",{src:M.url,alt:M.title,className:"w-40 h-24 md:w-56 md:h-32 object-cover shrink-0"}),c.jsxs("div",{className:"flex-1 min-w-0 py-3",children:[c.jsx("div",{className:"font-medium text-sm truncate",children:M.title}),c.jsxs("div",{className:"text-xs text-gray-400 mt-1",children:["排序:",T+1]})]}),c.jsxs("div",{className:"flex flex-col gap-1",children:[c.jsx("button",{onClick:()=>V(T,-1),disabled:T===0,className:"p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-20 transition-colors rounded-lg hover:bg-gray-50",title:"上移",children:c.jsx(xT,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>V(T,1),disabled:T===t.length-1,className:"p-1.5 text-gray-400 hover:text-gray-700 disabled:opacity-20 transition-colors rounded-lg hover:bg-gray-50",title:"下移",children:c.jsx(Qm,{className:"w-4 h-4"})})]}),c.jsx("button",{onClick:()=>A(M),className:"text-gray-400 hover:text-red-500 transition-colors p-2 rounded-lg hover:bg-red-50",children:c.jsx(er,{className:"w-4 h-4"})})]},M.id))})]})}const Ql=[{id:"fabricColors",title:"布面顏色",shape:"circle"},{id:"fabricMaterials",title:"布料材質",shape:"rounded"},{id:"legStyles",title:"腳架款式",shape:"rounded"}],Gv={fabricColors:{thumb:"依目前已上傳圖片比例,建議使用橫式紋理圖 200 x 109 px;若要更清楚可用 400 x 218 px。",thumbUpload:"點擊上傳(
3764建議 200 x 109 或 400 x 218)",preview:"依目前已上傳圖片比例,建議使用橫式視覺圖 1200 x 654 px。",previewUpload:"點擊上傳(建議橫式 1200 x 654)"},fabricMaterials:{thumb:"依目前已上傳圖片比例,建議使用橫式紋理圖 200 x 109 px;若要更清楚可用 400 x 218 px。",thumbUpload:"點擊上傳(建議 200 x 109 或 400 x 218)",preview:"依目前已上傳圖片比例,建議使用橫式視覺圖 1200 x 654 px。",previewUpload:"點擊上傳(建議橫式 1200 x 654)"},legStyles:{thumb:"依目前已上傳圖片比例,建議使用正方形 640 x 640 px;最低可用 200 x 200 px。",thumbUpload:"點擊上傳(建議正方形 640 x 640)",preview:"依目前已上傳圖片,建議預覽圖以正方形 640 x 640 px 為主;若是示意圖,也可用 600 x 800 px。",previewUpload:"點擊上傳(建議 640 x 640;示意圖可 600 x 800)"}};function Kv(t,e){return new Promise(n=>{const r=new FileReader;r.onload=s=>{const i=new Image;i.onload=()=>{const o=document.createElement("canvas"),l=Math.min(e/i.width,1);o.width=i.width*l,o.height=i.height*l,o.getContext("2d").drawImage(i,0,0,o.width,o.height),o.toBlob(h=>n(h),"image/webp",.85)},i.src=s.target.result}
3764,r.readAsDataURL(t)})}function FD(){var U;const[t,e]=C.useState({}),[n,r]=C.useState(!0),[s,i]=C.useState(null),[o,l]=C.useState(null),[u,h]=C.useState(""),[f,p]=C.useState(null),[g,E]=C.useState(null),[N,A]=C.useState(null),[P,_]=C.useState(null),[w,S]=C.useState(!1),[j,V]=C.useState(null),[M,T]=C.useState(!1),y=Gv[s]||Gv.fabricColors;C.useEffect(()=>yn(_t(ce,"tianwei-customization"),G=>{const Q={};G.docs.forEach(F=>{Q[F.id]={id:F.id,...F.data()}}),e(Q),r(!1)}),[]);const I=()=>{i(null),l(null),h(""),p(null),E(null),A(null),_(null)},k=(O,G,Q)=>{l({catId:O,idx:G,...Q}),i(O),h(Q.name),A(Q.thumb),_(Q.preview),p(null),E(null)},R=async O=>{var G;if(O.preventDefault(),!!u.trim()){if(!o&&!f){alert("請選擇縮圖");return}S(!0);try{const Q=s,F=Date.now();let B=(o==null?void 0:o.thumb)||"",W=(o==null?void 0:o.preview)||"";if(f){const be=await Kv(f,200),Se=en(tn,`tianwei/customization/${Q}/thumb-${F}.webp`),Et=await Bi(Se,be);B=await zi(Et.ref)}if(g){const be=await Kv(g,1200),Se=en(tn,`tianwei/customization/${Q}/preview-${F}.webp`),Et=await Bi(Se,be);W=await zi(Et.ref)}else!W&&B&&(W=B);const Y=[...((G=t[Q])==null?void 0:G.options)||[]],oe=Ql.find(be=>be.id===Q);o?Y[o.idx]={...Y[o.idx],name:u.trim(),thumb:B,preview:W}:Y.push({name:u.trim(),thumb:B,preview:W,order:Y.length}),await Gr(Oe(ce,"tianwei-customization",Q),{title:oe.title,order:Ql.indexOf(oe),displayStyle:oe.shape,options:Y},{merge:!0}),I()}catch(Q){alert("儲存失敗: "+Q.message)}finally{S(!1)}}},b=async()=>{var O,G,Q;if(j){T(!0);try{const{catId:F,idx:B}=j,W=[...((O=t[F])==null?void 0:O.options)||[]],Y=W.splice(B,1)[0];if((G=Y==null?void 0:Y.thumb)!=null&&G.includes("firebasestorage"))try{await Hi(en(tn,Y.thumb))}catch{}if((Q=Y==null?void 0:Y.preview)!=null&&Q.includes("firebasestorage")&&Y.preview!==Y.thumb)try{await Hi(en(tn,Y.preview))}catch{}await Gr(Oe(ce,"tianwei-customization",F),{options:W},{merge:!0}),V(null)}catch(F){alert("刪除失敗: "+F.message)}finally{T(!1)}}},v=async(O,G,Q)=>{var W;const F=[...((W=t[O])==null?void 0:W.options)||[]],B=G+Q;B<0||B>=F.length||([F[G],F[B]]=[F[B],F[G]],F.forEach((Y,oe)=>Y.order=oe),await Gr(Oe(ce,"tianwei-customization",O),{options:F},{merge:!0}))};return n?c.jsx("div",{className:"flex items-center justify-center py-20",children:c.jsx(Ht,{className:"w-6 h-6 animate-spin text-gray-400"})}):c.jsxs("div",{className:"p-10 max-w-5xl mx-auto",children:[c.jsxs("div",{className:"mb-8",children:[c.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"客製化選項管理"}),c.jsx("p",{className:"text-sm text-gray-400 mt-1",children:"管理前台客製化頁面的布面顏色、布料材質、腳架款式選項"})]}),Ql.map(O=>{const G=t[O.id],Q=(G==null?void 0:G.options)||[];return c.jsxs("div",{className:"mb-10",children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsxs("h2",{className:"text-lg font-semibold tracking-wide",children:[O.title,c.jsxs("span",{className:"text-sm text-gray-400 font-normal ml-2",children:["(",Q.length," 個選項)"]})]}),c.jsxs("button",{onClick:()=>i(O.id),className:"flex items-center gap-1.5 px-4 py-2 bg-gray-900 text-white text-xs font-medium rounded-lg hover:bg-black transition-colors",children:[c.jsx(Is,{className:"w-3.5 h-3.5"}),"新增"]})]}),Q.length===0?c.jsxs("div",{className:"text-center py-12 border-2 border-dashed border-gray-200 rounded-2xl text-gray-400",children:[c.jsx(Zn,{className:"w-10 h-10 mx-auto mb-2 opacity-30"}),c.jsx("p",{className:"text-sm",children:"尚無選項,請點擊「新增」"})]}):c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-4",children:Q.sort((F,B)=>(F.order??0)-(B.order??0)).map((F,B)=>c.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden group relative flex flex-col",children:[c.jsxs("div",{className:`aspect-square bg-gray-50 flex items-center justify-center relative ${O.shape==="circle"?"p-3":""}`,children:[c.jsx("img",{src:F.thumb||F.preview,alt:"",className:`w-full h-full object-cover text-transparent ${O.shape==="circle"?"rounded-full":""}`}),c.jsxs("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors flex flex-wrap content-center justify-center gap-1.5 opacity-0 group-hover:opacity-100 p-2",children:[c.jsx("button",{onClick:()=>v(O.id,B,-1),disabled:B===0,className:"w-8 h-8 flex items-center justify-center bg-white rounded-lg text-gray-600 hover:text-gray-900 disabled:opacity-30 shadow-sm",title:"往前移動",children:c.jsx(xT,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>v(O.id,B,1),disabled:B===Q.length-1,className:"w-8 h-8 flex items-center justify-center bg-white rounded-lg text-gray-600 hover:text-gray-900 disabled:opacity-30 shadow-sm",title:"往後移動",children:c.jsx(Qm,{className:"w-4 h-4"})}),c.jsx("button",{onClick:()=>k(O.id,B,F),className:"w-8 h-8 flex items-center justify-center bg-white rounded-lg text-blue-600 hover:text-blue-800 shadow-sm",title:"編輯選項",children:c.jsx(oD,{className:"w-3.5 h-3.5"})}),c.jsx("button",{onClick:()=>V({catId:O.id,idx:B,name:F.name}),className:"w-8 h-8 flex items-center justify-center bg-white rounded-lg text-red-500 hover:text-red-700 shadow-sm",title:"刪除選項",children:c.jsx(er,{className:"w-4 h-4"})})]})]}),c.jsx("div",{className:"p-2.5 text-center flex-1 flex flex-col justify-center",children:c.jsx("span",{className:"text-xs font-medium text-gray-700",children:F.name})})]},B))})]},O.id)}),s&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",onClick:()=>!w&&I(),children:c.jsxs("form",{onClick:O=>O.stopPropagation(),onSubmit:R,className:"bg-white rounded-2xl shadow-2xl w-full max-w-md p-8 space-y-5 my-auto max-h-[90vh] overflow-y-auto",children:[c.jsxs("h2",{className:"text-lg font-bold",children:[o?"編輯":"新增"," ",(U=Ql.find(O=>O.id===s))==null?void 0:U.title," 選項"]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"選項名稱"}),c.jsx("input",{type:"text",value:u,onChange:O=>h(O.target.value),className:"w-full px-4 py-3 rounded-xl border border-gray-200 text-sm focus:outline-none focus:ring-2 focus:ring-gray-900",placeholder:"ä¾
3764‹ï¼šæ·±ç°ã€äºžéº»ã€é»‘色鐵腳",required:!0,autoFocus:!0})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"縮圖(小圖,顯示在選項列)"}),c.jsx("p",{className:"mb-2 text-xs text-gray-400",children:y.thumb}),N?c.jsxs("div",{className:"relative group inline-block",children:[c.jsx("img",{src:N,alt:"thumb",className:"w-24 h-24 object-cover rounded-xl border border-gray-200"}),c.jsx("button",{type:"button",onClick:()=>{p(null),A(null),o&&(o.thumb=null)},className:"absolute top-1.5 right-1.5 w-7 h-7 flex items-center justify-center bg-white/90 text-red-500 rounded-full shadow-sm backdrop-blur-sm hover:bg-red-50 transition-colors",children:c.jsx(er,{className:"w-3.5 h-3.5"})})]}):c.jsxs("label",{className:"flex flex-col items-center justify-center h-24 border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 transition-colors bg-gray-50",children:[c.jsx(Zn,{className:"w-6 h-6 text-gray-300 mb-1"}),c.jsx("span",{className:"text-xs text-gray-400",children:y.thumbUpload}),c.jsx("input",{type:"file",accept:"image/*",onChange:O=>{const G=O.target.files[0];G&&(p(G),A(URL.createObjectURL(G)))},className:"hidden"})]})]}),c.jsxs("div",{children:[c.jsx("label",{className:"block text-xs font-medium text-gray-500 mb-1.5",children:"預覽大圖(選填,客製化時的視覺圖)"}),c.jsx("p",{className:"mb-2 text-xs text-gray-400",children:y.preview}),P?c.jsxs("div",{className:"relative group",children:[c.jsx("img",{src:P,alt:"preview",className:"w-full h-40 object-cover rounded-xl border border-gray-200"}),c.jsx("button",{type:"button",onClick:()=>{E(null),_(null),o&&(o.preview=null)},className:"absolute top-2 right-2 w-8 h-8 flex items-center justify-center bg-white/90 text-red-500 rounded-full shadow-sm backdrop-blur-sm hover:bg-red-50 transition-colors",title:"移除預覽大圖",children:c.jsx(er,{className:"w-4 h-4"})})]}):c.jsxs("label",{className:"flex flex-col items-center justify-center h-32 border-2 border-dashed border-gray-200 rounded-xl cursor-pointer hover:border-gray-400 transition-colors bg-gray-50",children:[c.jsx(Zn,{className:"w-6 h-6 text-gray-300 mb-1"}),c.jsx("span",{className:"text-xs text-gray-400",children:y.previewUpload}),c.jsx("input",{type:"file",accept:"image/*",onChange:O=>{const G=O.target.files[0];G&&(E(G),_(URL.createObjectURL(G)))},className:"hidden"})]})]}),c.jsxs("div",{className:"flex gap-3 pt-4 border-t border-gray-100",children:[c.jsx("button",{type:"button",onClick:I,disabled:w,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-600 hover:bg-gray-50 transition-colors",children:"取消"}),c.jsx("button",{type:"submit",disabled:w||!o&&!N,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-gray-900 text-white hover:bg-black transition-colors disabled:opacity-50 flex items-center justify-center gap-2",children:w?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"儲存中..."]}):"確認儲存"})]})]})}),j&&c.jsx("div",{className:"fixed inset-0 bg-black/40 backdrop-blur-sm z-50 flex items-center justify-center p-4",onClick:()=>!M&&V(null),children:c.jsxs("div",{onClick:O=>O.stopPropagation(),className:"bg-white rounded-2xl shadow-2xl w-full max-w-sm p-8 text-center space-y-5",children:[c.jsx("div",{className:"inline-flex items-center justify-center w-14 h-14 bg-red-50 rounded-2xl",children:c.jsx(lh,{className:"w-7 h-7 text-red-500"})}),c.jsx("h2",{className:"text-lg font-bold",children:"確認刪除"}),c.jsxs("p",{className:"text-sm text-gray-500",children:["確定要刪除「",j.name,"」嗎?此操作無法復原。"]}),c.jsxs("div",{className:"flex gap-3 mt-2",children:[c.jsx("button",{onClick:()=>V(null),disabled:M,className:"flex-1 py-3 text-sm font-medium rounded-xl border border-gray-200 text-gray-600 hover:bg-gray-50",children:"取消"}),c.jsx("button",{onClick:b,disabled:M,className:"flex-1 py-3 text-sm font-medium rounded-xl bg-red-600 text-white hover:bg-red-700 disabled:opacity-50 flex items-center justify-center gap-2",children:M?c.jsxs(c.Fragment,{children:[c.jsx(Ht,{className:"w-4 h-4 animate-spin"}),"刪除中..."]}):"確認刪除"})]})]})})]})}const UD=!1;function $D(){var i;const{company:t}=Ji(),e=os(),n=Wi(),r=`https://line.me/R/ti/p/${((i=t==null?void 0:t.contact)==null?void 0:i.lineId)||"@zta7959m"}`,s=[{icon:ol,title:"訂購方式",desc:"請加入官方Line或致電04-25320436~8洽詢,商品完成付款後,請提供帳號後五碼查詢,並提供寄送相關資訊(例如:姓名、電話、地址⋯寄送注意事項)。"},{icon:sl,title:"付款方式",desc:"支援銀行匯款、網銀轉帳、貨到付款,歡迎來電洽詢。"},{icon:al,title:"運送方式",desc:"配合專業物流車隊,全省皆可配送(偏遠地區/外島除外),配送時程依地區不同約需3-7個工作天。"},{icon:il,title:"退貨方式",desc:"收到商品鑒賞期7天內如有瑕疵可申請退換貨,請保持原包裝完整,若非品質瑕疵問題鑒賞期間內退貨,需酌收物流處理費於退費中扣除,退款將於收到商品後約3~5天退回您的指定帳戶,請注意客製化商品恕不退換。"}
3764,{icon:ll,title:"客製化服務",desc:null}];return c.jsxs("div",{className:"page-enter py-8 md:py-16 max-w-3xl mx-auto px-4 sm:px-6 lg:px-8",children:[c.jsxs("div",{className:"flex items-center gap-4 mb-10 pb-6 border-b border-gray-100",children:[c.jsx("button",{onClick:()=>e(-1),className:"p-2 -ml-2 text-gray-400 hover:text-gray-900 transition-colors rounded-full hover:bg-gray-100",children:c.jsx(oo,{className:"w-5 h-5"})}),c.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-widest text-gray-900",style:{fontFamily:"'Georgia', serif"},children:"訂購相關說明"})]}),c.jsx("div",{className:"space-y-5 md:space-y-6",ref:n,children:s.map((o,l)=>c.jsxs("div",{className:"scroll-reveal flex gap-4 md:gap-6 items-start p-5 md:p-8 rounded-2xl bg-white border border-gray-100 shadow-sm hover:shadow-md transition-shadow",children:[c.jsx("div",{className:"w-12 h-12 md:w-14 md:h-14 rounded-2xl bg-gray-50 flex items-center justify-center shrink-0 border border-gray-100",children:c.jsx(o.icon,{className:"w-6 h-6 md:w-7 md:h-7 text-gray-600",strokeWidth:1.5})}),c.jsxs("div",{className:"pt-1",children:[c.jsx("h2",{className:"text-lg md:text-xl font-bold text-gray-900 mb-2 md:mb-3 tracking-wide",children:o.title}),c.jsx("p",{className:"text-sm md:text-[15px] text-gray-600 leading-[1.8] md:leading-[2] tracking-wide",children:o.desc||c.jsxs(c.Fragment,{children:["提供尺寸、材質、顏色客製化服務,歡迎",c.jsx("a",{href:r,target:"_blank",rel:"noopener noreferrer",className:"text-[#06C755] font-semibold hover:underline",children:"加入 LINE"}
3764)," ","與我們討論您的需求。"]})})]})]},l))}),UD,c.jsx("div",{className:"mt-12 text-center pb-8",children:c.jsxs("p",{className:"text-gray-400 text-sm tracking-widest leading-relaxed",children:["如有任何疑問,歡迎隨時與我們聯繫。",c.jsx("br",{}),"TenWells Team"]})})]})}const Yl=["fabricColors","fabricMaterials","legStyles"],Qv={fabricColors:{title:"布面顏色",shape:"circle"},fabricMaterials:{title:"布料材質",shape:"rounded"},legStyles:{title:"腳架款式",shape:"rounded"}};function BD(){var y,I,k,R,b,v,U;const{company:t}=Ji(),e=os(),[n,r]=C.useState({}),[s,i]=C.useState(null),[o,l]=C.useState(!0),[u,h]=C.useState(0),f=C.useRef(null),p=C.useRef({startX:null,endX:null,isMultiTouch:!1});C.useEffect(()=>{const O=Yl.map(G=>{const Q=_t(ce,"tianwei-customization");return yn(Jn(Q,qr("order","asc")),F=>{const B={};F.docs.forEach(W=>{const Y=W.data();Y.options&&Y.options.sort((oe,be)=>(oe.order??0)-(be.order??0)),B[W.id]={id:W.id,...Y}}),r(W=>({...W,...B})),l(!1)},()=>l(!1))});return()=>O.forEach(G=>G())},[]),C.useEffect(()=>{var O;if(!o&&!s)for(const G of Yl){const Q=n[G];if(((O=Q==null?void 0:Q.options)==null?void 0:O.length)>0){i({catId:G,idx:0});return}}},[n,o,s]);const g=(O,G)=>{var Q;if(i({catId:O,idx:G}),h(F=>F+1),f.current){const F=f.current.querySelector(".relative")||f.current,B=((Q=document.querySelector("header"))==null?void 0:Q.offsetHeight)||80,W=F.getBoundingClientRect(),Y=W.top+window.pageYOffset,oe=W.height,be=window.innerHeight;let Se=Y-B-(be-B-oe)/2;oe>be-B-40&&(Se=Y-B-20),window.scrollTo({top:Math.max(0,Se),behavior:"smooth"})}},E=O=>{var Y;if(!s)return;const{catId:G,idx:Q}=s,F=n[G];if(!((Y=F==null?void 0:F.options)!=null&&Y.length))return;const B=F.options.length;let W=Q+O;W<0&&(W=B-1),W>=B&&(W=0),g(G,W)},N=O=>{if(O.touches.length!==1){p.current={startX:null,endX:null,isMultiTouch:!0};return}p.current={startX:O.touches[0].clientX,endX:null,isMultiTouch:!1}},A=O=>{if(O.touches.length!==1){p.current.isMultiTouch=!0,p.current.endX=null;return}p.current.isMultiTouch||(p.current.endX=O.touches[0].clientX)},P=()=>{const{startX:O,endX:G,isMultiTouch:Q}=p.current;if(p.current={startX:null,endX:null,isMultiTouch:!1},Q||O===null||G===null)return;const F=O-G,B=50;F>B?E(1):F<-B&&E(-1)},_=s&&((k=(I=(y=n[s.catId])==null?void 0:y.options)==null?void 0:I[s.idx])!=null&&k.preview)?n[s.catId].options[s.idx].preview:null,w=s&&((v=(b=(R=n[s.catId])==null?void 0:R.options)==null?void 0:b[s.idx])!=null&&v.name)?n[s.catId].options[s.idx].name:"",S=s?Qv[s.catId].title:"",j=((U=t==null?void 0:t.contact)==null?void 0:U.lineId)||"@zta7959m",V=w?encodeURIComponent(`我想諮詢客製化項目:${S} - ${w}`):"",M=`https://line.me/R/ti/p/${j}${V?`?text=${V}`:""}`;if(o)return c.jsx("div",{className:"page-enter py-8 md:py-16 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:c.jsxs("div",{className:"animate-pulse grid grid-cols-1 lg:grid-cols-[1fr_400px] gap-8",children:[c.jsx("div",{className:"aspect-[3/2] w-full max-w-[320px] md:max-w-[400px] mx-auto bg-gray-100 rounded-3xl"}),c.jsxs("div",{className:"space-y-12",children:[c.jsx("div",{className:"h-8 w-40 bg-gray-200 rounded-lg mb-8"}),c.jsx("div",{className:"flex gap-4",children:[...Array(4)].map((O,G)=>c.jsx("div",{className:"w-16 h-16 rounded-full bg-gray-100"},G))}),c.jsx("div",{className:"flex gap-4",children:[...Array(4)].map((O,G)=>c.jsx("div",{className:"w-16 h-16 rounded-xl bg-gray-100"},G))})]})]})});const T=Yl.some(O=>{var G,Q;return((Q=(G=n[O])==null?void 0:G.options)==null?void 0:Q.length)>0});return c.jsxs("div",{className:"page-enter pb-16 max-w-7xl mx-auto xl:px-8",children:[c.jsxs("div",{className:"flex flex-col gap-4 mb-8 pb-6 border-b border-gray-100 px-4 md:px-0 mt-4 md:mt-0",children:[c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("button",{onClick:()=>e(-1),className:"p-2 -ml-2 text-gray-400 hover:text-gray-900 transition-colors rounded-full hover:bg-gray-100",children:c.jsx(oo,{className:"w-5 h-5"})}),c.jsx("h1",{className:"text-2xl md:text-3xl font-bold tracking-widest text-gray-900",style:{fontFamily:"'Georgia', serif"},children:"客製化服務"})]}),c.jsxs("div",{className:"bg-amber-50 rounded-lg p-3 md:p-4 text-amber-800 text-sm tracking-wide shadow-sm border border-amber-100/50 flex gap-3 items-start",children:[c.jsx("div",{className:"mt-0.5",children:c.jsx("svg",{className:"w-4 h-4 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:c.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})})}),c.jsxs("p",{className:"leading-relaxed",children:["訂購客製化商品需加收材質與工本費用,收費價格請",c.jsx("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:"font-bold underline underline-offset-2 mx-1 hover:text-amber-900 text-amber-700",children:"加入官方Line"}),"洽詢。"]})]})]}),T?c.jsx("div",{className:"flex flex-col items-center gap-10 lg:gap-16 px-4 md:px-0 max-w-4xl mx-auto w-full",children:c.jsxs("div",{className:"w-full flex flex-col items-center",ref:f,children:[_&&c.jsx("div",{className:"relative w-full md:w-5/6 lg:w-4/5 xl
3764:w-[800px] transition-all duration-300",children:c.jsxs("div",{className:"relative overflow-hidden bg-[#F7F7F7] rounded-3xl mb-6 shadow-sm border border-gray-100 group select-none cursor-grab active:cursor-grabbing flex items-center justify-center",onTouchStart:N,onTouchMove:A,onTouchEnd:P,style:{touchAction:"auto"},children:[c.jsx("img",{src:_,alt:"客製化預覽",className:"w-auto h-auto max-w-full max-h-[70vh] object-contain mix-blend-multiply transition-transform duration-700 ease-out animate-fadeIn mx-auto",draggable:!1},u),c.jsx("button",{onClick:O=>{O.stopPropagation(),E(-1)},className:"absolute left-2 top-1/2 -translate-y-1/2 w-7 h-7 md:w-8 md:h-8 bg-white/90 hover:bg-white backdrop-blur-md text-gray-700 shadow-md rounded-full flex items-center justify-center transition-all opacity-80 hover:opacity-100 focus:opacity-100 hover:scale-105 active:scale-95","aria-label":"上一張",children:c.jsx(fc,{className:"w-4 h-4"})}),c.jsx("button",{onClick:O=>{O.stopPropagation(),E(1)},className:"absolute right-2 top-1/2 -translate-y-1/2 w-7 h-7 md:w-8 md:h-8 bg-white/90 hover:bg-white backdrop-blur-md text-gray-700 shadow-md rounded-full flex items-center justify-center transition-all opacity-80 hover:opacity-100 focus:opacity-100 hover:scale-105 active:scale-95","aria-label":"下一張",children:c.jsx(pc,{className:"w-4 h-4"})})]})}),c.jsxs("div",{className:"text-center mt-6 lg:mt-8 animate-fadeIn flex flex-col items-center",children:[c.jsx("span",{className:"inline-flex items-center px-4 py-1.5 rounded-full bg-gray-50 border border-gray-100/50 shadow-sm text-gray-500 text-xs font-medium tracking-widest uppercase mb-4 transition-all hover:bg-gray-100 cursor-default",children:S}),c.jsx("h2",{className:"text-3xl font-medium text-gray-900 drop-shadow-sm",style:{fontFamily:"'Georgia', serif"},children:w})]}),c.jsx("div",{className:"w-full flex flex-col gap-10 md:gap-12 mt-6 lg:mt-8 border-t border-gray-100 pt-8 lg:pt-12",children:Yl.map(O=>{var F;const G=n[O];if(!((F=G==null?void 0:G.options)!=null&&F.length))return null;const Q=Qv[O];return c.jsxs("div",{className:"flex flex-col",children:[c.jsxs("div",{className:"flex items-center justify-between mb-6 pb-2 border-b border-gray-50",children:[c.jsx("h3",{className:"text-[15px] font-bold text-gray-900 tracking-widest uppercase",children:Q.title}),c.jsxs("span",{className:"text-xs text-gray-400 font-medium px-2 py-1 bg-gray-50 rounded-md border border-gray-100",children:[G.options.length," 款可選"]})]}),c.jsx("div",{className:"grid grid-cols-5 sm:grid-cols-6 md:grid-cols-8 lg:grid-cols-8 gap-3 sm:gap-4",children:G.options.map((B,W)=>{const Y=(s==null?void 0:s.catId)===O&&(s==null?void 0:s.idx)===W;let oe="rounded-xl";return Q.shape==="circle"&&(oe="rounded-full"),c.jsxs("button",{onClick:()=>g(O,W),className:`group flex flex-col items-center gap-2.5 transition-all duration-300 ${Y?"scale-105":"opacity-70 hover:opacity-100 hover:scale-100"}`,children:[c.jsx("div",{className:`relative w-full aspect-square overflow-hidden bg-gray-50 flex items-center justify-center ${oe} ${Y?"ring-2 ring-gray-900 ring-offset-4 shadow-md":"ring-1 ring-gray-200 group-hover:ring-gray-300"} transition-all duration-300`,children:c.jsx("img",{src:(B==null?void 0:B.thumb)||(B==null?void 0:B.preview)||"",alt:(B==null?void 0:B.name)||"Option",className:`w-full h-full ${O==="legStyles"?"object-contain p-2 mix-blend-multiply":"object-cover"}`})}),c.jsx("span",{className:`text-[11px] leading-tight font-medium text-center transition-colors ${Y?"text-gray-900 font-bold":"text-gray-500"}`,children:(B==null?void 0:B.name)||""})]},W)})})]},O)})}),c.jsx("div",{className:"w-full max-w-sm mx-auto mt-12 mb-8",children:c.jsxs("a",{href:M,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-center gap-3 w-full bg-[#06C755] text-white font-bold py-4 rounded-2xl hover:bg-[#05a64a] active:scale-[0.98] transition-all text-[15px] tracking-wide shadow-xl shadow-[#06C755]/20",children:[c.jsxs("svg",{viewBox:"0 0 120 120",className:"w-6 h-6",xmlns:"http://www.w3.org/2000/svg",children:[c.jsx("path",{d:"M60 15C33.5 15 12 32.3 12 53.5c0 19 16.8 34.9 39.5 37.9 1.5.3 3.6 1 4.1 2.4.5 1.2.3 3.1.2 4.3 0 0-.6 3.3-.7 4-.2 1.2
3764-1 5.2 4.6 2.8 5.5-2.3 30-17.6 40.9-30.2h0C108.5 66 108 58.5 108 53.5 108 32.3 86.5 15 60 15z",fill:"white"}),c.jsx("text",{x:"60",y:"62",textAnchor:"middle",fontFamily:"Arial",fontWeight:"900",fontSize:"28",fill:"#06C755",letterSpacing:"1",children:"LINE"})]}),"諮詢此款型 (",w,")"]})})]})}):c.jsx("div",{className:"text-center py-20 text-gray-400",children:c.jsx("p",{className:"text-sm border border-gray-200 inline-block px-8 py-4 rounded-full",children:"客製化選項尚未設定,敬請期待"})})]})}function zD(){const{pathname:t}=ln();return C.useLayoutEffect(()=>{document.documentElement.style.scrollBehavior="auto",window.scrollTo(0,0),requestAnimationFrame(()=>{document.documentElement.style.scrollBehavior=""})},[t]),null}function HD({children:t}){const{user:e,isAdmin:n,loading:r}=Km();return r?c.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-50",children:c.jsx("div",{className:"w-6 h-6 border-2 border-gray-300 border-t-gray-800 rounded-full animate-spin"})}):e&&n?t:c.jsx(Tx,{to:"/admin/login",replace:!0})}function WD(){return c.jsxs(_2,{children:[c.jsxs(ot,{path:"/",element:c.jsx(TD,{}),children:[c.jsx(ot,{index:!0,element:c.jsx(SD,{})}),c.jsx(ot,{path:"new-arrivals",element:c.jsx(AD,{})}),c.jsx(ot,{path:"shipping-info",element:c.jsx($D,{})}),c.jsx(ot,{path:"about",element:c.jsx(PD,{})}),c.jsx(ot,{path:"customization",element:c.jsx(BD,{})}),c.jsx(ot,{path:"category/:id",element:c.jsx(kD,{})}),c.jsx(ot,{path:"category/:id/product/:productId",element:c.jsx(ND,{})})]}),c.jsx(ot,{path:"/admin/login",element:c.jsx(jD,{})}),c.jsxs(ot,{path:"/admin",element:c.jsx(HD,{children:c.jsx(ID,{})}),children:[c.jsx(ot,{index:!0,element:c.jsx(OD,{})}),c.jsx(ot,{path:"categories",element:c.jsx(LD,{})}),c.jsx(ot,{path:"items",element:c.jsx(VD,{})}),c.jsx(ot,{path:"banners",element:c.jsx(MD,{})}),c.jsx(ot,{path:"customization",element:c.jsx(FD,{})})]}),c.jsx(ot,{path:"*",element:c.jsx(Tx,{to:"/",replace:!0})})]})}function qD(){return c.jsx(C5,{children:c.jsxs(z2,{children:[c.jsx(zD,{}),c.jsx(WD,{})]})})}wd.createRoot(document.getElementById("root")).render(c.jsx(cI.StrictMode,{children:c.jsx(qD,{})}));

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.