PageSourceSearch

https://dash.fashiolabs.com/assets/index-5351M2Sx.js

js fashiolabs.com collected 2026-09-24 13:57:56 UTC 1,384,426 bytes, 5,436 lines download raw bytes

1(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))s(a);new MutationObserver(a=>{for(const c of a)if(c.type==="childList")for(const u of c.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&s(u)}).observe(document,{childList:!0,subtree:!0});function n(a){const c={};return a.integrity&&(c.integrity=a.integrity),a.referrerPolicy&&(c.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?c.credentials="include":a.crossOrigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function s(a){if(a.ep)return;a.ep=!0;const c=n(a);fetch(a.href,c)}})();function uS(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var cb={exports:{}},fd={};/**
2 * @license React
3 * react-jsx-runtime.production.js
4 *
5 * Copyright (c) Meta Platforms, Inc. and 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 IE;function KI(){if(IE)return fd;IE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(s,a,c){var u=null;if(c!==void 0&&(u=""+c),a.key!==void 0&&(u=""+a.key),"key"in a){c={};for(var h in a)h!=="key"&&(c[h]=a[h])}else c=a;return a=c.ref,{$$typeof:t,type:s,key:u,ref:a!==void 0?a:null,props:c}}return fd.Fragment=e,fd.jsx=n,fd.jsxs=n,fd}var ME;function $I(){return ME||(ME=1,cb.exports=KI()),cb.exports}var o=$I(),ub={exports:{}},Ze={};/**
10 * @license React
11 * react.production.js
12 *
13 * Copyright (c) Meta Platforms, Inc. and 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 PE;function qI(){if(PE)return Ze;PE=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),c=Symbol.for("react.consumer"),u=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),b=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),w=Symbol.iterator;function T(O){return O===null||typeof O!="object"?null:(O=w&&O[w]||O["@@iterator"],typeof O=="function"?O:null)}var N={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},j=Object.assign,A={};function F(O,B,re){this.props=O,this.context=B,this.refs=A,this.updater=re||N}F.prototype.isReactComponent={},F.prototype.setState=function(O,B){if(typeof O!="object"&&typeof O!="function"&&O!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,O,B,"setState")},F.prototype.forceUpdate=function(O){this.updater.enqueueForceUpdate(this,O,"forceUpdate")};function V(){}V.prototype=F.prototype;function L(O,B,re){this.props=O,this.context=B,this.refs=A,this.updater=re||N}var Y=L.prototype=new V;Y.constructor=L,j(Y,F.prototype),Y.isPureReactComponent=!0;var $=Array.isArray;function q(){}var I={H:null,A:null,T:null,S:null},S=Object.prototype.hasOwnProperty;function C(O,B,re){var pe=re.ref;return{$$typeof:t,type:O,key:B,ref:pe!==void 0?pe:null,props:re}}function R(O,B){return C(O.type,B,O.props)}function D(O){return typeof O=="object"&&O!==null&&O.$$typeof===t}function z(O){var B={"=":"=0",":":"=2"};return"$"+O.replace(/[=:]/g,function(re){return B[re]})}var P=/\/+/g;function ie(O,B){return typeof O=="object"&&O!==null&&O.key!=null?z(""+O.key):B.toString(36)}function _e(O){switch(O.status){case"fulfilled":return O.value;case"rejected":throw O.reason;default:switch(typeof O.status=="string"?O.then(q,q):(O.status="pending",O.then(function(B){O.status==="pending"&&(O.status="fulfilled",O.value=B)},function(B){O.status==="pending"&&(O.status="rejected",O.reason=B)})),O.status){case"fulfilled":return O.value;case"rejected":throw O.reason}}throw O}function W(O,B,re,pe,de){var me=typeof O;(me==="undefined"||me==="boolean")&&(O=null);var we=!1;if(O===null)we=!0;else switch(me){case"bigint":case"string":case"number":we=!0;break;case"object":switch(O.$$typeof){case t:case e:we=!0;break;case b:return we=O._init,W(we(O._payload),B,re,pe,de)}}if(we)return de=de(O),we=pe===""?"."+ie(O,0):pe,$(de)?(re="",we!=null&&(re=we.replace(P,"$&/")+"/"),W(de,B,re,"",function(Ce){return Ce}
vendor: 5,068 bytes, line 17
17)):de!=null&&(D(de)&&(de=R(de,re+(de.key==null||O&&O.key===de.key?"":(""+de.key).replace(P,"$&/")+"/")+we)),B.push(de)),1;we=0;var Se=pe===""?".":pe+":";if($(O))for(var Re=0;Re<O.length;Re++)pe=O[Re],me=Se+ie(pe,Re),we+=W(pe,B,re,me,de);else if(Re=T(O),typeof Re=="function")for(O=Re.call(O),Re=0;!(pe=O.next()).done;)pe=pe.value,me=Se+ie(pe,Re++),we+=W(pe,B,re,me,de);else if(me==="object"){if(typeof O.then=="function")return W(_e(O),B,re,pe,de);throw B=String(O),Error("Objects are not valid as a React child (found: "+(B==="[object Object]"?"object with keys {"+Object.keys(O).join(", ")+"}":B)+"). If you meant to render a collection of children, use an array instead.")}return we}function J(O,B,re){if(O==null)return O;var pe=[],de=0;return W(O,pe,"","",function(me){return B.call(re,me,de++)}),pe}function fe(O){if(O._status===-1){var B=O._result;B=B(),B.then(function(re){(O._status===0||O._status===-1)&&(O._status=1,O._result=re)},function(re){(O._status===0||O._status===-1)&&(O._status=2,O._result=re)}),O._status===-1&&(O._status=0,O._result=B)}if(O._status===1)return O._result.default;throw O._result}var ce=typeof reportError=="function"?reportError:function(O){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var B=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof O=="object"&&O!==null&&typeof O.message=="string"?String(O.message):String(O),error:O});if(!window.dispatchEvent(B))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",O);return}console.error(O)},ae={map:J,forEach:function(O,B,re){J(O,function(){B.apply(this,arguments)},re)},count:function(O){var B=0;return J(O,function(){B++}),B},toArray:function(O){return J(O,function(B){return B})||[]},only:function(O){if(!D(O))throw Error("React.Children.only expected to receive a single React element child.");return O}};return Ze.Activity=x,Ze.Children=ae,Ze.Component=F,Ze.Fragment=n,Ze.Profiler=a,Ze.PureComponent=L,Ze.StrictMode=s,Ze.Suspense=m,Ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=I,Ze.__COMPILER_RUNTIME={__proto__:null,c:function(O){return I.H.useMemoCache(O)}},Ze.cache=function(O){return function(){return O.apply(null,arguments)}},Ze.cacheSignal=function(){return null},Ze.cloneElement=function(O,B,re){if(O==null)throw Error("The argument must be a React element, but you passed "+O+".");var pe=j({},O.props),de=O.key;if(B!=null)for(me in B.key!==void 0&&(de=""+B.key),B)!S.call(B,me)||me==="key"||me==="__self"||me==="__source"||me==="ref"&&B.ref===void 0||(pe[me]=B[me]);var me=arguments.length-2;if(me===1)pe.children=re;else if(1<me){for(var we=Array(me),Se=0;Se<me;Se++)we[Se]=arguments[Se+2];pe.children=we}return C(O.type,de,pe)},Ze.createContext=function(O){return O={$$typeof:u,_currentValue:O,_currentValue2:O,_threadCount:0,Provider:null,Consumer:null},O.Provider=O,O.Consumer={$$typeof:c,_context:O},O},Ze.createElement=function(O,B,re){var pe,de={},me=null;if(B!=null)for(pe in B.key!==void 0&&(me=""+B.key),B)S.call(B,pe)&&pe!=="key"&&pe!=="__self"&&pe!=="__source"&&(de[pe]=B[pe]);var we=arguments.length-2;if(we===1)de.children=re;else if(1<we){for(var Se=Array(we),Re=0;Re<we;Re++)Se[Re]=arguments[Re+2];de.children=Se}if(O&&O.defaultProps)for(pe in we=O.defaultProps,we)de[pe]===void 0&&(de[pe]=we[pe]);return C(O,me,de)},Ze.createRef=function(){return{current:null}},Ze.forwardRef=function(O){return{$$typeof:h,render:O}},Ze.isValidElement=D,Ze.lazy=function(O){return{$$typeof:b,_payload:{_status:-1,_result:O},_init:fe}},Ze.memo=function(O,B){return{$$typeof:p,type:O,compare:B===void 0?null:B}},Ze.startTransition=function(O){var B=I.T,re={};I.T=re;try{var pe=O(),de=I.S;de!==null&&de(re,pe),typeof pe=="object"&&pe!==null&&typeof pe.then=="function"&&pe.then(q,ce)}catch(me){ce(me)}finally{B!==null&&re.types!==null&&(B.types=re.types),I.T=B}},Ze.unstable_useCacheRefresh=function(){return I.H.useCacheRefresh()},Ze.use=function(O){return I.H.use(O)},Ze.useActionState=function(O,B,re){return I.H.useActionState(O,B,re)},Ze.useCallback=function(O,B){return I.H.useCallback(O,B)},Ze.useContext=function(O){return I.H.useContext(O)},Ze.useDebugValue=function(){},Ze.useDeferredValue=function(O,B){return I.H.useDeferredValue(O,B)},Ze.useEffect=function(O,B){return I.H.useEffect(O,B)},Ze.useEffectEvent=function(O){return I.H.useEffectEvent(O)},Ze.useId=function(){return I.H.useId()},Ze.useImperativeHandle=function(O,B,re){return I.H.useImperativeHandle(O,B,re)},Ze.useInsertionEffect=function(O,B){return I.H.useInsertionEffect(O,B)},Ze.useLayoutEffect=function(O,B){return I.H.useLayoutEffect(O,B)},Ze.useMemo=function(O,B){return I.H.useMemo(O,B)},Ze.useOptimistic=function(O,B){return I.H.useOptimistic(O,B)},Ze.useReducer=function(O,B,re){return I.H.useReducer(O,B,re)},Ze.useRef=function(O){return I.H.useRef(O)},Ze.useState=function(O){return I.H.useState(O)},Ze.useSyncExternalStore=function(O,B,re){return I.H.useSyncExternalStore(O,B,re)},Ze.useTransition=function(){return I.H.useTransition()},Ze.version="19.2.4",Ze}var DE;
vendor: 5,587 bytes, lines 17-33
17function mv(){return DE||(DE=1,ub.exports=qI()),ub.exports}var v=mv();const fn=uS(v);var db={exports:{}},md={},hb={exports:{}},fb={};/**
18 * @license React
19 * scheduler.production.js
20 *
21 * Copyright (c) Meta Platforms, Inc. and 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 */var OE;function HI(){return OE||(OE=1,(function(t){function e(W,J){var fe=W.length;W.push(J);e:for(;0<fe;){var ce=fe-1>>>1,ae=W[ce];if(0<a(ae,J))W[ce]=J,W[fe]=ae,fe=ce;else break e}}function n(W){return W.length===0?null:W[0]}function s(W){if(W.length===0)return null;var J=W[0],fe=W.pop();if(fe!==J){W[0]=fe;e:for(var ce=0,ae=W.length,O=ae>>>1;ce<O;){var B=2*(ce+1)-1,re=W[B],pe=B+1,de=W[pe];if(0>a(re,fe))pe<ae&&0>a(de,re)?(W[ce]=de,W[pe]=fe,ce=pe):(W[ce]=re,W[B]=fe,ce=B);else if(pe<ae&&0>a(de,fe))W[ce]=de,W[pe]=fe,ce=pe;else break e}}return J}function a(W,J){var fe=W.sortIndex-J.sortIndex;return fe!==0?fe:W.id-J.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var c=performance;t.unstable_now=function(){return c.now()}}else{var u=Date,h=u.now();t.unstable_now=function(){return u.now()-h}}var m=[],p=[],b=1,x=null,w=3,T=!1,N=!1,j=!1,A=!1,F=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,L=typeof setImmediate<"u"?setImmediate:null;function Y(W){for(var J=n(p);J!==null;){if(J.callback===null)s(p);else if(J.startTime<=W)s(p),J.sortIndex=J.expirationTime,e(m,J);else break;J=n(p)}}function $(W){if(j=!1,Y(W),!N)if(n(m)!==null)N=!0,q||(q=!0,z());else{var J=n(p);J!==null&&_e($,J.startTime-W)}}var q=!1,I=-1,S=5,C=-1;function R(){return A?!0:!(t.unstable_now()-C<S)}function D(){if(A=!1,q){var W=t.unstable_now();C=W;var J=!0;try{e:{N=!1,j&&(j=!1,V(I),I=-1),T=!0;var fe=w;try{t:{for(Y(W),x=n(m);x!==null&&!(x.expirationTime>W&&R());){var ce=x.callback;if(typeof ce=="function"){x.callback=null,w=x.priorityLevel;var ae=ce(x.expirationTime<=W);if(W=t.unstable_now(),typeof ae=="function"){x.callback=ae,Y(W),J=!0;break t}x===n(m)&&s(m),Y(W)}else s(m);x=n(m)}if(x!==null)J=!0;else{var O=n(p);O!==null&&_e($,O.startTime-W),J=!1}}break e}finally{x=null,w=fe,T=!1}J=void 0}}finally{J?z():q=!1}}}var z;if(typeof L=="function")z=function(){L(D)};else if(typeof MessageChannel<"u"){var P=new MessageChannel,ie=P.port2;P.port1.onmessage=D,z=function(){ie.postMessage(null)}}else z=function(){F(D,0)};function _e(W,J){I=F(function(){W(t.unstable_now())},J)}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(W){W.callback=null},t.unstable_forceFrameRate=function(W){0>W||125<W?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):S=0<W?Math.floor(1e3/W):5},t.unstable_getCurrentPriorityLevel=function(){return w},t.unstable_next=function(W){switch(w){case 1:case 2:case 3:var J=3;break;default:J=w}var fe=w;w=J;try{return W()}finally{w=fe}},t.unstable_requestPaint=function(){A=!0},t.unstable_runWithPriority=function(W,J){switch(W){case 1:case 2:case 3:case 4:case 5:break;default:W=3}var fe=w;w=W;try{return J()}finally{w=fe}},t.unstable_scheduleCallback=function(W,J,fe){var ce=t.unstable_now();switch(typeof fe=="object"&&fe!==null?(fe=fe.delay,fe=typeof fe=="number"&&0<fe?ce+fe:ce):fe=ce,W){case 1:var ae=-1;break;case 2:ae=250;break;case 5:ae=1073741823;break;case 4:ae=1e4;break;default:ae=5e3}return ae=fe+ae,W={id:b++,callback:J,priorityLevel:W,startTime:fe,expirationTime:ae,sortIndex:-1},fe>ce?(W.sortIndex=fe,e(p,W),n(m)===null&&W===n(p)&&(j?(V(I),I=-1):j=!0,_e($,fe-ce))):(W.sortIndex=ae,e(m,W),N||T||(N=!0,q||(q=!0,z()))),W},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(W){var J=w;return function(){var fe=w;w=J;try{return W.apply(this,arguments)}finally{w=fe}}}})(fb)),fb}var LE;function GI(){return LE||(LE=1,hb.exports=HI()),hb.exports}var mb={exports:{}},Qn={};/**
26 * @license React
27 * react-dom.production.js
28 *
29 * Copyright (c) Meta Platforms, Inc. and 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 UE;function YI(){if(UE)return Qn;UE=1;var t=mv();function e(m){var p="https://react.dev/errors/"+m;if(1<arguments.length){p+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)p+="&args[]="+encodeURIComponent(arguments[b])}return"Minified React error #"+m+"; visit "+p+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var s={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},a=Symbol.for("react.portal");function c(m,p,b){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:x==null?null:""+x,children:m,containerInfo:p,implementation:b}}var u=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,p){if(m==="font")return"";if(typeof p=="string")return p==="use-credentials"?p:""}return Qn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,Qn.createPortal=function(m,p){var b=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!p||p.nodeType!==1&&p.nodeType!==9&&p.nodeType!==11)throw Error(e(299));return c(m,p,null,b)},Qn.flushSync=function(m){var p=u.T,b=s.p;try{if(u.T=null,s.p=2,m)return m()}finally{u.T=p,s.p=b,s.d.f()}}
vendor: 22,583 bytes, lines 33-48
33,Qn.preconnect=function(m,p){typeof m=="string"&&(p?(p=p.crossOrigin,p=typeof p=="string"?p==="use-credentials"?p:"":void 0):p=null,s.d.C(m,p))},Qn.prefetchDNS=function(m){typeof m=="string"&&s.d.D(m)},Qn.preinit=function(m,p){if(typeof m=="string"&&p&&typeof p.as=="string"){var b=p.as,x=h(b,p.crossOrigin),w=typeof p.integrity=="string"?p.integrity:void 0,T=typeof p.fetchPriority=="string"?p.fetchPriority:void 0;b==="style"?s.d.S(m,typeof p.precedence=="string"?p.precedence:void 0,{crossOrigin:x,integrity:w,fetchPriority:T}):b==="script"&&s.d.X(m,{crossOrigin:x,integrity:w,fetchPriority:T,nonce:typeof p.nonce=="string"?p.nonce:void 0})}},Qn.preinitModule=function(m,p){if(typeof m=="string")if(typeof p=="object"&&p!==null){if(p.as==null||p.as==="script"){var b=h(p.as,p.crossOrigin);s.d.M(m,{crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0})}}else p==null&&s.d.M(m)},Qn.preload=function(m,p){if(typeof m=="string"&&typeof p=="object"&&p!==null&&typeof p.as=="string"){var b=p.as,x=h(b,p.crossOrigin);s.d.L(m,b,{crossOrigin:x,integrity:typeof p.integrity=="string"?p.integrity:void 0,nonce:typeof p.nonce=="string"?p.nonce:void 0,type:typeof p.type=="string"?p.type:void 0,fetchPriority:typeof p.fetchPriority=="string"?p.fetchPriority:void 0,referrerPolicy:typeof p.referrerPolicy=="string"?p.referrerPolicy:void 0,imageSrcSet:typeof p.imageSrcSet=="string"?p.imageSrcSet:void 0,imageSizes:typeof p.imageSizes=="string"?p.imageSizes:void 0,media:typeof p.media=="string"?p.media:void 0})}},Qn.preloadModule=function(m,p){if(typeof m=="string")if(p){var b=h(p.as,p.crossOrigin);s.d.m(m,{as:typeof p.as=="string"&&p.as!=="script"?p.as:void 0,crossOrigin:b,integrity:typeof p.integrity=="string"?p.integrity:void 0})}else s.d.m(m)},Qn.requestFormReset=function(m){s.d.r(m)},Qn.unstable_batchedUpdates=function(m,p){return m(p)},Qn.useFormState=function(m,p,b){return u.H.useFormState(m,p,b)},Qn.useFormStatus=function(){return u.H.useHostTransitionStatus()},Qn.version="19.2.4",Qn}var FE;function dS(){if(FE)return mb.exports;FE=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),mb.exports=YI(),mb.exports}/**
34 * @license React
35 * react-dom-client.production.js
36 *
37 * Copyright (c) Meta Platforms, Inc. and affiliates.
38 *
39 * This source code is licensed under the MIT license found in the
40 * LICENSE file in the root directory of this source tree.
41 */var VE;function WI(){if(VE)return md;VE=1;var t=GI(),e=mv(),n=dS();function s(r){var i="https://react.dev/errors/"+r;if(1<arguments.length){i+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)i+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+r+"; visit "+i+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(r){return!(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)}function c(r){var i=r,l=r;if(r.alternate)for(;i.return;)i=i.return;else{r=i;do i=r,(i.flags&4098)!==0&&(l=i.return),r=i.return;while(r)}return i.tag===3?l:null}function u(r){if(r.tag===13){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function h(r){if(r.tag===31){var i=r.memoizedState;if(i===null&&(r=r.alternate,r!==null&&(i=r.memoizedState)),i!==null)return i.dehydrated}return null}function m(r){if(c(r)!==r)throw Error(s(188))}function p(r){var i=r.alternate;if(!i){if(i=c(r),i===null)throw Error(s(188));return i!==r?null:r}for(var l=r,d=i;;){var g=l.return;if(g===null)break;var y=g.alternate;if(y===null){if(d=g.return,d!==null){l=d;continue}break}if(g.child===y.child){for(y=g.child;y;){if(y===l)return m(g),r;if(y===d)return m(g),i;y=y.sibling}throw Error(s(188))}if(l.return!==d.return)l=g,d=y;else{for(var E=!1,M=g.child;M;){if(M===l){E=!0,l=g,d=y;break}if(M===d){E=!0,d=g,l=y;break}M=M.sibling}if(!E){for(M=y.child;M;){if(M===l){E=!0,l=y,d=g;break}if(M===d){E=!0,d=y,l=g;break}M=M.sibling}if(!E)throw Error(s(189))}}if(l.alternate!==d)throw Error(s(190))}if(l.tag!==3)throw Error(s(188));return l.stateNode.current===l?r:i}function b(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r;for(r=r.child;r!==null;){if(i=b(r),i!==null)return i;r=r.sibling}return null}var x=Object.assign,w=Symbol.for("react.element"),T=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),j=Symbol.for("react.fragment"),A=Symbol.for("react.strict_mode"),F=Symbol.for("react.profiler"),V=Symbol.for("react.consumer"),L=Symbol.for("react.context"),Y=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),q=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),C=Symbol.for("react.activity"),R=Symbol.for("react.memo_cache_sentinel"),D=Symbol.iterator;function z(r){return r===null||typeof r!="object"?null:(r=D&&r[D]||r["@@iterator"],typeof r=="function"?r:null)}var P=Symbol.for("react.client.reference");function ie(r){if(r==null)return null;if(typeof r=="function")return r.$$typeof===P?null:r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case j:return"Fragment";case F:return"Profiler";case A:return"StrictMode";case $:return"Suspense";case q:return"SuspenseList";case C:return"Activity"}if(typeof r=="object")switch(r.$$typeof){case N:return"Portal";case L:return r.displayName||"Context";case V:return(r._context.displayName||"Context")+".Consumer";case Y:var i=r.render;return r=r.displayName,r||(r=i.displayName||i.name||"",r=r!==""?"ForwardRef("+r+")":"ForwardRef"),r;case I:return i=r.displayName||null,i!==null?i:ie(r.type)||"Memo";case S:i=r._payload,r=r._init;try{return ie(r(i))}catch{}}return null}var _e=Array.isArray,W=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,J=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,fe={pending:!1,data:null,method:null,action:null},ce=[],ae=-1;function O(r){return{current:r}}function B(r){0>ae||(r.current=ce[ae],ce[ae]=null,ae--)}function re(r,i){ae++,ce[ae]=r.current,r.current=i}var pe=O(null),de=O(null),me=O(null),we=O(null);function Se(r,i){switch(re(me,i),re(de,r),re(pe,null),i.nodeType){case 9:case 11:r=(r=i.documentElement)&&(r=r.namespaceURI)?tE(r):0;break;default:if(r=i.tagName,i=i.namespaceURI)i=tE(i),r=nE(i,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}B(pe),re(pe,r)}function Re(){B(pe),B(de),B(me)}function Ce(r){r.memoizedState!==null&&re(we,r);var i=pe.current,l=nE(i,r.type);i!==l&&(re(de,r),re(pe,l))}function $e(r){de.current===r&&(B(pe),B(de)),we.current===r&&(B(we),cd._currentValue=fe)}var Ue,Qe;function Ke(r){if(Ue===void 0)try{throw Error()}catch(l){var i=l.stack.trim().match(/\n( *(at )?)/);Ue=i&&i[1]||"",Qe=-1<l.stack.indexOf(`
42    at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
43`+Ue+r+Qe}var Ne=!1;function H(r,i){if(!r||Ne)return"";Ne=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var d={DetermineComponentFrameRoot:function(){try{if(i){var xe=function(){throw Error()};if(Object.defineProperty(xe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(xe,[])}catch(ue){var ne=ue}Reflect.construct(r,[],xe)}else{try{xe.call()}catch(ue){ne=ue}r.call(xe.prototype)}}else{try{throw Error()}catch(ue){ne=ue}(xe=r())&&typeof xe.catch=="function"&&xe.catch(function(){})}}catch(ue){if(ue&&ne&&typeof ue.stack=="string")return[ue.stack,ne.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=d.DetermineComponentFrameRoot(),E=y[0],M=y[1];if(E&&M){var K=E.split(`
44`),ee=M.split(`
45`);for(g=d=0;d<K.length&&!K[d].includes("DetermineComponentFrameRoot");)d++;for(;g<ee.length&&!ee[g].includes("DetermineComponentFrameRoot");)g++;if(d===K.length||g===ee.length)for(d=K.length-1,g=ee.length-1;1<=d&&0<=g&&K[d]!==ee[g];)g--;for(;1<=d&&0<=g;d--,g--)if(K[d]!==ee[g]){if(d!==1||g!==1)do if(d--,g--,0>g||K[d]!==ee[g]){var ge=`
46`+K[d].replace(" at new "," at ");return r.displayName&&ge.includes("<anonymous>")&&(ge=ge.replace("<anonymous>",r.displayName)),ge}while(1<=d&&0<=g);break}}}finally{Ne=!1,Error.prepareStackTrace=l}return(l=r?r.displayName||r.name:"")?Ke(l):""}function oe(r,i){switch(r.tag){case 26:case 27:case 5:return Ke(r.type);case 16:return Ke("Lazy");case 13:return r.child!==i&&i!==null?Ke("Suspense Fallback"):Ke("Suspense");case 19:return Ke("SuspenseList");case 0:case 15:return H(r.type,!1);case 11:return H(r.type.render,!1);case 1:return H(r.type,!0);case 31:return Ke("Activity");default:return""}}function se(r){try{var i="",l=null;do i+=oe(r,l),l=r,r=r.return;while(r);return i}catch(d){return`
47Error generating stack: `+d.message+`
48`+d.stack}}var Ee=Object.prototype.hasOwnProperty,Me=t.unstable_scheduleCallback,ot=t.unstable_cancelCallback,sn=t.unstable_shouldYield,pn=t.unstable_requestPaint,wt=t.unstable_now,is=t.unstable_getCurrentPriorityLevel,He=t.unstable_ImmediatePriority,lt=t.unstable_UserBlockingPriority,te=t.unstable_NormalPriority,ke=t.unstable_LowPriority,nt=t.unstable_IdlePriority,he=t.log,Fe=t.unstable_setDisableYieldValue,Oe=null,Xe=null;function rn(r){if(typeof he=="function"&&Fe(r),Xe&&typeof Xe.setStrictMode=="function")try{Xe.setStrictMode(Oe,r)}catch{}}var jt=Math.clz32?Math.clz32:Ch,mo=Math.log,Nl=Math.LN2;function Ch(r){return r>>>=0,r===0?32:31-(mo(r)/Nl|0)|0}var Pr=256,po=262144,gn=4194304;function Dr(r){var i=r&42;if(i!==0)return i;switch(r&-r){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:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&261888;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Or(r,i,l){var d=r.pendingLanes;if(d===0)return 0;var g=0,y=r.suspendedLanes,E=r.pingedLanes;r=r.warmLanes;var M=d&134217727;return M!==0?(d=M&~y,d!==0?g=Dr(d):(E&=M,E!==0?g=Dr(E):l||(l=M&~r,l!==0&&(g=Dr(l))))):(M=d&~y,M!==0?g=Dr(M):E!==0?g=Dr(E):l||(l=d&~r,l!==0&&(g=Dr(l)))),g===0?0:i!==0&&i!==g&&(i&y)===0&&(y=g&-g,l=i&-i,y>=l||y===32&&(l&4194048)!==0)?i:g}function fr(r,i){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&i)===0}function fg(r,i){switch(r){case 1:case 2:case 4:case 8:case 64:return i+250;case 16:case 32: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 i+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Rh(){var r=gn;return gn<<=1,(gn&62914560)===0&&(gn=4194304),r}function Lr(r){for(var i=[],l=0;31>l;l++)i.push(r);return i}function go(r,i){r.pendingLanes|=i,i!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function mg(r,i,l,d,g,y){var E=r.pendingLanes;r.pendingLanes=l,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=l,r.entangledLanes&=l,r.errorRecoveryDisabledLanes&=l,r.shellSuspendCounter=0;var M=r.entanglements,K=r.expirationTimes,ee=r.hiddenUpdates;for(l=E&~l;0<l;){var ge=31-jt(l),xe=1<<ge;M[ge]=0,K[ge]=-1;var ne=ee[ge];if(ne!==null)for(ee[ge]=null,ge=0;ge<ne.length;ge++){var ue=ne[ge];ue!==null&&(ue.lane&=-536870913)}l&=~xe}d!==0&&yo(r,d,0),y!==0&&g===0&&r.tag!==0&&(r.suspendedLanes|=y&~(E&~i))}function yo(r,i,l){r.pendingLanes|=i,r.suspendedLanes&=~i;var d=31-jt(i);r.entangledLanes|=i,r.entanglements[d]=r.entanglements[d]|1073741824|l&261930}function mu(r,i){var l=r.entangledLanes|=i;for(r=r.entanglements;l;){var d=31-jt(l),g=1<<d;g&i|r[d]&i&&(r[d]|=i),l&=~g}}function pu(r,i){var l=i&-i;return l=(l&42)!==0?1:bo(l),(l&(r.suspendedLanes|i))!==0?0:l}function bo(r){switch(r){case 2:r=1;break;case 8:r=4;break;case 32:r=16;break;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:r=128;break;case 268435456:r=134217728;break;default:r=0}return r}function yi(r){return r&=-r,2<r?8<r?(r&134217727)!==0?32:268435456:8:2}function Ih(){var r=J.p;return r!==0?r:(r=window.event,r===void 0?32:TE(r.type))}function mr(r,i){var l=J.p;try{return J.p=r,i()}finally{J.p=l}}var pr=Math.random().toString(36).slice(2),yn="__reactFiber$"+pr,Mn="__reactProps$"+pr,Ur="__reactContainer$"+pr,jl="__reactEvents$"+pr,pg="__reactListeners$"+pr,Mh="__reactHandles$"+pr,Ph="__reactResources$"+pr,Fr="__reactMarker$"+pr;function Al(r){delete r[yn],delete r[Mn],delete r[jl],delete r[pg],delete r[Mh]}function Vr(r){var i=r[yn];if(i)return i;for(var l=r.parentNode;l;){if(i=l[Ur]||l[yn]){if(l=i.alternate,i.child!==null||l!==null&&l.child!==null)for(r=cE(r);r!==null;){if(l=r[yn])return l;r=cE(r)}return i}r=l,l=r.parentNode}return null}function $s(r){if(r=r[yn]||r[Ur]){var i=r.tag;if(i===5||i===6||i===13||i===31||i===26||i===27||i===3)return r}return null}function Ss(r){var i=r.tag;if(i===5||i===26||i===27||i===6)return r.stateNode;throw Error(s(33))}function zr(r){var i=r[Ph];return i||(i=r[Ph]={hoistableStyles:new Map,hoistableScripts:new Map}),i}function bn(r){r[Fr]=!0}var gu=new Set,yu={};function Br(r,i){Kr(r,i),Kr(r+"Capture",i)}function Kr(r,i){for(yu[r]=i,r=0;r<i.length;r++)gu.add(i[r])}var bu=RegExp("^[: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]*$"),xu={},vu={};function Dh(r){return Ee.call(vu,r)?!0:Ee.call(xu,r)?!1:bu.test(r)?vu[r]=!0:(xu[r]=!0,!1)}function Cl(r,i,l){if(Dh(i))if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":r.removeAttribute(i);return;case"boolean":var d=i.toLowerCase().slice(0,5);if(d!=="data-"&&d!=="aria-"){r.removeAttribute(i);return}}r.setAttribute(i,""+l)}}function Ns(r,i,l){if(l===null)r.removeAttribute(i);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(i);return}r.setAttribute(i,""+l)}}function xn(r,i,l,d){if(d===null)r.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":r.removeAttribute(l);return}r.setAttributeNS(i,l,""+d)}}function Pn(r){switch(typeof r){case"bigint":case"boolean":case"number":case"string":case"undefined":return r;case"object":return r;default:return""}}function oa(r){var i=r.type;return(r=r.nodeName)&&r.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function _u(r,i,l){var d=Object.getOwnPropertyDescriptor(r.constructor.prototype,i);if(!r.hasOwnProperty(i)&&typeof d<"u"&&typeof d.get=="function"&&typeof d.set=="function"){var g=d.get,y=d.set;return Object.defineProperty(r,i,{configurable:!0,get:function(){return g.call(this)},set:function(E){l=""+E,y.call(this,E)}}),Object.defineProperty(r,i,{enumerable:d.enumerable}),{getValue:function(){return l},setValue:function(E){l=""+E},stopTracking:function(){r._valueTracker=null,delete r[i]}}}}function Ct(r){if(!r._valueTracker){var i=oa(r)?"checked":"value";r._valueTracker=_u(r,i,""+r[i])}}function xo(r){if(!r)return!1;var i=r._valueTracker;if(!i)return!0;var l=i.getValue(),d="";return r&&(d=oa(r)?r.checked?"true":"false":r.value),r=d,r!==l?(i.setValue(r),!0):!1}function $r(r){if(r=r||(typeof document<"u"?document:void 0),typeof r>"u")return null;try{return r.activeElement||r.body}catch{return r.body}}var vo=/[\n"\\]/g;function hs(r){return r.replace(vo,function(i){return"\\"+i.charCodeAt(0).toString(16)+" "})}function Rl(r,i,l,d,g,y,E,M){r.name="",E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"?r.type=E:r.removeAttribute("type"),i!=null?E==="number"?(i===0&&r.value===""||r.value!=i)&&(r.value=""+Pn(i)):r.value!==""+Pn(i)&&(r.value=""+Pn(i)):E!=="submit"&&E!=="reset"||r.removeAttribute("value"),i!=null?wu(r,E,Pn(i)):l!=null?wu(r,E,Pn(l)):d!=null&&r.removeAttribute("value"),g==null&&y!=null&&(r.defaultChecked=!!y),g!=null&&(r.checked=g&&typeof g!="function"&&typeof g!="symbol"),M!=null&&typeof M!="function"&&typeof M!="symbol"&&typeof M!="boolean"?r.name=""+Pn(M):r.removeAttribute("name")}function Oh(r,i,l,d,g,y,E,M){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(r.type=y),i!=null||l!=null){if(!(y!=="submit"&&y!=="reset"||i!=null)){Ct(r);return}l=l!=null?""+Pn(l):"",i=i!=null?""+Pn(i):l,M||i===r.value||(r.value=i),r.defaultValue=i}d=d??g,d=typeof d!="function"&&typeof d!="symbol"&&!!d,r.checked=M?r.checked:!!d,r.defaultChecked=!!d,E!=null&&typeof E!="function"&&typeof E!="symbol"&&typeof E!="boolean"&&(r.name=E),Ct(r)}function wu(r,i,l){i==="number"&&$r(r.ownerDocument)===r||r.defaultValue===""+l||(r.defaultValue=""+l)}function la(r,i,l,d){if(r=r.options,i){i={};for(var g=0;g<l.length;g++)i["$"+l[g]]=!0;for(l=0;l<r.length;l++)g=i.hasOwnProperty("$"+r[l].value),r[l].selected!==g&&(r[l].selected=g),g&&d&&(r[l].defaultSelected=!0)}else{for(l=""+Pn(l),i=null,g=0;g<r.length;g++){if(r[g].value===l){r[g].selected=!0,d&&(r[g].defaultSelected=!0);return}i!==null||r[g].disabled||(i=r[g])}i!==null&&(i.selected=!0)}}function Lh(r,i,l){if(i!=null&&(i=""+Pn(i),i!==r.value&&(r.value=i),l==null)){r.defaultValue!==i&&(r.defaultValue=i);return}r.defaultValue=l!=null?""+Pn(l):""}function ca(r,i,l,d){if(i==null){if(d!=null){if(l!=null)throw Error(s(92));if(_e(d)){if(1<d.length)throw Error(s(93));d=d[0]}l=d}l==null&&(l=""),i=l}l=Pn(i),r.defaultValue=l,d=r.textContent,d===l&&d!==""&&d!==null&&(r.value=d),Ct(r)}function fs(r,i){if(i){var l=r.firstChild;if(l&&l===r.lastChild&&l.nodeType===3){l.nodeValue=i;return}}r.textContent=i}var Uh=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Eu(r,i,l){var d=i.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?d?r.setProperty(i,""):i==="float"?r.cssFloat="":r[i]="":d?r.setProperty(i,l):typeof l!="number"||l===0||Uh.has(i)?i==="float"?r.cssFloat=l:r[i]=(""+l).trim():r[i]=l+"px"}function ku(r,i,l){if(i!=null&&typeof i!="object")throw Error(s(62));if(r=r.style,l!=null){for(var d in l)!l.hasOwnProperty(d)||i!=null&&i.hasOwnProperty(d)||(d.indexOf("--")===0?r.setProperty(d,""):d==="float"?r.cssFloat="":r[d]="");for(var g in i)d=i[g],i.hasOwnProperty(g)&&l[g]!==d&&Eu(r,g,d)}else for(var y in i)i.hasOwnProperty(y)&&Eu(r,y,i[y])}function Il(r){if(r.indexOf("-")===-1)return!1;switch(r){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 Fh=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode
48-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),ua=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Ml(r){return ua.test(""+r)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":r}function gr(){}var Tu=null;function qs(r){return r=r.target||r.srcElement||window,r.correspondingUseElement&&(r=r.correspondingUseElement),r.nodeType===3?r.parentNode:r}var da=null,qr=null;function _o(r){var i=$s(r);if(i&&(r=i.stateNode)){var l=r[Mn]||null;e:switch(r=i.stateNode,i.type){case"input":if(Rl(r,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),i=l.name,l.type==="radio"&&i!=null){for(l=r;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+hs(""+i)+'"][type="radio"]'),i=0;i<l.length;i++){var d=l[i];if(d!==r&&d.form===r.form){var g=d[Mn]||null;if(!g)throw Error(s(90));Rl(d,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(i=0;i<l.length;i++)d=l[i],d.form===r.form&&xo(d)}break e;case"textarea":Lh(r,l.value,l.defaultValue);break e;case"select":i=l.value,i!=null&&la(r,!!l.multiple,i,!1)}}}var Pl=!1;function ha(r,i,l){if(Pl)return r(i,l);Pl=!0;try{var d=r(i);return d}finally{if(Pl=!1,(da!==null||qr!==null)&&(Mf(),da&&(i=da,r=qr,qr=da=null,_o(i),r)))for(i=0;i<r.length;i++)_o(r[i])}}function yr(r,i){var l=r.stateNode;if(l===null)return null;var d=l[Mn]||null;if(d===null)return null;l=d[i];e:switch(i){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(d=!d.disabled)||(r=r.type,d=!(r==="button"||r==="input"||r==="select"||r==="textarea")),r=!d;break e;default:r=!1}if(r)return null;if(l&&typeof l!="function")throw Error(s(231,i,typeof l));return l}var Hs=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),wo=!1;if(Hs)try{var Mt={};Object.defineProperty(Mt,"passive",{get:function(){wo=!0}}),window.addEventListener("test",Mt,Mt),window.removeEventListener("test",Mt,Mt)}catch{wo=!1}var Hr=null,Su=null,Eo=null;function Nu(){if(Eo)return Eo;var r,i=Su,l=i.length,d,g="value"in Hr?Hr.value:Hr.textContent,y=g.length;for(r=0;r<l&&i[r]===g[r];r++);var E=l-r;for(d=1;d<=E&&i[l-d]===g[y-d];d++);return Eo=g.slice(r,1<d?1-d:void 0)}function ko(r){var i=r.keyCode;return"charCode"in r?(r=r.charCode,r===0&&i===13&&(r=13)):r=i,r===10&&(r=13),32<=r||r===13?r:0}function bi(){return!0}function br(){return!1}function Fn(r){function i(l,d,g,y,E){this._reactName=l,this._targetInst=g,this.type=d,this.nativeEvent=y,this.target=E,this.currentTarget=null;for(var M in r)r.hasOwnProperty(M)&&(l=r[M],this[M]=l?l(y):y[M]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?bi:br,this.isPropagationStopped=br,this}return x(i.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=bi)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=bi)},persist:function(){},isPersistent:bi}),i}var xi={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(r){return r.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Gr=Fn(xi),fa=x({},xi,{view:0,detail:0}),ju=Fn(fa),ma,Dl,Yr,Ol=x({},fa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:pa,button:0,buttons:0,relatedTarget:function(r){return r.relatedTarget===void 0?r.fromElement===r.srcElement?r.toElement:r.fromElement:r.relatedTarget},movementX:function(r){return"movementX"in r?r.movementX:(r!==Yr&&(Yr&&r.type==="mousemove"?(ma=r.screenX-Yr.screenX,Dl=r.screenY-Yr.screenY):Dl=ma=0,Yr=r),ma)},movementY:function(r){return"movementY"in r?r.movementY:Dl}}),Au=Fn(Ol),To=x({},Ol,{dataTransfer:0}),Vh=Fn(To),zh=x({},fa,{relatedTarget:0}),So=Fn(zh),Cu=x({},xi,{animationName:0,elapsedTime:0,pseudoElement:0}),Bh=Fn(Cu),Ll=x({},xi,{clipboardData:function(r){return"clipboardData"in r?r.clipboardData:window.clipboardData}}),Kh=Fn(Ll),$h=x({},xi,{data:0}),Wr=Fn($h),qh={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Hh={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"},Gh={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yh(r){var i=this.nativeEvent;return i.getModifierState?i.getModifierState(r):(r=Gh[r])?!!i[r]:!1}function pa(){return Yh}var as=x({},fa,{key:function(r){if(r.key){var i=qh[r.key]||r.key;if(i!=="Unidentified")return i}
vendor: 115,107 bytes, lines 48-49
48return r.type==="keypress"?(r=ko(r),r===13?"Enter":String.fromCharCode(r)):r.type==="keydown"||r.type==="keyup"?Hh[r.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:pa,charCode:function(r){return r.type==="keypress"?ko(r):0},keyCode:function(r){return r.type==="keydown"||r.type==="keyup"?r.keyCode:0},which:function(r){return r.type==="keypress"?ko(r):r.type==="keydown"||r.type==="keyup"?r.keyCode:0}}),Wh=Fn(as),Xh=x({},Ol,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),vi=Fn(Xh),f=x({},fa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:pa}),_=Fn(f),k=x({},xi,{propertyName:0,elapsedTime:0,pseudoElement:0}),U=Fn(k),Q=x({},Ol,{deltaX:function(r){return"deltaX"in r?r.deltaX:"wheelDeltaX"in r?-r.wheelDeltaX:0},deltaY:function(r){return"deltaY"in r?r.deltaY:"wheelDeltaY"in r?-r.wheelDeltaY:"wheelDelta"in r?-r.wheelDelta:0},deltaZ:0,deltaMode:0}),le=Fn(Q),Te=x({},xi,{newState:0,oldState:0}),rt=Fn(Te),an=[9,13,27,32],Tt=Hs&&"CompositionEvent"in window,Ht=null;Hs&&"documentMode"in document&&(Ht=document.documentMode);var Gs=Hs&&"TextEvent"in window&&!Ht,Xr=Hs&&(!Tt||Ht&&8<Ht&&11>=Ht),xr=" ",vr=!1;function No(r,i){switch(r){case"keyup":return an.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ul(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Fl=!1;function fR(r,i){switch(r){case"compositionend":return Ul(i);case"keypress":return i.which!==32?null:(vr=!0,xr);case"textInput":return r=i.data,r===xr&&vr?null:r;default:return null}}function mR(r,i){if(Fl)return r==="compositionend"||!Tt&&No(r,i)?(r=Nu(),Eo=Su=Hr=null,Fl=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1<i.char.length)return i.char;if(i.which)return String.fromCharCode(i.which)}return null;case"compositionend":return Xr&&i.locale!=="ko"?null:i.data;default:return null}}var pR={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 h0(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i==="input"?!!pR[r.type]:i==="textarea"}function f0(r,i,l,d){da?qr?qr.push(d):qr=[d]:da=d,i=Vf(i,"onChange"),0<i.length&&(l=new Gr("onChange","change",null,l,d),r.push({event:l,listeners:i}))}var Ru=null,Iu=null;function gR(r){W1(r,0)}function Qh(r){var i=Ss(r);if(xo(i))return r}function m0(r,i){if(r==="change")return i}var p0=!1;if(Hs){var gg;if(Hs){var yg="oninput"in document;if(!yg){var g0=document.createElement("div");g0.setAttribute("oninput","return;"),yg=typeof g0.oninput=="function"}gg=yg}else gg=!1;p0=gg&&(!document.documentMode||9<document.documentMode)}function y0(){Ru&&(Ru.detachEvent("onpropertychange",b0),Iu=Ru=null)}function b0(r){if(r.propertyName==="value"&&Qh(Iu)){var i=[];f0(i,Iu,r,qs(r)),ha(gR,i)}}function yR(r,i,l){r==="focusin"?(y0(),Ru=i,Iu=l,Ru.attachEvent("onpropertychange",b0)):r==="focusout"&&y0()}function bR(r){if(r==="selectionchange"||r==="keyup"||r==="keydown")return Qh(Iu)}function xR(r,i){if(r==="click")return Qh(i)}function vR(r,i){if(r==="input"||r==="change")return Qh(i)}function _R(r,i){return r===i&&(r!==0||1/r===1/i)||r!==r&&i!==i}var js=typeof Object.is=="function"?Object.is:_R;function Mu(r,i){if(js(r,i))return!0;if(typeof r!="object"||r===null||typeof i!="object"||i===null)return!1;var l=Object.keys(r),d=Object.keys(i);if(l.length!==d.length)return!1;for(d=0;d<l.length;d++){var g=l[d];if(!Ee.call(i,g)||!js(r[g],i[g]))return!1}return!0}function x0(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function v0(r,i){var l=x0(r);r=0;for(var d;l;){if(l.nodeType===3){if(d=r+l.textContent.length,r<=i&&d>=i)return{node:l,offset:i-r};r=d}e:{for(;l;){if(l.nextSibling){l=l.nextSibling;break e}l=l.parentNode}l=void 0}l=x0(l)}}function _0(r,i){return r&&i?r===i?!0:r&&r.nodeType===3?!1:i&&i.nodeType===3?_0(r,i.parentNode):"contains"in r?r.contains(i):r.compareDocumentPosition?!!(r.compareDocumentPosition(i)&16):!1:!1}function w0(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var i=$r(r.document);i instanceof r.HTMLIFrameElement;){try{var l=typeof i.contentWindow.location.href=="string"}catch{l=!1}if(l)r=i.contentWindow;else break;i=$r(r.document)}return i}function bg(r){var i=r&&r.nodeName&&r.nodeName.toLowerCase();return i&&(i==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||i==="textarea"||r.contentEditable==="true")}var wR=Hs&&"documentMode"in document&&11>=document.documentMode,Vl=null,xg=null,Pu=null,vg=!1;function E0(r,i,l){var d=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;vg||Vl==null||Vl!==$r(d)||(d=Vl,"selectionStart"in d&&bg(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Pu&&Mu(Pu,d)||(Pu=d,d=Vf(xg,"onSelect"),0<d.length&&(i=new Gr("onSelect","select",null,i,l),r.push({event:i,listeners:d}),i.target=Vl)))}function jo(r,i){var l={};return l[r.toLowerCase()]=i.toLowerCase(),l["Webkit"+r]="webkit"+i,l["Moz"+r]="moz"+i,l}var zl={animationend:jo("Animation","AnimationEnd"),animationiteration:jo("Animation","AnimationIteration"),animationstart:jo("Animation","AnimationStart"),transitionrun:jo("Transition","TransitionRun"),transitionstart:jo("Transition","TransitionStart"),transitioncancel:jo("Transition","TransitionCancel"),transitionend:jo("Transition","TransitionEnd")},_g={},k0={};Hs&&(k0=document.createElement("div").style,"AnimationEvent"in window||(delete zl.animationend.animation,delete zl.animationiteration.animation,delete zl.animationstart.animation),"TransitionEvent"in window||delete zl.transitionend.transition);function Ao(r){if(_g[r])return _g[r];if(!zl[r])return r;var i=zl[r],l;for(l in i)if(i.hasOwnProperty(l)&&l in k0)return _g[r]=i[l];return r}var T0=Ao("animationend"),S0=Ao("animationiteration"),N0=Ao("animationstart"),ER=Ao("transitionrun"),kR=Ao("transitionstart"),TR=Ao("transitioncancel"),j0=Ao("transitionend"),A0=new Map,wg="abort auxClick beforeToggle 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(" ");wg.push("scrollEnd");function _r(r,i){A0.set(r,i),Br(i,[r])}var Jh=typeof reportError=="function"?reportError:function(r){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var i=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof r=="object"&&r!==null&&typeof r.message=="string"?String(r.message):String(r),error:r});if(!window.dispatchEvent(i))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",r);return}console.error(r)},Ys=[],Bl=0,Eg=0;function Zh(){for(var r=Bl,i=Eg=Bl=0;i<r;){var l=Ys[i];Ys[i++]=null;var d=Ys[i];Ys[i++]=null;var g=Ys[i];Ys[i++]=null;var y=Ys[i];if(Ys[i++]=null,d!==null&&g!==null){var E=d.pending;E===null?g.next=g:(g.next=E.next,E.next=g),d.pending=g}y!==0&&C0(l,g,y)}}function ef(r,i,l,d){Ys[Bl++]=r,Ys[Bl++]=i,Ys[Bl++]=l,Ys[Bl++]=d,Eg|=d,r.lanes|=d,r=r.alternate,r!==null&&(r.lanes|=d)}function kg(r,i,l,d){return ef(r,i,l,d),tf(r)}function Co(r,i){return ef(r,null,null,i),tf(r)}function C0(r,i,l){r.lanes|=l;var d=r.alternate;d!==null&&(d.lanes|=l);for(var g=!1,y=r.return;y!==null;)y.childLanes|=l,d=y.alternate,d!==null&&(d.childLanes|=l),y.tag===22&&(r=y.stateNode,r===null||r._visibility&1||(g=!0)),r=y,y=y.return;return r.tag===3?(y=r.stateNode,g&&i!==null&&(g=31-jt(l),r=y.hiddenUpdates,d=r[g],d===null?r[g]=[i]:d.push(i),i.lane=l|536870912),y):null}function tf(r){if(50<nd)throw nd=0,My=null,Error(s(185));for(var i=r.return;i!==null;)r=i,i=r.return;return r.tag===3?r.stateNode:null}var Kl={};function SR(r,i,l,d){this.tag=r,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=d,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function As(r,i,l,d){return new SR(r,i,l,d)}function Tg(r){return r=r.prototype,!(!r||!r.isReactComponent)}function _i(r,i){var l=r.alternate;return l===null?(l=As(r.tag,i,r.key,r.mode),l.elementType=r.elementType,l.type=r.type,l.stateNode=r.stateNode,l.alternate=r,r.alternate=l):(l.pendingProps=i,l.type=r.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=r.flags&65011712,l.childLanes=r.childLanes,l.lanes=r.lanes,l.child=r.child,l.memoizedProps=r.memoizedProps,l.memoizedState=r.memoizedState,l.updateQueue=r.updateQueue,i=r.dependencies,l.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},l.sibling=r.sibling,l.index=r.index,l.ref=r.ref,l.refCleanup=r.refCleanup,l}function R0(r,i){r.flags&=65011714;var l=r.alternate;return l===null?(r.childLanes=0,r.lanes=i,r.child=null,r.subtreeFlags=0,r.memoizedProps=null,r.memoizedState=null,r.updateQueue=null,r.dependencies=null,r.stateNode=null):(r.childLanes=l.childLanes,r.lanes=l.lanes,r.child=l.child,r.subtreeFlags=0,r.deletions=null,r.memoizedProps=l.memoizedProps,r.memoizedState=l.memoizedState,r.updateQueue=l.updateQueue,r.type=l.type,i=l.dependencies,r.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext}),r}function nf(r,i,l,d,g,y){var E=0;if(d=r,typeof r=="function")Tg(r)&&(E=1);else if(typeof r=="string")E=RI(r,l,pe.current)?26:r==="html"||r==="head"||r==="body"?27:5;else e:switch(r){case C:return r=As(31,l,i,g),r.elementType=C,r.lanes=y,r;case j:return Ro(l.children,g,y,i);case A:E=8,g|=24;break;case F:return r=As(12,l,i,g|2),r.elementType=F,r.lanes=y,r;case $:return r=As(13,l,i,g),r.elementType=$,r.lanes=y,r;case q:return r=As(19,l,i,g),r.elementType=q,r.lanes=y,r;default:if(typeof r=="object"&&r!==null)switch(r.$$typeof){case L:E=10;break e;case V:E=9;break e;case Y:E=11;break e;case I:E=14;break e;case S:E=16,d=null;break e}E=29,l=Error(s(130,r===null?"null":typeof r,"")),d=null}return i=As(E,l,i,g),i.elementType=r,i.type=d,i.lanes=y,i}function Ro(r,i,l,d){return r=As(7,r,d,i),r.lanes=l,r}function Sg(r,i,l){return r=As(6,r,null,i),r.lanes=l,r}function I0(r){var i=As(18,null,null,0);return i.stateNode=r,i}function Ng(r,i,l){return i=As(4,r.children!==null?r.children:[],r.key,i),i.lanes=l,i.stateNode={containerInfo:r.containerInfo,pendingChildren:null,implementation:r.implementation},i}var M0=new WeakMap;function Ws(r,i){if(typeof r=="object"&&r!==null){var l=M0.get(r);return l!==void 0?l:(i={value:r,source:i,stack:se(i)},M0.set(r,i),i)}return{value:r,source:i,stack:se(i)}}var $l=[],ql=0,sf=null,Du=0,Xs=[],Qs=0,ga=null,Qr=1,Jr="";function wi(r,i){$l[ql++]=Du,$l[ql++]=sf,sf=r,Du=i}function P0(r,i,l){Xs[Qs++]=Qr,Xs[Qs++]=Jr,Xs[Qs++]=ga,ga=r;var d=Qr;r=Jr;var g=32-jt(d)-1;d&=~(1<<g),l+=1;var y=32-jt(i)+g;if(30<y){var E=g-g%5;y=(d&(1<<E)-1).toString(32),d>>=E,g-=E,Qr=1<<32-jt(i)+g|l<<g|d,Jr=y+r}else Qr=1<<y|l<<g|d,Jr=r}function jg(r){r.return!==null&&(wi(r,1),P0(r,1,0))}function Ag(r){for(;r===sf;)sf=$l[--ql],$l[ql]=null,Du=$l[--ql],$l[ql]=null;for(;r===ga;)ga=Xs[--Qs],Xs[Qs]=null,Jr=Xs[--Qs],Xs[Qs]=null,Qr=Xs[--Qs],Xs[Qs]=null}function D0(r,i){Xs[Qs++]=Qr,Xs[Qs++]=Jr,Xs[Qs++]=ga,Qr=i.id,Jr=i.overflow,ga=r}var Vn=null,Bt=null,bt=!1,ya=null,Js=!1,Cg=Error(s(519));function ba(r){var i=Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ou(Ws(i,r)),Cg}function O0(r){var i=r.stateNode,l=r.type,d=r.memoizedProps;switch(i[yn]=r,i[Mn]=d,l){case"dialog":ht("cancel",i),ht("close",i);break;case"iframe":case"object":case"embed":ht("load",i);break;case"video":case"audio":for(l=0;l<rd.length;l++)ht(rd[l],i);break;case"source":ht("error",i);break;case"img":case"image":case"link":ht("error",i),ht("load",i);break;case"details":ht("toggle",i);break;case"input":ht("invalid",i),Oh(i,d.value,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name,!0);break;case"select":ht("invalid",i);break;case"textarea":ht("invalid",i),ca(i,d.value,d.defaultValue,d.children)}l=d.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||i.textContent===""+l||d.suppressHydrationWarning===!0||Z1(i.textContent,l)?(d.popover!=null&&(ht("beforetoggle",i),ht("toggle",i)),d.onScroll!=null&&ht("scroll",i),d.onScrollEnd!=null&&ht("scrollend",i),d.onClick!=null&&(i.onclick=gr),i=!0):i=!1,i||ba(r,!0)}function L0(r){for(Vn=r.return;Vn;)switch(Vn.tag){case 5:case 31:case 13:Js=!1;return;case 27:case 3:Js=!0;return;default:Vn=Vn.return}}function Hl(r){if(r!==Vn)return!1;if(!bt)return L0(r),bt=!0,!1;var i=r.tag,l;if((l=i!==3&&i!==27)&&((l=i===5)&&(l=r.type,l=!(l!=="form"&&l!=="button")||Yy(r.type,r.memoizedProps)),l=!l),l&&Bt&&ba(r),L0(r),i===13){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Bt=lE(r)}else if(i===31){if(r=r.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(317));Bt=lE(r)}else i===27?(i=Bt,Ia(r.type)?(r=Zy,Zy=null,Bt=r):Bt=i):Bt=Vn?er(r.stateNode.nextSibling):null;return!0}function Io(){Bt=Vn=null,bt=!1}function Rg(){var r=ya;return r!==null&&(ys===null?ys=r:ys.push.apply(ys,r),ya=null),r}function Ou(r){ya===null?ya=[r]:ya.push(r)}var Ig=O(null),Mo=null,Ei=null;function xa(r,i,l){re(Ig,i._currentValue),i._currentValue=l}function ki(r){r._currentValue=Ig.current,B(Ig)}function Mg(r,i,l){for(;r!==null;){var d=r.alternate;if((r.childLanes&i)!==i?(r.childLanes|=i,d!==null&&(d.childLanes|=i)):d!==null&&(d.childLanes&i)!==i&&(d.childLanes|=i),r===l)break;r=r.return}}function Pg(r,i,l,d){var g=r.child;for(g!==null&&(g.return=r);g!==null;){var y=g.dependencies;if(y!==null){var E=g.child;y=y.firstContext;e:for(;y!==null;){var M=y;y=g;for(var K=0;K<i.length;K++)if(M.context===i[K]){y.lanes|=l,M=y.alternate,M!==null&&(M.lanes|=l),Mg(y.return,l,r),d||(E=null);break e}y=M.next}}else if(g.tag===18){if(E=g.return,E===null)throw Error(s(341));E.lanes|=l,y=E.alternate,y!==null&&(y.lanes|=l),Mg(E,l,r),E=null}else E=g.child;if(E!==null)E.return=g;else for(E=g;E!==null;){if(E===r){E=null;break}if(g=E.sibling,g!==null){g.return=E.return,E=g;break}E=E.return}g=E}}function Gl(r,i,l,d){r=null;for(var g=i,y=!1;g!==null;){if(!y){if((g.flags&524288)!==0)y=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var E=g.alternate;if(E===null)throw Error(s(387));if(E=E.memoizedProps,E!==null){var M=g.type;js(g.pendingProps.value,E.value)||(r!==null?r.push(M):r=[M])}}else if(g===we.current){if(E=g.alternate,E===null)throw Error(s(387));E.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(r!==null?r.push(cd):r=[cd])}g=g.return}r!==null&&Pg(i,r,l,d),i.flags|=262144}function rf(r){for(r=r.firstContext;r!==null;){if(!js(r.context._currentValue,r.memoizedValue))return!0;r=r.next}return!1}function Po(r){Mo=r,Ei=null,r=r.dependencies,r!==null&&(r.firstContext=null)}function zn(r){return U0(Mo,r)}function af(r,i){return Mo===null&&Po(r),U0(r,i)}function U0(r,i){var l=i._currentValue;if(i={context:i,memoizedValue:l,next:null},Ei===null){if(r===null)throw Error(s(308));Ei=i,r.dependencies={lanes:0,firstContext:i},r.flags|=524288}else Ei=Ei.next=i;return l}var NR=typeof AbortController<"u"?AbortController:function(){var r=[],i=this.signal={aborted:!1,addEventListener:function(l,d){r.push(d)}};this.abort=function(){i.aborted=!0,r.forEach(function(l){return l()})}},jR=t.unstable_scheduleCallback,AR=t.unstable_NormalPriority,vn={$$typeof:L,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Dg(){return{controller:new NR,data:new Map,refCount:0}}function Lu(r){r.refCount--,r.refCount===0&&jR(AR,function(){r.controller.abort()})}var Uu=null,Og=0,Yl=0,Wl=null;function CR(r,i){if(Uu===null){var l=Uu=[];Og=0,Yl=Fy(),Wl={status:"pending",value:void 0,then:function(d){l.push(d)}}}return Og++,i.then(F0,F0),i}function F0(){if(--Og===0&&Uu!==null){Wl!==null&&(Wl.status="fulfilled");var r=Uu;Uu=null,Yl=0,Wl=null;for(var i=0;i<r.length;i++)(0,r[i])()}}function RR(r,i){var l=[],d={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return r.then(function(){d.status="fulfilled",d.value=i;for(var g=0;g<l.length;g++)(0,l[g])(i)},function(g){for(d.status="rejected",d.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),d}var V0=W.S;W.S=function(r,i){E1=wt(),typeof i=="object"&&i!==null&&typeof i.then=="function"&&CR(r,i),V0!==null&&V0(r,i)};var Do=O(null);function Lg(){var r=Do.current;return r!==null?r:Ft.pooledCache}function of(r,i){i===null?re(Do,Do.current):re(Do,i.pool)}function z0(){var r=Lg();return r===null?null:{parent:vn._currentValue,pool:r}}var Xl=Error(s(460)),Ug=Error(s(474)),lf=Error(s(542)),cf={then:function(){}};function B0(r){return r=r.status,r==="fulfilled"||r==="rejected"}function K0(r,i,l){switch(l=r[l],l===void 0?r.push(i):l!==i&&(i.then(gr,gr),i=l),i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,q0(r),r;default:if(typeof i.status=="string")i.then(gr,gr);else{if(r=Ft,r!==null&&100<r.shellSuspendCounter)throw Error(s(482));r=i,r.status="pending",r.then(function(d){if(i.status==="pending"){var g=i;g.status="fulfilled",g.value=d}},function(d){if(i.status==="pending"){var g=i;g.status="rejected",g.reason=d}})}switch(i.status){case"fulfilled":return i.value;case"rejected":throw r=i.reason,q0(r),r}throw Lo=i,Xl}}function Oo(r){try{var i=r._init;return i(r._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Lo=l,Xl):l}}var Lo=null;function $0(){if(Lo===null)throw Error(s(459));var r=Lo;return Lo=null,r}function q0(r){if(r===Xl||r===lf)throw Error(s(483))}var Ql=null,Fu=0;function uf(r){var i=Fu;return Fu+=1,Ql===null&&(Ql=[]),K0(Ql,r,i)}function Vu(r,i){i=i.props.ref,r.ref=i!==void 0?i:null}function df(r,i){throw i.$$typeof===w?Error(s(525)):(r=Object.prototype.toString.call(i),Error(s(31,r==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":r)))}function H0(r){function i(X,G){if(r){var Z=X.deletions;Z===null?(X.deletions=[G],X.flags|=16):Z.push(G)}}function l(X,G){if(!r)return null;for(;G!==null;)i(X,G),G=G.sibling;return null}function d(X){for(var G=new Map;X!==null;)X.key!==null?G.set(X.key,X):G.set(X.index,X),X=X.sibling;return G}function g(X,G){return X=_i(X,G),X.index=0,X.sibling=null,X}function y(X,G,Z){return X.index=Z,r?(Z=X.alternate,Z!==null?(Z=Z.index,Z<G?(X.flags|=67108866,G):Z):(X.flags|=67108866,G)):(X.flags|=1048576,G)}function E(X){return r&&X.alternate===null&&(X.flags|=67108866),X}function M(X,G,Z,be){return G===null||G.tag!==6?(G=Sg(Z,X.mode,be),G.return=X,G):(G=g(G,Z),G.return=X,G)}function K(X,G,Z,be){var Be=Z.type;return Be===j?ge(X,G,Z.props.children,be,Z.key):G!==null&&(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===S&&Oo(Be)===G.type)?(G=g(G,Z.props),Vu(G,Z),G.return=X,G):(G=nf(Z.type,Z.key,Z.props,null,X.mode,be),Vu(G,Z),G.return=X,G)}function ee(X,G,Z,be){return G===null||G.tag!==4||G.stateNode.containerInfo!==Z.containerInfo||G.stateNode.implementation!==Z.implementation?(G=Ng(Z,X.mode,be),G.return=X,G):(G=g(G,Z.children||[]),G.return=X,G)}function ge(X,G,Z,be,Be){return G===null||G.tag!==7?(G=Ro(Z,X.mode,be,Be),G.return=X,G):(G=g(G,Z),G.return=X,G)}function xe(X,G,Z){if(typeof G=="string"&&G!==""||typeof G=="number"||typeof G=="bigint")return G=Sg(""+G,X.mode,Z),G.return=X,G;if(typeof G=="object"&&G!==null){switch(G.$$typeof){case T:return Z=nf(G.type,G.key,G.props,null,X.mode,Z),Vu(Z,G),Z.return=X,Z;case N:return G=Ng(G,X.mode,Z),G.return=X,G;case S:return G=Oo(G),xe(X,G,Z)}if(_e(G)||z(G))return G=Ro(G,X.mode,Z,null),G.return=X,G;if(typeof G.then=="function")return xe(X,uf(G),Z);if(G.$$typeof===L)return xe(X,af(X,G),Z);df(X,G)}return null}function ne(X,G,Z,be){var Be=G!==null?G.key:null;if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Be!==null?null:M(X,G,""+Z,be);if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case T:return Z.key===Be?K(X,G,Z,be):null;case N:return Z.key===Be?ee(X,G,Z,be):null;case S:return Z=Oo(Z),ne(X,G,Z,be)}if(_e(Z)||z(Z))return Be!==null?null:ge(X,G,Z,be,null);if(typeof Z.then=="function")return ne(X,G,uf(Z),be);if(Z.$$typeof===L)return ne(X,G,af(X,Z),be);df(X,Z)}return null}function ue(X,G,Z,be,Be){if(typeof be=="string"&&be!==""||typeof be=="number"||typeof be=="bigint")return X=X.get(Z)||null,M(G,X,""+be,Be);if(typeof be=="object"&&be!==null){switch(be.$$typeof){case T:return X=X.get(be.key===null?Z:be.key)||null,K(G,X,be,Be);case N:return X=X.get(be.key===null?Z:be.key)||null,ee(G,X,be,Be);case S:return be=Oo(be),ue(X,G,Z,be,Be)}if(_e(be)||z(be))return X=X.get(Z)||null,ge(G,X,be,Be,null);if(typeof be.then=="function")return ue(X,G,Z,uf(be),Be);if(be.$$typeof===L)return ue(X,G,Z,af(G,be),Be);df(G,be)}return null}function Pe(X,G,Z,be){for(var Be=null,Et=null,Le=G,at=G=0,pt=null;Le!==null&&at<Z.length;at++){Le.index>at?(pt=Le,Le=null):pt=Le.sibling;var kt=ne(X,Le,Z[at],be);if(kt===null){Le===null&&(Le=pt);break}r&&Le&&kt.alternate===null&&i(X,Le),G=y(kt,G,at),Et===null?Be=kt:Et.sibling=kt,Et=kt,Le=pt}if(at===Z.length)return l(X,Le),bt&&wi(X,at),Be;if(Le===null){for(;at<Z.length;at++)Le=xe(X,Z[at],be),Le!==null&&(G=y(Le,G,at),Et===null?Be=Le:Et.sibling=Le,Et=Le);return bt&&wi(X,at),Be}for(Le=d(Le);at<Z.length;at++)pt=ue(Le,X,at,Z[at],be),pt!==null&&(r&&pt.alternate!==null&&Le.delete(pt.key===null?at:pt.key),G=y(pt,G,at),Et===null?Be=pt:Et.sibling=pt,Et=pt);return r&&Le.forEach(function(La){return i(X,La)}),bt&&wi(X,at),Be}function qe(X,G,Z,be){if(Z==null)throw Error(s(151));for(var Be=null,Et=null,Le=G,at=G=0,pt=null,kt=Z.next();Le!==null&&!kt.done;at++,kt=Z.next()){Le.index>at?(pt=Le,Le=null):pt=Le.sibling;var La=ne(X,Le,kt.value,be);if(La===null){Le===null&&(Le=pt);break}r&&Le&&La.alternate===null&&i(X,Le),G=y(La,G,at),Et===null?Be=La:Et.sibling=La,Et=La,Le=pt}if(kt.done)return l(X,Le),bt&&wi(X,at),Be;if(Le===null){for(;!kt.done;at++,kt=Z.next())kt=xe(X,kt.value,be),kt!==null&&(G=y(kt,G,at),Et===null?Be=kt:Et.sibling=kt,Et=kt);return bt&&wi(X,at),Be}for(Le=d(Le);!kt.done;at++,kt=Z.next())kt=ue(Le,X,at,kt.value,be),kt!==null&&(r&&kt.alternate!==null&&Le.delete(kt.key===null?at:kt.key),G=y(kt,G,at),Et===null?Be=kt:Et.sibling=kt,Et=kt);return r&&Le.forEach(function(BI){return i(X,BI)}),bt&&wi(X,at),Be}function Ot(X,G,Z,be){if(typeof Z=="object"&&Z!==null&&Z.type===j&&Z.key===null&&(Z=Z.props.children),typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case T:e:{for(var Be=Z.key;G!==null;){if(G.key===Be){if(Be=Z.type,Be===j){if(G.tag===7){l(X,G.sibling),be=g(G,Z.props.children),be.return=X,X=be;break e}}else if(G.elementType===Be||typeof Be=="object"&&Be!==null&&Be.$$typeof===S&&Oo(Be)===G.type){l(X,G.sibling),be=g(G,Z.props),Vu(be,Z),be.return=X,X=be;break e}l(X,G);break}else i(X,G);G=G.sibling}Z.type===j?(be=Ro(Z.props.children,X.mode,be,Z.key),be.return=X,X=be):(be=nf(Z.type,Z.key,Z.props,null,X.mode,be),Vu(be,Z),be.return=X,X=be)}return E(X);case N:e:{for(Be=Z.key;G!==null;){if(G.key===Be)if(G.tag===4&&G.stateNode.containerInfo===Z.containerInfo&&G.stateNode.implementation===Z.implementation){l(X,G.sibling),be=g(G,Z.children||[]),be.return=X,X=be;break e}else{l(X,G);break}else i(X,G);G=G.sibling}be=Ng(Z,X.mode,be),be.return=X,X=be}return E(X);case S:return Z=Oo(Z),Ot(X,G,Z,be)}if(_e(Z))return Pe(X,G,Z,be);if(z(Z)){if(Be=z(Z),typeof Be!="function")throw Error(s(150));return Z=Be.call(Z),qe(X,G,Z,be)}if(typeof Z.then=="function")return Ot(X,G,uf(Z),be);if(Z.$$typeof===L)return Ot(X,G,af(X,Z),be);df(X,Z)}return typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint"?(Z=""+Z,G!==null&&G.tag===6?(l(X,G.sibling),be=g(G,Z),be.return=X,X=be):(l(X,G),be=Sg(Z,X.mode,be),be.return=X,X=be),E(X)):l(X,G)}return function(X,G,Z,be){try{Fu=0;var Be=Ot(X,G,Z,be);return Ql=null,Be}catch(Le){if(Le===Xl||Le===lf)throw Le;var Et=As(29,Le,null,X.mode);return Et.lanes=be,Et.return=X,Et}finally{}}}var Uo=H0(!0),G0=H0(!1),va=!1;function Fg(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Vg(r,i){r=r.updateQueue,i.updateQueue===r&&(i.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function _a(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function wa(r,i,l){var d=r.updateQueue;if(d===null)return null;if(d=d.shared,(St&2)!==0){var g=d.pending;return g===null?i.next=i:(i.next=g.next,g.next=i),d.pending=i,i=tf(r),C0(r,null,l),i}return ef(r,d,i,l),tf(r)}function zu(r,i,l){if(i=i.updateQueue,i!==null&&(i=i.shared,(l&4194048)!==0)){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,mu(r,l)}}function zg(r,i){var l=r.updateQueue,d=r.alternate;if(d!==null&&(d=d.updateQueue,l===d)){var g=null,y=null;if(l=l.firstBaseUpdate,l!==null){do{var E={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};y===null?g=y=E:y=y.next=E,l=l.next}while(l!==null);y===null?g=y=i:y=y.next=i}else g=y=i;l={baseState:d.baseState,firstBaseUpdate:g,lastBaseUpdate:y,shared:d.shared,callbacks:d.callbacks},r.updateQueue=l;return}r=l.lastBaseUpdate,r===null?l.firstBaseUpdate=i:r.next=i,l.lastBaseUpdate=i}var Bg=!1;function Bu(){if(Bg){var r=Wl;if(r!==null)throw r}}function Ku(r,i,l,d){Bg=!1;var g=r.updateQueue;va=!1;var y=g.firstBaseUpdate,E=g.lastBaseUpdate,M=g.shared.pending;if(M!==null){g.shared.pending=null;var K=M,ee=K.next;K.next=null,E===null?y=ee:E.next=ee,E=K;var ge=r.alternate;ge!==null&&(ge=ge.updateQueue,M=ge.lastBaseUpdate,M!==E&&(M===null?ge.firstBaseUpdate=ee:M.next=ee,ge.lastBaseUpdate=K))}if(y!==null){var xe=g.baseState;E=0,ge=ee=K=null,M=y;do{var ne=M.lane&-536870913,ue=ne!==M.lane;if(ue?(mt&ne)===ne:(d&ne)===ne){ne!==0&&ne===Yl&&(Bg=!0),ge!==null&&(ge=ge.next={lane:0,tag:M.tag,payload:M.payload,callback:null,next:null});e:{var Pe=r,qe=M;ne=i;var Ot=l;switch(qe.tag){case 1:if(Pe=qe.payload,typeof Pe=="function"){xe=Pe.call(Ot,xe,ne);break e}xe=Pe;break e;case 3:Pe.flags=Pe.flags&-65537|128;case 0:if(Pe=qe.payload,ne=typeof Pe=="function"?Pe.call(Ot,xe,ne):Pe,ne==null)break e;xe=x({},xe,ne);break e;case 2:va=!0}}ne=M.callback,ne!==null&&(r.flags|=64,ue&&(r.flags|=8192),ue=g.callbacks,ue===null?g.callbacks=[ne]:ue.push(ne))}else ue={lane:ne,tag:M.tag,payload:M.payload,callback:M.callback,next:null},ge===null?(ee=ge=ue,K=xe):ge=ge.next=ue,E|=ne;if(M=M.next,M===null){if(M=g.shared.pending,M===null)break;ue=M,M=ue.next,ue.next=null,g.lastBaseUpdate=ue,g.shared.pending=null}}while(!0);ge===null&&(K=xe),g.baseState=K,g.firstBaseUpdate=ee,g.lastBaseUpdate=ge,y===null&&(g.shared.lanes=0),Na|=E,r.lanes=E,r.memoizedState=xe}}function Y0(r,i){if(typeof r!="function")throw Error(s(191,r));r.call(i)}function W0(r,i){var l=r.callbacks;if(l!==null)for(r.callbacks=null,r=0;r<l.length;r++)Y0(l[r],i)}var Jl=O(null),hf=O(0);function X0(r,i){r=Mi,re(hf,r),re(Jl,i),Mi=r|i.baseLanes}function Kg(){re(hf,Mi),re(Jl,Jl.current)}function $g(){Mi=hf.current,B(Jl),B(hf)}var Cs=O(null),Zs=null;function Ea(r){var i=r.alternate;re(on,on.current&1),re(Cs,r),Zs===null&&(i===null||Jl.current!==null||i.memoizedState!==null)&&(Zs=r)}function qg(r){re(on,on.current),re(Cs,r),Zs===null&&(Zs=r)}function Q0(r){r.tag===22?(re(on,on.current),re(Cs,r),Zs===null&&(Zs=r)):ka()}function ka(){re(on,on.current),re(Cs,Cs.current)}function Rs(r){B(Cs),Zs===r&&(Zs=null),B(on)}var on=O(0);function ff(r){for(var i=r;i!==null;){if(i.tag===13){var l=i.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||Qy(l)||Jy(l)))return i}else if(i.tag===19&&(i.memoizedProps.revealOrder==="forwards"||i.memoizedProps.revealOrder==="backwards"||i.memoizedProps.revealOrder==="unstable_legacy-backwards"||i.memoizedProps.revealOrder==="together")){if((i.flags&128)!==0)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Ti=0,it=null,Pt=null,_n=null,mf=!1,Zl=!1,Fo=!1,pf=0,$u=0,ec=null,IR=0;function Zt(){throw Error(s(321))}function Hg(r,i){if(i===null)return!1;for(var l=0;l<i.length&&l<r.length;l++)if(!js(r[l],i[l]))return!1;return!0}function Gg(r,i,l,d,g,y){return Ti=y,it=i,i.memoizedState=null,i.updateQueue=null,i.lanes=0,W.H=r===null||r.memoizedState===null?Pw:ly,Fo=!1,y=l(d,g),Fo=!1,Zl&&(y=Z0(i,l,d,g)),J0(r),y}function J0(r){W.H=Gu;var i=Pt!==null&&Pt.next!==null;if(Ti=0,_n=Pt=it=null,mf=!1,$u=0,ec=null,i)throw Error(s(300));r===null||wn||(r=r.dependencies,r!==null&&rf(r)&&(wn=!0))}function Z0(r,i,l,d){it=r;var g=0;do{if(Zl&&(ec=null),$u=0,Zl=!1,25<=g)throw Error(s(301));if(g+=1,_n=Pt=null,r.updateQueue!=null){var y=r.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}W.H=Dw,y=i(l,d)}while(Zl);return y}function MR(){var r=W.H,i=r.useState()[0];return i=typeof i.then=="function"?qu(i):i,r=r.useState()[0],(Pt!==null?Pt.memoizedState:null)!==r&&(it.flags|=1024),i}function Yg(){var r=pf!==0;return pf=0,r}function Wg(r,i,l){i.updateQueue=r.updateQueue,i.flags&=-2053,r.lanes&=~l}function Xg(r){if(mf){for(r=r.memoizedState;r!==null;){var i=r.queue;i!==null&&(i.pending=null),r=r.next}mf=!1}Ti=0,_n=Pt=it=null,Zl=!1,$u=pf=0,ec=null}function os(){var r={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return _n===null?it.memoizedState=_n=r:_n=_n.next=r,_n}function ln(){if(Pt===null){var r=it.alternate;r=r!==null?r.memoizedState:null}else r=Pt.next;var i=_n===null?it.memoizedState:_n.next;if(i!==null)_n=i,Pt=r;else{if(r===null)throw it.alternate===null?Error(s(467)):Error(s(310));Pt=r,r={memoizedState:Pt.memoizedState,baseState:Pt.baseState,baseQueue:Pt.baseQueue,queue:Pt.queue,next:null},_n===null?it.memoizedState=_n=r:_n=_n.next=r}return _n}function gf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function qu(r){var i=$u;return $u+=1,ec===null&&(ec=[]),r=K0(ec,r,i),i=it,(_n===null?i.memoizedState:_n.next)===null&&(i=i.alternate,W.H=i===null||i.memoizedState===null?Pw:ly),r}function yf(r){if(r!==null&&typeof r=="object"){if(typeof r.then=="function")return qu(r);if(r.$$typeof===L)return zn(r)}throw Error(s(438,String(r)))}function Qg(r){var i=null,l=it.updateQueue;if(l!==null&&(i=l.memoCache),i==null){var d=it.alternate;d!==null&&(d=d.updateQueue,d!==null&&(d=d.memoCache,d!=null&&(i={data:d.data.map(function(g){return g.slice()}),index:0})))}if(i==null&&(i={data:[],index:0}),l===null&&(l=gf(),it.updateQueue=l),l.memoCache=i,l=i.data[i.index],l===void 0)for(l=i.data[i.index]=Array(r),d=0;d<r;d++)l[d]=R;return i.index++,l}function Si(r,i){return typeof i=="function"?i(r):i}function bf(r){var i=ln();return Jg(i,Pt,r)}function Jg(r,i,l){var d=r.queue;if(d===null)throw Error(s(311));d.lastRenderedReducer=l;var g=r.baseQueue,y=d.pending;if(y!==null){if(g!==null){var E=g.next;g.next=y.next,y.next=E}i.baseQueue=g=y,d.pending=null}if(y=r.baseState,g===null)r.memoizedState=y;else{i=g.next;var M=E=null,K=null,ee=i,ge=!1;do{var xe=ee.lane&-536870913;if(xe!==ee.lane?(mt&xe)===xe:(Ti&xe)===xe){var ne=ee.revertLane;if(ne===0)K!==null&&(K=K.next={lane:0,revertLane:0,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null}),xe===Yl&&(ge=!0);else if((Ti&ne)===ne){ee=ee.next,ne===Yl&&(ge=!0);continue}else xe={lane:0,revertLane:ee.revertLane,gesture:null,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},K===null?(M=K=xe,E=y):K=K.next=xe,it.lanes|=ne,Na|=ne;xe=ee.action,Fo&&l(y,xe),y=ee.hasEagerState?ee.eagerState:l(y,xe)}else ne={lane:xe,revertLane:ee.revertLane,gesture:ee.gesture,action:ee.action,hasEagerState:ee.hasEagerState,eagerState:ee.eagerState,next:null},K===null?(M=K=ne,E=y):K=K.next=ne,it.lanes|=xe,Na|=xe;ee=ee.next}while(ee!==null&&ee!==i);if(K===null?E=y:K.next=M,!js(y,r.memoizedState)&&(wn=!0,ge&&(l=Wl,l!==null)))throw l;r.memoizedState=y,r.baseState=E,r.baseQueue=K,d.lastRenderedState=y}return g===null&&(d.lanes=0),[r.memoizedState,d.dispatch]}function Zg(r){var i=ln(),l=i.queue;if(l===null)throw Error(s(311));l.lastRenderedReducer=r;var d=l.dispatch,g=l.pending,y=i.memoizedState;if(g!==null){l.pending=null;var E=g=g.next;do y=r(y,E.action),E=E.next;while(E!==g);js(y,i.memoizedState)||(wn=!0),i.memoizedState=y,i.baseQueue===null&&(i.baseState=y),l.lastRenderedState=y}return[y,d]}function ew(r,i,l){var d=it,g=ln(),y=bt;if(y){if(l===void 0)throw Error(s(407));l=l()}else l=i();var E=!js((Pt||g).memoizedState,l);if(E&&(g.memoizedState=l,wn=!0),g=g.queue,ny(sw.bind(null,d,g,r),[r]),g.getSnapshot!==i||E||_n!==null&&_n.memoizedState.tag&1){if(d.flags|=2048,tc(9,{destroy:void 0},nw.bind(null,d,g,l,i),null),Ft===null)throw Error(s(349));y||(Ti&127)!==0||tw(d,i,l)}return l}function tw(r,i,l){r.flags|=16384,r={getSnapshot:i,value:l},i=it.updateQueue,i===null?(i=gf(),it.updateQueue=i,i.stores=[r]):(l=i.stores,l===null?i.stores=[r]:l.push(r))}function nw(r,i,l,d){i.value=l,i.getSnapshot=d,rw(i)&&iw(r)}function sw(r,i,l){return l(function(){rw(i)&&iw(r)})}function rw(r){var i=r.getSnapshot;r=r.value;try{var l=i();return!js(r,l)}catch{return!0}}function iw(r){var i=Co(r,2);i!==null&&bs(i,r,2)}function ey(r){var i=os();if(typeof r=="function"){var l=r;if(r=l(),Fo){rn(!0);try{l()}finally{rn(!1)}}}return i.memoizedState=i.baseState=r,i.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Si,lastRenderedState:r},i}function aw(r,i,l,d){return r.baseState=l,Jg(r,Pt,typeof d=="function"?d:Si)}function PR(r,i,l,d,g){if(_f(r))throw Error(s(485));if(r=i.action,r!==null){var y={payload:g,action:r,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(E){y.listeners.push(E)}};W.T!==null?l(!0):y.isTransition=!1,d(y),l=i.pending,l===null?(y.next=i.pending=y,ow(i,y)):(y.next=l.next,i.pending=l.next=y)}}function ow(r,i){var l=i.action,d=i.payload,g=r.state;if(i.isTransition){var y=W.T,E={};W.T=E;try{var M=l(g,d),K=W.S;K!==null&&K(E,M),lw(r,i,M)}catch(ee){ty(r,i,ee)}finally{y!==null&&E.types!==null&&(y.types=E.types),W.T=y}}else try{y=l(g,d),lw(r,i,y)}catch(ee){ty(r,i,ee)}}function lw(r,i,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(d){cw(r,i,d)},function(d){return ty(r,i,d)}):cw(r,i,l)}function cw(r,i,l){i.status="fulfilled",i.value=l,uw(i),r.state=l,i=r.pending,i!==null&&(l=i.next,l===i?r.pending=null:(l=l.next,i.next=l,ow(r,l)))}function ty(r,i,l){var d=r.pending;if(r.pending=null,d!==null){d=d.next;do i.status="rejected",i.reason=l,uw(i),i=i.next;while(i!==d)}r.action=null}function uw(r){r=r.listeners;for(var i=0;i<r.length;i++)(0,r[i])()}function dw(r,i){return i}function hw(r,i){if(bt){var l=Ft.formState;if(l!==null){e:{var d=it;if(bt){if(Bt){t:{for(var g=Bt,y=Js;g.nodeType!==8;){if(!y){g=null;break t}if(g=er(g.nextSibling),g===null){g=null;break t}}y=g.data,g=y==="F!"||y==="F"?g:null}if(g){Bt=er(g.nextSibling),d=g.data==="F!";break e}}ba(d)}d=!1}d&&(i=l[0])}}return l=os(),l.memoizedState=l.baseState=i,d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:dw,lastRenderedState:i},l.queue=d,l=Rw.bind(null,it,d),d.dispatch=l,d=ey(!1),y=oy.bind(null,it,!1,d.queue),d=os(),g={state:i,dispatch:null,action:r,pending:null},d.queue=g,l=PR.bind(null,it,g,y,l),g.dispatch=l,d.memoizedState=r,[i,l,!1]}function fw(r){var i=ln();return mw(i,Pt,r)}function mw(r,i,l){if(i=Jg(r,i,dw)[0],r=bf(Si)[0],typeof i=="object"&&i!==null&&typeof i.then=="function")try{var d=qu(i)}catch(E){throw E===Xl?lf:E}else d=i;i=ln();var g=i.queue,y=g.dispatch;return l!==i.memoizedState&&(it.flags|=2048,tc(9,{destroy:void 0},DR.bind(null,g,l),null)),[d,y,r]}function DR(r,i){r.action=i}function pw(r){var i=ln(),l=Pt;if(l!==null)return mw(i,l,r);ln(),i=i.memoizedState,l=ln();var d=l.queue.dispatch;return l.memoizedState=r,[i,d,!1]}function tc(r,i,l,d){return r={tag:r,create:l,deps:d,inst:i,next:null},i=it.updateQueue,i===null&&(i=gf(),it.updateQueue=i),l=i.lastEffect,l===null?i.lastEffect=r.next=r:(d=l.next,l.next=r,r.next=d,i.lastEffect=r),r}function gw(){return ln().memoizedState}function xf(r,i,l,d){var g=os();it.flags|=r,g.memoizedState=tc(1|i,{destroy:void 0},l,d===void 0?null:d)}function vf(r,i,l,d){var g=ln();d=d===void 0?null:d;var y=g.memoizedState.inst;Pt!==null&&d!==null&&Hg(d,Pt.memoizedState.deps)?g.memoizedState=tc(i,y,l,d):(it.flags|=r,g.memoizedState=tc(1|i,y,l,d))}function yw(r,i){xf(8390656,8,r,i)}function ny(r,i){vf(2048,8,r,i)}function OR(r){it.flags|=4;var i=it.updateQueue;if(i===null)i=gf(),it.updateQueue=i,i.events=[r];else{var l=i.events;l===null?i.events=[r]:l.push(r)}}function bw(r){var i=ln().memoizedState;return OR({ref:i,nextImpl:r}),function(){if((St&2)!==0)throw Error(s(440));return i.impl.apply(void 0,arguments)}}function xw(r,i){return vf(4,2,r,i)}function vw(r,i){return vf(4,4,r,i)}function _w(r,i){if(typeof i=="function"){r=r();var l=i(r);return function(){typeof l=="function"?l():i(null)}}if(i!=null)return r=r(),i.current=r,function(){i.current=null}}function ww(r,i,l){l=l!=null?l.concat([r]):null,vf(4,4,_w.bind(null,i,r),l)}function sy(){}function Ew(r,i){var l=ln();i=i===void 0?null:i;var d=l.memoizedState;return i!==null&&Hg(i,d[1])?d[0]:(l.memoizedState=[r,i],r)}function kw(r,i){var l=ln();i=i===void 0?null:i;var d=l.memoizedState;if(i!==null&&Hg(i,d[1]))return d[0];if(d=r(),Fo){rn(!0);try{r()}finally{rn(!1)}}return l.memoizedState=[d,i],d}function ry(r,i,l){return l===void 0||(Ti&1073741824)!==0&&(mt&261930)===0?r.memoizedState=i:(r.memoizedState=l,r=T1(),it.lanes|=r,Na|=r,l)}function Tw(r,i,l,d){return js(l,i)?l:Jl.current!==null?(r=ry(r,l,d),js(r,i)||(wn=!0),r):(Ti&42)===0||(Ti&1073741824)!==0&&(mt&261930)===0?(wn=!0,r.memoizedState=l):(r=T1(),it.lanes|=r,Na|=r,i)}function Sw(r,i,l,d,g){var y=J.p;J.p=y!==0&&8>y?y:8;var E=W.T,M={};W.T=M,oy(r,!1,i,l);try{var K=g(),ee=W.S;if(ee!==null&&ee(M,K),K!==null&&typeof K=="object"&&typeof K.then=="function"){var ge=RR(K,d);Hu(r,i,ge,Ps(r))}else Hu(r,i,d,Ps(r))}catch(xe){Hu(r,i,{then:function(){},status:"rejected",reason:xe},Ps())}finally{J.p=y,E!==null&&M.types!==null&&(E.types=M.types),W.T=E}}function LR(){}function iy(r,i,l,d){if(r.tag!==5)throw Error(s(476));var g=Nw(r).queue;Sw(r,g,i,fe,l===null?LR:function(){return jw(r),l(d)})}function Nw(r){var i=r.memoizedState;if(i!==null)return i;i={memoizedState:fe,baseState:fe,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Si,lastRenderedState:fe},next:null};var l={};return i.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Si,lastRenderedState:l},next:null},r.memoizedState=i,r=r.alternate,r!==null&&(r.memoizedState=i),i}function jw(r){var i=Nw(r);i.next===null&&(i=r.alternate.memoizedState),Hu(r,i.next.queue,{},Ps())}function ay(){return zn(cd)}function Aw(){return ln().memoizedState}function Cw(){return ln().memoizedState}function UR(r){for(var i=r.return;i!==null;){switch(i.tag){case 24:case 3:var l=Ps();r=_a(l);var d=wa(i,r,l);d!==null&&(bs(d,i,l),zu(d,i,l)),i={cache:Dg()},r.payload=i;return}i=i.return}}function FR(r,i,l){var d=Ps();l={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},_f(r)?Iw(i,l):(l=kg(r,i,l,d),l!==null&&(bs(l,r,d),Mw(l,i,d)))}function Rw(r,i,l){var d=Ps();Hu(r,i,l,d)}function Hu(r,i,l,d){var g={lane:d,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(_f(r))Iw(i,g);else{var y=r.alternate;if(r.lanes===0&&(y===null||y.lanes===0)&&(y=i.lastRenderedReducer,y!==null))try{var E=i.lastRenderedState,M=y(E,l);if(g.hasEagerState=!0,g.eagerState=M,js(M,E))return ef(r,i,g,0),Ft===null&&Zh(),!1}catch{}finally{}if(l=kg(r,i,g,d),l!==null)return bs(l,r,d),Mw(l,i,d),!0}return!1}function oy(r,i,l,d){if(d={lane:2,revertLane:Fy(),gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},_f(r)){if(i)throw Error(s(479))}else i=kg(r,l,d,2),i!==null&&bs(i,r,2)}function _f(r){var i=r.alternate;return r===it||i!==null&&i===it}function Iw(r,i){Zl=mf=!0;var l=r.pending;l===null?i.next=i:(i.next=l.next,l.next=i),r.pending=i}function Mw(r,i,l){if((l&4194048)!==0){var d=i.lanes;d&=r.pendingLanes,l|=d,i.lanes=l,mu(r,l)}}var Gu={readContext:zn,use:yf,useCallback:Zt,useContext:Zt,useEffect:Zt,useImperativeHandle:Zt,useLayoutEffect:Zt,useInsertionEffect:Zt,useMemo:Zt,useReducer:Zt,useRef:Zt,useState:Zt,useDebugValue:Zt,useDeferredValue:Zt,useTransition:Zt,useSyncExternalStore:Zt,useId:Zt,useHostTransitionStatus:Zt,useFormState:Zt,useActionState:Zt,useOptimistic:Zt,useMemoCache:Zt,useCacheRefresh:Zt};Gu.useEffectEvent=Zt;var Pw={readContext:zn,use:yf,useCallback:function(r,i){return os().memoizedState=[r,i===void 0?null:i],r},useContext:zn,useEffect:yw,useImperativeHandle:function(r,i,l){l=l!=null?l.concat([r]):null,xf(4194308,4,_w.bind(null,i,r),l)},useLayoutEffect:function(r,i){return xf(4194308,4,r,i)},useInsertionEffect:function(r,i){xf(4,2,r,i)},useMemo:function(r,i){var l=os();i=i===void 0?null:i;var d=r();if(Fo){rn(!0);try{r()}finally{rn(!1)}}return l.memoizedState=[d,i],d},useReducer:function(r,i,l){var d=os();if(l!==void 0){var g=l(i);if(Fo){rn(!0);try{l(i)}finally{rn(!1)}}}else g=i;return d.memoizedState=d.baseState=g,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:g},d.queue=r,r=r.dispatch=FR.bind(null,it,r),[d.memoizedState,r]},useRef:function(r){var i=os();return r={current:r},i.memoizedState=r},useState:function(r){r=ey(r);var i=r.queue,l=Rw.bind(null,it,i);return i.dispatch=l,[r.memoizedState,l]},useDebugValue:sy,useDeferredValue:function(r,i){var l=os();return ry(l,r,i)},useTransition:function(){var r=ey(!1);return r=Sw.bind(null,it,r.queue,!0,!1),os().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,i,l){var d=it,g=os();if(bt){if(l===void 0)throw Error(s(407));l=l()}else{if(l=i(),Ft===null)throw Error(s(349));(mt&127)!==0||tw(d,i,l)}g.memoizedState=l;var y={value:l,getSnapshot:i};return g.queue=y,yw(sw.bind(null,d,y,r),[r]),d.flags|=2048,tc(9,{destroy:void 0},nw.bind(null,d,y,l,i),null),l},useId:function(){var r=os(),i=Ft.identifierPrefix;if(bt){var l=Jr,d=Qr;l=(d&~(1<<32-jt(d)-1)).toString(32)+l,i="_"+i+"R_"+l,l=pf++,0<l&&(i+="H"+l.toString(32)),i+="_"}else l=IR++,i="_"+i+"r_"+l.toString(32)+"_";return r.memoizedState=i},useHostTransitionStatus:ay,useFormState:hw,useActionState:hw,useOptimistic:function(r){var i=os();i.memoizedState=i.baseState=r;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return i.queue=l,i=oy.bind(null,it,!0,l),l.dispatch=i,[r,i]},useMemoCache:Qg,useCacheRefresh:function(){return os().memoizedState=UR.bind(null,it)},useEffectEvent:function(r){var i=os(),l={impl:r};return i.memoizedState=l,function(){if((St&2)!==0)throw Error(s(440));return l.impl.apply(void 0,arguments)}}},ly={readContext:zn,use:yf,useCallback:Ew,useContext:zn,useEffect:ny,useImperativeHandle:ww,useInsertionEffect:xw,useLayoutEffect:vw,useMemo:kw,useReducer:bf,useRef:gw,useState:function(){return bf(Si)},useDebugValue:sy,useDeferredValue:function(r,i){var l=ln();return Tw(l,Pt.memoizedState,r,i)},useTransition:function(){var r=bf(Si)[0],i=ln().memoizedState;return[typeof r=="boolean"?r:qu(r),i]},useSyncExternalStore:ew,useId:Aw,useHostTransitionStatus:ay,useFormState:fw,useActionState:fw,useOptimistic:function(r,i){var l=ln();return aw(l,Pt,r,i)},useMemoCache:Qg,useCacheRefresh:Cw};ly.useEffectEvent=bw;var Dw={readContext:zn,use:yf,useCallback:Ew,useContext:zn,useEffect:ny,useImperativeHandle:ww,useInsertionEffect:xw,useLayoutEffect:vw,useMemo:kw,useReducer:Zg,useRef:gw,useState:function(){return Zg(Si)},useDebugValue:sy,useDeferredValue:function(r,i){var l=ln();return Pt===null?ry(l,r,i):Tw(l,Pt.memoizedState,r,i)},useTransition:function(){var r=Zg(Si)[0],i=ln().memoizedState;return[typeof r=="boolean"?r:qu(r),i]},useSyncExternalStore:ew,useId:Aw,useHostTransitionStatus:ay,useFormState:pw,useActionState:pw,useOptimistic:function(r,i){var l=ln();return Pt!==null?aw(l,Pt,r,i):(l.baseState=r,[r,l.queue.dispatch])},useMemoCache:Qg,useCacheRefresh:Cw};Dw.useEffectEvent=bw;function cy(r,i,l,d){i=r.memoizedState,l=l(d,i),l=l==null?i:x({},i,l),r.memoizedState=l,r.lanes===0&&(r.updateQueue.baseState=l)}var uy={enqueueSetState:function(r,i,l){r=r._reactInternals;var d=Ps(),g=_a(d);g.payload=i,l!=null&&(g.callback=l),i=wa(r,g,d),i!==null&&(bs(i,r,d),zu(i,r,d))},enqueueReplaceState:function(r,i,l){r=r._reactInternals;var d=Ps(),g=_a(d);g.tag=1,g.payload=i,l!=null&&(g.callback=l),i=wa(r,g,d),i!==null&&(bs(i,r,d),zu(i,r,d))},enqueueForceUpdate:function(r,i){r=r._reactInternals;var l=Ps(),d=_a(l);d.tag=2,i!=null&&(d.callback=i),i=wa(r,d,l),i!==null&&(bs(i,r,l),zu(i,r,l))}};function Ow(r,i,l,d,g,y,E){return r=r.stateNode,typeof r.shouldComponentUpdate=="function"?r.shouldComponentUpdate(d,y,E):i.prototype&&i.prototype.isPureReactComponent?!Mu(l,d)||!Mu(g,y):!0}function Lw(r,i,l,d){r=i.state,typeof i.componentWillReceiveProps=="function"&&i.componentWillReceiveProps(l,d),typeof i.UNSAFE_componentWillReceiveProps=="function"&&i.UNSAFE_componentWillReceiveProps(l,d),i.state!==r&&uy.enqueueReplaceState(i,i.state,null)}function Vo(r,i){var l=i;if("ref"in i){l={};for(var d in i)d!=="ref"&&(l[d]=i[d])}if(r=r.defaultProps){l===i&&(l=x({},l));for(var g in r)l[g]===void 0&&(l[g]=r[g])}return l}function Uw(r){Jh(r)}function Fw(r){console.error(r)}function Vw(r){Jh(r)}function wf(r,i){try{var l=r.onUncaughtError;l(i.value,{componentStack:i.stack})}catch(d){setTimeout(function(){throw d})}}function zw(r,i,l){try{var d=r.onCaughtError;d(l.value,{componentStack:l.stack,errorBoundary:i.tag===1?i.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function dy(r,i,l){return l=_a(l),l.tag=3,l.payload={element:null},l.callback=function(){wf(r,i)},l}function Bw(r){return r=_a(r),r.tag=3,r}function Kw(r,i,l,d){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var y=d.value;r.payload=function(){return g(y)},r.callback=function(){zw(i,l,d)}}var E=l.stateNode;E!==null&&typeof E.componentDidCatch=="function"&&(r.callback=function(){zw(i,l,d),typeof g!="function"&&(ja===null?ja=new Set([this]):ja.add(this));var M=d.stack;this.componentDidCatch(d.value,{componentStack:M!==null?M:""})})}function VR(r,i,l,d,g){if(l.flags|=32768,d!==null&&typeof d=="object"&&typeof d.then=="function"){if(i=l.alternate,i!==null&&Gl(i,l,g,!0),l=Cs.current,l!==null){switch(l.tag){case 31:case 13:return Zs===null?Pf():l.alternate===null&&en===0&&(en=3),l.flags&=-257,l.flags|=65536,l.lanes=g,d===cf?l.flags|=16384:(i=l.updateQueue,i===null?l.updateQueue=new Set([d]):i.add(d),Oy(r,d,g)),!1;case 22:return l.flags|=65536,d===cf?l.flags|=16384:(i=l.updateQueue,i===null?(i={transitions:null,markerInstances:null,retryQueue:new Set([d])},l.updateQueue=i):(l=i.retryQueue,l===null?i.retryQueue=new Set([d]):l.add(d)),Oy(r,d,g)),!1}throw Error(s(435,l.tag))}return Oy(r,d,g),Pf(),!1}if(bt)return i=Cs.current,i!==null?((i.flags&65536)===0&&(i.flags|=256),i.flags|=65536,i.lanes=g,d!==Cg&&(r=Error(s(422),{cause:d}),Ou(Ws(r,l)))):(d!==Cg&&(i=Error(s(423),{cause:d}),Ou(Ws(i,l))),r=r.current.alternate,r.flags|=65536,g&=-g,r.lanes|=g,d=Ws(d,l),g=dy(r.stateNode,d,g),zg(r,g),en!==4&&(en=2)),!1;var y=Error(s(520),{cause:d});if(y=Ws(y,l),td===null?td=[y]:td.push(y),en!==4&&(en=2),i===null)return!0;d=Ws(d,l),l=i;do{switch(l.tag){case 3:return l.flags|=65536,r=g&-g,l.lanes|=r,r=dy(l.stateNode,d,r),zg(l,r),!1;case 1:if(i=l.type,y=l.stateNode,(l.flags&128)===0&&(typeof i.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(ja===null||!ja.has(y))))return l.flags|=65536,g&=-g,l.lanes|=g,g=Bw(g),Kw(g,r,l,d),zg(l,g),!1}l=l.return}while(l!==null);return!1}var hy=Error(s(461)),wn=!1;function Bn(r,i,l,d){i.child=r===null?G0(i,null,l,d):Uo(i,r.child,l,d)}function $w(r,i,l,d,g){l=l.render;var y=i.ref;if("ref"in d){var E={};for(var M in d)M!=="ref"&&(E[M]=d[M])}else E=d;return Po(i),d=Gg(r,i,l,E,y,g),M=Yg(),r!==null&&!wn?(Wg(r,i,g),Ni(r,i,g)):(bt&&M&&jg(i),i.flags|=1,Bn(r,i,d,g),i.child)}function qw(r,i,l,d,g){if(r===null){var y=l.type;return typeof y=="function"&&!Tg(y)&&y.defaultProps===void 0&&l.compare===null?(i.tag=15,i.type=y,Hw(r,i,y,d,g)):(r=nf(l.type,null,d,i,i.mode,g),r.ref=i.ref,r.return=i,i.child=r)}if(y=r.child,!vy(r,g)){var E=y.memoizedProps;if(l=l.compare,l=l!==null?l:Mu,l(E,d)&&r.ref===i.ref)return Ni(r,i,g)}return i.flags|=1,r=_i(y,d),r.ref=i.ref,r.return=i,i.child=r}function Hw(r,i,l,d,g){if(r!==null){var y=r.memoizedProps;if(Mu(y,d)&&r.ref===i.ref)if(wn=!1,i.pendingProps=d=y,vy(r,g))(r.flags&131072)!==0&&(wn=!0);else return i.lanes=r.lanes,Ni(r,i,g)}return fy(r,i,l,d,g)}function Gw(r,i,l,d){var g=d.children,y=r!==null?r.memoizedState:null;if(r===null&&i.stateNode===null&&(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),d.mode==="hidden"){if((i.flags&128)!==0){if(y=y!==null?y.baseLanes|l:l,r!==null){for(d=i.child=r.child,g=0;d!==null;)g=g|d.lanes|d.childLanes,d=d.sibling;d=g&~y}else d=0,i.child=null;return Yw(r,i,y,l,d)}if((l&536870912)!==0)i.memoizedState={baseLanes:0,cachePool:null},r!==null&&of(i,y!==null?y.cachePool:null),y!==null?X0(i,y):Kg(),Q0(i);else return d=i.lanes=536870912,Yw(r,i,y!==null?y.baseLanes|l:l,l,d)}else y!==null?(of(i,y.cachePool),X0(i,y),ka(),i.memoizedState=null):(r!==null&&of(i,null),Kg(),ka());return Bn(r,i,g,l),i.child}function Yu(r,i){return r!==null&&r.tag===22||i.stateNode!==null||(i.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.sibling}function Yw(r,i,l,d,g){var y=Lg();return y=y===null?null:{parent:vn._currentValue,pool:y},i.memoizedState={baseLanes:l,cachePool:y},r!==null&&of(i,null),Kg(),Q0(i),r!==null&&Gl(r,i,d,!0),i.childLanes=g,null}function Ef(r,i){return i=Tf({mode:i.mode,children:i.children},r.mode),i.ref=r.ref,r.child=i,i.return=r,i}function Ww(r,i,l){return Uo(i,r.child,null,l),r=Ef(i,i.pendingProps),r.flags|=2,Rs(i),i.memoizedState=null,r}function zR(r,i,l){var d=i.pendingProps,g=(i.flags&128)!==0;if(i.flags&=-129,r===null){if(bt){if(d.mode==="hidden")return r=Ef(i,d),i.lanes=536870912,Yu(null,r);if(qg(i),(r=Bt)?(r=oE(r,Js),r=r!==null&&r.data==="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ga!==null?{id:Qr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},l=I0(r),l.return=i,i.child=l,Vn=i,Bt=null)):r=null,r===null)throw ba(i);return i.lanes=536870912,null}return Ef(i,d)}var y=r.memoizedState;if(y!==null){var E=y.dehydrated;if(qg(i),g)if(i.flags&256)i.flags&=-257,i=Ww(r,i,l);else if(i.memoizedState!==null)i.child=r.child,i.flags|=128,i=null;else throw Error(s(558));else if(wn||Gl(r,i,l,!1),g=(l&r.childLanes)!==0,wn||g){if(d=Ft,d!==null&&(E=pu(d,l),E!==0&&E!==y.retryLane))throw y.retryLane=E,Co(r,E),bs(d,r,E),hy;Pf(),i=Ww(r,i,l)}else r=y.treeContext,Bt=er(E.nextSibling),Vn=i,bt=!0,ya=null,Js=!1,r!==null&&D0(i,r),i=Ef(i,d),i.flags|=4096;return i}return r=_i(r.child,{mode:d.mode,children:d.children}),r.ref=i.ref,i.child=r,r.return=i,r}function kf(r,i){var l=i.ref;if(l===null)r!==null&&r.ref!==null&&(i.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(s(284));(r===null||r.ref!==l)&&(i.flags|=4194816)}}function fy(r,i,l,d,g){return Po(i),l=Gg(r,i,l,d,void 0,g),d=Yg(),r!==null&&!wn?(Wg(r,i,g),Ni(r,i,g)):(bt&&d&&jg(i),i.flags|=1,Bn(r,i,l,g),i.child)}function Xw(r,i,l,d,g,y){return Po(i),i.updateQueue=null,l=Z0(i,d,l,g),J0(r),d=Yg(),r!==null&&!wn?(Wg(r,i,y),Ni(r,i,y)):(bt&&d&&jg(i),i.flags|=1,Bn(r,i,l,y),i.child)}function Qw(r,i,l,d,g){if(Po(i),i.stateNode===null){var y=Kl,E=l.contextType;typeof E=="object"&&E!==null&&(y=zn(E)),y=new l(d,y),i.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=uy,i.stateNode=y,y._reactInternals=i,y=i.stateNode,y.props=d,y.state=i.memoizedState,y.refs={},Fg(i),E=l.contextType,y.context=typeof E=="object"&&E!==null?zn(E):Kl,y.state=i.memoizedState,E=l.getDerivedStateFromProps,typeof E=="function"&&(cy(i,l,E,d),y.state=i.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(E=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),E!==y.state&&uy.enqueueReplaceState(y,y.state,null),Ku(i,d,y,g),Bu(),y.state=i.memoizedState),typeof y.componentDidMount=="function"&&(i.flags|=4194308),d=!0}else if(r===null){y=i.stateNode;var M=i.memoizedProps,K=Vo(l,M);y.props=K;var ee=y.context,ge=l.contextType;E=Kl,typeof ge=="object"&&ge!==null&&(E=zn(ge));var xe=l.getDerivedStateFromProps;ge=typeof xe=="function"||typeof y.getSnapshotBeforeUpdate=="function",M=i.pendingProps!==M,ge||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(M||ee!==E)&&Lw(i,y,d,E),va=!1;var ne=i.memoizedState;y.state=ne,Ku(i,d,y,g),Bu(),ee=i.memoizedState,M||ne!==ee||va?(typeof xe=="function"&&(cy(i,l,xe,d),ee=i.memoizedState),(K=va||Ow(i,l,K,d,ne,ee,E))?(ge||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(i.flags|=4194308)):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),i.memoizedProps=d,i.memoizedState=ee),y.props=d,y.state=ee,y.context=E,d=K):(typeof y.componentDidMount=="function"&&(i.flags|=4194308),d=!1)}else{y=i.stateNode,Vg(r,i),E=i.memoizedProps,ge=Vo(l,E),y.props=ge,xe=i.pendingProps,ne=y.context,ee=l.contextType,K=Kl,typeof ee=="object"&&ee!==null&&(K=zn(ee)),M=l.getDerivedStateFromProps,(ee=typeof M=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(E!==xe||ne!==K)&&Lw(i,y,d,K),va=!1,ne=i.memoizedState,y.state=ne,Ku(i,d,y,g),Bu();var ue=i.memoizedState;E!==xe||ne!==ue||va||r!==null&&r.dependencies!==null&&rf(r.dependencies)?(typeof M=="function"&&(cy(i,l,M,d),ue=i.memoizedState),(ge=va||Ow(i,l,ge,d,ne,ue,K)||r!==null&&r.dependencies!==null&&rf(r.dependencies))?(ee||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(d,ue,K),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(d,ue,K)),typeof y.componentDidUpdate=="function"&&(i.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(i.flags|=1024)):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),i.memoizedProps=d,i.memoizedState=ue),y.props=d,y.state=ue,y.context=K,d=ge):(typeof y.componentDidUpdate!="function"||E===r.memoizedProps&&ne===r.memoizedState||(i.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||E===r.memoizedProps&&ne===r.memoizedState||(i.flags|=1024),d=!1)}return y=d,kf(r,i),d=(i.flags&128)!==0,y||d?(y=i.stateNode,l=d&&typeof l.getDerivedStateFromError!="function"?null:y.render(),i.flags|=1,r!==null&&d?(i.child=Uo(i,r.child,null,g),i.child=Uo(i,null,l,g)):Bn(r,i,l,g),i.memoizedState=y.state,r=i.child):r=Ni(r,i,g),r}function Jw(r,i,l,d){return Io(),i.flags|=256,Bn(r,i,l,d),i.child}var my={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function py(r){return{baseLanes:r,cachePool:z0()}}function gy(r,i,l){return r=r!==null?r.childLanes&~l:0,i&&(r|=Ms),r}function Zw(r,i,l){var d=i.pendingProps,g=!1,y=(i.flags&128)!==0,E;if((E=y)||(E=r!==null&&r.memoizedState===null?!1:(on.current&2)!==0),E&&(g=!0,i.flags&=-129),E=(i.flags&32)!==0,i.flags&=-33,r===null){if(bt){if(g?Ea(i):ka(),(r=Bt)?(r=oE(r,Js),r=r!==null&&r.data!=="&"?r:null,r!==null&&(i.memoizedState={dehydrated:r,treeContext:ga!==null?{id:Qr,overflow:Jr}:null,retryLane:536870912,hydrationErrors:null},l=I0(r),l.return=i,i.child=l,Vn=i,Bt=null)):r=null,r===null)throw ba(i);return Jy(r)?i.lanes=32:i.lanes=536870912,null}var M=d.children;return d=d.fallback,g?(ka(),g=i.mode,M=Tf({mode:"hidden",children:M},g),d=Ro(d,g,l,null),M.return=i,d.return=i,M.sibling=d,i.child=M,d=i.child,d.memoizedState=py(l),d.childLanes=gy(r,E,l),i.memoizedState=my,Yu(null,d)):(Ea(i),yy(i,M))}var K=r.memoizedState;if(K!==null&&(M=K.dehydrated,M!==null)){if(y)i.flags&256?(Ea(i),i.flags&=-257,i=by(r,i,l)):i.memoizedState!==null?(ka(),i.child=r.child,i.flags|=128,i=null):(ka(),M=d.fallback,g=i.mode,d=Tf({mode:"visible",children:d.children},g),M=Ro(M,g,l,null),M.flags|=2,d.return=i,M.return=i,d.sibling=M,i.child=d,Uo(i,r.child,null,l),d=i.child,d.memoizedState=py(l),d.childLanes=gy(r,E,l),i.memoizedState=my,i=Yu(null,d));else if(Ea(i),Jy(M)){if(E=M.nextSibling&&M.nextSibling.dataset,E)var ee=E.dgst;E=ee,d=Error(s(419)),d.stack="",d.digest=E,Ou({value:d,source:null,stack:null}),i=by(r,i,l)}else if(wn||Gl(r,i,l,!1),E=(l&r.childLanes)!==0,wn||E){if(E=Ft,E!==null&&(d=pu(E,l),d!==0&&d!==K.retryLane))throw K.retryLane=d,Co(r,d),bs(E,r,d),hy;Qy(M)||Pf(),i=by(r,i,l)}else Qy(M)?(i.flags|=192,i.child=r.child,i=null):(r=K.treeContext,Bt=er(M.nextSibling),Vn=i,bt=!0,ya=null,Js=!1,r!==null&&D0(i,r),i=yy(i,d.children),i.flags|=4096);return i}return g?(ka(),M=d.fallback,g=i.mode,K=r.child,ee=K.sibling,d=_i(K,{mode:"hidden",children:d.children}),d.subtreeFlags=K.subtreeFlags&65011712,ee!==null?M=_i(ee,M):(M=Ro(M,g,l,null),M.flags|=2),M.return=i,d.return=i,d.sibling=M,i.child=d,Yu(null,d),d=i.child,M=r.child.memoizedState,M===null?M=py(l):(g=M.cachePool,g!==null?(K=vn._currentValue,g=g.parent!==K?{parent:K,pool:K}:g):g=z0(),M={baseLanes:M.baseLanes|l,cachePool:g}),d.memoizedState=M,d.childLanes=gy(r,E,l),i.memoizedState=my,Yu(r.child,d)):(Ea(i),l=r.child,r=l.sibling,l=_i(l,{mode:"visible",children:d.children}),l.return=i,l.sibling=null,r!==null&&(E=i.deletions,E===null?(i.deletions=[r],i.flags|=16):E.push(r)),i.child=l,i.memoizedState=null,l)}function yy(r,i){return i=Tf({mode:"visible",children:i},r.mode),i.return=r,r.child=i}function Tf(r,i){return r=As(22,r,null,i),r.lanes=0,r}function by(r,i,l){return Uo(i,r.child,null,l),r=yy(i,i.pendingProps.children),r.flags|=2,i.memoizedState=null,r}function e1(r,i,l){r.lanes|=i;var d=r.alternate;d!==null&&(d.lanes|=i),Mg(r.return,i,l)}function xy(r,i,l,d,g,y){var E=r.memoizedState;E===null?r.memoizedState={isBackwards:i,rendering:null,renderingStartTime:0,last:d,tail:l,tailMode:g,treeForkCount:y}:(E.isBackwards=i,E.rendering=null,E.renderingStartTime=0,E.last=d,E.tail=l,E.tailMode=g,E.treeForkCount=y)}function t1(r,i,l){var d=i.pendingProps,g=d.revealOrder,y=d.tail;d=d.children;var E=on.current,M=(E&2)!==0;if(M?(E=E&1|2,i.flags|=128):E&=1,re(on,E),Bn(r,i,d,l),d=bt?Du:0,!M&&r!==null&&(r.flags&128)!==0)e:for(r=i.child;r!==null;){if(r.tag===13)r.memoizedState!==null&&e1(r,l,i);else if(r.tag===19)e1(r,l,i);else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break e;for(;r.sibling===null;){if(r.return===null||r.return===i)break e;r=r.return}r.sibling.return=r.return,r=r.sibling}switch(g){case"forwards":for(l=i.child,g=null;l!==null;)r=l.alternate,r!==null&&ff(r)===null&&(g=l),l=l.sibling;l=g,l===null?(g=i.child,i.child=null):(g=l.sibling,l.sibling=null),xy(i,!1,g,l,y,d);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=i.child,i.child=null;g!==null;){if(r=g.alternate,r!==null&&ff(r)===null){i.child=g;break}r=g.sibling,g.sibling=l,l=g,g=r}xy(i,!0,l,null,y,d);break;case"together":xy(i,!1,null,null,void 0,d);break;default:i.memoizedState=null}return i.child}function Ni(r,i,l){if(r!==null&&(i.dependencies=r.dependencies),Na|=i.lanes,(l&i.childLanes)===0)if(r!==null){if(Gl(r,i,l,!1),(l&i.childLanes)===0)return null}else return null;if(r!==null&&i.child!==r.child)throw Error(s(153));if(i.child!==null){for(r=i.child,l=_i(r,r.pendingProps),i.child=l,l.return=i;r.sibling!==null;)r=r.sibling,l=l.sibling=_i(r,r.pendingProps),l.return=i;l.sibling=null}return i.child}function vy(r,i){return(r.lanes&i)!==0?!0:(r=r.dependencies,!!(r!==null&&rf(r)))}function BR(r,i,l){switch(i.tag){case 3:Se(i,i.stateNode.containerInfo),xa(i,vn,r.memoizedState.cache),Io();break;case 27:case 5:Ce(i);break;case 4:Se(i,i.stateNode.containerInfo);break;case 10:xa(i,i.type,i.memoizedProps.value);break;case 31:if(i.memoizedState!==null)return i.flags|=128,qg(i),null;break;case 13:var d=i.memoizedState;if(d!==null)return d.dehydrated!==null?(Ea(i),i.flags|=128,null):(l&i.child.childLanes)!==0?Zw(r,i,l):(Ea(i),r=Ni(r,i,l),r!==null?r.sibling:null);Ea(i);break;case 19:var g=(r.flags&128)!==0;if(d=(l&i.childLanes)!==0,d||(Gl(r,i,l,!1),d=(l&i.childLanes)!==0),g){if(d)return t1(r,i,l);i.flags|=128}if(g=i.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),re(on,on.current),d)break;return null;case 22:return i.lanes=0,Gw(r,i,l,i.pendingProps);case 24:xa(i,vn,r.memoizedState.cache)}return Ni(r,i,l)}function n1(r,i,l){if(r!==null)if(r.memoizedProps!==i.pendingProps)wn=!0;else{if(!vy(r,l)&&(i.flags&128)===0)return wn=!1,BR(r,i,l);wn=(r.flags&131072)!==0}else wn=!1,bt&&(i.flags&1048576)!==0&&P0(i,Du,i.index);switch(i.lanes=0,i.tag){case 16:e:{var d=i.pendingProps;if(r=Oo(i.elementType),i.type=r,typeof r=="function")Tg(r)?(d=Vo(r,d),i.tag=1,i=Qw(null,i,r,d,l)):(i.tag=0,i=fy(null,i,r,d,l));else{if(r!=null){var g=r.$$typeof;if(g===Y){i.tag=11,i=$w(null,i,r,d,l);break e}else if(g===I){i.tag=14,i=qw(null,i,r,d,l);break e}}throw i=ie(r)||r,Error(s(306,i,""))}}return i;case 0:return fy(r,i,i.type,i.pendingProps,l);case 1:return d=i.type,g=Vo(d,i.pendingProps),Qw(r,i,d,g,l);case 3:e:{if(Se(i,i.stateNode.containerInfo),r===null)throw Error(s(387));d=i.pendingProps;var y=i.memoizedState;g=y.element,Vg(r,i),Ku(i,d,null,l);var E=i.memoizedState;if(d=E.cache,xa(i,vn,d),d!==y.cache&&Pg(i,[vn],l,!0),Bu(),d=E.element,y.isDehydrated)if(y={element:d,isDehydrated:!1,cache:E.cache},i.updateQueue.baseState=y,i.memoizedState=y,i.flags&256){i=Jw(r,i,d,l);break e}else if(d!==g){g=Ws(Error(s(424)),i),Ou(g),i=Jw(r,i,d,l);break e}else{switch(r=i.stateNode.containerInfo,r.nodeType){case 9:r=r.body;break;default:r=r.nodeName==="HTML"?r.ownerDocument.body:r}for(Bt=er(r.firstChild),Vn=i,bt=!0,ya=null,Js=!0,l=G0(i,null,d,l),i.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling}else{if(Io(),d===g){i=Ni(r,i,l);break e}Bn(r,i,d,l)}i=i.child}return i;case 26:return kf(r,i),r===null?(l=fE(i.type,null,i.pendingProps,null))?i.memoizedState=l:bt||(l=i.type,r=i.pendingProps,d=zf(me.current).createElement(l),d[yn]=i,d[Mn]=r,Kn(d,l,r),bn(d),i.stateNode=d):i.memoizedState=fE(i.type,r.memoizedProps,i.pendingProps,r.memoizedState),null;case 27:return Ce(i),r===null&&bt&&(d=i.stateNode=uE(i.type,i.pendingProps,me.current),Vn=i,Js=!0,g=Bt,Ia(i.type)?(Zy=g,Bt=er(d.firstChild)):Bt=g),Bn(r,i,i.pendingProps.children,l),kf(r,i),r===null&&(i.flags|=4194304),i.child;case 5:return r===null&&bt&&((g=d=Bt)&&(d=bI(d,i.type,i.pendingProps,Js),d!==null?(i.stateNode=d,Vn=i,Bt=er(d.firstChild),Js=!1,g=!0):g=!1),g||ba(i)),Ce(i),g=i.type,y=i.pendingProps,E=r!==null?r.memoizedProps:null,d=y.children,Yy(g,y)?d=null:E!==null&&Yy(g,E)&&(i.flags|=32),i.memoizedState!==null&&(g=Gg(r,i,MR,null,null,l),cd._currentValue=g),kf(r,i),Bn(r,i,d,l),i.child;case 6:return r===null&&bt&&((r=l=Bt)&&(l=xI(l,i.pendingProps,Js),l!==null?(i.stateNode=l,Vn=i,Bt=null,r=!0):r=!1),r||ba(i)),null;case 13:return Zw(r,i,l);case 4:return Se(i,i.stateNode.containerInfo),d=i.pendingProps,r===null?i.child=Uo(i,null,d,l):Bn(r,i,d,l),i.child;case 11:return $w(r,i,i.type,i.pendingProps,l);case 7:return Bn(r,i,i.pendingProps,l),i.child;case 8:return Bn(r,i,i.pendingProps.children,l),i.child;case 12:return Bn(r,i,i.pendingProps.children,l),i.child;case 10:return d=i.pendingProps,xa(i,i.type,d.value),Bn(r,i,d.children,l),i.child;case 9:return g=i.type._context,d=i.pendingProps.children,Po(i),g=zn(g),d=d(g),i.flags|=1,Bn(r,i,d,l),i.child;case 14:return qw(r,i,i.type,i.pendingProps,l);case 15:return Hw(r,i,i.type,i.pendingProps,l);case 19:return t1(r,i,l);case 31:return zR(r,i,l);case 22:return Gw(r,i,l,i.pendingProps);case 24:return Po(i),d=zn(vn),r===null?(g=Lg(),g===null&&(g=Ft,y=Dg(),g.pooledCache=y,y.refCount++,y!==null&&(g.pooledCacheLanes|=l),g=y),i.memoizedState={parent:d,cache:g},Fg(i),xa(i,vn,g)):((r.lanes&l)!==0&&(Vg(r,i),Ku(i,null,null,l),Bu()),g=r.memoizedState,y=i.memoizedState,g.parent!==d?(g={parent:d,cache:d},i.memoizedState=g,i.lanes===0&&(i.memoizedState=i.updateQueue.baseState=g),xa(i,vn,d)):(d=y.cache,xa(i,vn,d),d!==g.cache&&Pg(i,[vn],l,!0))),Bn(r,i,i.pendingProps.children,l),i.child;case 29:throw i.pendingProps}throw Error(s(156,i.tag))}function ji(r){r.flags|=4}function _y(r,i,l,d,g){if((i=(r.mode&32)!==0)&&(i=!1),i){if(r.flags|=16777216,(g&335544128)===g)if(r.stateNode.complete)r.flags|=8192;else if(A1())r.flags|=8192;else throw Lo=cf,Ug}else r.flags&=-16777217}function s1(r,i){if(i.type!=="stylesheet"||(i.state.loading&4)!==0)r.flags&=-16777217;else if(r.flags|=16777216,!bE(i))if(A1())r.flags|=8192;else throw Lo=cf,Ug}function Sf(r,i){i!==null&&(r.flags|=4),r.flags&16384&&(i=r.tag!==22?Rh():536870912,r.lanes|=i,ic|=i)}function Wu(r,i){if(!bt)switch(r.tailMode){case"hidden":i=r.tail;for(var l=null;i!==null;)i.alternate!==null&&(l=i),i=i.sibling;l===null?r.tail=null:l.sibling=null;break;case"collapsed":l=r.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?i||r.tail===null?r.tail=null:r.tail.sibling=null:d.sibling=null}}function Kt(r){var i=r.alternate!==null&&r.alternate.child===r.child,l=0,d=0;if(i)for(var g=r.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags&65011712,d|=g.flags&65011712,g.return=r,g=g.sibling;else for(g=r.child;g!==null;)l|=g.lanes|g.childLanes,d|=g.subtreeFlags,d|=g.flags,g.return=r,g=g.sibling;return r.subtreeFlags|=d,r.childLanes=l,i}function KR(r,i,l){var d=i.pendingProps;switch(Ag(i),i.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Kt(i),null;case 1:return Kt(i),null;case 3:return l=i.stateNode,d=null,r!==null&&(d=r.memoizedState.cache),i.memoizedState.cache!==d&&(i.flags|=2048),ki(vn),Re(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(r===null||r.child===null)&&(Hl(i)?ji(i):r===null||r.memoizedState.isDehydrated&&(i.flags&256)===0||(i.flags|=1024,Rg())),Kt(i),null;case 26:var g=i.type,y=i.memoizedState;return r===null?(ji(i),y!==null?(Kt(i),s1(i,y)):(Kt(i),_y(i,g,null,d,l))):y?y!==r.memoizedState?(ji(i),Kt(i),s1(i,y)):(Kt(i),i.flags&=-16777217):(r=r.memoizedProps,r!==d&&ji(i),Kt(i),_y(i,g,r,d,l)),null;case 27:if($e(i),l=me.current,g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ji(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return Kt(i),null}r=pe.current,Hl(i)?O0(i):(r=uE(g,d,l),i.stateNode=r,ji(i))}return Kt(i),null;case 5:if($e(i),g=i.type,r!==null&&i.stateNode!=null)r.memoizedProps!==d&&ji(i);else{if(!d){if(i.stateNode===null)throw Error(s(166));return Kt(i),null}if(y=pe.current,Hl(i))O0(i);else{var E=zf(me.current);switch(y){case 1:y=E.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:y=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":y=E.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":y=E.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":y=E.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof d.is=="string"?E.createElement("select",{is:d.is}):E.createElement("select"),d.multiple?y.multiple=!0:d.size&&(y.size=d.size);break;default:y=typeof d.is=="string"?E.createElement(g,{is:d.is}):E.createElement(g)}}y[yn]=i,y[Mn]=d;e:for(E=i.child;E!==null;){if(E.tag===5||E.tag===6)y.appendChild(E.stateNode);else if(E.tag!==4&&E.tag!==27&&E.child!==null){E.child.return=E,E=E.child;continue}if(E===i)break e;for(;E.sibling===null;){if(E.return===null||E.return===i)break e;E=E.return}E.sibling.return=E.return,E=E.sibling}i.stateNode=y;e:switch(Kn(y,g,d),g){case"button":case"input":case"select":case"textarea":d=!!d.autoFocus;break e;case"img":d=!0;break e;default:d=!1}d&&ji(i)}}return Kt(i),_y(i,i.type,r===null?null:r.memoizedProps,i.pendingProps,l),null;case 6:if(r&&i.stateNode!=null)r.memoizedProps!==d&&ji(i);else{if(typeof d!="string"&&i.stateNode===null)throw Error(s(166));if(r=me.current,Hl(i)){if(r=i.stateNode,l=i.memoizedProps,d=null,g=Vn,g!==null)switch(g.tag){case 27:case 5:d=g.memoizedProps}r[yn]=i,r=!!(r.nodeValue===l||d!==null&&d.suppressHydrationWarning===!0||Z1(r.nodeValue,l)),r||ba(i,!0)}else r=zf(r).createTextNode(d),r[yn]=i,i.stateNode=r}return Kt(i),null;case 31:if(l=i.memoizedState,r===null||r.memoizedState!==null){if(d=Hl(i),l!==null){if(r===null){if(!d)throw Error(s(318));if(r=i.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(s(557));r[yn]=i}else Io(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Kt(i),r=!1}else l=Rg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=l),r=!0;if(!r)return i.flags&256?(Rs(i),i):(Rs(i),null);if((i.flags&128)!==0)throw Error(s(558))}return Kt(i),null;case 13:if(d=i.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(g=Hl(i),d!==null&&d.dehydrated!==null){if(r===null){if(!g)throw Error(s(318));if(g=i.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(s(317));g[yn]=i}else Io(),(i.flags&128)===0&&(i.memoizedState=null),i.flags|=4;Kt(i),g=!1}else g=Rg(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=g),g=!0;if(!g)return i.flags&256?(Rs(i),i):(Rs(i),null)}return Rs(i),(i.flags&128)!==0?(i.lanes=l,i):(l=d!==null,r=r!==null&&r.memoizedState!==null,l&&(d=i.child,g=null,d.alternate!==null&&d.alternate.memoizedState!==null&&d.alternate.memoizedState.cachePool!==null&&(g=d.alternate.memoizedState.cachePool.pool),y=null,d.memoizedState!==null&&d.memoizedState.cachePool!==null&&(y=d.memoizedState.cachePool.pool),y!==g&&(d.flags|=2048)),l!==r&&l&&(i.child.flags|=8192),Sf(i,i.updateQueue),Kt(i),null);case 4:return Re(),r===null&&Ky(i.stateNode.containerInfo),Kt(i),null;case 10:return ki(i.type),Kt(i),null;case 19:if(B(on),d=i.memoizedState,d===null)return Kt(i),null;if(g=(i.flags&128)!==0,y=d.rendering,y===null)if(g)Wu(d,!1);else{if(en!==0||r!==null&&(r.flags&128)!==0)for(r=i.child;r!==null;){if(y=ff(r),y!==null){for(i.flags|=128,Wu(d,!1),r=y.updateQueue,i.updateQueue=r,Sf(i,r),i.subtreeFlags=0,r=l,l=i.child;l!==null;)R0(l,r),l=l.sibling;return re(on,on.current&1|2),bt&&wi(i,d.treeForkCount),i.child}r=r.sibling}d.tail!==null&&wt()>Rf&&(i.flags|=128,g=!0,Wu(d,!1),i.lanes=4194304)}else{if(!g)if(r=ff(y),r!==null){if(i.flags|=128,g=!0,r=r.updateQueue,i.updateQueue=r,Sf(i,r),Wu(d,!0),d.tail===null&&d.tailMode==="hidden"&&!y.alternate&&!bt)return Kt(i),null}else 2*wt()-d.renderingStartTime>Rf&&l!==536870912&&(i.flags|=128,g=!0,Wu(d,!1),i.lanes=4194304);d.isBackwards?(y.sibling=i.child,i.child=y):(r=d.last,r!==null?r.sibling=y:i.child=y,d.last=y)}return d.tail!==null?(r=d.tail,d.rendering=r,d.tail=r.sibling,d.renderingStartTime=wt(),r.sibling=null,l=on.current,re(on,g?l&1|2:l&1),bt&&wi(i,d.treeForkCount),r):(Kt(i),null);case 22:case 23:return Rs(i),$g(),d=i.memoizedState!==null,r!==null?r.memoizedState!==null!==d&&(i.flags|=8192):d&&(i.flags|=8192),d?(l&536870912)!==0&&(i.flags&128)===0&&(Kt(i),i.subtreeFlags&6&&(i.flags|=8192)):Kt(i),l=i.updateQueue,l!==null&&Sf(i,l.retryQueue),l=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),d=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(d=i.memoizedState.cachePool.pool),d!==l&&(i.flags|=2048),r!==null&&B(Do),null;case 24:return l=null,r!==null&&(l=r.memoizedState.cache),i.memoizedState.cache!==l&&(i.flags|=2048),ki(vn),Kt(i),null;case 25:return null;case 30:return null}throw Error(s(156,i.tag))}function $R(r,i){switch(Ag(i),i.tag){case 1:return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 3:return ki(vn),Re(),r=i.flags,(r&65536)!==0&&(r&128)===0?(i.flags=r&-65537|128,i):null;case 26:case 27:case 5:return $e(i),null;case 31:if(i.memoizedState!==null){if(Rs(i),i.alternate===null)throw Error(s(340));Io()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 13:if(Rs(i),r=i.memoizedState,r!==null&&r.dehydrated!==null){if(i.alternate===null)throw Error(s(340));Io()}return r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 19:return B(on),null;case 4:return Re(),null;case 10:return ki(i.type),null;case 22:case 23:return Rs(i),$g(),r!==null&&B(Do),r=i.flags,r&65536?(i.flags=r&-65537|128,i):null;case 24:return ki(vn),null;case 25:return null;default:return null}}function r1(r,i){switch(Ag(i),i.tag){case 3:ki(vn),Re();break;case 26:case 27:case 5:$e(i);break;case 4:Re();break;case 31:i.memoizedState!==null&&Rs(i);break;case 13:Rs(i);break;case 19:B(on);break;case 10:ki(i.type);break;case 22:case 23:Rs(i),$g(),r!==null&&B(Do);break;case 24:ki(vn)}}function Xu(r,i){try{var l=i.updateQueue,d=l!==null?l.lastEffect:null;if(d!==null){var g=d.next;l=g;do{if((l.tag&r)===r){d=void 0;var y=l.create,E=l.inst;d=y(),E.destroy=d}l=l.next}while(l!==g)}}catch(M){It(i,i.return,M)}}function Ta(r,i,l){try{var d=i.updateQueue,g=d!==null?d.lastEffect:null;if(g!==null){var y=g.next;d=y;do{if((d.tag&r)===r){var E=d.inst,M=E.destroy;if(M!==void 0){E.destroy=void 0,g=i;var K=l,ee=M;try{ee()}catch(ge){It(g,K,ge)}}}d=d.next}while(d!==y)}}catch(ge){It(i,i.return,ge)}}function i1(r){var i=r.updateQueue;if(i!==null){var l=r.stateNode;try{W0(i,l)}catch(d){It(r,r.return,d)}}}function a1(r,i,l){l.props=Vo(r.type,r.memoizedProps),l.state=r.memoizedState;try{l.componentWillUnmount()}catch(d){It(r,i,d)}}function Qu(r,i){try{var l=r.ref;if(l!==null){switch(r.tag){case 26:case 27:case 5:var d=r.stateNode;break;case 30:d=r.stateNode;break;default:d=r.stateNode}typeof l=="function"?r.refCleanup=l(d):l.current=d}}catch(g){It(r,i,g)}}function Zr(r,i){var l=r.ref,d=r.refCleanup;if(l!==null)if(typeof d=="function")try{d()}catch(g){It(r,i,g)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){It(r,i,g)}else l.current=null}function o1(r){var i=r.type,l=r.memoizedProps,d=r.stateNode;try{e:switch(i){case"button":case"input":case"select":case"textarea":l.autoFocus&&d.focus();break e;case"img":l.src?d.src=l.src:l.srcSet&&(d.srcset=l.srcSet)}}catch(g){It(r,r.return,g)}}function wy(r,i,l){try{var d=r.stateNode;hI(d,r.type,l,i),d[Mn]=i}catch(g){It(r,r.return,g)}}function l1(r){return r.tag===5||r.tag===3||r.tag===26||r.tag===27&&Ia(r.type)||r.tag===4}function Ey(r){e:for(;;){for(;r.sibling===null;){if(r.return===null||l1(r.return))return null;r=r.return}for(r.sibling.return=r.return,r=r.sibling;r.tag!==5&&r.tag!==6&&r.tag!==18;){if(r.tag===27&&Ia(r.type)||r.flags&2||r.child===null||r.tag===4)continue e;r.child.return=r,r=r.child}if(!(r.flags&2))return r.stateNode}}function ky(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(r,i):(i=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,i.appendChild(r),l=l._reactRootContainer,l!=null||i.onclick!==null||(i.onclick=gr));else if(d!==4&&(d===27&&Ia(r.type)&&(l=r.stateNode,i=null),r=r.child,r!==null))for(ky(r,i,l),r=r.sibling;r!==null;)ky(r,i,l),r=r.sibling}function Nf(r,i,l){var d=r.tag;if(d===5||d===6)r=r.stateNode,i?l.insertBefore(r,i):l.appendChild(r);else if(d!==4&&(d===27&&Ia(r.type)&&(l=r.stateNode),r=r.child,r!==null))for(Nf(r,i,l),r=r.sibling;r!==null;)Nf(r,i,l),r=r.sibling}function c1(r){var i=r.stateNode,l=r.memoizedProps;try{for(var d=r.type,g=i.attributes;g.length;)i.removeAttributeNode(g[0]);Kn(i,d,l),i[yn]=r,i[Mn]=l}catch(y){It(r,r.return,y)}}var Ai=!1,En=!1,Ty=!1,u1=typeof WeakSet=="function"?WeakSet:Set,Dn=null;function qR(r,i){if(r=r.containerInfo,Hy=Yf,r=w0(r),bg(r)){if("selectionStart"in r)var l={start:r.selectionStart,end:r.selectionEnd};else e:{l=(l=r.ownerDocument)&&l.defaultView||window;var d=l.getSelection&&l.getSelection();if(d&&d.rangeCount!==0){l=d.anchorNode;var g=d.anchorOffset,y=d.focusNode;d=d.focusOffset;try{l.nodeType,y.nodeType}catch{l=null;break e}var E=0,M=-1,K=-1,ee=0,ge=0,xe=r,ne=null;t:for(;;){for(var ue;xe!==l||g!==0&&xe.nodeType!==3||(M=E+g),xe!==y||d!==0&&xe.nodeType!==3||(K=E+d),xe.nodeType===3&&(E+=xe.nodeValue.length),(ue=xe.firstChild)!==null;)ne=xe,xe=ue;for(;;){if(xe===r)break t;if(ne===l&&++ee===g&&(M=E),ne===y&&++ge===d&&(K=E),(ue=xe.nextSibling)!==null)break;xe=ne,ne=xe.parentNode}xe=ue}l=M===-1||K===-1?null:{start:M,end:K}}else l=null}l=l||{start:0,end:0}}else l=null;for(Gy={focusedElem:r,selectionRange:l},Yf=!1,Dn=i;Dn!==null;)if(i=Dn,r=i.child,(i.subtreeFlags&1028)!==0&&r!==null)r.return=i,Dn=r;else for(;Dn!==null;){switch(i=Dn,y=i.alternate,r=i.flags,i.tag){case 0:if((r&4)!==0&&(r=i.updateQueue,r=r!==null?r.events:null,r!==null))for(l=0;l<r.length;l++)g=r[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((r&1024)!==0&&y!==null){r=void 0,l=i,g=y.memoizedProps,y=y.memoizedState,d=l.stateNode;try{var Pe=Vo(l.type,g);r=d.getSnapshotBeforeUpdate(Pe,y),d.__reactInternalSnapshotBeforeUpdate=r}catch(qe){It(l,l.return,qe)}}break;case 3:if((r&1024)!==0){if(r=i.stateNode.containerInfo,l=r.nodeType,l===9)Xy(r);else if(l===1)switch(r.nodeName){case"HEAD":case"HTML":case"BODY":Xy(r);break;default:r.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((r&1024)!==0)throw Error(s(163))}if(r=i.sibling,r!==null){r.return=i.return,Dn=r;break}Dn=i.return}}function d1(r,i,l){var d=l.flags;switch(l.tag){case 0:case 11:case 15:Ri(r,l),d&4&&Xu(5,l);break;case 1:if(Ri(r,l),d&4)if(r=l.stateNode,i===null)try{r.componentDidMount()}catch(E){It(l,l.return,E)}else{var g=Vo(l.type,i.memoizedProps);i=i.memoizedState;try{r.componentDidUpdate(g,i,r.__reactInternalSnapshotBeforeUpdate)}catch(E){It(l,l.return,E)}}d&64&&i1(l),d&512&&Qu(l,l.return);break;case 3:if(Ri(r,l),d&64&&(r=l.updateQueue,r!==null)){if(i=null,l.child!==null)switch(l.child.tag){case 27:case 5:i=l.child.stateNode;break;case 1:i=l.child.stateNode}try{W0(r,i)}catch(E){It(l,l.return,E)}}break;case 27:i===null&&d&4&&c1(l);case 26:case 5:Ri(r,l),i===null&&d&4&&o1(l),d&512&&Qu(l,l.return);break;case 12:Ri(r,l);break;case 31:Ri(r,l),d&4&&m1(r,l);break;case 13:Ri(r,l),d&4&&p1(r,l),d&64&&(r=l.memoizedState,r!==null&&(r=r.dehydrated,r!==null&&(l=eI.bind(null,l),vI(r,l))));break;case 22:if(d=l.memoizedState!==null||Ai,!d){i=i!==null&&i.memoizedState!==null||En,g=Ai;var y=En;Ai=d,(En=i)&&!y?Ii(r,l,(l.subtreeFlags&8772)!==0):Ri(r,l),Ai=g,En=y}break;case 30:break;default:Ri(r,l)}}function h1(r){var i=r.alternate;i!==null&&(r.alternate=null,h1(i)),r.child=null,r.deletions=null,r.sibling=null,r.tag===5&&(i=r.stateNode,i!==null&&Al(i)),r.stateNode=null,r.return=null,r.dependencies=null,r.memoizedProps=null,r.memoizedState=null,r.pendingProps=null,r.stateNode=null,r.updateQueue=null}var Gt=null,ms=!1;function Ci(r,i,l){for(l=l.child;l!==null;)f1(r,i,l),l=l.sibling}function f1(r,i,l){if(Xe&&typeof Xe.onCommitFiberUnmount=="function")try{Xe.onCommitFiberUnmount(Oe,l)}catch{}switch(l.tag){case 26:En||Zr(l,i),Ci(r,i,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:En||Zr(l,i);var d=Gt,g=ms;Ia(l.type)&&(Gt=l.stateNode,ms=!1),Ci(r,i,l),ad(l.stateNode),Gt=d,ms=g;break;case 5:En||Zr(l,i);case 6:if(d=Gt,g=ms,Gt=null,Ci(r,i,l),Gt=d,ms=g,Gt!==null)if(ms)try{(Gt.nodeType===9?Gt.body:Gt.nodeName==="HTML"?Gt.ownerDocument.body:Gt).removeChild(l.stateNode)}catch(y){It(l,i,y)}else try{Gt.removeChild(l.stateNode)}catch(y){It(l,i,y)}break;case 18:Gt!==null&&(ms?(r=Gt,iE(r.nodeType===9?r.body:r.nodeName==="HTML"?r.ownerDocument.body:r,l.stateNode),fc(r)):iE(Gt,l.stateNode));break;case 4:d=Gt,g=ms,Gt=l.stateNode.containerInfo,ms=!0,Ci(r,i,l),Gt=d,ms=g;break;case 0:case 11:case 14:case 15:Ta(2,l,i),En||Ta(4,l,i),Ci(r,i,l);break;case 1:En||(Zr(l,i),d=l.stateNode,typeof d.componentWillUnmount=="function"&&a1(l,i,d)),Ci(r,i,l);break;case 21:Ci(r,i,l);break;case 22:En=(d=En)||l.memoizedState!==null,Ci(r,i,l),En=d;break;default:Ci(r,i,l)}}function m1(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null))){r=r.dehydrated;try{fc(r)}catch(l){It(i,i.return,l)}}}function p1(r,i){if(i.memoizedState===null&&(r=i.alternate,r!==null&&(r=r.memoizedState,r!==null&&(r=r.dehydrated,r!==null))))try{fc(r)}catch(l){It(i,i.return,l)}}function HR(r){switch(r.tag){case 31:case 13:case 19:var i=r.stateNode;return i===null&&(i=r.stateNode=new u1),i;case 22:return r=r.stateNode,i=r._retryCache,i===null&&(i=r._retryCache=new u1),i;default:throw Error(s(435,r.tag))}}function jf(r,i){var l=HR(r);i.forEach(function(d){if(!l.has(d)){l.add(d);var g=tI.bind(null,r,d);d.then(g,g)}})}function ps(r,i){var l=i.deletions;if(l!==null)for(var d=0;d<l.length;d++){var g=l[d],y=r,E=i,M=E;e:for(;M!==null;){switch(M.tag){case 27:if(Ia(M.type)){Gt=M.stateNode,ms=!1;break e}break;case 5:Gt=M.stateNode,ms=!1;break e;case 3:case 4:Gt=M.stateNode.containerInfo,ms=!0;break e}M=M.return}if(Gt===null)throw Error(s(160));f1(y,E,g),Gt=null,ms=!1,y=g.alternate,y!==null&&(y.return=null),g.return=null}if(i.subtreeFlags&13886)for(i=i.child;i!==null;)g1(i,r),i=i.sibling}var wr=null;function g1(r,i){var l=r.alternate,d=r.flags;switch(r.tag){case 0:case 11:case 14:case 15:ps(i,r),gs(r),d&4&&(Ta(3,r,r.return),Xu(3,r),Ta(5,r,r.return));break;case 1:ps(i,r),gs(r),d&512&&(En||l===null||Zr(l,l.return)),d&64&&Ai&&(r=r.updateQueue,r!==null&&(d=r.callbacks,d!==null&&(l=r.shared.hiddenCallbacks,r.shared.hiddenCallbacks=l===null?d:l.concat(d))));break;case 26:var g=wr;if(ps(i,r),gs(r),d&512&&(En||l===null||Zr(l,l.return)),d&4){var y=l!==null?l.memoizedState:null;if(d=r.memoizedState,l===null)if(d===null)if(r.stateNode===null){e:{d=r.type,l=r.memoizedProps,g=g.ownerDocument||g;t:switch(d){case"title":y=g.getElementsByTagName("title")[0],(!y||y[Fr]||y[yn]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=g.createElement(d),g.head.insertBefore(y,g.querySelector("head > title"))),Kn(y,d,l),y[yn]=r,bn(y),d=y;break e;case"link":var E=gE("link","href",g).get(d+(l.href||""));if(E){for(var M=0;M<E.length;M++)if(y=E[M],y.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&y.getAttribute("rel")===(l.rel==null?null:l.rel)&&y.getAttribute("title")===(l.title==null?null:l.title)&&y.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){E.splice(M,1);break t}}y=g.createElement(d),Kn(y,d,l),g.head.appendChild(y);break;case"meta":if(E=gE("meta","content",g).get(d+(l.content||""))){for(M=0;M<E.length;M++)if(y=E[M],y.getAttribute("content")===(l.content==null?null:""+l.content)&&y.getAttribute("name")===(l.name==null?null:l.name)&&y.getAttribute("property")===(l.property==null?null:l.property)&&y.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&y.getAttribute("charset")===(l.charSet==null?null:l.charSet)){E.splice(M,1);break t}}y=g.createElement(d),Kn(y,d,l),g.head.appendChild(y);break;default:throw Error(s(468,d))}y[yn]=r,bn(y),d=y}r.stateNode=d}else yE(g,r.type,r.stateNode);else r.stateNode=pE(g,d,r.memoizedProps);else y!==d?(y===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):y.count--,d===null?yE(g,r.type,r.stateNode):pE(g,d,r.memoizedProps)):d===null&&r.stateNode!==null&&wy(r,r.memoizedProps,l.memoizedProps)}break;case 27:ps(i,r),gs(r),d&512&&(En||l===null||Zr(l,l.return)),l!==null&&d&4&&wy(r,r.memoizedProps,l.memoizedProps);break;case 5:if(ps(i,r),gs(r),d&512&&(En||l===null||Zr(l,l.return)),r.flags&32){g=r.stateNode;try{fs(g,"")}catch(Pe){It(r,r.return,Pe)}}d&4&&r.stateNode!=null&&(g=r.memoizedProps,wy(r,g,l!==null?l.memoizedProps:g)),d&1024&&(Ty=!0);break;case 6:if(ps(i,r),gs(r),d&4){if(r.stateNode===null)throw Error(s(162));d=r.memoizedProps,l=r.stateNode;try{l.nodeValue=d}catch(Pe){It(r,r.return,Pe)}}break;case 3:if($f=null,g=wr,wr=Bf(i.containerInfo),ps(i,r),wr=g,gs(r),d&4&&l!==null&&l.memoizedState.isDehydrated)try{fc(i.containerInfo)}catch(Pe){It(r,r.return,Pe)}Ty&&(Ty=!1,y1(r));break;case 4:d=wr,wr=Bf(r.stateNode.containerInfo),ps(i,r),gs(r),wr=d;break;case 12:ps(i,r),gs(r);break;case 31:ps(i,r),gs(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,jf(r,d)));break;case 13:ps(i,r),gs(r),r.child.flags&8192&&r.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Cf=wt()),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,jf(r,d)));break;case 22:g=r.memoizedState!==null;var K=l!==null&&l.memoizedState!==null,ee=Ai,ge=En;if(Ai=ee||g,En=ge||K,ps(i,r),En=ge,Ai=ee,gs(r),d&8192)e:for(i=r.stateNode,i._visibility=g?i._visibility&-2:i._visibility|1,g&&(l===null||K||Ai||En||zo(r)),l=null,i=r;;){if(i.tag===5||i.tag===26){if(l===null){K=l=i;try{if(y=K.stateNode,g)E=y.style,typeof E.setProperty=="function"?E.setProperty("display","none","important"):E.display="none";else{M=K.stateNode;var xe=K.memoizedProps.style,ne=xe!=null&&xe.hasOwnProperty("display")?xe.display:null;M.style.display=ne==null||typeof ne=="boolean"?"":(""+ne).trim()}}catch(Pe){It(K,K.return,Pe)}}}else if(i.tag===6){if(l===null){K=i;try{K.stateNode.nodeValue=g?"":K.memoizedProps}catch(Pe){It(K,K.return,Pe)}}}else if(i.tag===18){if(l===null){K=i;try{var ue=K.stateNode;g?aE(ue,!0):aE(K.stateNode,!1)}catch(Pe){It(K,K.return,Pe)}}}else if((i.tag!==22&&i.tag!==23||i.memoizedState===null||i===r)&&i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break e;for(;i.sibling===null;){if(i.return===null||i.return===r)break e;l===i&&(l=null),i=i.return}l===i&&(l=null),i.sibling.return=i.return,i=i.sibling}d&4&&(d=r.updateQueue,d!==null&&(l=d.retryQueue,l!==null&&(d.retryQueue=null,jf(r,l))));break;case 19:ps(i,r),gs(r),d&4&&(d=r.updateQueue,d!==null&&(r.updateQueue=null,jf(r,d)));break;case 30:break;case 21:break;default:ps(i,r),gs(r)}}function gs(r){var i=r.flags;if(i&2){try{for(var l,d=r.return;d!==null;){if(l1(d)){l=d;break}d=d.return}if(l==null)throw Error(s(160));switch(l.tag){case 27:var g=l.stateNode,y=Ey(r);Nf(r,y,g);break;case 5:var E=l.stateNode;l.flags&32&&(fs(E,""),l.flags&=-33);var M=Ey(r);Nf(r,M,E);break;case 3:case 4:var K=l.stateNode.containerInfo,ee=Ey(r);ky(r,ee,K);break;default:throw Error(s(161))}}catch(ge){It(r,r.return,ge)}r.flags&=-3}i&4096&&(r.flags&=-4097)}function y1(r){if(r.subtreeFlags&1024)for(r=r.child;r!==null;){var i=r;y1(i),i.tag===5&&i.flags&1024&&i.stateNode.reset(),r=r.sibling}}function Ri(r,i){if(i.subtreeFlags&8772)for(i=i.child;i!==null;)d1(r,i.alternate,i),i=i.sibling}function zo(r){for(r=r.child;r!==null;){var i=r;switch(i.tag){case 0:case 11:case 14:case 15:Ta(4,i,i.return),zo(i);break;case 1:Zr(i,i.return);var l=i.stateNode;typeof l.componentWillUnmount=="function"&&a1(i,i.return,l),zo(i);break;case 27:ad(i.stateNode);case 26:case 5:Zr(i,i.return),zo(i);break;case 22:i.memoizedState===null&&zo(i);break;case 30:zo(i);break;default:zo(i)}r=r.sibling}}function Ii(r,i,l){for(l=l&&(i.subtreeFlags&8772)!==0,i=i.child;i!==null;){var d=i.alternate,g=r,y=i,E=y.flags;switch(y.tag){case 0:case 11:case 15:Ii(g,y,l),Xu(4,y);break;case 1:if(Ii(g,y,l),d=y,g=d.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(ee){It(d,d.return,ee)}if(d=y,g=d.updateQueue,g!==null){var M=d.stateNode;try{var K=g.shared.hiddenCallbacks;if(K!==null)for(g.shared.hiddenCallbacks=null,g=0;g<K.length;g++)Y0(K[g],M)}catch(ee){It(d,d.return,ee)}}l&&E&64&&i1(y),Qu(y,y.return);break;case 27:c1(y);case 26:case 5:Ii(g,y,l),l&&d===null&&E&4&&o1(y),Qu(y,y.return);break;case 12:Ii(g,y,l);break;case 31:Ii(g,y,l),l&&E&4&&m1(g,y);break;case 13:Ii(g,y,l),l&&E&4&&p1(g,y);break;case 22:y.memoizedState===null&&Ii(g,y,l),Qu(y,y.return);break;case 30:break;default:Ii(g,y,l)}i=i.sibling}}function Sy(r,i){var l=null;r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(l=r.memoizedState.cachePool.pool),r=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(r=i.memoizedState.cachePool.pool),r!==l&&(r!=null&&r.refCount++,l!=null&&Lu(l))}function Ny(r,i){r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Lu(r))}function Er(r,i,l,d){if(i.subtreeFlags&10256)for(i=i.child;i!==null;)b1(r,i,l,d),i=i.sibling}function b1(r,i,l,d){var g=i.flags;switch(i.tag){case 0:case 11:case 15:Er(r,i,l,d),g&2048&&Xu(9,i);break;case 1:Er(r,i,l,d);break;case 3:Er(r,i,l,d),g&2048&&(r=null,i.alternate!==null&&(r=i.alternate.memoizedState.cache),i=i.memoizedState.cache,i!==r&&(i.refCount++,r!=null&&Lu(r)));break;case 12:if(g&2048){Er(r,i,l,d),r=i.stateNode;try{var y=i.memoizedProps,E=y.id,M=y.onPostCommit;typeof M=="function"&&M(E,i.alternate===null?"mount":"update",r.passiveEffectDuration,-0)}catch(K){It(i,i.return,K)}}else Er(r,i,l,d);break;case 31:Er(r,i,l,d);break;case 13:Er(r,i,l,d);break;case 23:break;case 22:y=i.stateNode,E=i.alternate,i.memoizedState!==null?y._visibility&2?Er(r,i,l,d):Ju(r,i):y._visibility&2?Er(r,i,l,d):(y._visibility|=2,nc(r,i,l,d,(i.subtreeFlags&10256)!==0||!1)),g&2048&&Sy(E,i);break;case 24:Er(r,i,l,d),g&2048&&Ny(i.alternate,i);break;default:Er(r,i,l,d)}}function nc(r,i,l,d,g){for(g=g&&((i.subtreeFlags&10256)!==0||!1),i=i.child;i!==null;){var y=r,E=i,M=l,K=d,ee=E.flags;switch(E.tag){case 0:case 11:case 15:nc(y,E,M,K,g),Xu(8,E);break;case 23:break;case 22:var ge=E.stateNode;E.memoizedState!==null?ge._visibility&2?nc(y,E,M,K,g):Ju(y,E):(ge._visibility|=2,nc(y,E,M,K,g)),g&&ee&2048&&Sy(E.alternate,E);break;case 24:nc(y,E,M,K,g),g&&ee&2048&&Ny(E.alternate,E);break;default:nc(y,E,M,K,g)}i=i.sibling}}function Ju(r,i){if(i.subtreeFlags&10256)for(i=i.child;i!==null;){var l=r,d=i,g=d.flags;switch(d.tag){case 22:Ju(l,d),g&2048&&Sy(d.alternate,d);break;case 24:Ju(l,d),g&2048&&Ny(d.alternate,d);break;default:Ju(l,d)}i=i.sibling}}var Zu=8192;function sc(r,i,l){if(r.subtreeFlags&Zu)for(r=r.child;r!==null;)x1(r,i,l),r=r.sibling}function x1(r,i,l){switch(r.tag){case 26:sc(r,i,l),r.flags&Zu&&r.memoizedState!==null&&II(l,wr,r.memoizedState,r.memoizedProps);break;case 5:sc(r,i,l);break;case 3:case 4:var d=wr;wr=Bf(r.stateNode.containerInfo),sc(r,i,l),wr=d;break;case 22:r.memoizedState===null&&(d=r.alternate,d!==null&&d.memoizedState!==null?(d=Zu,Zu=16777216,sc(r,i,l),Zu=d):sc(r,i,l));break;default:sc(r,i,l)}}function v1(r){var i=r.alternate;if(i!==null&&(r=i.child,r!==null)){i.child=null;do i=r.sibling,r.sibling=null,r=i;while(r!==null)}}function ed(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Dn=d,w1(d,r)}v1(r)}if(r.subtreeFlags&10256)for(r=r.child;r!==null;)_1(r),r=r.sibling}function _1(r){switch(r.tag){case 0:case 11:case 15:ed(r),r.flags&2048&&Ta(9,r,r.return);break;case 3:ed(r);break;case 12:ed(r);break;case 22:var i=r.stateNode;r.memoizedState!==null&&i._visibility&2&&(r.return===null||r.return.tag!==13)?(i._visibility&=-3,Af(r)):ed(r);break;default:ed(r)}}function Af(r){var i=r.deletions;if((r.flags&16)!==0){if(i!==null)for(var l=0;l<i.length;l++){var d=i[l];Dn=d,w1(d,r)}v1(r)}for(r=r.child;r!==null;){switch(i=r,i.tag){case 0:case 11:case 15:Ta(8,i,i.return),Af(i);break;case 22:l=i.stateNode,l._visibility&2&&(l._visibility&=-3,Af(i));break;default:Af(i)}r=r.sibling}}function w1(r,i){for(;Dn!==null;){var l=Dn;switch(l.tag){case 0:case 11:case 15:Ta(8,l,i);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var d=l.memoizedState.cachePool.pool;d!=null&&d.refCount++}break;case 24:Lu(l.memoizedState.cache)}if(d=l.child,d!==null)d.return=l,Dn=d;else e:for(l=r;Dn!==null;){d=Dn;var g=d.sibling,y=d.return;if(h1(d),d===l){Dn=null;break e}if(g!==null){g.return=y,Dn=g;break e}Dn=y}}}var GR={getCacheForType:function(r){var i=zn(vn),l=i.data.get(r);return l===void 0&&(l=r(),i.data.set(r,l)),l},cacheSignal:function(){return zn(vn).controller.signal}},YR=typeof WeakMap=="function"?WeakMap:Map,St=0,Ft=null,dt=null,mt=0,Rt=0,Is=null,Sa=!1,rc=!1,jy=!1,Mi=0,en=0,Na=0,Bo=0,Ay=0,Ms=0,ic=0,td=null,ys=null,Cy=!1,Cf=0,E1=0,Rf=1/0,If=null,ja=null,jn=0,Aa=null,ac=null,Pi=0,Ry=0,Iy=null,k1=null,nd=0,My=null;function Ps(){return(St&2)!==0&&mt!==0?mt&-mt:W.T!==null?Fy():Ih()}function T1(){if(Ms===0)if((mt&536870912)===0||bt){var r=po;po<<=1,(po&3932160)===0&&(po=262144),Ms=r}else Ms=536870912;return r=Cs.current,r!==null&&(r.flags|=32),Ms}function bs(r,i,l){(r===Ft&&(Rt===2||Rt===9)||r.cancelPendingCommit!==null)&&(oc(r,0),Ca(r,mt,Ms,!1)),go(r,l),((St&2)===0||r!==Ft)&&(r===Ft&&((St&2)===0&&(Bo|=l),en===4&&Ca(r,mt,Ms,!1)),ei(r))}function S1(r,i,l){if((St&6)!==0)throw Error(s(327));var d=!l&&(i&127)===0&&(i&r.expiredLanes)===0||fr(r,i),g=d?QR(r,i):Dy(r,i,!0),y=d;do{if(g===0){rc&&!d&&Ca(r,i,0,!1);break}else{if(l=r.current.alternate,y&&!WR(l)){g=Dy(r,i,!1),y=!1;continue}if(g===2){if(y=i,r.errorRecoveryDisabledLanes&y)var E=0;else E=r.pendingLanes&-536870913,E=E!==0?E:E&536870912?536870912:0;if(E!==0){i=E;e:{var M=r;g=td;var K=M.current.memoizedState.isDehydrated;if(K&&(oc(M,E).flags|=256),E=Dy(M,E,!1),E!==2){if(jy&&!K){M.errorRecoveryDisabledLanes|=y,Bo|=y,g=4;break e}y=ys,ys=g,y!==null&&(ys===null?ys=y:ys.push.apply(ys,y))}g=E}if(y=!1,g!==2)continue}}if(g===1){oc(r,0),Ca(r,i,0,!0);break}e:{switch(d=r,y=g,y){case 0:case 1:throw Error(s(345));case 4:if((i&4194048)!==i)break;case 6:Ca(d,i,Ms,!Sa);break e;case 2:ys=null;break;case 3:case 5:break;default:throw Error(s(329))}if((i&62914560)===i&&(g=Cf+300-wt(),10<g)){if(Ca(d,i,Ms,!Sa),Or(d,0,!0)!==0)break e;Pi=i,d.timeoutHandle=sE(N1.bind(null,d,l,ys,If,Cy,i,Ms,Bo,ic,Sa,y,"Throttled",-0,0),g);break e}N1(d,l,ys,If,Cy,i,Ms,Bo,ic,Sa,y,null,-0,0)}}break}while(!0);ei(r)}function N1(r,i,l,d,g,y,E,M,K,ee,ge,xe,ne,ue){if(r.timeoutHandle=-1,xe=i.subtreeFlags,xe&8192||(xe&16785408)===16785408){xe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:gr},x1(i,y,xe);var Pe=(y&62914560)===y?Cf-wt():(y&4194048)===y?E1-wt():0;if(Pe=MI(xe,Pe),Pe!==null){Pi=y,r.cancelPendingCommit=Pe(D1.bind(null,r,i,y,l,d,g,E,M,K,ge,xe,null,ne,ue)),Ca(r,y,E,!ee);return}}D1(r,i,y,l,d,g,E,M,K)}function WR(r){for(var i=r;;){var l=i.tag;if((l===0||l===11||l===15)&&i.flags&16384&&(l=i.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var d=0;d<l.length;d++){var g=l[d],y=g.getSnapshot;g=g.value;try{if(!js(y(),g))return!1}catch{return!1}}if(l=i.child,i.subtreeFlags&16384&&l!==null)l.return=i,i=l;else{if(i===r)break;for(;i.sibling===null;){if(i.return===null||i.return===r)return!0;i=i.return}i.sibling.return=i.return,i=i.sibling}}return!0}function Ca(r,i,l,d){i&=~Ay,i&=~Bo,r.suspendedLanes|=i,r.pingedLanes&=~i,d&&(r.warmLanes|=i),d=r.expirationTimes;for(var g=i;0<g;){var y=31-jt(g),E=1<<y;d[y]=-1,g&=~E}l!==0&&yo(r,l,i)}function Mf(){return(St&6)===0?(sd(0),!1):!0}function Py(){if(dt!==null){if(Rt===0)var r=dt.return;else r=dt,Ei=Mo=null,Xg(r),Ql=null,Fu=0,r=dt;for(;r!==null;)r1(r.alternate,r),r=r.return;dt=null}}function oc(r,i){var l=r.timeoutHandle;l!==-1&&(r.timeoutHandle=-1,pI(l)),l=r.cancelPendingCommit,l!==null&&(r.cancelPendingCommit=null,l()),Pi=0,Py(),Ft=r,dt=l=_i(r.current,null),mt=i,Rt=0,Is=null,Sa=!1,rc=fr(r,i),jy=!1,ic=Ms=Ay=Bo=Na=en=0,ys=td=null,Cy=!1,(i&8)!==0&&(i|=i&32);var d=r.entangledLanes;if(d!==0)for(r=r.entanglements,d&=i;0<d;){var g=31-jt(d),y=1<<g;i|=r[g],d&=~y}return Mi=i,Zh(),l}function j1(r,i){it=null,W.H=Gu,i===Xl||i===lf?(i=$0(),Rt=3):i===Ug?(i=$0(),Rt=4):Rt=i===hy?8:i!==null&&typeof i=="object"&&typeof i.then=="function"?6:1,Is=i,dt===null&&(en=1,wf(r,Ws(i,r.current)))}function A1(){var r=Cs.current;return r===null?!0:(mt&4194048)===mt?Zs===null:(mt&62914560)===mt||(mt&536870912)!==0?r===Zs:!1}function C1(){var r=W.H;return W.H=Gu,r===null?Gu:r}function R1(){var r=W.A;return W.A=GR,r}function Pf(){en=4,Sa||(mt&4194048)!==mt&&Cs.current!==null||(rc=!0),(Na&134217727)===0&&(Bo&134217727)===0||Ft===null||Ca(Ft,mt,Ms,!1)}function Dy(r,i,l){var d=St;St|=2;var g=C1(),y=R1();(Ft!==r||mt!==i)&&(If=null,oc(r,i)),i=!1;var E=en;e:do try{if(Rt!==0&&dt!==null){var M=dt,K=Is;switch(Rt){case 8:Py(),E=6;break e;case 3:case 2:case 9:case 6:Cs.current===null&&(i=!0);var ee=Rt;if(Rt=0,Is=null,lc(r,M,K,ee),l&&rc){E=0;break e}break;default:ee=Rt,Rt=0,Is=null,lc(r,M,K,ee)}}XR(),E=en;break}catch(ge){j1(r,ge)}while(!0);return i&&r.shellSuspendCounter++,Ei=Mo=null,St=d,W.H=g,W.A=y,dt===null&&(Ft=null,mt=0,Zh()),E}function XR(){for(;dt!==null;)I1(dt)}function QR(r,i){var l=St;St|=2;var d=C1(),g=R1();Ft!==r||mt!==i?(If=null,Rf=wt()+500,oc(r,i)):rc=fr(r,i);e:do try{if(Rt!==0&&dt!==null){i=dt;var y=Is;t:switch(Rt){case 1:Rt=0,Is=null,lc(r,i,y,1);break;case 2:case 9:if(B0(y)){Rt=0,Is=null,M1(i);break}i=function(){Rt!==2&&Rt!==9||Ft!==r||(Rt=7),ei(r)},y.then(i,i);break e;case 3:Rt=7;break e;case 4:Rt=5;break e;case 7:B0(y)?(Rt=0,Is=null,M1(i)):(Rt=0,Is=null,lc(r,i,y,7));break;case 5:var E=null;switch(dt.tag){case 26:E=dt.memoizedState;case 5:case 27:var M=dt;if(E?bE(E):M.stateNode.complete){Rt=0,Is=null;var K=M.sibling;if(K!==null)dt=K;else{var ee=M.return;ee!==null?(dt=ee,Df(ee)):dt=null}break t}}Rt=0,Is=null,lc(r,i,y,5);break;case 6:Rt=0,Is=null,lc(r,i,y,6);break;case 8:Py(),en=6;break e;default:throw Error(s(462))}}JR();break}catch(ge){j1(r,ge)}while(!0);return Ei=Mo=null,W.H=d,W.A=g,St=l,dt!==null?0:(Ft=null,mt=0,Zh(),en)}function JR(){for(;dt!==null&&!sn();)I1(dt)}function I1(r){var i=n1(r.alternate,r,Mi);r.memoizedProps=r.pendingProps,i===null?Df(r):dt=i}function M1(r){var i=r,l=i.alternate;switch(i.tag){case 15:case 0:i=Xw(l,i,i.pendingProps,i.type,void 0,mt);break;case 11:i=Xw(l,i,i.pendingProps,i.type.render,i.ref,mt);break;case 5:Xg(i);default:r1(l,i),i=dt=R0(i,Mi),i=n1(l,i,Mi)}r.memoizedProps=r.pendingProps,i===null?Df(r):dt=i}function lc(r,i,l,d){Ei=Mo=null,Xg(i),Ql=null,Fu=0;var g=i.return;try{if(VR(r,g,i,l,mt)){en=1,wf(r,Ws(l,r.current)),dt=null;return}}catch(y){if(g!==null)throw dt=g,y;en=1,wf(r,Ws(l,r.current)),dt=null;return}i.flags&32768?(bt||d===1?r=!0:rc||(mt&536870912)!==0?r=!1:(Sa=r=!0,(d===2||d===9||d===3||d===6)&&(d=Cs.current,d!==null&&d.tag===13&&(d.flags|=16384))),P1(i,r)):Df(i)}function Df(r){var i=r;do{if((i.flags&32768)!==0){P1(i,Sa);return}r=i.return;var l=KR(i.alternate,i,Mi);if(l!==null){dt=l;return}if(i=i.sibling,i!==null){dt=i;return}dt=i=r}while(i!==null);en===0&&(en=5)}function P1(r,i){do{var l=$R(r.alternate,r);if(l!==null){l.flags&=32767,dt=l;return}if(l=r.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!i&&(r=r.sibling,r!==null)){dt=r;return}dt=r=l}while(r!==null);en=6,dt=null}function D1(r,i,l,d,g,y,E,M,K){r.cancelPendingCommit=null;do Of();while(jn!==0);if((St&6)!==0)throw Error(s(327));if(i!==null){if(i===r.current)throw Error(s(177));if(y=i.lanes|i.childLanes,y|=Eg,mg(r,l,y,E,M,K),r===Ft&&(dt=Ft=null,mt=0),ac=i,Aa=r,Pi=l,Ry=y,Iy=g,k1=d,(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?(r.callbackNode=null,r.callbackPriority=0,nI(te,function(){return V1(),null})):(r.callbackNode=null,r.callbackPriority=0),d=(i.flags&13878)!==0,(i.subtreeFlags&13878)!==0||d){d=W.T,W.T=null,g=J.p,J.p=2,E=St,St|=4;try{qR(r,i,l)}finally{St=E,J.p=g,W.T=d}}jn=1,O1(),L1(),U1()}}function O1(){if(jn===1){jn=0;var r=Aa,i=ac,l=(i.flags&13878)!==0;if((i.subtreeFlags&13878)!==0||l){l=W.T,W.T=null;var d=J.p;J.p=2;var g=St;St|=4;try{g1(i,r);var y=Gy,E=w0(r.containerInfo),M=y.focusedElem,K=y.selectionRange;if(E!==M&&M&&M.ownerDocument&&_0(M.ownerDocument.documentElement,M)){if(K!==null&&bg(M)){var ee=K.start,ge=K.end;if(ge===void 0&&(ge=ee),"selectionStart"in M)M.selectionStart=ee,M.selectionEnd=Math.min(ge,M.value.length);else{var xe=M.ownerDocument||document,ne=xe&&xe.defaultView||window;if(ne.getSelection){var ue=ne.getSelection(),Pe=M.textContent.length,qe=Math.min(K.start,Pe),Ot=K.end===void 0?qe:Math.min(K.end,Pe);!ue.extend&&qe>Ot&&(E=Ot,Ot=qe,qe=E);var X=v0(M,qe),G=v0(M,Ot);if(X&&G&&(ue.rangeCount!==1||ue.anchorNode!==X.node||ue.anchorOffset!==X.offset||ue.focusNode!==G.node||ue.focusOffset!==G.offset)){var Z=xe.createRange();Z.setStart(X.node,X.offset),ue.removeAllRanges(),qe>Ot?(ue.addRange(Z),ue.extend(G.node,G.offset)):(Z.setEnd(G.node,G.offset),ue.addRange(Z))}}}}for(xe=[],ue=M;ue=ue.parentNode;)ue.nodeType===1&&xe.push({element:ue,left:ue.scrollLeft,top:ue.scrollTop});for(typeof M.focus=="function"&&M.focus(),M=0;M<xe.length;M++){var be=xe[M];be.element.scrollLeft=be.left,be.element.scrollTop=be.top}}Yf=!!Hy,Gy=Hy=null}finally{St=g,J.p=d,W.T=l}}r.current=i,jn=2}}function L1(){if(jn===2){jn=0;var r=Aa,i=ac,l=(i.flags&8772)!==0;if((i.subtreeFlags&8772)!==0||l){l=W.T,W.T=null;var d=J.p;J.p=2;var g=St;St|=4;try{d1(r,i.alternate,i)}finally{St=g,J.p=d,W.T=l}}jn=3}}function U1(){if(jn===4||jn===3){jn=0,pn();var r=Aa,i=ac,l=Pi,d=k1;(i.subtreeFlags&10256)!==0||(i.flags&10256)!==0?jn=5:(jn=0,ac=Aa=null,F1(r,r.pendingLanes));var g=r.pendingLanes;if(g===0&&(ja=null),yi(l),i=i.stateNode,Xe&&typeof Xe.onCommitFiberRoot=="function")try{Xe.onCommitFiberRoot(Oe,i,void 0,(i.current.flags&128)===128)}catch{}if(d!==null){i=W.T,g=J.p,J.p=2,W.T=null;try{for(var y=r.onRecoverableError,E=0;E<d.length;E++){var M=d[E];y(M.value,{componentStack:M.stack})}}finally{W.T=i,J.p=g}}(Pi&3)!==0&&Of(),ei(r),g=r.pendingLanes,(l&261930)!==0&&(g&42)!==0?r===My?nd++:(nd=0,My=r):nd=0,sd(0)}}function F1(r,i){(r.pooledCacheLanes&=i)===0&&(i=r.pooledCache,i!=null&&(r.pooledCache=null,Lu(i)))}function Of(){return O1(),L1(),U1(),V1()}function V1(){if(jn!==5)return!1;var r=Aa,i=Ry;Ry=0;var l=yi(Pi),d=W.T,g=J.p;try{J.p=32>l?32:l,W.T=null,l=Iy,Iy=null;var y=Aa,E=Pi;if(jn=0,ac=Aa=null,Pi=0,(St&6)!==0)throw Error(s(331));var M=St;if(St|=4,_1(y.current),b1(y,y.current,E,l),St=M,sd(0,!1),Xe&&typeof Xe.onPostCommitFiberRoot=="function")try{Xe.onPostCommitFiberRoot(Oe,y)}catch{}return!0}finally{J.p=g,W.T=d,F1(r,i)}}function z1(r,i,l){i=Ws(l,i),i=dy(r.stateNode,i,2),r=wa(r,i,2),r!==null&&(go(r,2),ei(r))}function It(r,i,l){if(r.tag===3)z1(r,r,l);else for(;i!==null;){if(i.tag===3){z1(i,r,l);break}else if(i.tag===1){var d=i.stateNode;if(typeof i.type.getDerivedStateFromError=="function"||typeof d.componentDidCatch=="function"&&(ja===null||!ja.has(d))){r=Ws(l,r),l=Bw(2),d=wa(i,l,2),d!==null&&(Kw(l,d,i,r),go(d,2),ei(d));break}}i=i.return}}function Oy(r,i,l){var d=r.pingCache;if(d===null){d=r.pingCache=new YR;var g=new Set;d.set(i,g)}else g=d.get(i),g===void 0&&(g=new Set,d.set(i,g));g.has(l)||(jy=!0,g.add(l),r=ZR.bind(null,r,i,l),i.then(r,r))}function ZR(r,i,l){var d=r.pingCache;d!==null&&d.delete(i),r.pingedLanes|=r.suspendedLanes&l,r.warmLanes&=~l,Ft===r&&(mt&l)===l&&(en===4||en===3&&(mt&62914560)===mt&&300>wt()-Cf?(St&2)===0&&oc(r,0):Ay|=l,ic===mt&&(ic=0)),ei(r)}function B1(r,i){i===0&&(i=Rh()),r=Co(r,i),r!==null&&(go(r,i),ei(r))}function eI(r){var i=r.memoizedState,l=0;i!==null&&(l=i.retryLane),B1(r,l)}function tI(r,i){var l=0;switch(r.tag){case 31:case 13:var d=r.stateNode,g=r.memoizedState;g!==null&&(l=g.retryLane);break;case 19:d=r.stateNode;break;case 22:d=r.stateNode._retryCache;break;default:throw Error(s(314))}d!==null&&d.delete(i),B1(r,l)}function nI(r,i){return Me(r,i)}var Lf=null,cc=null,Ly=!1,Uf=!1,Uy=!1,Ra=0;function ei(r){r!==cc&&r.next===null&&(cc===null?Lf=cc=r:cc=cc.next=r),Uf=!0,Ly||(Ly=!0,rI())}function sd(r,i){if(!Uy&&Uf){Uy=!0;do for(var l=!1,d=Lf;d!==null;){if(r!==0){var g=d.pendingLanes;if(g===0)var y=0;else{var E=d.suspendedLanes,M=d.pingedLanes;y=(1<<31-jt(42|r)+1)-1,y&=g&~(E&~M),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(l=!0,H1(d,y))}else y=mt,y=Or(d,d===Ft?y:0,d.cancelPendingCommit!==null||d.timeoutHandle!==-1),(y&3)===0||fr(d,y)||(l=!0,H1(d,y));d=d.next}while(l);Uy=!1}}function sI(){K1()}function K1(){Uf=Ly=!1;var r=0;Ra!==0&&mI()&&(r=Ra);for(var i=wt(),l=null,d=Lf;d!==null;){var g=d.next,y=$1(d,i);y===0?(d.next=null,l===null?Lf=g:l.next=g,g===null&&(cc=l)):(l=d,(r!==0||(y&3)!==0)&&(Uf=!0)),d=g}jn!==0&&jn!==5||sd(r),Ra!==0&&(Ra=0)}function $1(r,i){for(var l=r.suspendedLanes,d=r.pingedLanes,g=r.expirationTimes,y=r.pendingLanes&-62914561;0<y;){var E=31-jt(y),M=1<<E,K=g[E];K===-1?((M&l)===0||(M&d)!==0)&&(g[E]=fg(M,i)):K<=i&&(r.expiredLanes|=M),y&=~M}if(i=Ft,l=mt,l=Or(r,r===i?l:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d=r.callbackNode,l===0||r===i&&(Rt===2||Rt===9)||r.cancelPendingCommit!==null)return d!==null&&d!==null&&ot(d),r.callbackNode=null,r.callbackPriority=0;if((l&3)===0||fr(r,l)){if(i=l&-l,i===r.callbackPriority)return i;switch(d!==null&&ot(d),yi(l)){case 2:case 8:l=lt;break;case 32:l=te;break;case 268435456:l=nt;break;default:l=te}return d=q1.bind(null,r),l=Me(l,d),r.callbackPriority=i,r.callbackNode=l,i}return d!==null&&d!==null&&ot(d),r.callbackPriority=2,r.callbackNode=null,2}function q1(r,i){if(jn!==0&&jn!==5)return r.callbackNode=null,r.callbackPriority=0,null;var l=r.callbackNode;if(Of()&&r.callbackNode!==l)return null;var d=mt;return d=Or(r,r===Ft?d:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),d===0?null:(S1(r,d,i),$1(r,wt()),r.callbackNode!=null&&r.callbackNode===l?q1.bind(null,r):null)}function H1(r,i){if(Of())return null;S1(r,i,!0)}function rI(){gI(function(){(St&6)!==0?Me(He,sI):K1()})}function Fy(){if(Ra===0){var r=Yl;r===0&&(r=Pr,Pr<<=1,(Pr&261888)===0&&(Pr=256)),Ra=r}return Ra}function G1(r){return r==null||typeof r=="symbol"||typeof r=="boolean"?null:typeof r=="function"?r:Ml(""+r)}function Y1(r,i){var l=i.ownerDocument.createElement("input");return l.name=i.name,l.value=i.value,r.id&&l.setAttribute("form",r.id),i.parentNode.insertBefore(l,i),r=new FormData(r),l.parentNode.removeChild(l),r}function iI(r,i,l,d,g){if(i==="submit"&&l&&l.stateNode===g){var y=G1((g[Mn]||null).action),E=d.submitter;E&&(i=(i=E[Mn]||null)?G1(i.formAction):E.getAttribute("formAction"),i!==null&&(y=i,E=null));var M=new Gr("action","action",null,d,g);r.push({event:M,listeners:[{instance:null,listener:function(){if(d.defaultPrevented){if(Ra!==0){var K=E?Y1(g,E):new FormData(g);iy(l,{pending:!0,data:K,method:g.method,action:y},null,K)}}else typeof y=="function"&&(M.preventDefault(),K=E?Y1(g,E):new FormData(g),iy(l,{pending:!0,data:K,method:g.method,action:y},y,K))},currentTarget:g}]})}}for(var Vy=0;Vy<wg.length;Vy++){var zy=wg[Vy],aI=zy.toLowerCase(),oI=zy[0].toUpperCase()+zy.slice(1);_r(aI,"on"+oI)}_r(T0,"onAnimationEnd"),_r(S0,"onAnimationIteration"),_r(N0,"onAnimationStart"),_r("dblclick","onDoubleClick"),_r("focusin","onFocus"),_r("focusout","onBlur"),_r(ER,"onTransitionRun"),_r(kR,"onTransitionStart"),_r(TR,"onTransitionCancel"),_r(j0,"onTransitionEnd"),Kr("onMouseEnter",["mouseout","mouseover"]),Kr("onMouseLeave",["mouseout","mouseover"]),Kr("onPointerEnter",["pointerout","pointerover"]),Kr("onPointerLeave",["pointerout","pointerover"]),Br("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Br("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Br("onBeforeInput",["compositionend","keypress","textInput","paste"]),Br("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Br("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Br("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var rd="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(" "),lI=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(rd));function W1(r,i){i=(i&4)!==0;for(var l=0;l<r.length;l++){var d=r[l],g=d.event;d=d.listeners;e:{var y=void 0;if(i)for(var E=d.length-1;0<=E;E--){var M=d[E],K=M.instance,ee=M.currentTarget;if(M=M.listener,K!==y&&g.isPropagationStopped())break e;y=M,g.currentTarget=ee;try{y(g)}catch(ge){Jh(ge)}g.currentTarget=null,y=K}else for(E=0;E<d.length;E++){if(M=d[E],K=M.instance,ee=M.currentTarget,M=M.listener,K!==y&&g.isPropagationStopped())break e;y=M,g.currentTarget=ee;try{y(g)}catch(ge){Jh(ge)}g.currentTarget=null,y=K}}}}function ht(r,i){var l=i[jl];l===void 0&&(l=i[jl]=new Set);var d=r+"__bubble";l.has(d)||(X1(i,r,2,!1),l.add(d))}function By(r,i,l){var d=0;i&&(d|=4),X1(l,r,d,i)}var Ff="_reactListening"+Math.random().toString(36).slice(2);function Ky(r){if(!r[Ff]){r[Ff]=!0,gu.forEach(function(l){l!=="selectionchange"&&(lI.has(l)||By(l,!1,r),By(l,!0,r))});var i=r.nodeType===9?r:r.ownerDocument;i===null||i[Ff]||(i[Ff]=!0,By("selectionchange",!1,i))}}function X1(r,i,l,d){switch(TE(i)){case 2:var g=OI;break;case 8:g=LI;break;default:g=rb}l=g.bind(null,i,l,r),g=void 0,!wo||i!=="touchstart"&&i!=="touchmove"&&i!=="wheel"||(g=!0),d?g!==void 0?r.addEventListener(i,l,{capture:!0,passive:g}):r.addEventListener(i,l,!0):g!==void 0?r.addEventListener(i,l,{passive:g}):r.addEventListener(i,l,!1)}function $y(r,i,l,d,g){var y=d;if((i&1)===0&&(i&2)===0&&d!==null)e:for(;;){if(d===null)return;var E=d.tag;if(E===3||E===4){var M=d.stateNode.containerInfo;if(M===g)break;if(E===4)for(E=d.return;E!==null;){var K=E.tag;if((K===3||K===4)&&E.stateNode.containerInfo===g)return;E=E.return}for(;M!==null;){if(E=Vr(M),E===null)return;if(K=E.tag,K===5||K===6||K===26||K===27){d=y=E;continue e}M=M.parentNode}}d=d.return}ha(function(){var ee=y,ge=qs(l),xe=[];e:{var ne=A0.get(r);if(ne!==void 0){var ue=Gr,Pe=r;switch(r){case"keypress":if(ko(l)===0)break e;case"keydown":case"keyup":ue=Wh;break;case"focusin":Pe="focus",ue=So;break;case"focusout":Pe="blur",ue=So;break;case"beforeblur":case"afterblur":ue=So;break;case"click":if(l.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ue=Au;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ue=Vh;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ue=_;break;case T0:case S0:case N0:ue=Bh;break;case j0:ue=U;break;case"scroll":case"scrollend":ue=ju;break;case"wheel":ue=le;break;case"copy":case"cut":case"paste":ue=Kh;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ue=vi;break;case"toggle":case"beforetoggle":ue=rt}var qe=(i&4)!==0,Ot=!qe&&(r==="scroll"||r==="scrollend"),X=qe?ne!==null?ne+"Capture":null:ne;qe=[];for(var G=ee,Z;G!==null;){var be=G;if(Z=be.stateNode,be=be.tag,be!==5&&be!==26&&be!==27||Z===null||X===null||(be=yr(G,X),be!=null&&qe.push(id(G,be,Z))),Ot)break;G=G.return}0<qe.length&&(ne=new ue(ne,Pe,null,l,ge),xe.push({event:ne,listeners:qe}))}}if((i&7)===0){e:{if(ne=r==="mouseover"||r==="pointerover",ue=r==="mouseout"||r==="pointerout",ne&&l!==Tu&&(Pe=l.relatedTarget||l.fromElement)&&(Vr(Pe)||Pe[Ur]))break e;if((ue||ne)&&(ne=ge.window===ge?ge:(ne=ge.ownerDocument)?ne.defaultView||ne.parentWindow:window,ue?(Pe=l.relatedTarget||l.toElement,ue=ee,Pe=Pe?Vr(Pe):null,Pe!==null&&(Ot=c(Pe),qe=Pe.tag,Pe!==Ot||qe!==5&&qe!==27&&qe!==6)&&(Pe=null)):(ue=null,Pe=ee),ue!==Pe)){if(qe=Au,be="onMouseLeave",X="onMouseEnter",G="mouse",(r==="pointerout"||r==="pointerover")&&(qe=vi,be="onPointerLeave",X="onPointerEnter",G="pointer"),Ot=ue==null?ne:Ss(ue),Z=Pe==null?ne:Ss(Pe),ne=new qe(be,G+"leave",ue,l,ge),ne.target=Ot,ne.relatedTarget=Z,be=null,Vr(ge)===ee&&(qe=new qe(X,G+"enter",Pe,l,ge),qe.target=Z,qe.relatedTarget=Ot,be=qe),Ot=be,ue&&Pe)t:{for(qe=cI,X=ue,G=Pe,Z=0,be=X;be;be=qe(be))Z++;be=0;for(var Be=G;Be;Be=qe(Be))be++;for(;0<Z-be;)X=qe(X),Z--;for(;0<be-Z;)G=qe(G),be--;for(;Z--;){if(X===G||G!==null&&X===G.alternate){qe=X;break t}X=qe(X),G=qe(G)}qe=null}else qe=null;ue!==null&&Q1(xe,ne,ue,qe,!1),Pe!==null&&Ot!==null&&Q1(xe,Ot,Pe,qe,!0)}}e:{if(ne=ee?Ss(ee):window,ue=ne.nodeName&&ne.nodeName.toLowerCase(),ue==="select"||ue==="input"&&ne.type==="file")var Et=m0;else if(h0(ne))if(p0)Et=vR;else{Et=bR;var Le=yR}else ue=ne.nodeName,!ue||ue.toLowerCase()!=="input"||ne.type!=="checkbox"&&ne.type!=="radio"?ee&&Il(ee.elementType)&&(Et=m0):Et=xR;if(Et&&(Et=Et(r,ee))){f0(xe,Et,l,ge);break e}Le&&Le(r,ne,ee),r==="focusout"&&ee&&ne.type==="number"&&ee.memoizedProps.value!=null&&wu(ne,"number",ne.value)}switch(Le=ee?Ss(ee):window,r){case"focusin":(h0(Le)||Le.contentEditable==="true")&&(Vl=Le,xg=ee,Pu=null);break;case"focusout":Pu=xg=Vl=null;break;case"mousedown":vg=!0;break;case"contextmenu":case"mouseup":case"dragend":vg=!1,E0(xe,l,ge);break;case"selectionchange":if(wR)break;case"keydown":case"keyup":E0(xe,l,ge)}var at;if(Tt)e:{switch(r){case"compositionstart":var pt="onCompositionStart";break e;case"compositionend":pt="onCompositionEnd";break e;case"compositionupdate":pt="onCompositionUpdate";break e}pt=void 0}else Fl?No(r,l)&&(pt="onCompositionEnd"):r==="keydown"&&l.keyCode===229&&(pt="onCompositionStart");pt&&(Xr&&l.locale!=="ko"&&(Fl||pt!=="onCompositionStart"?pt==="onCompositionEnd"&&Fl&&(at=Nu()):(Hr=ge,Su="value"in Hr?Hr.value:Hr.textContent,Fl=!0)),Le=Vf(ee,pt),0<Le.length&&(pt=new Wr(pt,r,null,l,ge),xe.push({event:pt,listeners:Le}),at?pt.data=at:(at=Ul(l),at!==null&&(pt.data=at)))),(at=Gs?fR(r,l):mR(r,l))&&(pt=Vf(ee,"onBeforeInput"),0<pt.length&&(Le=new Wr("onBeforeInput","beforeinput",null,l,ge),xe.push({event:Le,listeners:pt}),Le.data=at)),iI(xe,r,ee,l,ge)}W1(xe,i)})}function id(r,i,l){return{instance:r,listener:i,currentTarget:l}}function Vf(r,i){for(var l=i+"Capture",d=[];r!==null;){var g=r,y=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||y===null||(g=yr(r,l),g!=null&&d.unshift(id(r,g,y)),g=yr(r,i),g!=null&&d.push(id(r,g,y))),r.tag===3)return d;r=r.return}return[]}function cI(r){if(r===null)return null;do r=r.return;while(r&&r.tag!==5&&r.tag!==27);return r||null}function Q1(r,i,l,d,g){for(var y=i._reactName,E=[];l!==null&&l!==d;){var M=l,K=M.alternate,ee=M.stateNode;if(M=M.tag,K!==null&&K===d)break;M!==5&&M!==26&&M!==27||ee===null||(K=ee,g?(ee=yr(l,y),ee!=null&&E.unshift(id(l,ee,K))):g||(ee=yr(l,y),ee!=null&&E.push(id(l,ee,K)))),l=l.return}E.length!==0&&r.push({event:i,listeners:E})}var uI=/\r\n?/g,dI=/\u0000|\uFFFD/g;function J1(r){return(typeof r=="string"?r:""+r).replace(uI,`
49`).replace(dI,"")}function Z1(r,i){return i=J1(i),J1(r)===i}function Dt(r,i,l,d,g,y){switch(l){case"children":typeof d=="str
49ing"?i==="body"||i==="textarea"&&d===""||fs(r,d):(typeof d=="number"||typeof d=="bigint")&&i!=="body"&&fs(r,""+d);break;case"className":Ns(r,"class",d);break;case"tabIndex":Ns(r,"tabindex",d);break;case"dir":case"role":case"viewBox":case"width":case"height":Ns(r,l,d);break;case"style":ku(r,d,y);break;case"data":if(i!=="object"){Ns(r,"data",d);break}case"src":case"href":if(d===""&&(i!=="a"||l!=="href")){r.removeAttribute(l);break}if(d==null||typeof d=="function"||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Ml(""+d),r.setAttribute(l,d);break;case"action":case"formAction":if(typeof d=="function"){r.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof y=="function"&&(l==="formAction"?(i!=="input"&&Dt(r,i,"name",g.name,g,null),Dt(r,i,"formEncType",g.formEncType,g,null),Dt(r,i,"formMethod",g.formMethod,g,null),Dt(r,i,"formTarget",g.formTarget,g,null)):(Dt(r,i,"encType",g.encType,g,null),Dt(r,i,"method",g.method,g,null),Dt(r,i,"target",g.target,g,null)));if(d==null||typeof d=="symbol"||typeof d=="boolean"){r.removeAttribute(l);break}d=Ml(""+d),r.setAttribute(l,d);break;case"onClick":d!=null&&(r.onclick=gr);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(s(60));r.innerHTML=l}}break;case"multiple":r.multiple=d&&typeof d!="function"&&typeof d!="symbol";break;case"muted":r.muted=d&&typeof d!="function"&&typeof d!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(d==null||typeof d=="function"||typeof d=="boolean"||typeof d=="symbol"){r.removeAttribute("xlink:href");break}l=Ml(""+d),r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""+d):r.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":d&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,""):r.removeAttribute(l);break;case"capture":case"download":d===!0?r.setAttribute(l,""):d!==!1&&d!=null&&typeof d!="function"&&typeof d!="symbol"?r.setAttribute(l,d):r.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":d!=null&&typeof d!="function"&&typeof d!="symbol"&&!isNaN(d)&&1<=d?r.setAttribute(l,d):r.removeAttribute(l);break;case"rowSpan":case"start":d==null||typeof d=="function"||typeof d=="symbol"||isNaN(d)?r.removeAttribute(l):r.setAttribute(l,d);break;case"popover":ht("beforetoggle",r),ht("toggle",r),Cl(r,"popover",d);break;case"xlinkActuate":xn(r,"http://www.w3.org/1999/xlink","xlink:actuate",d);break;case"xlinkArcrole":xn(r,"http://www.w3.org/1999/xlink","xlink:arcrole",d);break;case"xlinkRole":xn(r,"http://www.w3.org/1999/xlink","xlink:role",d);break;case"xlinkShow":xn(r,"http://www.w3.org/1999/xlink","xlink:show",d);break;case"xlinkTitle":xn(r,"http://www.w3.org/1999/xlink","xlink:title",d);break;case"xlinkType":xn(r,"http://www.w3.org/1999/xlink","xlink:type",d);break;case"xmlBase":xn(r,"http://www.w3.org/XML/1998/namespace","xml:base",d);break;case"xmlLang":xn(r,"http://www.w3.org/XML/1998/namespace","xml:lang",d);break;case"xmlSpace":xn(r,"http://www.w3.org/XML/1998/namespace","xml:space",d);break;case"is":Cl(r,"is",d);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=Fh.get(l)||l,Cl(r,l,d))}}function qy(r,i,l,d,g,y){switch(l){case"style":ku(r,d,y);break;case"dangerouslySetInnerHTML":if(d!=null){if(typeof d!="object"||!("__html"in d))throw Error(s(61));if(l=d.__html,l!=null){if(g.children!=null)throw Error(s(60));r.innerHTML=l}}break;
vendor: 33,346 bytes, lines 49-58
49case"children":typeof d=="string"?fs(r,d):(typeof d=="number"||typeof d=="bigint")&&fs(r,""+d);break;case"onScroll":d!=null&&ht("scroll",r);break;case"onScrollEnd":d!=null&&ht("scrollend",r);break;case"onClick":d!=null&&(r.onclick=gr);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!yu.hasOwnProperty(l))e:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),i=l.slice(2,g?l.length-7:void 0),y=r[Mn]||null,y=y!=null?y[l]:null,typeof y=="function"&&r.removeEventListener(i,y,g),typeof d=="function")){typeof y!="function"&&y!==null&&(l in r?r[l]=null:r.hasAttribute(l)&&r.removeAttribute(l)),r.addEventListener(i,d,g);break e}l in r?r[l]=d:d===!0?r.setAttribute(l,""):Cl(r,l,d)}}}function Kn(r,i,l){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":ht("error",r),ht("load",r);var d=!1,g=!1,y;for(y in l)if(l.hasOwnProperty(y)){var E=l[y];if(E!=null)switch(y){case"src":d=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:Dt(r,i,y,E,l,null)}}g&&Dt(r,i,"srcSet",l.srcSet,l,null),d&&Dt(r,i,"src",l.src,l,null);return;case"input":ht("invalid",r);var M=y=E=g=null,K=null,ee=null;for(d in l)if(l.hasOwnProperty(d)){var ge=l[d];if(ge!=null)switch(d){case"name":g=ge;break;case"type":E=ge;break;case"checked":K=ge;break;case"defaultChecked":ee=ge;break;case"value":y=ge;break;case"defaultValue":M=ge;break;case"children":case"dangerouslySetInnerHTML":if(ge!=null)throw Error(s(137,i));break;default:Dt(r,i,d,ge,l,null)}}Oh(r,y,M,K,ee,E,g,!1);return;case"select":ht("invalid",r),d=E=y=null;for(g in l)if(l.hasOwnProperty(g)&&(M=l[g],M!=null))switch(g){case"value":y=M;break;case"defaultValue":E=M;break;case"multiple":d=M;default:Dt(r,i,g,M,l,null)}i=y,l=E,r.multiple=!!d,i!=null?la(r,!!d,i,!1):l!=null&&la(r,!!d,l,!0);return;case"textarea":ht("invalid",r),y=g=d=null;for(E in l)if(l.hasOwnProperty(E)&&(M=l[E],M!=null))switch(E){case"value":d=M;break;case"defaultValue":g=M;break;case"children":y=M;break;case"dangerouslySetInnerHTML":if(M!=null)throw Error(s(91));break;default:Dt(r,i,E,M,l,null)}ca(r,d,g,y);return;case"option":for(K in l)if(l.hasOwnProperty(K)&&(d=l[K],d!=null))switch(K){case"selected":r.selected=d&&typeof d!="function"&&typeof d!="symbol";break;default:Dt(r,i,K,d,l,null)}return;case"dialog":ht("beforetoggle",r),ht("toggle",r),ht("cancel",r),ht("close",r);break;case"iframe":case"object":ht("load",r);break;case"video":case"audio":for(d=0;d<rd.length;d++)ht(rd[d],r);break;case"image":ht("error",r),ht("load",r);break;case"details":ht("toggle",r);break;case"embed":case"source":case"link":ht("error",r),ht("load",r);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ee in l)if(l.hasOwnProperty(ee)&&(d=l[ee],d!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,i));default:Dt(r,i,ee,d,l,null)}return;default:if(Il(i)){for(ge in l)l.hasOwnProperty(ge)&&(d=l[ge],d!==void 0&&qy(r,i,ge,d,l,void 0));return}}for(M in l)l.hasOwnProperty(M)&&(d=l[M],d!=null&&Dt(r,i,M,d,l,null))}function hI(r,i,l,d){switch(i){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,y=null,E=null,M=null,K=null,ee=null,ge=null;for(ue in l){var xe=l[ue];if(l.hasOwnProperty(ue)&&xe!=null)switch(ue){case"checked":break;case"value":break;case"defaultValue":K=xe;default:d.hasOwnProperty(ue)||Dt(r,i,ue,null,d,xe)}}for(var ne in d){var ue=d[ne];if(xe=l[ne],d.hasOwnProperty(ne)&&(ue!=null||xe!=null))switch(ne){case"type":y=ue;break;case"name":g=ue;break;case"checked":ee=ue;break;case"defaultChecked":ge=ue;break;case"value":E=ue;break;case"defaultValue":M=ue;break;case"children":case"dangerouslySetInnerHTML":if(ue!=null)throw Error(s(137,i));break;default:ue!==xe&&Dt(r,i,ne,ue,d,xe)}}Rl(r,E,M,K,ee,ge,y,g);return;case"select":ue=E=M=ne=null;for(y in l)if(K=l[y],l.hasOwnProperty(y)&&K!=null)switch(y){case"value":break;case"multiple":ue=K;default:d.hasOwnProperty(y)||Dt(r,i,y,null,d,K)}for(g in d)if(y=d[g],K=l[g],d.hasOwnProperty(g)&&(y!=null||K!=null))switch(g){case"value":ne=y;break;case"defaultValue":M=y;break;case"multiple":E=y;default:y!==K&&Dt(r,i,g,y,d,K)}i=M,l=E,d=ue,ne!=null?la(r,!!l,ne,!1):!!d!=!!l&&(i!=null?la(r,!!l,i,!0):la(r,!!l,l?[]:"",!1));return;case"textarea":ue=ne=null;for(M in l)if(g=l[M],l.hasOwnProperty(M)&&g!=null&&!d.hasOwnProperty(M))switch(M){case"value":break;case"children":break;default:Dt(r,i,M,null,d,g)}for(E in d)if(g=d[E],y=l[E],d.hasOwnProperty(E)&&(g!=null||y!=null))switch(E){case"value":ne=g;break;case"defaultValue":ue=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(s(91));break;default:g!==y&&Dt(r,i,E,g,d,y)}Lh(r,ne,ue);return;case"option":for(var Pe in l)if(ne=l[Pe],l.hasOwnProperty(Pe)&&ne!=null&&!d.hasOwnProperty(Pe))switch(Pe){case"selected":r.selected=!1;break;default:Dt(r,i,Pe,null,d,ne)}for(K in d)if(ne=d[K],ue=l[K],d.hasOwnProperty(K)&&ne!==ue&&(ne!=null||ue!=null))switch(K){case"selected":r.selected=ne&&typeof ne!="function"&&typeof ne!="symbol";break;default:Dt(r,i,K,ne,d,ue)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var qe in l)ne=l[qe],l.hasOwnProperty(qe)&&ne!=null&&!d.hasOwnProperty(qe)&&Dt(r,i,qe,null,d,ne);for(ee in d)if(ne=d[ee],ue=l[ee],d.hasOwnProperty(ee)&&ne!==ue&&(ne!=null||ue!=null))switch(ee){case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(s(137,i));break;default:Dt(r,i,ee,ne,d,ue)}return;default:if(Il(i)){for(var Ot in l)ne=l[Ot],l.hasOwnProperty(Ot)&&ne!==void 0&&!d.hasOwnProperty(Ot)&&qy(r,i,Ot,void 0,d,ne);for(ge in d)ne=d[ge],ue=l[ge],!d.hasOwnProperty(ge)||ne===ue||ne===void 0&&ue===void 0||qy(r,i,ge,ne,d,ue);return}}for(var X in l)ne=l[X],l.hasOwnProperty(X)&&ne!=null&&!d.hasOwnProperty(X)&&Dt(r,i,X,null,d,ne);for(xe in d)ne=d[xe],ue=l[xe],!d.hasOwnProperty(xe)||ne===ue||ne==null&&ue==null||Dt(r,i,xe,ne,d,ue)}function eE(r){switch(r){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function fI(){if(typeof performance.getEntriesByType=="function"){for(var r=0,i=0,l=performance.getEntriesByType("resource"),d=0;d<l.length;d++){var g=l[d],y=g.transferSize,E=g.initiatorType,M=g.duration;if(y&&M&&eE(E)){for(E=0,M=g.responseEnd,d+=1;d<l.length;d++){var K=l[d],ee=K.startTime;if(ee>M)break;var ge=K.transferSize,xe=K.initiatorType;ge&&eE(xe)&&(K=K.responseEnd,E+=ge*(K<M?1:(M-ee)/(K-ee)))}if(--d,i+=8*(y+E)/(g.duration/1e3),r++,10<r)break}}if(0<r)return i/r/1e6}return navigator.connection&&(r=navigator.connection.downlink,typeof r=="number")?r:5}var Hy=null,Gy=null;function zf(r){return r.nodeType===9?r:r.ownerDocument}function tE(r){switch(r){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function nE(r,i){if(r===0)switch(i){case"svg":return 1;case"math":return 2;default:return 0}return r===1&&i==="foreignObject"?0:r}function Yy(r,i){return r==="textarea"||r==="noscript"||typeof i.children=="string"||typeof i.children=="number"||typeof i.children=="bigint"||typeof i.dangerouslySetInnerHTML=="object"&&i.dangerouslySetInnerHTML!==null&&i.dangerouslySetInnerHTML.__html!=null}var Wy=null;function mI(){var r=window.event;return r&&r.type==="popstate"?r===Wy?!1:(Wy=r,!0):(Wy=null,!1)}var sE=typeof setTimeout=="function"?setTimeout:void 0,pI=typeof clearTimeout=="function"?clearTimeout:void 0,rE=typeof Promise=="function"?Promise:void 0,gI=typeof queueMicrotask=="function"?queueMicrotask:typeof rE<"u"?function(r){return rE.resolve(null).then(r).catch(yI)}:sE;function yI(r){setTimeout(function(){throw r})}function Ia(r){return r==="head"}function iE(r,i){var l=i,d=0;do{var g=l.nextSibling;if(r.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(d===0){r.removeChild(g),fc(i);return}d--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")d++;else if(l==="html")ad(r.ownerDocument.documentElement);else if(l==="head"){l=r.ownerDocument.head,ad(l);for(var y=l.firstChild;y;){var E=y.nextSibling,M=y.nodeName;y[Fr]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&y.rel.toLowerCase()==="stylesheet"||l.removeChild(y),y=E}}else l==="body"&&ad(r.ownerDocument.body);l=g}while(l);fc(i)}function aE(r,i){var l=r;r=0;do{var d=l.nextSibling;if(l.nodeType===1?i?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(i?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),d&&d.nodeType===8)if(l=d.data,l==="/$"){if(r===0)break;r--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||r++;l=d}while(l)}function Xy(r){var i=r.firstChild;for(i&&i.nodeType===10&&(i=i.nextSibling);i;){var l=i;switch(i=i.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":Xy(l),Al(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}r.removeChild(l)}}function bI(r,i,l,d){for(;r.nodeType===1;){var g=l;if(r.nodeName.toLowerCase()!==i.toLowerCase()){if(!d&&(r.nodeName!=="INPUT"||r.type!=="hidden"))break}else if(d){if(!r[Fr])switch(i){case"meta":if(!r.hasAttribute("itemprop"))break;return r;case"link":if(y=r.getAttribute("rel"),y==="stylesheet"&&r.hasAttribute("data-precedence"))break;if(y!==g.rel||r.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||r.getAttribute("title")!==(g.title==null?null:g.title))break;return r;case"style":if(r.hasAttribute("data-precedence"))break;return r;case"script":if(y=r.getAttribute("src"),(y!==(g.src==null?null:g.src)||r.getAttribute("type")!==(g.type==null?null:g.type)||r.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&y&&r.hasAttribute("async")&&!r.hasAttribute("itemprop"))break;return r;default:return r}}else if(i==="input"&&r.type==="hidden"){var y=g.name==null?null:""+g.name;if(g.type==="hidden"&&r.getAttribute("name")===y)return r}else return r;if(r=er(r.nextSibling),r===null)break}return null}function xI(r,i,l){if(i==="")return null;for(;r.nodeType!==3;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!l||(r=er(r.nextSibling),r===null))return null;return r}function oE(r,i){for(;r.nodeType!==8;)if((r.nodeType!==1||r.nodeName!=="INPUT"||r.type!=="hidden")&&!i||(r=er(r.nextSibling),r===null))return null;return r}function Qy(r){return r.data==="$?"||r.data==="$~"}function Jy(r){return r.data==="$!"||r.data==="$?"&&r.ownerDocument.readyState!=="loading"}function vI(r,i){var l=r.ownerDocument;if(r.data==="$~")r._reactRetry=i;else if(r.data!=="$?"||l.readyState!=="loading")i();else{var d=function(){i(),l.removeEventListener("DOMContentLoaded",d)};l.addEventListener("DOMContentLoaded",d),r._reactRetry=d}}function er(r){for(;r!=null;r=r.nextSibling){var i=r.nodeType;if(i===1||i===3)break;if(i===8){if(i=r.data,i==="$"||i==="$!"||i==="$?"||i==="$~"||i==="&"||i==="F!"||i==="F")break;if(i==="/$"||i==="/&")return null}}return r}var Zy=null;function lE(r){r=r.nextSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="/$"||l==="/&"){if(i===0)return er(r.nextSibling);i--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||i++}r=r.nextSibling}return null}function cE(r){r=r.previousSibling;for(var i=0;r;){if(r.nodeType===8){var l=r.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(i===0)return r;i--}else l!=="/$"&&l!=="/&"||i++}r=r.previousSibling}return null}function uE(r,i,l){switch(i=zf(l),r){case"html":if(r=i.documentElement,!r)throw Error(s(452));return r;case"head":if(r=i.head,!r)throw Error(s(453));return r;case"body":if(r=i.body,!r)throw Error(s(454));return r;default:throw Error(s(451))}}function ad(r){for(var i=r.attributes;i.length;)r.removeAttributeNode(i[0]);Al(r)}var tr=new Map,dE=new Set;function Bf(r){return typeof r.getRootNode=="function"?r.getRootNode():r.nodeType===9?r:r.ownerDocument}var Di=J.d;J.d={f:_I,r:wI,D:EI,C:kI,L:TI,m:SI,X:jI,S:NI,M:AI};function _I(){var r=Di.f(),i=Mf();return r||i}function wI(r){var i=$s(r);i!==null&&i.tag===5&&i.type==="form"?jw(i):Di.r(r)}var uc=typeof document>"u"?null:document;function hE(r,i,l){var d=uc;if(d&&typeof i=="string"&&i){var g=hs(i);g='link[rel="'+r+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),dE.has(g)||(dE.add(g),r={rel:r,crossOrigin:l,href:i},d.querySelector(g)===null&&(i=d.createElement("link"),Kn(i,"link",r),bn(i),d.head.appendChild(i)))}}function EI(r){Di.D(r),hE("dns-prefetch",r,null)}function kI(r,i){Di.C(r,i),hE("preconnect",r,i)}function TI(r,i,l){Di.L(r,i,l);var d=uc;if(d&&r&&i){var g='link[rel="preload"][as="'+hs(i)+'"]';i==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+hs(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+hs(l.imageSizes)+'"]')):g+='[href="'+hs(r)+'"]';var y=g;switch(i){case"style":y=dc(r);break;case"script":y=hc(r)}tr.has(y)||(r=x({rel:"preload",href:i==="image"&&l&&l.imageSrcSet?void 0:r,as:i},l),tr.set(y,r),d.querySelector(g)!==null||i==="style"&&d.querySelector(od(y))||i==="script"&&d.querySelector(ld(y))||(i=d.createElement("link"),Kn(i,"link",r),bn(i),d.head.appendChild(i)))}}function SI(r,i){Di.m(r,i);var l=uc;if(l&&r){var d=i&&typeof i.as=="string"?i.as:"script",g='link[rel="modulepreload"][as="'+hs(d)+'"][href="'+hs(r)+'"]',y=g;switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=hc(r)}if(!tr.has(y)&&(r=x({rel:"modulepreload",href:r},i),tr.set(y,r),l.querySelector(g)===null)){switch(d){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(ld(y)))return}d=l.createElement("link"),Kn(d,"link",r),bn(d),l.head.appendChild(d)}}}function NI(r,i,l){Di.S(r,i,l);var d=uc;if(d&&r){var g=zr(d).hoistableStyles,y=dc(r);i=i||"default";var E=g.get(y);if(!E){var M={loading:0,preload:null};if(E=d.querySelector(od(y)))M.loading=5;else{r=x({rel:"stylesheet",href:r,"data-precedence":i},l),(l=tr.get(y))&&eb(r,l);var K=E=d.createElement("link");bn(K),Kn(K,"link",r),K._p=new Promise(function(ee,ge){K.onload=ee,K.onerror=ge}),K.addEventListener("load",function(){M.loading|=1}),K.addEventListener("error",function(){M.loading|=2}),M.loading|=4,Kf(E,i,d)}E={type:"stylesheet",instance:E,count:1,state:M},g.set(y,E)}}}function jI(r,i){Di.X(r,i);var l=uc;if(l&&r){var d=zr(l).hoistableScripts,g=hc(r),y=d.get(g);y||(y=l.querySelector(ld(g)),y||(r=x({src:r,async:!0},i),(i=tr.get(g))&&tb(r,i),y=l.createElement("script"),bn(y),Kn(y,"link",r),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function AI(r,i){Di.M(r,i);var l=uc;if(l&&r){var d=zr(l).hoistableScripts,g=hc(r),y=d.get(g);y||(y=l.querySelector(ld(g)),y||(r=x({src:r,async:!0,type:"module"},i),(i=tr.get(g))&&tb(r,i),y=l.createElement("script"),bn(y),Kn(y,"link",r),l.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},d.set(g,y))}}function fE(r,i,l,d){var g=(g=me.current)?Bf(g):null;if(!g)throw Error(s(446));switch(r){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(i=dc(l.href),l=zr(g).hoistableStyles,d=l.get(i),d||(d={type:"style",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){r=dc(l.href);var y=zr(g).hoistableStyles,E=y.get(r);if(E||(g=g.ownerDocument||g,E={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(r,E),(y=g.querySelector(od(r)))&&!y._p&&(E.instance=y,E.state.loading=5),tr.has(r)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},tr.set(r,l),y||CI(g,r,l,E.state))),i&&d===null)throw Error(s(528,""));return E}if(i&&d!==null)throw Error(s(529,""));return null;case"script":return i=l.async,l=l.src,typeof l=="string"&&i&&typeof i!="function"&&typeof i!="symbol"?(i=hc(l),l=zr(g).hoistableScripts,d=l.get(i),d||(d={type:"script",instance:null,count:0,state:null},l.set(i,d)),d):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,r))}}function dc(r){return'href="'+hs(r)+'"'}function od(r){return'link[rel="stylesheet"]['+r+"]"}function mE(r){return x({},r,{"data-precedence":r.precedence,precedence:null})}function CI(r,i,l,d){r.querySelector('link[rel="preload"][as="style"]['+i+"]")?d.loading=1:(i=r.createElement("link"),d.preload=i,i.addEventListener("load",function(){return d.loading|=1}),i.addEventListener("error",function(){return d.loading|=2}),Kn(i,"link",l),bn(i),r.head.appendChild(i))}function hc(r){return'[src="'+hs(r)+'"]'}function ld(r){return"script[async]"+r}function pE(r,i,l){if(i.count++,i.instance===null)switch(i.type){case"style":var d=r.querySelector('style[data-href~="'+hs(l.href)+'"]');if(d)return i.instance=d,bn(d),d;var g=x({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return d=(r.ownerDocument||r).createElement("style"),bn(d),Kn(d,"style",g),Kf(d,l.precedence,r),i.instance=d;case"stylesheet":g=dc(l.href);var y=r.querySelector(od(g));if(y)return i.state.loading|=4,i.instance=y,bn(y),y;d=mE(l),(g=tr.get(g))&&eb(d,g),y=(r.ownerDocument||r).createElement("link"),bn(y);var E=y;return E._p=new Promise(function(M,K){E.onload=M,E.onerror=K}),Kn(y,"link",d),i.state.loading|=4,Kf(y,l.precedence,r),i.instance=y;case"script":return y=hc(l.src),(g=r.querySelector(ld(y)))?(i.instance=g,bn(g),g):(d=l,(g=tr.get(y))&&(d=x({},l),tb(d,g)),r=r.ownerDocument||r,g=r.createElement("script"),bn(g),Kn(g,"link",d),r.head.appendChild(g),i.instance=g);case"void":return null;default:throw Error(s(443,i.type))}else i.type==="stylesheet"&&(i.state.loading&4)===0&&(d=i.instance,i.state.loading|=4,Kf(d,l.precedence,r));return i.instance}function Kf(r,i,l){for(var d=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=d.length?d[d.length-1]:null,y=g,E=0;E<d.length;E++){var M=d[E];if(M.dataset.precedence===i)y=M;else if(y!==g)break}y?y.parentNode.insertBefore(r,y.nextSibling):(i=l.nodeType===9?l.head:l,i.insertBefore(r,i.firstChild))}function eb(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.title==null&&(r.title=i.title)}function tb(r,i){r.crossOrigin==null&&(r.crossOrigin=i.crossOrigin),r.referrerPolicy==null&&(r.referrerPolicy=i.referrerPolicy),r.integrity==null&&(r.integrity=i.integrity)}var $f=null;function gE(r,i,l){if($f===null){var d=new Map,g=$f=new Map;g.set(l,d)}else g=$f,d=g.get(l),d||(d=new Map,g.set(l,d));if(d.has(r))return d;for(d.set(r,null),l=l.getElementsByTagName(r),g=0;g<l.length;g++){var y=l[g];if(!(y[Fr]||y[yn]||r==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var E=y.getAttribute(i)||"";E=r+E;var M=d.get(E);M?M.push(y):d.set(E,[y])}}return d}function yE(r,i,l){r=r.ownerDocument||r,r.head.insertBefore(l,i==="title"?r.querySelector("head > title"):null)}function RI(r,i,l){if(l===1||i.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof i.precedence!="string"||typeof i.href!="string"||i.href==="")break;return!0;case"link":if(typeof i.rel!="string"||typeof i.href!="string"||i.href===""||i.onLoad||i.onError)break;switch(i.rel){case"stylesheet":return r=i.disabled,typeof i.precedence=="string"&&r==null;default:return!0}case"script":if(i.async&&typeof i.async!="function"&&typeof i.async!="symbol"&&!i.onLoad&&!i.onError&&i.src&&typeof i.src=="string")return!0}return!1}function bE(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function II(r,i,l,d){if(l.type==="stylesheet"&&(typeof d.media!="string"||matchMedia(d.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=dc(d.href),y=i.querySelector(od(g));if(y){i=y._p,i!==null&&typeof i=="object"&&typeof i.then=="function"&&(r.count++,r=qf.bind(r),i.then(r,r)),l.state.loading|=4,l.instance=y,bn(y);return}y=i.ownerDocument||i,d=mE(d),(g=tr.get(g))&&eb(d,g),y=y.createElement("link"),bn(y);var E=y;E._p=new Promise(function(M,K){E.onload=M,E.onerror=K}),Kn(y,"link",d),l.instance=y}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(l,i),(i=l.state.preload)&&(l.state.loading&3)===0&&(r.count++,l=qf.bind(r),i.addEventListener("load",l),i.addEventListener("error",l))}}var nb=0;function MI(r,i){return r.stylesheets&&r.count===0&&Gf(r,r.stylesheets),0<r.count||0<r.imgCount?function(l){var d=setTimeout(function(){if(r.stylesheets&&Gf(r,r.stylesheets),r.unsuspend){var y=r.unsuspend;r.unsuspend=null,y()}},6e4+i);0<r.imgBytes&&nb===0&&(nb=62500*fI());var g=setTimeout(function(){if(r.waitingForImages=!1,r.count===0&&(r.stylesheets&&Gf(r,r.stylesheets),r.unsuspend)){var y=r.unsuspend;r.unsuspend=null,y()}},(r.imgBytes>nb?50:800)+i);return r.unsuspend=l,function(){r.unsuspend=null,clearTimeout(d),clearTimeout(g)}}:null}function qf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Gf(this,this.stylesheets);else if(this.unsuspend){var r=this.unsuspend;this.unsuspend=null,r()}}}var Hf=null;function Gf(r,i){r.stylesheets=null,r.unsuspend!==null&&(r.count++,Hf=new Map,i.forEach(PI,r),Hf=null,qf.call(r))}function PI(r,i){if(!(i.state.loading&4)){var l=Hf.get(r);if(l)var d=l.get(null);else{l=new Map,Hf.set(r,l);for(var g=r.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<g.length;y++){var E=g[y];(E.nodeName==="LINK"||E.getAttribute("media")!=="not all")&&(l.set(E.dataset.precedence,E),d=E)}d&&l.set(null,d)}g=i.instance,E=g.getAttribute("data-precedence"),y=l.get(E)||d,y===d&&l.set(null,g),l.set(E,g),this.count++,d=qf.bind(this),g.addEventListener("load",d),g.addEventListener("error",d),y?y.parentNode.insertBefore(g,y.nextSibling):(r=r.nodeType===9?r.head:r,r.insertBefore(g,r.firstChild)),i.state.loading|=4}}var cd={$$typeof:L,Provider:null,Consumer:null,_currentValue:fe,_currentValue2:fe,_threadCount:0};function DI(r,i,l,d,g,y,E,M,K){this.tag=1,this.containerInfo=r,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Lr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Lr(0),this.hiddenUpdates=Lr(null),this.identifierPrefix=d,this.onUncaughtError=g,this.onCaughtError=y,this.onRecoverableError=E,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=K,this.incompleteTransitions=new Map}function xE(r,i,l,d,g,y,E,M,K,ee,ge,xe){return r=new DI(r,i,l,E,K,ee,ge,xe,M),i=1,y===!0&&(i|=24),y=As(3,null,null,i),r.current=y,y.stateNode=r,i=Dg(),i.refCount++,r.pooledCache=i,i.refCount++,y.memoizedState={element:d,isDehydrated:l,cache:i},Fg(y),r}function vE(r){return r?(r=Kl,r):Kl}function _E(r,i,l,d,g,y){g=vE(g),d.context===null?d.context=g:d.pendingContext=g,d=_a(i),d.payload={element:l},y=y===void 0?null:y,y!==null&&(d.callback=y),l=wa(r,d,i),l!==null&&(bs(l,r,i),zu(l,r,i))}function wE(r,i){if(r=r.memoizedState,r!==null&&r.dehydrated!==null){var l=r.retryLane;r.retryLane=l!==0&&l<i?l:i}}function sb(r,i){wE(r,i),(r=r.alternate)&&wE(r,i)}function EE(r){if(r.tag===13||r.tag===31){var i=Co(r,67108864);i!==null&&bs(i,r,67108864),sb(r,67108864)}}function kE(r){if(r.tag===13||r.tag===31){var i=Ps();i=bo(i);var l=Co(r,i);l!==null&&bs(l,r,i),sb(r,i)}}var Yf=!0;function OI(r,i,l,d){var g=W.T;W.T=null;var y=J.p;try{J.p=2,rb(r,i,l,d)}finally{J.p=y,W.T=g}}function LI(r,i,l,d){var g=W.T;W.T=null;var y=J.p;try{J.p=8,rb(r,i,l,d)}finally{J.p=y,W.T=g}}function rb(r,i,l,d){if(Yf){var g=ib(d);if(g===null)$y(r,i,d,Wf,l),SE(r,d);else if(FI(g,r,i,l,d))d.stopPropagation();else if(SE(r,d),i&4&&-1<UI.indexOf(r)){for(;g!==null;){var y=$s(g);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var E=Dr(y.pendingLanes);if(E!==0){var M=y;for(M.pendingLanes|=2,M.entangledLanes|=2;E;){var K=1<<31-jt(E);M.entanglements[1]|=K,E&=~K}ei(y),(St&6)===0&&(Rf=wt()+500,sd(0))}}break;case 31:case 13:M=Co(y,2),M!==null&&bs(M,y,2),Mf(),sb(y,2)}if(y=ib(d),y===null&&$y(r,i,d,Wf,l),y===g)break;g=y}g!==null&&d.stopPropagation()}else $y(r,i,d,null,l)}}function ib(r){return r=qs(r),ab(r)}var Wf=null;function ab(r){if(Wf=null,r=Vr(r),r!==null){var i=c(r);if(i===null)r=null;else{var l=i.tag;if(l===13){if(r=u(i),r!==null)return r;r=null}else if(l===31){if(r=h(i),r!==null)return r;r=null}else if(l===3){if(i.stateNode.current.memoizedState.isDehydrated)return i.tag===3?i.stateNode.containerInfo:null;r=null}else i!==r&&(r=null)}}return Wf=r,null}function TE(r){switch(r){case"beforetoggle":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"toggle":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 2;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"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(is()){case He:return 2;case lt:return 8;case te:case ke:return 32;case nt:return 268435456;default:return 32}default:return 32}}var ob=!1,Ma=null,Pa=null,Da=null,ud=new Map,dd=new Map,Oa=[],UI="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".split(" ");function SE(r,i){switch(r){case"focusin":case"focusout":Ma=null;break;case"dragenter":case"dragleave":Pa=null;break;case"mouseover":case"mouseout":Da=null;break;case"pointerover":case"pointerout":ud.delete(i.pointerId);break;case"gotpointercapture":case"lostpointercapture":dd.delete(i.pointerId)}}function hd(r,i,l,d,g,y){return r===null||r.nativeEvent!==y?(r={blockedOn:i,domEventName:l,eventSystemFlags:d,nativeEvent:y,targetContainers:[g]},i!==null&&(i=$s(i),i!==null&&EE(i)),r):(r.eventSystemFlags|=d,i=r.targetContainers,g!==null&&i.indexOf(g)===-1&&i.push(g),r)}function FI(r,i,l,d,g){switch(i){case"focusin":return Ma=hd(Ma,r,i,l,d,g),!0;case"dragenter":return Pa=hd(Pa,r,i,l,d,g),!0;case"mouseover":return Da=hd(Da,r,i,l,d,g),!0;case"pointerover":var y=g.pointerId;return ud.set(y,hd(ud.get(y)||null,r,i,l,d,g)),!0;case"gotpointercapture":return y=g.pointerId,dd.set(y,hd(dd.get(y)||null,r,i,l,d,g)),!0}return!1}function NE(r){var i=Vr(r.target);if(i!==null){var l=c(i);if(l!==null){if(i=l.tag,i===13){if(i=u(l),i!==null){r.blockedOn=i,mr(r.priority,function(){kE(l)});return}}else if(i===31){if(i=h(l),i!==null){r.blockedOn=i,mr(r.priority,function(){kE(l)});return}}else if(i===3&&l.stateNode.current.memoizedState.isDehydrated){r.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}r.blockedOn=null}function Xf(r){if(r.blockedOn!==null)return!1;for(var i=r.targetContainers;0<i.length;){var l=ib(r.nativeEvent);if(l===null){l=r.nativeEvent;var d=new l.constructor(l.type,l);Tu=d,l.target.dispatchEvent(d),Tu=null}else return i=$s(l),i!==null&&EE(i),r.blockedOn=l,!1;i.shift()}return!0}function jE(r,i,l){Xf(r)&&l.delete(i)}function VI(){ob=!1,Ma!==null&&Xf(Ma)&&(Ma=null),Pa!==null&&Xf(Pa)&&(Pa=null),Da!==null&&Xf(Da)&&(Da=null),ud.forEach(jE),dd.forEach(jE)}function Qf(r,i){r.blockedOn===i&&(r.blockedOn=null,ob||(ob=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,VI)))}var Jf=null;function AE(r){Jf!==r&&(Jf=r,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Jf===r&&(Jf=null);for(var i=0;i<r.length;i+=3){var l=r[i],d=r[i+1],g=r[i+2];if(typeof d!="function"){if(ab(d||l)===null)continue;break}var y=$s(l);y!==null&&(r.splice(i,3),i-=3,iy(y,{pending:!0,data:g,method:l.method,action:d},d,g))}}))}function fc(r){function i(K){return Qf(K,r)}Ma!==null&&Qf(Ma,r),Pa!==null&&Qf(Pa,r),Da!==null&&Qf(Da,r),ud.forEach(i),dd.forEach(i);for(var l=0;l<Oa.length;l++){var d=Oa[l];d.blockedOn===r&&(d.blockedOn=null)}for(;0<Oa.length&&(l=Oa[0],l.blockedOn===null);)NE(l),l.blockedOn===null&&Oa.shift();if(l=(r.ownerDocument||r).$$reactFormReplay,l!=null)for(d=0;d<l.length;d+=3){var g=l[d],y=l[d+1],E=g[Mn]||null;if(typeof y=="function")E||AE(l);else if(E){var M=null;if(y&&y.hasAttribute("formAction")){if(g=y,E=y[Mn]||null)M=E.formAction;else if(ab(g)!==null)continue}else M=E.action;typeof M=="function"?l[d+1]=M:(l.splice(d,3),d-=3),AE(l)}}}function CE(){function r(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(E){return g=E})},focusReset:"manual",scroll:"manual"})}function i(){g!==null&&(g(),g=null),d||setTimeout(l,20)}function l(){if(!d&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var d=!1,g=null;return navigation.addEventListener("navigate",r),navigation.addEventListener("navigatesuccess",i),navigation.addEventListener("navigateerror",i),setTimeout(l,100),function(){d=!0,navigation.removeEventListener("navigate",r),navigation.removeEventListener("navigatesuccess",i),navigation.removeEventListener("navigateerror",i),g!==null&&(g(),g=null)}}}function lb(r){this._internalRoot=r}Zf.prototype.render=lb.prototype.render=function(r){var i=this._internalRoot;if(i===null)throw Error(s(409));var l=i.current,d=Ps();_E(l,d,r,i,null,null)},Zf.prototype.unmount=lb.prototype.unmount=function(){var r=this._internalRoot;if(r!==null){this._internalRoot=null;var i=r.containerInfo;_E(r.current,2,null,r,null,null),Mf(),i[Ur]=null}};function Zf(r){this._internalRoot=r}Zf.prototype.unstable_scheduleHydration=function(r){if(r){var i=Ih();r={blockedOn:null,target:r,priority:i};for(var l=0;l<Oa.length&&i!==0&&i<Oa[l].priority;l++);Oa.splice(l,0,r),l===0&&NE(r)}};var RE=e.version;if(RE!=="19.2.4")throw Error(s(527,RE,"19.2.4"));J.findDOMNode=function(r){var i=r._reactInternals;if(i===void 0)throw typeof r.render=="function"?Error(s(188)):(r=Object.keys(r).join(","),Error(s(268,r)));return r=p(i),r=r!==null?b(r):null,r=r===null?null:r.stateNode,r};var zI={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:W,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var em=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!em.isDisabled&&em.supportsFiber)try{Oe=em.inject(zI),Xe=em}catch{}}return md.createRoot=function(r,i){if(!a(r))throw Error(s(299));var l=!1,d="",g=Uw,y=Fw,E=Vw;return i!=null&&(i.unstable_strictMode===!0&&(l=!0),i.identifierPrefix!==void 0&&(d=i.identifierPrefix),i.onUncaughtError!==void 0&&(g=i.onUncaughtError),i.onCaughtError!==void 0&&(y=i.onCaughtError),i.onRecoverableError!==void 0&&(E=i.onRecoverableError)),i=xE(r,1,!1,null,null,l,d,null,g,y,E,CE),r[Ur]=i.current,Ky(r),new lb(i)},md.hydrateRoot=function(r,i,l){if(!a(r))throw Error(s(299));var d=!1,g="",y=Uw,E=Fw,M=Vw,K=null;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(y=l.onUncaughtError),l.onCaughtError!==void 0&&(E=l.onCaughtError),l.onRecoverableError!==void 0&&(M=l.onRecoverableError),l.formState!==void 0&&(K=l.formState)),i=xE(r,1,!0,i,l??null,d,g,K,y,E,M,CE),i.context=vE(null),l=i.current,d=Ps(),d=bo(d),g=_a(d),g.callback=null,wa(l,g,d),l=d,i.current.lanes=l,go(i,l),ei(i),r[Ur]=i.current,Ky(r),new Zf(i)},md.version="19.2.4",md}var zE;function XI(){if(zE)return db.exports;zE=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),db.exports=WI(),db.exports}var QI=XI();const JI=uS(QI);/**
50 * react-router v7.13.0
51 *
52 * Copyright (c) Remix Software Inc.
53 *
54 * This source code is licensed under the MIT license found in the
55 * LICENSE.md file in the root directory of this source tree.
56 *
57 * @license MIT
58 */var BE="popstate";function ZI(t={}){function e(s,a){let{pathname:c,search:u,hash:h}=s.location;return _x("",{pathname:c,search:u,hash:h},a.state&&a.state.usr||null,a.state&&a.state.key||"default")}
58function n(s,a){return typeof a=="string"?a:Fd(a)}return t4(e,n,null,t)}function Yt(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function or(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function e4(){return Math.random().toString(36).substring(2,10)}function KE(t,e){return{usr:t.state,key:t.key,idx:e}}function _x(t,e,n=null,s){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof e=="string"?Zc(e):e,state:n,key:e&&e.key||s||e4()}}function Fd({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 Zc(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substring(n),t=t.substring(0,n));let s=t.indexOf("?");s>=0&&(e.search=t.substring(s),t=t.substring(0,s)),t&&(e.pathname=t)}return e}function t4(t,e,n,s={}){let{window:a=document.defaultView,v5Compat:c=!1}=s,u=a.history,h="POP",m=null,p=b();p==null&&(p=0,u.replaceState({...u.state,idx:p},""));function b(){return(u.state||{idx:null}).idx}function x(){h="POP";let A=b(),F=A==null?null:A-p;p=A,m&&m({action:h,location:j.location,delta:F})}function w(A,F){h="PUSH";let V=_x(j.location,A,F);p=b()+1;let L=KE(V,p),Y=j.createHref(V);try{u.pushState(L,"",Y)}catch($){if($ instanceof DOMException&&$.name==="DataCloneError")throw $;a.location.assign(Y)}c&&m&&m({action:h,location:j.location,delta:1})}function T(A,F){h="REPLACE";let V=_x(j.location,A,F);p=b();let L=KE(V,p),Y=j.createHref(V);u.replaceState(L,"",Y),c&&m&&m({action:h,location:j.location,delta:0})}function N(A){return n4(A)}let j={get action(){return h},get location(){return t(a,u)},listen(A){if(m)throw new Error("A history only accepts one active listener");return a.addEventListener(BE,x),m=A,()=>{a.removeEventListener(BE,x),m=null}},createHref(A){return e(a,A)},createURL:N,encodeLocation(A){let F=N(A);return{pathname:F.pathname,search:F.search,hash:F.hash}},push:w,replace:T,go(A){return u.go(A)}};return j}function n4(t,e=!1){let n="http://localhost";
58typeof window<"u"&&(n=window.location.origin!=="null"?window.location.origin:window.location.href),Yt(n,"No window.location.(origin|href) available to create URL");let s=typeof t=="string"?t:Fd(t);return s=s.replace(/ $/,"%20"),!e&&s.startsWith("//")&&(s=n+s),new URL(s,n)}function hS(t,e,n="/"){return s4(t,e,n,!1)}function s4(t,e,n,s){let a=typeof e=="string"?Zc(e):e,c=Xi(a.pathname||"/",n);if(c==null)return null;let u=fS(t);r4(u);let h=null;for(let m=0;h==null&&m<u.length;++m){let p=p4(c);h=f4(u[m],p,s)}return h}function fS(t,e=[],n=[],s="",a=!1){let c=(u,h,m=a,p)=>{let b={relativePath:p===void 0?u.path||"":p,caseSensitive:u.caseSensitive===!0,childrenIndex:h,route:u};if(b.relativePath.startsWith("/")){if(!b.relativePath.startsWith(s)&&m)return;Yt(b.relativePath.startsWith(s),`Absolute route path "${b.relativePath}" nested under path "${s}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),b.relativePath=b.relativePath.slice(s.length)}let x=Hi([s,b.relativePath]),w=n.concat(b);u.children&&u.children.length>0&&(Yt(u.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${x}".`),fS(u.children,e,w,x,m)),!(u.path==null&&!u.index)&&e.push({path:x,score:d4(x,u.index),routesMeta:w})};return t.forEach((u,h)=>{var m;if(u.path===""||!((m=u.path)!=null&&m.includes("?")))c(u,h);else for(let p of mS(u.path))c(u,h,!0,p)}),e}function mS(t){let e=t.split("/");if(e.length===0)return[];let[n,...s]=e,a=n.endsWith("?"),c=n.replace(/\?$/,"");if(s.length===0)return a?[c,""]:[c];let u=mS(s.join("/")),h=[];return h.push(...u.map(m=>m===""?c:[c,m].join("/"))),a&&h.push(...u),h.map(m=>t.startsWith("/")&&m===""?"/":m)}function r4(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:h4(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}var i4=/^:[\w-]+$/,a4=3,o4=2,l4=1,c4=10,u4=-2,$E=t=>t==="*";function d4(t,e){let n=t.split("/"),s=n.length;return n.some($E)&&(s+=u4),e&&(s+=o4),n.filter(a=>!$E(a)).reduce((a,c)=>a+(i4.test(c)?a4:c===""?l4:c4),s)}function h4(t,e){return t.length===e.length&&t.slice(0,-1).every((s,a)=>s===e[a])?t[t.length-1]-e[e.length-1]:0}function f4(t,e,n=!1){let{routesMeta:s}=t,a={},c="/",u=[];for(let h=0;h<s.length;++h){let m=s[h],p=h===s.length-1,b=c==="/"?e:e.slice(c.length)||"/",x=Lm({path:m.relativePath,caseSensitive:m.caseSensitive,end:p},b),w=m.route;if(!x&&p&&n&&!s[s.length-1].route.index&&(x=Lm({path:m.relativePath,caseSensitive:m.caseSensitive,end:!1},b)),!x)return null;
58Object.assign(a,x.params),u.push({params:a,pathname:Hi([c,x.pathname]),pathnameBase:x4(Hi([c,x.pathnameBase])),route:w}),x.pathnameBase!=="/"&&(c=Hi([c,x.pathnameBase]))}return u}function Lm(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,s]=m4(t.path,t.caseSensitive,t.end),a=e.match(n);if(!a)return null;let c=a[0],u=c.replace(/(.)\/+$/,"$1"),h=a.slice(1);return{params:s.reduce((p,{paramName:b,isOptional:x},w)=>{if(b==="*"){let N=h[w]||"";u=c.slice(0,c.length-N.length).replace(/(.)\/+$/,"$1")}const T=h[w];return x&&!T?p[b]=void 0:p[b]=(T||"").replace(/%2F/g,"/"),p},{}),pathname:c,pathnameBase:u,pattern:t}}function m4(t,e=!1,n=!0){or(t==="*"||!t.endsWith("*")||t.endsWith("/*"),`Route path "${t}" will be treated as if it were "${t.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${t.replace(/\*$/,"/*")}".`);let s=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(u,h,m)=>(s.push({paramName:h,isOptional:m!=null}),m?"/?([^\\/]+)?":"/([^\\/]+)")).replace(/\/([\w-]+)\?(\/|$)/g,"(/$1)?$2");return t.endsWith("*")?(s.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),s]}function p4(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return or(!1,`The URL path "${t}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),t}}function Xi(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}var g4=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;function y4(t,e="/"){let{pathname:n,search:s="",hash:a=""}=typeof t=="string"?Zc(t):t,c;return n?(n=n.replace(/\/\/+/g,"/"),n.startsWith("/")?c=qE(n.substring(1),"/"):c=qE(n,e)):c=e,{pathname:c,search:v4(s),hash:_4(a)}}function qE(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function pb(t,e,n,s){return`Cannot include a '${t}' character in a manually specified \`to.${e}\` field [${JSON.stringify(s)}].  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 b4(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function pv(t){let e=b4(t);return e.map((n,s)=>s===e.length-1?n.pathname:n.pathnameBase)}function gv(t,e,n,s=!1){let a;typeof t=="string"?a=Zc(t):(a={...t},Yt(!a.pathname||!a.pathname.includes("?"),pb("?","pathname","search",a)),Yt(!a.pathname||!a.pathname.includes("#"),pb("#","pathname","hash",a)),Yt(!a.search||!a.search.includes("#"),pb("#","search","hash",a)));let c=t===""||a.pathname==="",u=c?"/":a.pathname,h;if(u==null)h=n;else{let x=e.length-1;if(!s&&u.startsWith("..")){let w=u.split("/");for(;w[0]==="..";)w.shift(),x-=1;a.pathname=w.join("/")}h=x>=0?e[x]:"/"}let m=y4(a,h),p=u&&u!=="/"&&u.endsWith("/"),b=(c||u===".")&&n.endsWith("/");return!m.pathname.endsWith("/")&&(p||b)&&(m.pathname+="/"),m}var Hi=t=>t.join("/").replace(/\/\/+/g,"/"),x4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),v4=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,_4=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t,w4=class{constructor(t,e,n,s=!1){this.status=t,this.statusText=e||"",this.internal=s,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function E4(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}function k4(t){return t.map(e=>e.route.path).filter(Boolean).join("/").replace(/\/\/*/g,"/")||"/"}var pS=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function gS(t,e){let n=t;if(typeof n!="string"||!g4.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let s=n,a=!1;if(pS)try{let c=new URL(window.location.href),u=n.startsWith("//")?new URL(c.protocol+n):new URL(n),h=Xi(u.pathname,e);u.origin===c.origin&&h!=null?n=h+u.search+u.hash:a=!0}catch{or(!1,`<Link to="${n}">
58 contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:s,isExternal:a,to:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var yS=["POST","PUT","PATCH","DELETE"];new Set(yS);var T4=["GET",...yS];new Set(T4);var eu=v.createContext(null);eu.displayName="DataRouter";var _p=v.createContext(null);_p.displayName="DataRouterState";var S4=v.createContext(!1),bS=v.createContext({isTransitioning:!1});bS.displayName="ViewTransition";var N4=v.createContext(new Map);N4.displayName="Fetchers";var j4=v.createContext(null);j4.displayName="Await";var Bs=v.createContext(null);Bs.displayName="Navigation";var ch=v.createContext(null);ch.displayName="Location";var Ir=v.createContext({outlet:null,matches:[],isDataRoute:!1});Ir.displayName="Route";var yv=v.createContext(null);yv.displayName="RouteError";var xS="REACT_ROUTER_ERROR",A4="REDIRECT",C4="ROUTE_ERROR_RESPONSE";function R4(t){if(t.startsWith(`${xS}:${A4}:{`))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 I4(t){if(t.startsWith(`${xS}:${C4}:{`))try{let e=JSON.parse(t.slice(40));if(typeof e=="object"&&e&&typeof e.status=="number"&&typeof e.statusText=="string")return new w4(e.status,e.statusText,e.data)}catch{}}function M4(t,{relative:e}={}){Yt(tu(),"useHref() may be used only in the context of a <Router> component.");let{basename:n,navigator:s}=v.useContext(Bs),{hash:a,pathname:c,search:u}=uh(t,{relative:e}),h=c;return n!=="/"&&(h=c==="/"?n:Hi([n,c])),s.createHref({pathname:h,search:u,hash:a})}function tu(){return v.useContext(ch)!=null}function rs(){return Yt(tu(),"useLocation() may be used only in the context of a <Router> component."),v.useContext(ch).location}var vS="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function _S(t){v.useContext(Bs).static||v.useLayoutEffect(t)}function Xn(){let{isDataRoute:t}=v.useContext(Ir);return t?G4():P4()}function P4(){Yt(tu(),"useNavigate() may be used only in the context of a <Router> component.");
58let t=v.useContext(eu),{basename:e,navigator:n}=v.useContext(Bs),{matches:s}=v.useContext(Ir),{pathname:a}=rs(),c=JSON.stringify(pv(s)),u=v.useRef(!1);return _S(()=>{u.current=!0}),v.useCallback((m,p={})=>{if(or(u.current,vS),!u.current)return;if(typeof m=="number"){n.go(m);return}let b=gv(m,JSON.parse(c),a,p.relative==="path");t==null&&e!=="/"&&(b.pathname=b.pathname==="/"?e:Hi([e,b.pathname])),(p.replace?n.replace:n.push)(b,p.state,p)},[e,n,c,a,t])}v.createContext(null);function D4(){let{matches:t}=v.useContext(Ir),e=t[t.length-1];return e?e.params:{}}function uh(t,{relative:e}={}){let{matches:n}=v.useContext(Ir),{pathname:s}=rs(),a=JSON.stringify(pv(n));return v.useMemo(()=>gv(t,JSON.parse(a),s,e==="path"),[t,a,s,e])}function O4(t,e){return wS(t,e)}function wS(t,e,n,s,a){var V;Yt(tu(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:c}=v.useContext(Bs),{matches:u}=v.useContext(Ir),h=u[u.length-1],m=h?h.params:{},p=h?h.pathname:"/",b=h?h.pathnameBase:"/",x=h&&h.route;{let L=x&&x.path||"";kS(p,!x||L.endsWith("*")||L.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${p}" (under <Route path="${L}">) 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.
59
60Please change the parent <Route path="${L}"> to <Route path="${L==="/"?"*":`${L}/*`}">.`)}let w=rs(),T;if(e){let L=typeof e=="string"?Zc(e):e;Yt(b==="/"||((V=L.pathname)==null?void 0:V.startsWith(b)),`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 "${b}" but pathname "${L.pathname}" was given in the \`location\` prop.`),T=L}else T=w;let N=T.pathname||"/",j=N;if(b!=="/"){let L=b.replace(/^\//,"").split("/");j="/"+N.replace(/^\//,"").split("/").slice(L.length).join("/")}let A=hS(t,{pathname:j});or(x||A!=null,`No routes matched location "${T.pathname}${T.search}${T.hash}" `),or(A==null||A[A.length-1].route.element!==void 0||A[A.length-1].route.Component!==void 0||A[A.length-1].route.lazy!==void 0,`Matched leaf route at location "${T.pathname}${T.search}${T.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 F=z4(A&&A.map(L=>Object.assign({},L,{params:Object.assign({},m,L.params),pathname:Hi([b,c.encodeLocation?c.encodeLocation(L.pathname.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathname]),pathnameBase:L.pathnameBase==="/"?b:Hi([b,c.encodeLocation?c.encodeLocation(L.pathnameBase.replace(/\?/g,"%3F").replace(/#/g,"%23")).pathname:L.pathnameBase])})),u,n,s,a);return e&&F?v.createElement(ch.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...T},navigationType:"POP"}},F):F}function L4(){let t=H4(),e=E4(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s="rgba(200,200,200, 0.5)",a={padding:"0.5rem",backgroundColor:s},c={padding:"2px 4px",backgroundColor:s},u=null;return console.error("Error handled by React Router default ErrorBoundary:",t),u=v.createElement(v.Fragment,null,v.createElement("p",null,"💿 Hey developer 👋"),v.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",v.createElement("code",{style:c},"ErrorBoundary")," or"," ",v.createElement("code",{style:c},"errorElement")," prop on your route.")),v.createElement(v.Fragment,null,v.createElement("h2",null,"Unexpected Application Error!"),v.createElement("h3",{style:{fontStyle:"italic"}},e),n?v.createElement("pre",{style:a},n):null,u)}var U4=v.createElement(L4,null),ES=class extends v.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=I4(t.digest);n&&(t=n)}let e=t!==void 0?v.createElement(Ir.Provider,{value:this.props.routeContext},v.createElement(yv.Provider,{value:t,children:this.props.component})):this.props.children;return this.context?v.createElement(F4,{error:t},e):e}};ES.contextType=S4;var gb=new WeakMap;
60function F4({children:t,error:e}){let{basename:n}=v.useContext(Bs);if(typeof e=="object"&&e&&"digest"in e&&typeof e.digest=="string"){let s=R4(e.digest);if(s){let a=gb.get(e);if(a)throw a;let c=gS(s.location,n);if(pS&&!gb.get(e))if(c.isExternal||s.reloadDocument)window.location.href=c.absoluteURL||c.to;else{const u=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(c.to,{replace:s.replace}));throw gb.set(e,u),u}return v.createElement("meta",{httpEquiv:"refresh",content:`0;url=${c.absoluteURL||c.to}`})}}return t}function V4({routeContext:t,match:e,children:n}){let s=v.useContext(eu);return s&&s.static&&s.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=e.route.id),v.createElement(Ir.Provider,{value:t},n)}function z4(t,e=[],n=null,s=null,a=null){if(t==null){if(!n)return null;if(n.errors)t=n.matches;else if(e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let c=t,u=n==null?void 0:n.errors;if(u!=null){let b=c.findIndex(x=>x.route.id&&(u==null?void 0:u[x.route.id])!==void 0);Yt(b>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(u).join(",")}`),c=c.slice(0,Math.min(c.length,b+1))}let h=!1,m=-1;if(n)for(let b=0;b<c.length;b++){let x=c[b];if((x.route.HydrateFallback||x.route.hydrateFallbackElement)&&(m=b),x.route.id){let{loaderData:w,errors:T}=n,N=x.route.loader&&!w.hasOwnProperty(x.route.id)&&(!T||T[x.route.id]===void 0);if(x.route.lazy||N){h=!0,m>=0?c=c.slice(0,m+1):c=[c[0]];break}}}let p=n&&s?(b,x)=>{var w,T;s(b,{location:n.location,params:((T=(w=n.matches)==null?void 0:w[0])==null?void 0:T.params)??{},unstable_pattern:k4(n.matches),errorInfo:x})}:void 0;return c.reduceRight((b,x,w)=>{let T,N=!1,j=null,A=null;n&&(T=u&&x.route.id?u[x.route.id]:void 0,j=x.route.errorElement||U4,h&&(m<0&&w===0?(kS("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),N=!0,A=null):m===w&&(N=!0,A=x.route.hydrateFallbackElement||null)));let F=e.concat(c.slice(0,w+1)),V=()=>{let L;return T?L=j:N?L=A:x.route.Component?L=v.createElement(x.route.Component,null):x.route.element?L=x.route.element:L=b,v.createElement(V4,{match:x,routeContext:{outlet:b,matches:F,isDataRoute:n!=null},children:L})};return n&&(x.route.ErrorBoundary||x.route.errorElement||w===0)?v.createElement(ES,{location:n.location,revalidation:n.revalidation,component:j,error:T,children:V(),routeContext:{outlet:null,matches:F,isDataRoute:!0},onError:p}):V()},null)}function bv(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function B4(t){let e=v.useContext(eu);return Yt(e,bv(t)),e}function K4(t){let e=v.useContext(_p);return Yt(e,bv(t)),e}function $4(t){let e=v.useContext(Ir);return Yt(e,bv(t)),e}function xv(t){let e=$4(t),n=e.matches[e.matches.length-1];return Yt(n.route.id,`${t} can only be used on routes that contain a unique "id"`),n.route.id}function q4(){return xv("useRouteId")}function H4(){var s;let t=v.useContext(yv),e=K4("useRouteError"),n=xv("useRouteError");return t!==void 0?t:(s=e.errors)==null?void 0:s[n]}function G4(){let{router:t}=B4("useNavigate"),e=xv("useNavigate"),n=v.useRef(!1);return _S(()=>{n.current=!0}),v.useCallback(async(a,c={})=>{or(n.current,vS),n.current&&(typeof a=="number"?await t.navigate(a):await t.navigate(a,{fromRouteId:e,...c}))},[t,e])}var HE={};function kS(t,e,n){!e&&!HE[t]&&(HE[t]=!0,or(!1,n))}v.memo(Y4);function Y4({routes:t,future:e,state:n,onError:s}){return wS(t,void 0,n,s,e)}function mc({to:t,replace:e,state:n,relative:s}){Yt(tu(),"<Navigate> may be used only in the context of a <Router> component.");let{static:a}=v.useContext(Bs);or(!a,"<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:c}=v.useContext(Ir),{pathname:u}=rs(),h=Xn(),m=gv(t,pv(c),u,s==="path"),p=JSON.stringify(m);return v.useEffect(()=>{h(JSON.parse(p),{replace:e,state:n,relative:s})},[h,p,s,e,n]),null}function Lt(t){Yt(!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 W4({basename:t="/",children:e=null,location:n,navigationType:s="POP",navigator:a,static:c=!1,unstable_useTransitions:u}){Yt(!tu(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let h=t.replace(/^\/*/,"/"),m=v.useMemo(()=>({basename:h,navigator:a,static:c,unstable_useTransitions:u,future:{}}),[h,a,c,u]);typeof n=="string"&&(n=Zc(n));let{pathname:p="/",search:b="",hash:x="",state:w=null,key:T="default"}=n,N=v.useMemo(()=>{let j=Xi(p,h);return j==null?null:{location:{pathname:j,search:b,hash:x,state:w,key:T},navigationType:s}},[h,p,b,x,w,T,s]);
60return or(N!=null,`<Router basename="${h}"> is not able to match the URL "${p}${b}${x}" because it does not start with the basename, so the <Router> won't render anything.`),N==null?null:v.createElement(Bs.Provider,{value:m},v.createElement(ch.Provider,{children:e,value:N}))}function GE({children:t,location:e}){return O4(wx(t),e)}function wx(t,e=[]){let n=[];return v.Children.forEach(t,(s,a)=>{if(!v.isValidElement(s))return;let c=[...e,a];if(s.type===v.Fragment){n.push.apply(n,wx(s.props.children,c));return}Yt(s.type===Lt,`[${typeof s.type=="string"?s.type:s.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Yt(!s.props.index||!s.props.children,"An index route cannot have child routes.");let u={id:s.props.id||c.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,middleware:s.props.middleware,loader:s.props.loader,action:s.props.action,hydrateFallbackElement:s.props.hydrateFallbackElement,HydrateFallback:s.props.HydrateFallback,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.hasErrorBoundary===!0||s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(u.children=wx(s.props.children,c)),n.push(u)}),n}var Em="get",km="application/x-www-form-urlencoded";function wp(t){return typeof HTMLElement<"u"&&t instanceof HTMLElement}function X4(t){return wp(t)&&t.tagName.toLowerCase()==="button"}function Q4(t){return wp(t)&&t.tagName.toLowerCase()==="form"}function J4(t){return wp(t)&&t.tagName.toLowerCase()==="input"}function Z4(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function e3(t,e){return t.button===0&&(!e||e==="_self")&&!Z4(t)}function Ex(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function t3(t,e){let n=Ex(t);return e&&e.forEach((s,a)=>{n.has(a)||e.getAll(a).forEach(c=>{n.append(a,c)})}),n}var tm=null;function n3(){if(tm===null)try{new FormData(document.createElement("form"),0),tm=!1}catch{tm=!0}return tm}var s3=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function yb(t){return t!=null&&!s3.has(t)?(or(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${km}"`),null):t}function r3(t,e){let n,s,a,c,u;if(Q4(t)){let h=t.getAttribute("action");s=h?Xi(h,e):null,n=t.getAttribute("method")||Em,a=yb(t.getAttribute("enctype"))||km,c=new FormData(t)}else if(X4(t)||J4(t)&&(t.type==="submit"||t.type==="image")){let h=t.form;if(h==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let m=t.getAttribute("formaction")||h.getAttribute("action");if(s=m?Xi(m,e):null,n=t.getAttribute("formmethod")||h.getAttribute("method")||Em,a=yb(t.getAttribute("formenctype"))||yb(h.getAttribute("enctype"))||km,c=new FormData(h,t),!n3()){let{name:p,type:b,value:x}=t;if(b==="image"){let w=p?`${p}.`:"";c.append(`${w}x`,"0"),c.append(`${w}y`,"0")}else p&&c.append(p,x)}}else{if(wp(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');n=Em,s=null,a=km,u=t}return c&&a==="text/plain"&&(u=c,c=void 0),{action:s,method:n.toLowerCase(),encType:a,formData:c,body:u}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function vv(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function i3(t,e,n,s){let a=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return n?a.pathname.endsWith("/")?a.pathname=`${a.pathname}_.${s}`:a.pathname=`${a.pathname}.${s}`:a.pathname==="/"?a.pathname=`_root.${s}`:e&&Xi(a.pathname,e)==="/"?a.pathname=`${e.replace(/\/$/,"")}/_root.${s}`:a.pathname=`${a.pathname.replace(/\/$/,"")}.${s}`,a}async function a3(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.
60isSpaMode,window.location.reload(),new Promise(()=>{})}}function o3(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 l3(t,e,n){let s=await Promise.all(t.map(async a=>{let c=e.routes[a.route.id];if(c){let u=await a3(c,n);return u.links?u.links():[]}return[]}));return h3(s.flat(1).filter(o3).filter(a=>a.rel==="stylesheet"||a.rel==="preload").map(a=>a.rel==="stylesheet"?{...a,rel:"prefetch",as:"style"}:{...a,rel:"prefetch"}))}function YE(t,e,n,s,a,c){let u=(m,p)=>n[p]?m.route.id!==n[p].route.id:!0,h=(m,p)=>{var b;return n[p].pathname!==m.pathname||((b=n[p].route.path)==null?void 0:b.endsWith("*"))&&n[p].params["*"]!==m.params["*"]};return c==="assets"?e.filter((m,p)=>u(m,p)||h(m,p)):c==="data"?e.filter((m,p)=>{var x;let b=s.routes[m.route.id];if(!b||!b.hasLoader)return!1;if(u(m,p)||h(m,p))return!0;if(m.route.shouldRevalidate){let w=m.route.shouldRevalidate({currentUrl:new URL(a.pathname+a.search+a.hash,window.origin),currentParams:((x=n[0])==null?void 0:x.params)||{},nextUrl:new URL(t,window.origin),nextParams:m.params,defaultShouldRevalidate:!0});if(typeof w=="boolean")return w}return!0}):[]}function c3(t,e,{includeHydrateFallback:n}={}){return u3(t.map(s=>{let a=e.routes[s.route.id];if(!a)return[];let c=[a.module];return a.clientActionModule&&(c=c.concat(a.clientActionModule)),a.clientLoaderModule&&(c=c.concat(a.clientLoaderModule)),n&&a.hydrateFallbackModule&&(c=c.concat(a.hydrateFallbackModule)),a.imports&&(c=c.concat(a.imports)),c}).flat(1))}function u3(t){return[...new Set(t)]}function d3(t){let e={},n=Object.keys(t).sort();for(let s of n)e[s]=t[s];return e}function h3(t,e){let n=new Set;return new Set(e),t.reduce((s,a)=>{let c=JSON.stringify(d3(a));return n.has(c)||(n.add(c),s.push({key:c,link:a})),s},[])}function TS(){let t=v.useContext(eu);return vv(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function f3(){let t=v.useContext(_p);return vv(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var _v=v.createContext(void 0);_v.displayName="FrameworkContext";function SS(){let t=v.useContext(_v);return vv(t,"You must render this element inside a <HydratedRouter> element"),t}function m3(t,e){let n=v.useContext(_v),[s,a]=v.useState(!1),[c,u]=v.useState(!1),{onFocus:h,onBlur:m,onMouseEnter:p,onMouseLeave:b,onTouchStart:x}=e,w=v.useRef(null);v.useEffect(()=>{if(t==="render"&&u(!0),t==="viewport"){let j=F=>{F.forEach(V=>{u(V.isIntersecting)})},A=new IntersectionObserver(j,{threshold:.5});return w.current&&A.observe(w.current),()=>{A.disconnect()}}},[t]),v.useEffect(()=>{if(s){let j=setTimeout(()=>{u(!0)},100);return()=>{clearTimeout(j)}}},[s]);let T=()=>{a(!0)},N=()=>{a(!1),u(!1)};return n?t!=="intent"?[c,w,{}]:[c,w,{onFocus:pd(h,T),onBlur:pd(m,N),onMouseEnter:pd(p,T),onMouseLeave:pd(b,N),onTouchStart:pd(x,T)}]:[!1,w,{}]}function pd(t,e){return n=>{t&&t(n),n.defaultPrevented||e(n)}}function p3({page:t,...e}){let{router:n}=TS(),s=v.useMemo(()=>hS(n.routes,t,n.basename),[n.routes,t,n.basename]);return s?v.createElement(y3,{page:t,matches:s,...e}):null}function g3(t){let{manifest:e,routeModules:n}=SS(),[s,a]=v.useState([]);return v.useEffect(()=>{let c=!1;return l3(t,e,n).then(u=>{c||a(u)}),()=>{c=!0}},[t,e,n]),s}function y3({page:t,matches:e,...n}){let s=rs(),{future:a,manifest:c,routeModules:u}=SS(),{basename:h}=TS(),{loaderData:m,matches:p}=f3(),b=v.useMemo(()=>YE(t,e,p,c,s,"data"),[t,e,p,c,s]),x=v.useMemo(()=>YE(t,e,p,c,s,"assets"),[t,e,p,c,s]),w=v.useMemo(()=>{if(t===s.pathname+s.search+s.hash)return[];let j=new Set,A=!1;if(e.forEach(V=>{var Y;let L=c.routes[V.route.id];!L||!L.hasLoader||(!b.some($=>$.route.id===V.route.id)&&V.route.id in m&&((Y=u[V.route.id])!=null&&Y.shouldRevalidate)||L.hasClientLoader?A=!0:j.add(V.route.id))}),j.size===0)return[];let F=i3(t,h,a.unstable_trailingSlashAwareDataRequests,"data");return A&&j.size>0&&F.searchParams.set("_routes",e.filter(V=>j.has(V.route.id)).map(V=>V.route.id).join(",")),[F.pathname+F.search]},[h,a.unstable_trailingSlashAwareDataRequests,m,s,c,b,e,t,u]),T=v.useMemo(()=>c3(x,c),[x,c]),N=g3(x);return v.createElement(v.Fragment,null,w.map(j=>v.createElement("link",{key:j,rel:"prefetch",as:"fetch",href:j,...n})),T.map(j=>v.createElement("link",{key:j,rel:"modulepreload",href:j,...n})),N.map(({key:j,link:A})=>v.createElement("link",{key:j,nonce:n.nonce,...A,crossOrigin:A.crossOrigin??n.crossOrigin})))}function b3(...t){return e=>{t.forEach(n=>{typeof n=="function"?n(e):n!=null&&(n.current=e)})}}var x3=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{x3&&(window.__reactRouterVersion="7.13.0")}catch{}function v3({basename:t,children:e,unstable_useTransitions:n,window:s}){let a=v.useRef();a.current==null&&(a.current=ZI({window:s,v5Compat:!0}));let c=a.current,[u,h]=v.useState({action:c.action,location:c.location}),m=v.useCallback(p=>{n===!1?h(p):v.startTransition(()=>h(p))},[n]);return v.useLayoutEffect(()=>c.listen(m),[c,m]),v.createElement(W4,{basename:t,children:e,location:u.location,navigationType:u.action,navigator:c,unstable_useTransitions:n})}var NS=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,zt=v.forwardRef(function({onClick:e,discover:n="render",prefetch:s="none",relative:a,reloadDocument:c,replace:u,state:h,target:m,to:p,preventScrollReset:b,viewTransition:x,unstable_defaultShouldRevalidate:w,...T},N){let{basename:j,unstable_useTransitions:A}=v.useContext(Bs),F=typeof p=="string"&&NS.test(p),V=gS(p,j);p=V.to;let L=M4(p,{relative:a}),[Y,$,q]=m3(s,T),I=E3(p,{replace:u,state:h,target:m,preventScrollReset:b,relative:a,viewTransition:x,unstable_defaultShouldRevalidate:w,unstable_useTransitions:A});function S(R){e&&e(R),R.defaultPrevented||I(R)}let C=v.createElement("a",{...T,...q,href:V.absoluteURL||L,onClick:V.isExternal||c?e:S,ref:b3(N,$),target:m,"data-discover":!F&&n==="render"?"true":void 0});return Y&&!F?v.createElement(v.Fragment,null,C,v.createElement(p3,{page:L})):C});zt.displayName="Link";var jS=v.forwardRef(function({"aria-current":e="page",caseSensitive:n=!1,className:s="",end:a=!1,style:c,to:u,viewTransition:h,children:m,...p},b){let x=uh(u,{relative:p.relative}),w=rs(),T=v.useContext(_p),{navigator:N,basename:j}=v.useContext(Bs),A=T!=null&&A3(x)&&h===!0,F=N.encodeLocation?N.encodeLocation(x).pathname:x.pathname,V=w.pathname,L=T&&T.navigation&&T.navigation.location?T.navigation.location.pathname:null;n||(V=V.toLowerCase(),L=L?L.toLowerCase():null,F=F.toLowerCase()),L&&j&&(L=Xi(L,j)||L);const Y=F!=="/"&&F.endsWith("/")?F.length-1:F.length;let $=V===F||!a&&V.startsWith(F)&&V.charAt(Y)==="/",q=L!=null&&(L===F||!a&&L.startsWith(F)&&L.charAt(F.length)==="/"),I={isActive:$,isPending:q,isTransitioning:A},S=$?e:void 0,C;typeof s=="function"?C=s(I):C=[s,$?"active":null,q?"pending":null,A?"transitioning":null].filter(
60Boolean).join(" ");let R=typeof c=="function"?c(I):c;return v.createElement(zt,{...p,"aria-current":S,className:C,ref:b,style:R,to:u,viewTransition:h},typeof m=="function"?m(I):m)});jS.displayName="NavLink";var _3=v.forwardRef(({discover:t="render",fetcherKey:e,navigate:n,reloadDocument:s,replace:a,state:c,method:u=Em,action:h,onSubmit:m,relative:p,preventScrollReset:b,viewTransition:x,unstable_defaultShouldRevalidate:w,...T},N)=>{let{unstable_useTransitions:j}=v.useContext(Bs),A=N3(),F=j3(h,{relative:p}),V=u.toLowerCase()==="get"?"get":"post",L=typeof h=="string"&&NS.test(h),Y=$=>{if(m&&m($),$.defaultPrevented)return;$.preventDefault();let q=$.nativeEvent.submitter,I=(q==null?void 0:q.getAttribute("formmethod"))||u,S=()=>A(q||$.currentTarget,{fetcherKey:e,method:I,navigate:n,replace:a,state:c,relative:p,preventScrollReset:b,viewTransition:x,unstable_defaultShouldRevalidate:w});j&&n!==!1?v.startTransition(()=>S()):S()};return v.createElement("form",{ref:N,method:V,action:F,onSubmit:s?m:Y,...T,"data-discover":!L&&t==="render"?"true":void 0})});_3.displayName="Form";function w3(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function AS(t){let e=v.useContext(eu);return Yt(e,w3(t)),e}function E3(t,{target:e,replace:n,state:s,preventScrollReset:a,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:h,unstable_useTransitions:m}={}){let p=Xn(),b=rs(),x=uh(t,{relative:c}
60);return v.useCallback(w=>{if(e3(w,e)){w.preventDefault();let T=n!==void 0?n:Fd(b)===Fd(x),N=()=>p(t,{replace:T,state:s,preventScrollReset:a,relative:c,viewTransition:u,unstable_defaultShouldRevalidate:h});m?v.startTransition(()=>N()):N()}},[b,p,x,n,s,e,t,a,c,u,h,m])}function k3(t){or(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let e=v.useRef(Ex(t)),n=v.useRef(!1),s=rs(),a=v.useMemo(()=>t3(s.search,n.current?null:e.current),[s.search]),c=Xn(),u=v.useCallback((h,m)=>{const p=Ex(typeof h=="function"?h(new URLSearchParams(a)):h);n.current=!0,c("?"+p,m)},[c,a]);return[a,u]}var T3=0,S3=()=>`__${String(++T3)}__`;function N3(){let{router:t}=AS("useSubmit"),{basename:e}=v.useContext(Bs),n=q4(),s=t.fetch,a=t.navigate;return v.useCallback(async(c,u={})=>{let{action:h,method:m,encType:p,formData:b,body:x}=r3(c,e);if(u.navigate===!1){let w=u.fetcherKey||S3();await s(w,n,u.action||h,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:x,formMethod:u.method||m,formEncType:u.encType||p,flushSync:u.flushSync})}else await a(u.action||h,{unstable_defaultShouldRevalidate:u.unstable_defaultShouldRevalidate,preventScrollReset:u.preventScrollReset,formData:b,body:x,formMethod:u.method||m,formEncType:u.encType||p,replace:u.replace,state:u.state,fromRouteId:n,flushSync:u.flushSync,viewTransition:u.viewTransition})},[s,a,e,n])}function j3(t,{relative:e}={}){let{basename:n}=v.useContext(Bs),s=v.useContext(Ir);Yt(s,"useFormAction must be used inside a RouteContext");let[a]=s.matches.slice(-1),c={...uh(t||".",{relative:e})},u=rs();if(t==null){c.search=u.search;let h=new URLSearchParams(c.search),m=h.getAll("index");if(m.some(b=>b==="")){h.delete("index"),m.filter(x=>x).forEach(x=>h.append("index",x));let b=h.toString();c.search=b?`?${b}`:""}}return(!t||t===".")&&a.route.index&&(c.search=c.search?c.search.replace(/^\?/,"?index&"):"?index"),n!=="/"&&(c.pathname=c.pathname==="/"?n:Hi([n,c.pathname])),Fd(c)}function A3(t,{relative:e}={}){let n=v.useContext(bS);Yt(n!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:s}=AS("useViewTransitionState"),a=uh(t,{relative:e});if(!n.isTransitioning)return!1;let c=Xi(n.currentLocation.pathname,s)||n.currentLocation.pathname,u=Xi(n.nextLocation.pathname,s)||n.nextLocation.pathname;return Lm(a.pathname,u)!=null||Lm(a.pathname,c)!=null}var C3=dS();const wv="shoot_intent",CS={lingerie:"/lingerie-studio","try-on":"/try-on",catalogue:"/catalogue","pro-studio":"/pro-studio","jewelry-on-model":"/jewelry-on-model",video:"/video","ugc-creator":"/ugc-creator","body-editor":"/body-editor",remove_background:"/tools/remove_background",photo_enhance:"/tools/photo_enhance",amateur_to_pro:"/tools/amateur_to_pro",photo_reframe:"/tools/photo_reframe",photo_edit:"/tools/photo_edit",pose_angle_switch:"/tools/pose_angle_switch",model_to_flat_lay:"/tools/model_to_flat_lay"},RS=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Ac=/^[a-z0-9_]{1,64}$/,IS=/^(auto|\d{1,2}:\d{1,2})$/;function ni(t,e){return t&&e.test(t)?t:void 0}function MS(t){try{const e=new URL(t);return e.protocol==="https:"&&e.hostname==="firebasestorage.googleapis.com"&&e.pathname.includes("landing_uploads")}catch{return!1}}function Ep(){try{const t=sessionStorage.getItem(wv);if(!t)return null;const e=JSON.parse(t);return!(e!=null&&e.url)||!(e!=null&&e.tool)||!MS(e.url)?null:{capturedAt:typeof e.capturedAt=="number"?e.capturedAt:void 0,id:e.id||"",url:e.url,tool:e.tool,model:ni(e.model??null,RS),venue:ni(e.venue??null,Ac),pose:ni(e.pose??null,Ac),ratio:ni(e.ratio??null,IS),preset:ni(e.preset??null,Ac),prompt:typeof e.prompt=="string"&&e.prompt.trim()?e.prompt.trim().slice(0,300):void 0}}catch{return null}}function PS(){var a;if(typeof window>"u")return;const t=new URLSearchParams(window.location.search),e=t.get("img"),n=t.get("tool");if(!e||!n||!CS[n]||!MS(e))return;try{sessionStorage.setItem(wv,JSON.stringify({capturedAt:Date.now(),id:t.get("shoot")||"",url:e,tool:n,model:ni(t.get("model"),RS),venue:ni(t.get("venue"),Ac),pose:ni(t.get("pose"),Ac),ratio:ni(t.get("ratio"),IS),preset:ni(t.get("preset"),Ac),prompt:((a=t.get("prompt"))==null?void 0:a.trim().slice(0,300))||void 0}))}catch{return}t.delete("shoot"),t.delete("tool"),t.delete("img"),t.delete("model"),t.delete("venue"),t.delete("pose"),t.delete("ratio"),t.delete("preset"),t.delete("prompt");const s=t.toString();window.history.replaceState({},"",window.location.pathname+(s?`?${s}`:"")+window.location.hash)}function DS(){const t=Ep();return t?CS[t.tool]??null:null}function ia(t){const e=Ep();if(!e||e.tool!==t)return null;try{sessionStorage.removeItem(wv)}catch{}return{url:e.url,model:e.model,venue:e.venue,pose:e.pose,ratio:e.ratio,prompt:e.prompt,preset:e.preset}}/**
61 * @license lucide-react v0.562.0 - ISC
62 *
63 * This source code is licensed under the ISC license.
64 * See the LICENSE file in the root directory of this source tree.
65 */const R3=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),I3=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,s)=>s?s.toUpperCase():n.toLowerCase()),WE=t=>{const e=I3(t);return e.charAt(0).toUpperCase()+e.slice(1)},OS=(...t)=>t.filter((e,n,s)=>!!e&&e.trim()!==""&&s.indexOf(e)===n).join(" ").trim(),M3=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};/**
66 * @license lucide-react v0.562.0 - ISC
67 *
68 * This source code is licensed under the ISC license.
69 * See the LICENSE file in the root directory of this source tree.
70 */var P3={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"};/**
71 * @license lucide-react v0.562.0 - ISC
72 *
73 * This source code is licensed under the ISC license.
74 * See the LICENSE file in the root directory of this source tree.
75 */const D3=v.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:c,iconNode:u,...h},m)=>v.createElement("svg",{ref:m,...P3,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:OS("lucide",a),...!c&&!M3(h)&&{"aria-hidden":"true"},...h},[...u.map(([p,b])=>
75v.createElement(p,b)),...Array.isArray(c)?c:[c]]));/**
76 * @license lucide-react v0.562.0 - ISC
77 *
78 * This source code is licensed under the ISC license.
79 * See the LICENSE file in the root directory of this source tree.
80 */const Ae=(t,e)=>{const n=v.forwardRef(({className:s,...a},c)=>v.createElement(D3,{ref:c,iconNode:e,className:OS(`lucide-${R3(WE(t))}`,`lucide-${t}`,s),...a}));return n.displayName=WE(t),n};/**
81 * @license lucide-react v0.562.0 - ISC
82 *
83 * This source code is licensed under the ISC license.
84 * See the LICENSE file in the root directory of this source tree.
85 */const O3=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],di=Ae("arrow-left",O3);/**
86 * @license lucide-react v0.562.0 - ISC
87 *
88 * This source code is licensed under the ISC license.
89 * See the LICENSE file in the root directory of this source tree.
90 */const L3=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],ks=Ae("arrow-right",L3);/**
91 * @license lucide-react v0.562.0 - ISC
92 *
93 * This source code is licensed under the ISC license.
94 * See the LICENSE file in the root directory of this source tree.
95 */const U3=[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]],F3=Ae("arrow-up-right",U3);/**
96 * @license lucide-react v0.562.0 - ISC
97 *
98 * This source code is licensed under the ISC license.
99 * See the LICENSE file in the root directory of this source tree.
100 */const V3=[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]],z3=Ae("book-open",V3);/**
101 * @license lucide-react v0.562.0 - ISC
102 *
103 * This source code is licensed under the ISC license.
104 * See the LICENSE file in the root directory of this source tree.
105 */const B3=[["path",{d:"M21 8a2 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.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]],Ev=Ae("box",B3);/**
106 * @license lucide-react v0.562.0 - ISC
107 *
108 * This source code is licensed under the ISC license.
109 * See the LICENSE file in the root directory of this source tree.
110 */const K3=[["path",{d:"M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z",key:"18u6gg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],kp=Ae("camera",K3);/**
111 * @license lucide-react v0.562.0 - ISC
112 *
113 * This source code is licensed under the ISC license.
114 * See the LICENSE file in the root directory of this source tree.
115 */const $3=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Cn=Ae("check",$3);/**
116 * @license lucide-react v0.562.0 - ISC
117 *
118 * This source code is licensed under the ISC license.
119 * See the LICENSE file in the root directory of this source tree.
120 */const q3=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],Um=Ae("chevron-down",q3);/**
121 * @license lucide-react v0.562.0 - ISC
122 *
123 * This source code is licensed under the ISC license.
124 * See the LICENSE file in the root directory of this source tree.
125 */const H3=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],G3=Ae("chevron-left",H3);/**
126 * @license lucide-react v0.562.0 - ISC
127 *
128 * This source code is licensed under the ISC license.
129 * See the LICENSE file in the root directory of this source tree.
130 */const Y3=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Vd=Ae("chevron-right",Y3);/**
131 * @license lucide-react v0.562.0 - ISC
132 *
133 * This source code is licensed under the ISC license.
134 * See the LICENSE file in the root directory of this source tree.
135 */const W3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],dh=Ae("circle-alert",W3);/**
136 * @license lucide-react v0.562.0 - ISC
137 *
138 * This source code is licensed under the ISC license.
139 * See the LICENSE file in the root directory of this source tree.
140 */const X3=[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]],kv=Ae("circle-check-big",X3);/**
141 * @license lucide-react v0.562.0 - ISC
142 *
143 * This source code is licensed under the ISC license.
144 * See the LICENSE file in the root directory of this source tree.
145 */const Q3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Ya=Ae("circle-check",Q3);/**
146 * @license lucide-react v0.562.0 - ISC
147 *
148 * This source code is licensed under the ISC license.
149 * See the LICENSE file in the root directory of this source tree.
150 */const J3=[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]],XE=Ae("circle-play",J3);/**
151 * @license lucide-react v0.562.0 - ISC
152 *
153 * This source code is licensed under the ISC license.
154 * See the LICENSE file in the root directory of this source tree.
155 */const Z3=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],e5=Ae("circle-question-mark",Z3);/**
156 * @license lucide-react v0.562.0 - ISC
157 *
158 * This source code is licensed under the ISC license.
159 * See the LICENSE file in the root directory of this source tree.
160 */const t5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],n5=Ae("circle-x",t5);/**
161 * @license lucide-react v0.562.0 - ISC
162 *
163 * This source code is licensed under the ISC license.
164 * See the LICENSE file in the root directory of this source tree.
165 */const s5=[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]],r5=Ae("clapperboard",s5);/**
166 * @license lucide-react v0.562.0 - ISC
167 *
168 * This source code is licensed under the ISC license.
169 * See the LICENSE file in the root directory of this source tree.
170 */const i5=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],a5=Ae("copy",i5);/**
171 * @license lucide-react v0.562.0 - ISC
172 *
173 * This source code is licensed under the ISC license.
174 * See the LICENSE file in the root directory of this source tree.
175 */const o5=[["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}],["path",{d:"m9 10-5 5 5 5",key:"1kshq7"}]],l5=Ae("corner-down-left",o5);/**
176 * @license lucide-react v0.562.0 - ISC
177 *
178 * This source code is licensed under the ISC license.
179 * See the LICENSE file in the root directory of this source tree.
180 */const c5=[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]],LS=Ae("credit-card",c5);/**
181 * @license lucide-react v0.562.0 - ISC
182 *
183 * This source code is licensed under the ISC license.
184 * See the LICENSE file in the root directory of this source tree.
185 */const u5=[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]],US=Ae("crop",u5);/**
186 * @license lucide-react v0.562.0 - ISC
187 *
188 * This source code is licensed under the ISC license.
189 * See the LICENSE file in the root directory of this source tree.
190 */const d5=[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]],h5=Ae("crown",d5);/**
191 * @license lucide-react v0.562.0 - ISC
192 *
193 * This source code is licensed under the ISC license.
194 * See the LICENSE file in the root directory of this source tree.
195 */const f5=[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]],Bc=Ae("diamond",f5);/**
196 * @license lucide-react v0.562.0 - ISC
197 *
198 * This source code is licensed under the ISC license.
199 * See the LICENSE file in the root directory of this source tree.
200 */const m5=[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]],aa=Ae("download",m5);/**
201 * @license lucide-react v0.562.0 - ISC
202 *
203 * This source code is licensed under the ISC license.
204 * See the LICENSE file in the root directory of this source tree.
205 */const p5=[["path",{d:"M21 21H8a2 2 0 0 1-1.42-.587l-3.994-3.999a2 2 0 0 1 0-2.828l10-10a2 2 0 0 1 2.829 0l5.999 6a2 2 0 0 1 0 2.828L12.834 21",key:"g5wo59"}],["path",{d:"m5.082 11.09 8.828 8.828",key:"1wx5vj"}]],g5=Ae("eraser",p5);/**
206 * @license lucide-react v0.562.0 - ISC
207 *
208 * This source code is licensed under the ISC license.
209 * See the LICENSE file in the root directory of this source tree.
210 */const y5=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],Fm=Ae("external-link",y5);/**
211 * @license lucide-react v0.562.0 - ISC
212 *
213 * This source code is licensed under the ISC license.
214 * See the LICENSE file in the root directory of this source tree.
215 */const b5=[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],x5=Ae("file-text",b5);/**
216 * @license lucide-react v0.562.0 - ISC
217 *
218 * This source code is licensed under the ISC license.
219 * See the LICENSE file in the root directory of this source tree.
220 */const v5=[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}
220],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]],_5=Ae("flower-2",v5);/**
221 * @license lucide-react v0.562.0 - ISC
222 *
223 * This source code is licensed under the ISC license.
224 * See the LICENSE file in the root directory of this source tree.
225 */const w5=[["path",{d:"M10.5 3 8 9l4 13 4-13-2.5-6",key:"b3dvk1"}],["path",{d:"M17 3a2 2 0 0 1 1.6.8l3 4a2 2 0 0 1 .013 2.382l-7.99 10.986a2 2 0 0 1-3.247 0l-7.99-10.986A2 2 0 0 1 2.4 7.8l2.998-3.997A2 2 0 0 1 7 3z",key:"7w4byz"}],["path",{d:"M2 9h20",key:"16fsjt"}]],rr=Ae("gem",w5);/**
226 * @license lucide-react v0.562.0 - ISC
227 *
228 * This source code is licensed under the ISC license.
229 * See the LICENSE file in the root directory of this source tree.
230 */const E5=[["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"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]],kx=Ae("history",E5);/**
231 * @license lucide-react v0.562.0 - ISC
232 *
233 * This source code is licensed under the ISC license.
234 * See the LICENSE file in the root directory of this source tree.
235 */const k5=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],T5=Ae("house",k5);/**
236 * @license lucide-react v0.562.0 - ISC
237 *
238 * This source code is licensed under the ISC license.
239 * See the LICENSE file in the root directory of this source tree.
240 */const S5=[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]],N5=Ae("image-off",S5);/**
241 * @license lucide-react v0.562.0 - ISC
242 *
243 * This source code is licensed under the ISC license.
244 * See the LICENSE file in the root directory of this source tree.
245 */const j5=[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]],Jo=Ae("image-plus",j5);/**
246 * @license lucide-react v0.562.0 - ISC
247 *
248 * This source code is licensed under the ISC license.
249 * See the LICENSE file in the root directory of this source tree.
250 */const A5=[["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"}]],Tv=Ae("image",A5);/**
251 * @license lucide-react v0.562.0 - ISC
252 *
253 * This source code is licensed under the ISC license.
254 * See the LICENSE file in the root directory of this source tree.
255 */const C5=[["path",{d:"m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16",key:"9kzy35"}],["path",{d:"M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2",key:"1t0f0t"}],["circle",{cx:"13",cy:"7",r:"1",fill:"currentColor",key:"1obus6"}],["rect",{x:"8",y:"2",width:"14",height:"14",rx:"2",key:"1gvhby"}]],Sv=Ae("images",C5);/**
256 * @license lucide-react v0.562.0 - ISC
257 *
258 * This source code is licensed under the ISC license.
259 * See the LICENSE file in the root directory of this source tree.
260 */const R5=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],FS=Ae("info",R5);/**
261 * @license lucide-react v0.562.0 - ISC
262 *
263 * This source code is licensed under the ISC license.
264 * See the LICENSE file in the root directory of this source tree.
265 */const I5=[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]],Tp=Ae("key-round",I5);/**
266 * @license lucide-react v0.562.0 - ISC
267 *
268 * This source code is licensed under the ISC license.
269 * See the LICENSE file in the root directory of this source tree.
270 */const M5=[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]],VS=Ae("layout-grid",M5);/**
271 * @license lucide-react v0.562.0 - ISC
272 *
273 * This source code is licensed under the ISC license.
274 * See the LICENSE file in the root directory of this source tree.
275 */const P5=[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]],Nv=Ae("lightbulb",P5);/**
276 * @license lucide-react v0.562.0 - ISC
277 *
278 * This source code is licensed under the ISC license.
279 * See the LICENSE file in the root directory of this source tree.
280 */const D5=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],et=Ae("loader-circle",D5);/**
281 * @license lucide-react v0.562.0 - ISC
282 *
283 * This source code is licensed under the ISC license.
284 * See the LICENSE file in the root directory of this source tree.
285 */const O5=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],zS=Ae("lock",O5);/**
286 * @license lucide-react v0.562.0 - ISC
287 *
288 * This source code is licensed under the ISC license.
289 * See the LICENSE file in the root directory of this source tree.
290 */const L5=[["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"}]],Tx=Ae("log-out",L5);/**
291 * @license lucide-react v0.562.0 - ISC
292 *
293 * This source code is licensed under the ISC license.
294 * See the LICENSE file in the root directory of this source tree.
295 */const U5=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]],Sp=Ae("mail",U5);/**
296 * @license lucide-react v0.562.0 - ISC
297 *
298 * This source code is licensed under the ISC license.
299 * See the LICENSE file in the root directory of this source tree.
300 */const F5=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"m21 3-7 7",key:"1l2asr"}],["path",{d:"m3 21 7-7",key:"tjx5ai"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]],BS=Ae("maximize-2",F5);/**
301 * @license lucide-react v0.562.0 - ISC
302 *
303 * This source code is licensed under the ISC license.
304 * See the LICENSE file in the root directory of this source tree.
305 */const V5=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],z5=Ae("menu",V5);/**
306 * @license lucide-react v0.562.0 - ISC
307 *
308 * This source code is licensed under the ISC license.
309 * See the LICENSE file in the root directory of this source tree.
310 */const B5=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],KS=Ae("moon",B5);/**
311 * @license lucide-react v0.562.0 - ISC
312 *
313 * This source code is licensed under the ISC license.
314 * See the LICENSE file in the root directory of this source tree.
315 */const K5=[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]],$5=Ae("move-horizontal",K5);/**
316 * @license lucide-react v0.562.0 - ISC
317 *
318 * This source code is licensed under the ISC license.
319 * See the LICENSE file in the root directory of this source tree.
320 */const q5=[["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"}]],Tr=Ae("package",q5);/**
321 * @license lucide-react v0.562.0 - ISC
322 *
323 * This source code is licensed under the ISC license.
324 * See the LICENSE file in the root directory of this source tree.
325 */const H5=[["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"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],G5=Ae("pencil",H5);/**
326 * @license lucide-react v0.562.0 - ISC
327 *
328 * This source code is licensed under the ISC license.
329 * See the LICENSE file in the root directory of this source tree.
330 */const Y5=[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}
330]],W5=Ae("person-standing",Y5);/**
331 * @license lucide-react v0.562.0 - ISC
332 *
333 * This source code is licensed under the ISC license.
334 * See the LICENSE file in the root directory of this source tree.
335 */const X5=[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]],Q5=Ae("pipette",X5);/**
336 * @license lucide-react v0.562.0 - ISC
337 *
338 * This source code is licensed under the ISC license.
339 * See the LICENSE file in the root directory of this source tree.
340 */const J5=[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]],$S=Ae("play",J5);/**
341 * @license lucide-react v0.562.0 - ISC
342 *
343 * This source code is licensed under the ISC license.
344 * See the LICENSE file in the root directory of this source tree.
345 */const Z5=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],eM=Ae("plug",Z5);/**
346 * @license lucide-react v0.562.0 - ISC
347 *
348 * This source code is licensed under the ISC license.
349 * See the LICENSE file in the root directory of this source tree.
350 */const tM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Kc=Ae("plus",tM);/**
351 * @license lucide-react v0.562.0 - ISC
352 *
353 * This source code is licensed under the ISC license.
354 * See the LICENSE file in the root directory of this source tree.
355 */const nM=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],qS=Ae("refresh-cw",nM);/**
356 * @license lucide-react v0.562.0 - ISC
357 *
358 * This source code is licensed under the ISC license.
359 * See the LICENSE file in the root directory of this source tree.
360 */const sM=[["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"}]],rM=Ae("rotate-ccw",sM);/**
361 * @license lucide-react v0.562.0 - ISC
362 *
363 * This source code is licensed under the ISC license.
364 * See the LICENSE file in the root directory of this source tree.
365 */const iM=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],Sx=Ae("rotate-cw",iM);/**
366 * @license lucide-react v0.562.0 - ISC
367 *
368 * This source code is licensed under the ISC license.
369 * See the LICENSE file in the root directory of this source tree.
370 */const aM=[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]],zd=Ae("search",aM);/**
371 * @license lucide-react v0.562.0 - ISC
372 *
373 * This source code is licensed under the ISC license.
374 * See the LICENSE file in the root directory of this source tree.
375 */const oM=[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]],lM=Ae("share-2",oM);/**
376 * @license lucide-react v0.562.0 - ISC
377 *
378 * This source code is licensed under the ISC license.
379 * See the LICENSE file in the root directory of this source tree.
380 */const cM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],HS=Ae("shield-check",cM);/**
381 * @license lucide-react v0.562.0 - ISC
382 *
383 * This source code is licensed under the ISC license.
384 * See the LICENSE file in the root directory of this source tree.
385 */const uM=[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",ke
385y:"oel41y"}]],hh=Ae("shield",uM);/**
386 * @license lucide-react v0.562.0 - ISC
387 *
388 * This source code is licensed under the ISC license.
389 * See the LICENSE file in the root directory of this source tree.
390 */const dM=[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]],jv=Ae("shirt",dM);/**
391 * @license lucide-react v0.562.0 - ISC
392 *
393 * This source code is licensed under the ISC license.
394 * See the LICENSE file in the root directory of this source tree.
395 */const hM=[["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"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]],us=Ae("sparkles",hM);/**
396 * @license lucide-react v0.562.0 - ISC
397 *
398 * This source code is licensed under the ISC license.
399 * See the LICENSE file in the root directory of this source tree.
400 */const fM=[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]],mM=Ae("star",fM);/**
401 * @license lucide-react v0.562.0 - ISC
402 *
403 * This source code is licensed under the ISC license.
404 * See the LICENSE file in the root directory of this source tree.
405 */const pM=[["path",{d:"M15 21v-5a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v5",key:"slp6dd"}],["path",{d:"M17.774 10.31a1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.451 0 1.12 1.12 0 0 0-1.548 0 2.5 2.5 0 0 1-3.452 0 1.12 1.12 0 0 0-1.549 0 2.5 2.5 0 0 1-3.77-3.248l2.889-4.184A2 2 0 0 1 7 2h10a2 2 0 0 1 1.653.873l2.895 4.192a2.5 2.5 0 0 1-3.774 3.244",key:"o0xfot"}],["path",{d:"M4 10.95V19a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8.05",key:"wn3emo"}]],gM=Ae("store",pM);/**
406 * @license lucide-react v0.562.0 - ISC
407 *
408 * This source code is licensed under the ISC license.
409 * See the LICENSE file in the root directory of this source tree.
410 */const yM=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],GS=Ae("sun",yM);/**
411 * @license lucide-react v0.562.0 - ISC
412 *
413 * This source code is licensed under the ISC license.
414 * See the LICENSE file in the root directory of this source tree.
415 */const bM=[["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}],["path",{d:"M17 14V2",key:"8ymqnk"}]],xM=Ae("thumbs-down",bM);/**
416 * @license lucide-react v0.562.0 - ISC
417 *
418 * This source code is licensed under the ISC license.
419 * See the LICENSE file in the root directory of this source tree.
420 */const vM=[["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}],["path",{d:"M7 10v12",key:"1qc93n"}]],_M=Ae("thumbs-up",vM);/**
421 * @license lucide-react v0.562.0 - ISC
422 *
423 * This source code is licensed under the ISC license.
424 * See the LICENSE file in the root directory of this source tree.
425 */const wM=[["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"}]],Np=Ae("trash-2",wM);/**
426 * @license lucide-react v0.562.0 - ISC
427 *
428 * This source code is licensed under the ISC license.
429 * See the LICENSE file in the root directory of this source tree.
430 */const EM=[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}
430]],kM=Ae("trees",EM);/**
431 * @license lucide-react v0.562.0 - ISC
432 *
433 * This source code is licensed under the ISC license.
434 * See the LICENSE file in the root directory of this source tree.
435 */const TM=[["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"}]],oo=Ae("triangle-alert",TM);/**
436 * @license lucide-react v0.562.0 - ISC
437 *
438 * This source code is licensed under the ISC license.
439 * See the LICENSE file in the root directory of this source tree.
440 */const SM=[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]],fl=Ae("upload",SM);/**
441 * @license lucide-react v0.562.0 - ISC
442 *
443 * This source code is licensed under the ISC license.
444 * See the LICENSE file in the root directory of this source tree.
445 */const NM=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],YS=Ae("user-round",NM);/**
446 * @license lucide-react v0.562.0 - ISC
447 *
448 * This source code is licensed under the ISC license.
449 * See the LICENSE file in the root directory of this source tree.
450 */const jM=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],Bd=Ae("user",jM);/**
451 * @license lucide-react v0.562.0 - ISC
452 *
453 * This source code is licensed under the ISC license.
454 * See the LICENSE file in the root directory of this source tree.
455 */const AM=[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]],WS=Ae("video",AM);/**
456 * @license lucide-react v0.562.0 - ISC
457 *
458 * This source code is licensed under the ISC license.
459 * See the LICENSE file in the root directory of this source tree.
460 */const CM=[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]],ir=Ae("wand-sparkles",CM);/**
461 * @license lucide-react v0.562.0 - ISC
462 *
463 * This source code is licensed under the ISC license.
464 * See the LICENSE file in the root directory of this source tree.
465 */const RM=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Wt=Ae("x",RM);/**
466 * @license lucide-react v0.562.0 - ISC
467 *
468 * This source code is licensed under the ISC license.
469 * See the LICENSE file in the root directory of this source tree.
470 */const IM=[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]],XS=Ae("zap",IM);/**
471 * @license lucide-react v0.562.0 - ISC
472 *
473 * This source code is licensed under the ISC license.
474 * See the LICENSE file in the root directory of this source tree.
475 */const MM=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]],PM=Ae("zoom-in",MM),DM="modulepreload",OM=function(t){return"/"+t},QE={},Xt=function(e,n,s){let a=Promise.resolve();if(n&&n.length>0){let u=function(p){return Promise.all(p.map(b=>Promise.resolve(b).then(x=>({status:"fulfilled",value:x}),x=>({status:"rejected",reason:x}))))};document.getElementsByTagName("link");const h=document.querySelector("meta[property=csp-nonce]"),m=(h==null?void 0:h.nonce)||(h==null?void 0:h.getAttribute("nonce"));a=u(n.map(p=>{if(p=OM(p),p in QE)return;QE[p]=!0;const b=p.endsWith(".css"),x=b?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${p}"]${x}`))return;const w=document.createElement("link");if(w.rel=b?"stylesheet":DM,b||(w.as="script"),w.crossOrigin="",w.href=p,m&&w.setAttribute("nonce",m),document.head.appendChild(w),b)return new Promise((T,N)=>{w.addEventListener("load",T),w.addEventListener("error",()=>N(new Error(`Unable to preload CSS for ${p}`)))})}))}function c(u){const h=new Event("vite:preloadError",{cancelable:!0});if(h.payload=u,window.dispatchEvent(h),!h.defaultPrevented)throw u}return a.then(u=>{for(const h of u||[])h.status==="rejected"&&c(h.reason);return e().catch(c)})},rl={"flow.ready":"Your shoot is ready","flow.continue":"Continue with your photo and selections.","flow.back":"Back to my shoot","flow.once":"One-time payment","flow.renew":"Auto-renews. Cancel anytime.","flow.saveFailed":"Could not save your shoot. Please try again before continuing.","flow.confirming":"Confirming your payment…","flow.afterTrial":"Then {price}{period} after {days} days.","auth.login.title":"Welcome back","auth.login.subtitle":"Enter your details to access your closet.","auth.register.title":"Create an account","auth.register.subtitle":"Start your AI fashion journey today.","auth.reset.title":"Reset password","auth.reset.subtitle":"Enter your email to receive a reset link.","auth.continueWithGoogle":"Continue with Google","auth.orContinueWithEmail":"Or continue with email","auth.orSignUpWithEmail":"Or sign up with email","auth.email":"Email address","auth.password":"Password","auth.fullName":"Full name","auth.forgotPassword":"Forgot password?","auth.signIn":"Sign in","auth.createAccount":"Create account","auth.send
475ResetLink":"Send reset link","auth.backToLogin":"Back to login","auth.noAccount":"Don't have an account?","auth.signUp":"Sign up","auth.haveAccount":"Already have an account?","auth.logIn":"Log in","auth.resetSent":"Password reset email sent. Check your inbox.","auth.error.generic":"An error occurred during authentication.","auth.error.invalidCredentials":"Invalid email or password.","auth.error.popupClosed":"Sign-in popup was closed.","auth.error.emailInUse":"Email is already in use.","auth.error.weakPassword":"Password should be at least 6 characters.","auth.error.invalidEmail":"Invalid email address.","auth.error.registrationFailed":"Registration failed.","auth.badge":"Generated with Fashio","auth.slideAlt":"Fashion image generated with Fashio {index}","auth.logoAlt":"Fashio logo","lang.label":"Language","lang.select":"Select language","nav.dashboard":"Dashboard","nav.search":"Search","nav.searchTools":"Search tools…","nav.account":"Account","nav.menu":"Menu","nav.signOut":"Sign out","nav.credits":"Credits","nav.buyCredits":"Buy credits","nav.goPro":"Go Pro","theme.lightMode":"Light mode","theme.darkMode":"Dark mode","theme.switchToLight":"Switch to light","theme.switchToDark":"Switch to dark","nav.group.create":"Create","nav.group.product":"Product","nav.group.enhance":"Enhance","nav.group.account":"Account","palette.title":"Command palette","palette.placeholder":"Search tools, pages and actions…","palette.empty":"Nothing matched “{term}”.","palette.hint.go":"Go","palette.hint.action":"Action","palette.toggleTheme":"Toggle theme","palette.buyCredits":"Buy credits","palette.footer.navigate":"navigate","palette.footer.select":"select","palette.footer.anywhere":"anywhere","nav.tryOn.label":"Outfit Try-On","nav.tryOn.blurb":"Layer a full outfit onto one AI model","nav.tryOn.input":"One photo per piece + model","nav.tryOn.output":"Model wearing the whole outfit","nav.proStudio.label":"Pro Studio","nav.proStudio.blurb":"Editorial campaign photography","nav.proStudio.input":"Garment photos + model + style preset","nav.proStudio.output":"Editorial fashion photograph","nav.catalogue.short":"Catalog","nav.catalogue.label":"Catalogue Shoot","nav.catalogue.blurb":"One garment through a whole photoshoot","nav.catalogue.input":"Garment photos + template set","nav.catalogue.output":"Every pinned shot of the set","nav.video.label":"Photo to Video","nav.video.blurb":"Animate a still into a clip","nav.video.input":"Photo of the worn item + motion prompt","nav.video.output":"5–10s video","nav.packs.label":"E-com Pack","nav.packs.blurb":"Four publish-ready shots — apparel or jewelry","nav.packs.input":"Apparel or jewelry photo (+ model)","nav.packs.output":"4 listing shots in one run","nav.packs.variant.apparel":"Apparel","nav.packs.variant.jewelry":"Jewelry","nav.jewelry.label":"Jewelry on Model","nav.jewelry.blurb":"Place jewelry exactly where you want it","nav.jewelry.input":"Jewelry cut-out positioned on a model","nav.jewelry.output":"Photoreal on-model shot","nav.flatLay.label":"Mannequin to Flat Lay","nav.flatLay.blurb":"Worn or mannequin shot into a clean flat lay","nav.flatLay.input":"Garment on a person or mannequin","nav.flatLay.output":"Clean flat-lay product photo","nav.spin360.label":"360 Packshot","nav.spin360.blurb":"Spinning product video","nav.spin360.input":"Product photos (up to 9 angles)","nav.spin360.output":"360° spin video","nav.photoEdit.label":"Photo Edit","nav.photoEdit.blurb":"Describe the change, only that changes","nav.photoEdit.input":"Any photo + a sentence","nav.photoEdit.output":"Same photo with just that change","nav.modelSwap.label":"Change the Model","nav.modelSwap.blurb":"Same photo, a different model in it","nav.modelSwap.input":"Photo + the model you want","nav.modelSwap.output":"Same pose, outfit and light — new model","nav.reel.before":"Before","nav.reel.yourProduct":"Your product","nav.reel.shot":"Shot {n}","nav.reel.after":"After","nav.imageTo3d.label":"Image to 3D","nav.imageTo3d.blurb":"Turn a photo into a 3D model","nav.imageTo3d.input":"Product photo","nav.imageTo3d.output":"3D model you can rotate","nav.amateurToPro.label":"Amateur to Pro","nav.amateurToPro.blurb":"Phone snap into studio quality","nav.amateurToPro.input":"Any product photo","nav.amateurToPro.output":"Professional studio version","nav.poseVariation.label":"Pose Variation","nav.poseVariation.blurb":"Same person, same outfit, new pose","nav.poseVariation.input":"Photo of a person + target pose","nav.poseVariation.output":"Identical shot in a new pose","nav.enhance.label":"Enhance / Upscale","nav.enhance.blurb":"More resolution, cleaner detail","nav.enhance.input":"Low-res or soft photo","nav.enhance.output":"Upscaled, sharper photo","nav.removeBackgroun
475d.label":"Remove Background","nav.removeBackground.blurb":"Isolate the product","nav.removeBackground.input":"Any product photo","nav.removeBackground.output":"Transparent cut-out","nav.reframe.label":"Reframe","nav.reframe.blurb":"Change the aspect ratio without cropping","nav.reframe.input":"Photo + target ratio","nav.reframe.output":"Same photo, extended to fit","nav.bodyEditor.label":"Body Editor","nav.bodyEditor.blurb":"Adjust body proportions","nav.bodyEditor.input":"Photo of a person","nav.bodyEditor.output":"Adjusted proportions","nav.ugc.label":"UGC Creator","nav.ugc.blurb":"Creator-style content","nav.ugc.input":"Product photo + effect","nav.ugc.output":"UGC-style clip","nav.lingerie.label":"Lingerie Studio","nav.lingerie.blurb":"Intimates try-on","nav.lingerie.input":"Lingerie photo + model + scene","nav.lingerie.output":"On-model shot","nav.products.label":"My Products","nav.products.blurb":"Your reusable product photo library","nav.products.input":"Product photos + name","nav.products.output":"Reusable input for every tool","nav.uploads.label":"Uploads","nav.uploads.blurb":"Quick photo library — upload once, reuse instantly","nav.uploads.input":"Any photo","nav.uploads.output":"Instant reuse everywhere","nav.history.label":"History","nav.history.blurb":"Everything you have generated","nav.history.input":"—","nav.history.output":"Your past generations","nav.billing.label":"Billing","nav.billing.blurb":"Plan and credits","nav.billing.input":"—","nav.billing.output":"Plan management","nav.profile.label":"Profile","nav.profile.blurb":"Account settings","nav.profile.input":"—","nav.profile.output":"Account settings","nav.apiKeys.label":"API Keys","nav.apiKeys.blurb":"Call Fashio from your own apps","nav.apiKeys.input":"—","nav.apiKeys.output":"A key for your integration","home.eyebrow":"Your photoshoot, on demand","home.greeting":"Welcome back, {name}.","home.intro":"Upload the product photo you already have. Get campaign, catalogue and listing imagery back in minutes — no studio, no model booking, no shoot day.","home.jumpToTool":"Jump to any tool","home.defaultName":"Designer","home.credits":"Credits","home.plan":"Plan","home.plan.pro":"Pro","home.plan.free":"Free","home.recentRuns":"Recent runs","home.upgrade":"Upgrade to Pro","home.startHere":"Start here","home.startHereBlurb":"Every card below is real output. Hover or watch — that is what comes back from one upload.","home.inputOutput":"input → output","home.card.in":"in","home.card.out":"out","home.card.hoverForResult":"hover for result","home.card.video":"video","home.latestOutput":"Your latest output","home.allHistory":"All history","home.empty":"Nothing generated yet.","home.runFirst":"Run your first try-on","home.products.emptyTitle":"Save your products once","home.products.emptyBody":"Every tool can reuse the same photos, so results stop drifting between runs. We check the photos before saving and tell you which shot is worth adding.","home.products.add":"Add a product","home.products.manage":"Manage","home.products.untitled":"Untitled","home.products.addShort":"Add","home.shortcuts":"Shortcuts","home.shortcut.palette":"command palette","home.shortcut.navigate":"navigate results","home.shortcut.open":"open","home.shortcut.close":"close","studio.choose":"Choose","studio.clearField":"Clear {label}","studio.removePhoto":"Remove photo","studio.uploadPhotos":"Upload photos","studio.fromThisComputer":"From this computer","studio.myProducts":"My products","studio.betterResults":"Better, consistent results","studio.myUploads":"My uploads","studio.quickReuse":"Quick reuse, no setup","studio.dropToAdd":"Drop to add","studio.orDropPhoto":"Or drop a photo here","studio.orDropPhotos":"Or drop photos here","studio.fileHint":"PNG or JPG","studio.upTo":"up to {max}","studio.status.idle":"Ready","studio.status.processing":"Processing","studio.status.completed":"Completed","studio.status.failed":"Failed","studio.generate":"Generate","studio.generating":"Generating","common.dismiss":"Dismiss","precheck.title":"Before you generate","precheck.subtitle":"We spotted a few things that could hurt the result.","precheck.photoIndex":"Photo {index}","precheck.fixPhoto":"Fix photo","precheck.continueAnyway":"Continue anyway","tools.title":"AI Tools","tools.subtitle":"Specialized tools to perfect your fashion workflow.","tools.open":"Open Tool","tools.tag.productTool":"PRODUCT TOOL","tools.tag.enhance":"ENHANCE","tools.tag.pose":"POSE","tools.tag.imageTool":"IMAGE TOOL","tools.tag.bodyTool":"BODY TOOL","tools.tag.jewelry":"JEWELRY","tools.tag.threeD":"3D","tools.flatLay.desc":"Convert mannequin or model shots into clean flat-lay product photos instantly.","tools.amateurToPro.desc":"Transform casual or amateur fashion photos into studio-quality professional shots.","tools.poseVariation.desc":"Switch model pose and camera angle while keeping the same outfit and style.","tools.removeBackgroun
475d.desc":"Auto-remove background and keep your garment clean for product-ready exports.","tools.upscaler.name":"Upscaler","tools.upscaler.desc":"Enhance details and sharpness for a high-quality fashion output.","tools.bodyEditor.desc":"Resize fashion model body to regular proportions with one click.","tools.jewelry.desc":"Place your jewelry products on professional model photos with precise positioning.","tools.imageTo3d.desc":"Convert product images into a rotatable 3D model with AI-powered reconstruction.","common.close":"Close","common.processing":"Processing…","common.send":"Send","profile.eyebrow":"Account","profile.title":"My Profile","profile.proMember":"PRO MEMBER","profile.freePlan":"FREE PLAN","profile.creditBalance":"Credit Balance","profile.creditsAvailable":"Available credits for generations","profile.buyCredits":"Buy Credits","profile.membership":"Membership","profile.active":"ACTIVE","profile.planYearly":"Fashio Pro Yearly","profile.planMonthly":"Fashio Pro Monthly","profile.planPro":"Fashio Pro","profile.planFree":"Starter Free","profile.manageBilling":"Manage billing, invoices, and cancellation in Billing & Subscription.","profile.providerNote":"Provider: {provider}.","profile.providerOther":"existing provider","profile.upgrade":"Upgrade to Pro","profile.upgradeBlurb":"Upgrade to unlock Pro features, faster queues, and premium tools.","profile.existingSubscription":"Subscription exists on {provider}. Additional membership purchase is blocked for this account.","profile.billing":"Billing & Subscription","profile.integrations":"Integrations","profile.integrations.blurb":"Stores and tools connected to this account.","profile.integrations.connected":"CONNECTED","profile.integrations.none":"No store connected yet.","profile.integrations.browse":"Browse integrations","profile.integrations.ikasPrivate":"ikas store (private app)","profile.integrations.apiKeysActive":"{n} active","profile.integrations.apiKeysNone":"No keys yet","profile.apiKeys":"API Keys","profile.privacy":"Privacy Policy","profile.terms":"Terms of Service","profile.help":"Help & Support","profile.signOut":"Sign Out","profile.version":"Version {version}","profile.feedback.title":"Send Feedback","profile.feedback.placeholder":"Write your feedback here…","profile.feedback.sent":"Feedback sent! Thank you.","profile.feedback.failed":"Failed to send feedback. Please try again.","apiKeys.eyebrow":"Developer","apiKeys.title":"API Keys","apiKeys.subtitle":"Call the Fashio generation API from your own apps and integrations.","apiKeys.createButton":"Create new key","apiKeys.labelPlaceholder":'Label (e.g. "Shopify store")',"apiKeys.aside.title":"Using the API","apiKeys.aside.body":"Send the key as a Bearer token. Every call spends this account's credits, and a revoked key stops working immediately.","apiKeys.aside.docs":"Read the API docs","apiKeys.empty":"No API keys yet.","apiKeys.newKeyTitle":"Save this key now","apiKeys.newKeyWarning":"This is the only time the full key is shown. Store it somewhere safe.","apiKeys.copy":"Copy","apiKeys.copied":"Copied","apiKeys.revoke":"Revoke","apiKeys.revokeConfirm":"Revoke this key? Anything using it will stop working immediately.","apiKeys.statusActive":"Active","apiKeys.statusRevoked":"Revoked","apiKeys.lastUsed":"Last used {date}","apiKeys.neverUsed":"Never used yet","apiKeys.created":"Created {date}","apiKeys.limitReached":"You've reached the maximum of 5 active keys. Revoke one to create another.","apiKeys.createFailed":"Failed to create key.","apiKeys.revokeFailed":"Failed to revoke key.","apiKeys.done":"I've saved it","credits.title":"Buy Credits","credits.dealTitle":"This week · 50% off","credits.dealBlurb":"One-time packs. Credits never expire and work in every tool.","credits.endsIn":"Ends in","credits.popular":"Popular","credits.bestValue":"Best value","credits.buy":"Buy","credits.opening":"Opening…","credits.error.signIn":"Please sign in first.","credits.error.checkout":"Failed to open checkout.","credits.checkoutOpened":"Checkout opened. Credits will be added once the payment is confirmed.","billing.paymentReceived":"Payment received. Syncing your account…","billingReturn.title":"Payment Received","billingReturn.subtitle":"We are confirming your purchase.","billingReturn.body":"Your account will update automatically within a few seconds once the payment is confirmed.","billingReturn.autoClose":"This window should close automatically. If it stays open, you can close it safely.","billingReturn.returnToBilling":"Return to Billing","home.value.speed.head":"Minutes, not weeks","home.value.speed.body":"A shoot day books out weeks ahead. A run here finishes while you are still writing the product description.","home.value.cost.head":"A fraction of a shoot","home.value.cost.body":"Studio, model, photographer and retouching for one product runs into the thousands. Here it costs credits.","home.value.coverage.head":"Every angle, one upload","home.value.coverage.body":"Packshot, on-model, detail, alternate pose, video. One product photo in, the whole listing set out.","home.value.proLine":"Pro includes 160 credits every month, 4K exports and a commercial licence — cancel any time.","home.value.seePlans":"See plans","catalogueBand.eyebrow":"Catalogue shoot","catalogueBand.title":"One garment. A finished shoot.","catalogueBand.body":"Pick a ready-made set — one model, one location, every angle already art-directed. Upload the product and the whole photoshoot comes back in minutes, for less than the taxi to a studio.","catalogueBand.browse":"Browse sets","catalogueBand.shots":"{count} shots","catalogueBand.footer":"{sets}+ sets ready · {shots} shots art-directed · no studio, no model booking, no shoot day","studio.back":"Back","studio.viewProgress":"View progress","studio.viewResult":"View result","studio.resultOf":"{title} result","studio.working":"Working — you can close this, it keeps running","studio.result":"Result","studio.closeResult":"Close result","studio.canvasEmptyDefault":"Your result will appear here","studio.downloadResult":"Download result","studio.generationFailed":"Generation failed","catalogue.title":"Catalogue Shoot","catalogue.step1":"Step 1 of 3 · Choose a photoshoot","catalogue.intro":"Every set is a finished photoshoot — the model, location and lighting are already decided. Pick one and your garment goes through all of its shots.","catalogue.searchSets":"Search sets…","catalogue.clearSearch":"Clear search","catalogue.noMatch":"No sets matched “{query}”.","catalogue.shotsCount":"{count} shots","catalogue.choose":"Choose","catalogue.loadMore":"Load more","catalogue.step2":"Step 2 of 3 · Choose the shots","catalogue.backToSets":"Back to sets","catalogue.shotsInShoot":"{count} shots in this photoshoot","catalogue.clearAll":"Clear all","catalogue.selectAll":"Select all {count}","catalogue.recommended":"Recommended","catalogue.selectedCount":"{selected} of {total} selected","catalogue.drop":"Drop","catalogue.add":"Add","catalogue.shotsTimesPr
475ice":"{count} shots × {price}","catalogue.total":"{total} total","catalogue.continue":"Continue","catalogue.step3":"Step 3 of 3 · {count} shots","catalogue.canvasEmpty":"Add the garment photos and render — every selected shot lands here as it finishes.","catalogue.rendering":"Rendering {count} shots","catalogue.shotFailed":"Failed","catalogue.renderedCount":"{done} / {total} rendered","catalogue.downloadAll":"Download all","catalogue.priceLine":"{price} × {count} shots","catalogue.render":"Render catalogue","catalogue.renderingShort":"Rendering","catalogue.garmentPhotos":"Garment photos","catalogue.garmentHint":"Front, back and side angles give the best identity match","catalogue.ratio":"Ratio","catalogue.selectedShoot":"Selected shoot","catalogue.changeShoot":"{count} shots · change","catalogue.error.allFailed":"Every shot in this catalogue failed.","catalogue.error.timeout":"Processing timed out. Check your history page.","catalogue.error.pickSet":"Pick a template set first.","catalogue.error.uploadGarment":"Upload at least one garment photo.","catalogue.error.selectShot":"Select at least one shot to render.","catalogue.error.startFailed":"Failed to start the catalogue.","catalogue.error.generic":"Catalogue failed.","credits.choosePack":"Choose a pack","credits.balance":"Balance","credits.neverExpires":"Never expires","credits.secureCheckout":"Secure checkout","credits.instantTopUp":"Instant top-up","common.designer":"Designer","profile.goProToBuy":"Go Pro to buy credits","billing.back":"Back to Profile","billing.account":"Account","billing.title":"Billing & Subscription","billing.subtitle":"Manage your plan, payment method and billing history.","billing.status.willExpire":"Cancels at period end","billing.status.paymentIssue":"Payment issue","billing.status.expired":"Expired","billing.status.refunded":"Refunded","billing.status.active":"Active","billing.status.free":"Free","billing.cancelsOn":"Cancels on {date}","billing.plan.yearly":"Pro Yearly","billing.plan.monthly":"Pro Monthly","billing.plan.pro":"Pro Membership","billing.plan.free":"Free Plan","billing.product.yearly":"Yearly Pro Membership","billing.product.monthly":"Monthly Pro Membership","billing.product.pro":"Pro Membership","billing.membershipLine":"Membership: {product}","billing.accessEnds":"Access ends: {date}","billing.periodEnds":"Current period ends: {date}","billing.pro":"Pro","billing.free":"Free","billing.membershipWord":"membership","billing.planWord":"plan","billing.creditsCount":"{count} credits","billing.proCreditsNote":"Pro membership unlocks the tools. Credits are counted separately.","billing.manageTitle":"Your subscription","billing.manageBlurb":"This account already has an active membership ({status}). Payment details, invoices and cancellation are handled in {provider}.","billing.checking":"Checking…","billing.providerOther":"your provider","billing.manage.gumroad":"Manage on Gumroad","billing.manage.openingPortal":"Opening billing portal…","billing.manage.creem":"Manage billing & invoices","billing.manage.appStore":"Manage in the App Store","billing.manage.googlePlay":"Manage in Google Play","billing.manage.generic":"Manage subscription","billing.cancel.appStore":"Cancel in the App Store","billing.cancel.googlePlay":"Cancel in Google Play","billing.cancel.gumroad":"Cancel via Gumroad","billing.cancel.openingFlow":"Opening cancellation…","billing.cancel.generic":"Cancel subscription","billing.manageInAppStore":"Manage your subscription in the App Store.","billing.manageInGooglePlay":"Manage your subscription in Google Play.","billing.portalFailed":"Could not open the billing portal.","billing.startTitle":"Start a web membership","billing.startBlurb":"Checkout opens in a secure popup. Duplicate subscriptions on the same account are blocked, and access syncs automatically once the payment is confirmed.","billing.startMonthly":"Start monthly","billing.startYearly":"Start yearly","billing.resume":"Resume / manage subscription","billing.packsTitle":"Credit packs","billing.packsBlurbPro":"One-time top-ups for extra generations. Credits never expire.","billing.packsBlurbFree":"One-time top-ups for extra generations, included with Pro. Start a membership to buy them.","billing.buyCreditsCount":"Buy {count} credits","billing.cancelSure":"Are you sure?","billing.cancelBlurb":"You will lose access to Pro features at the end of your current billing cycle. This cannot be undone.","billing.keepPlan":"Keep plan","billing.confirmCancel":"Confirm cancellation","billing.ssl":"Secure 256-bit SSL encrypted payment.","billing.checkoutFailed":"Could not start checkout. Please try again.","billing.creditsCheckoutFailed":"Could not start the credits checkout. Please try again.","billing.pendingCheckout":"Another membership checkout is already in progress for this account. Finish it first, or wait a few minutes.","billing.alreadySubscribed":"This account already has a subscription. Manage it in {provider}.","pro.dealTitleAll":"This week · 50% off everything","pro.dealTitleCredits":"This week · 50% off credits","pro.dealBlurbAll":"Memberships and credit packs at half price. Price
475s reset every week.","pro.dealBlurbCredits":"Credit packs at half price. Prices reset every week.","pro.tab.membership":"Pro Membership","pro.monthly.name":"Pro Monthly","pro.monthly.tagline":"Cancel any time","pro.monthly.period":"/month","pro.yearly.name":"Pro Yearly","pro.yearly.tagline":"Billed once a year","pro.yearly.period":"/year","pro.creditsNote":"160 credits every month","pro.saveAmount":"save {amount}/yr","pro.perCredit":"{price} / credit","pro.mostPopular":"Most popular","pro.yearlyNote":"{fullPrice} if paid monthly · save {savings}/yr","pro.tier.starter.name":"Starter","pro.tier.starter.tagline":"For trying things out","pro.tier.plus.name":"Plus","pro.tier.plus.tagline":"For steady, regular work","pro.tier.pro.name":"Pro","pro.tier.pro.tagline":"For high-volume teams","pro.period.monthly":"Monthly","pro.period.yearly":"Yearly","pro.creditsPerMonth":"{count} credits every month","pro.trialDays":"{days}-day free trial","pro.startPlan":"Start {plan}","pro.bothInclude":"Every plan includes","pro.benefit.tools":"Unlimited access to every Pro tool","pro.benefit.credits":"Monthly credits included, on every plan","pro.benefit.exports":"4K Ultra-HD exports + commercial licence","pro.benefit.queue":"Priority queue — faster renders","pro.benefit.models":"Full model library and catalog sets","pro.benefit.tryon":"Virtual try-on and 360° product video","pro.benefit.api":"REST API access on every plan","pro.benefit.mcp":"MCP server — drive it from AI agents","pro.benefit.shopify":"Shopify app integration","pro.benefit.new":"Every new tool as it ships","pro.payg.title":"Pay as you go","pro.payg.blurb":"One-time credits, no subscription. They never expire.","pro.packCredits":"{count} credits","pro.packTitle":"{count} Credits","pro.openingCheckout":"Opening checkout…","pro.buyPack":"Buy {pack}","pro.instantAccess":"Instant access","pro.cancelAnyTime":"Cancel any time","pro.madeWith":"Made with Fashio","pro.faq.cancel.q":"Can I cancel any time?","pro.faq.cancel.a":"Yes. Cancel from Billing whenever you like — your access runs to the end of the period you already paid for.","pro.faq.credits.q":"How many credits come with Pro?","pro.faq.credits.a":"It depends on the plan: 100, 160 or 500 credits every month. They work in every tool and stack on top of the balance you already have.","pro.faq.tools.q":"Can I use credits in every tool?","pro.faq.tools.a":"Yes. One balance, shared across the whole dashboard.","pro.faq.timing.q":"When do my plan and credits show up?","pro.faq.timing.a":"Usually within seconds of the payment being confirmed. Your account updates on its own once checkout returns.","pro.alreadyPro":"You are already on Pro","pro.alreadyProCompact":"Top up any time. Manage your plan in {provider}.","pro.alreadyProFull":"Manage invoices, payment methods or cancellation in {provider}.","pro.manageBilling":"Manage billing","pro.popupBlockedLink":"Popup blocked — open checkout manually","pro.error.subActive":"A subscription is already active. Manage it in {provider}.","pro.error.membershipFailed":"Could not start the membership checkout. Please try again.","pro.error.catalogUnavailable":"We couldn't load the prices. Check your connection and try again.","pro.error.blockedPending":"Membership checkout is blocked: another checkout is already in progress.","pro.error.blockedExisting":"Membership checkout is blocked. Manage the existing subscription in {provider}.","pro.error.popupBlocked":"Your browser blocked the popup. Use the link below to open checkout.","pro.checkoutOpened":"Checkout opened via {provider}. Complete the payment to activate your plan.","pro.creditsCheckoutOpened":"Credits checkout opened. Credits will be added once the payment is confirmed.","pro.portalUnavailableAt":"The billing portal is not available here yet. Please manage it in {provider}.","pro.portalUnavailable":"The billing portal is not available for this account.","pro.portalFailed":"Could not open the billing portal.","model.filter.all":"All","model.gender":"Gender","model.gender.female":"Female","model.gender.male":"Male","model.ethnicity":"Ethnicity","model.race.caucasian":"Caucasian","model.race.eastAsian":"East Asian","model.race.southAsian":"South Asian","model.race.african":"African","model.race.hispanic":"His
475panic / Latino","model.race.middleEastern":"Middle Eastern","model.race.pacificIslander":"Pacific Islander","model.bodyType":"Body type","model.body.athletic":"Athletic","model.body.slim":"Slim","model.body.average":"Average","model.body.curvy":"Curvy","model.body.plusSize":"Plus size","model.body.pearShaped":"Pear-shaped","model.ageRange":"Age range","picker.models.title":"All models","picker.models.empty":"No models match these filters.","picker.loadMore":"Load more","picker.poses.title":"All poses","picker.poses.failed":"Could not load the poses.","picker.environments.title":"All environments","picker.environments.failed":"Could not load the environments.","picker.environments.count":"Backgrounds · {count}","picker.retry":"Retry","picker.noImage":"No image","env.filter.studio":"Studio","env.filter.outdoor":"Outdoor","env.filter.indoor":"Indoor","env.filter.nature":"Nature","env.filter.landmark":"Landmark","env.filter.street":"Street","env.filter.rooftop":"Rooftop","productPicker.subtitle":"Reusing saved photos keeps every run consistent","productPicker.empty":"No saved products","productPicker.emptyBlurb":"Save a product once and every tool can reuse the same photos.","productPicker.add":"Add a product","productPicker.untitled":"Untitled product","productPicker.clear":"Clear","productPicker.allCount":"All {count}","productPicker.selected":"Selected · {picked}/{total}","productPicker.manage":"Manage","productPicker.use":"Use selected ({count})","result.like":"Like this result","result.dislike":"Dislike this result","onboarding.studio.title":`AI Fashion
476Studio`,"onboarding.studio.desc":"Turn simple mannequin photos into high-end editorial shoots instantly.","onboarding.anywhere.title":`Create
477Anywhere`,"onboarding.anywhere.desc":"Choose models, venues, and lighting to match your brand identity.","onboarding.models.title":`Any Fashion
478Model`,"onboarding.models.desc":"Select from various professional models to showcase your designs.","onboarding.catalogue.title":`A Whole
479Catalogue`,"onboarding.catalogue.desc":"One product photo becomes a full shoot — same model, same location, every angle.","onboarding.jewelry.title":`Jewelry
480on Model`,"onboarding.jewelry.desc":"Place your earrings, necklaces, bracelet and rings on AI models instantly.","onboarding.getStarted":"Get Started","onboarding.next":"Next","onboarding.skip":"Skip","onboarding.skipAria":"Skip the introduction","guide.kicker":"HOW TO GET GREAT RESULTS","guide.done":"Got it","guide.tag.result":"RESULT","guide.tag.youUpload":"YOU UPLOAD","guide.tag.closeUp":"CLOSE-UP","guide.tag.mistake":"MISTAKE","guide.tag.doThis":"DO THIS","guide.hero.title":"Get catalog-quality results","guide.hero.desc":"Shoot your products at home with your phone. Follow these and the AI nails it every time. Every image here is a real generation.","guide.outfit.title":"Build a full outfit from separate photos","guide.outfit.desc":"Lay every item flat and straight — one photo each. Add a close-up of any small detail (a collar, print, logo) you want reproduced exactly.","guide.in.shirt":"Shirt","guide.in.pants":"Trousers","guide.in.shoes":"Shoes","guide.in.collar":"Collar detail","guide.single.title":"A single clean item works great too","guide.single.desc":"One garment in good light is enough. Add a close-up of its logo or detail so it comes through.","guide.in.item":"The item","guide.in.logo":"Logo detail","guide.dark.title":"Shoot in good light","guide.dark.bad":"Dark photo → came out a dull, wrong colour.","guide.dark.good":"Bright daylight → the true colour is kept.","guide.crop.title":"Fit the whole item in frame","guide.crop.bad":"Cropped photo → the AI guessed a short mini.","guide.crop.good":"Full-length photo → your real maxi is reproduced.","guide.back.title":"Photograph every angle","guide.back.bad":"Front only → the back stayed blank, print gone.","guide.back.good":"Front + back → the print lands correctly.","guide.checklist.title":"Quick checklist","guide.tag.do":"DO","guide.tag.avoid":"AVOID","guide.do1":"Bright, even daylight","guide.do2":"The whole item in frame","guide.do3":"Straight-on — flat or on a hanger","guide.do4":"Plain, tidy background","guide.do5":"One item per type","guide.do6":"Every angle for a detailed piece","guide.dont1":"Dark or blurry shots","guide.dont2":"Angled or folded","guide.dont3":"Half the item cut off","guide.dont4":"Cluttered background","guide.previous":"Previous","guide.caption.input":"Input","guide.caption.output":"Output","guide.closeAria":"Close the guide","guide.slideAria":"Slide {n}","video.subtitle":"Animate a still into a short clip","video.canvasEmpty":"Upload a photo of the item already worn on a person — motion looks natural that way.","video.rendering":"Rendering a {seconds}s clip","video.sourcePhoto":"Source photo","video.clipLength":"{seconds}s clip","video.sourceHint":"Item worn on a person, not a flat product shot","video.motionPrompt":"Motion prompt","video.motionHint":"what moves, not what it looks like","video.motionPlaceholder":"Model walks toward camera with confident steps…","video.readyMotions":"Ready motions","video.ratio":"Ratio","video.generate":"Generate video","video.generating":"Rendering","video.defaultPrompt":"Fashion video with 
480natural movement","video.error.noImage":"Upload an image first.","video.error.failed":"The video could not be generated.","video.error.timeout":"This is taking longer than expected. Check your gallery in a few minutes.","studio.error.startFailed":"Could not start the generation. Please try again.","studio.error.generic":"Generation failed.","common.language":"Language","common.optional":"optional","common.required":"required","tool.ratioExtended":"the photo is extended to fit","common.cancel":"Cancel","common.delete":"Delete","common.download":"Download","common.downloadAll":"Download all","common.example":"Example","common.original":"Original","common.upload":"Upload","common.prev":"Prev","common.next":"Next","common.viewAll":"View all","common.select":"Select","common.tryAgain":"Try again","common.refresh":"Refresh","common.keep":"Keep","common.saving":"Saving","common.uploading":"Uploading","common.deleting":"Deleting…","studio.model":"Model","studio.pose":"Pose","studio.ratio":"Ratio","studio.prompt":"Prompt","studio.scene":"Scene","studio.chooseModel":"Choose a model","studio.choosePose":"Choose a pose","studio.clickToUpload":"Click to upload","studio.resultHere":"Your result will appear here","studio.completed":"Done — your result is ready.","studio.error.loginFirst":"Please sign in first.","studio.error.uploadFailed":"The images could not be uploaded.","studio.error.uploadImage":"Upload an image first.","studio.error.uploadGarment":"Upload at least one garment photo.","studio.error.selectModel":"Choose a model first.","studio.error.processingFailed":"Processing failed.","studio.error.imageFailed":"The image could not be generated.","studio.error.timeoutGallery":"This is taking longer than expected. Check your gallery in a few minutes.","creations.title":"Gallery","creations.emptyTitle":"Nothing here yet","creations.emptyBody":"Create stunning AI fashion photos for your products without models or studios.","creations.create":"Create an AI fashion photo","creations.loadFailed":"Your gallery could not be loaded.","creations.recently":"Recently","creations.tag.image":"IMAGE","creations.tag.video":"VIDEO","creations.tag.model3d":"3D MODEL","creations.before":"Before","creations.after":"After","creations.beforeCaps":"BEFORE","creations.afterCaps":"AFTER","creations.transform":"Transform this image","creations.animate":"Animate","creations.retouch":"Retouch","creations.removeBg":"Remove background","creations.deleteTitle":"Delete this creation?","creations.deleteBody":"This cannot be undone.","tool.notFound":"Tool not found","tool.back":"Back to dashboard","tool.aiTool":"AI-powered tool","tool.run":"Run tool","tool.running":"Running","tool.source":"Source","tool.sourcePhoto":"Source photo","tool.targetPose":"Target pose","tool.targetRatio":"Target ratio","tool.newModel":"New model","tool.ratioKept":"Ratio kept from the source","tool.whatChanges":"What should change?","tool.editPlaceholder":"Make the skirt knee-length. Change the background to a white studio…","tool.extraDirection":"Extra direction for the edit…","tool.error.describeChange":"Describe the change you want.","tool.error.chooseModel":"Choose the model you want in the photo.","tool.error.startFailed":"The tool could not be started. Please try again.","tool.error.processingFailed":"The tool failed while processing.","tool.photoEdit.blurb":"Describe the change in your own words — skirt length, sleeve, colour, background — and only that is edited.","tool.modelSwap.blurb":"Keep the photo exactly as it is and put a different AI model in it — same pose, same outfit, same light.","jewelry.subtitle":"Position it yourself, then render it photoreal","jewelry.canvasEmpty":"Upload a jewelry cut-out — you position it on the model here, and exactly that composite is what gets rendered.","jewelry.photos":"Jewelry photos","jewelry.photosHint":"A cut-out on a plain background works best","jewelry.type":"Jewelry type","jewelry.wornBy":"Worn by","jewelry.background":"Background","jewelry.customColour":"Custom colour","jewelry.type.earring":"Earring","jewelry.type.necklace":"Necklace","jewelry.type.bracelet":"Bracelet","jewelry.type.ring":"Ring","jewelry.worn.model":"Model","jewelry.worn.mannequin":"Mannequin","jewelry.hint.earring":"Place the earring on the ear and match its real size.","jewelry.hint.necklace":"Drag the necklace onto the neckline and scale it to fit.","jewelry.hint.bracelet":"Wrap the bracelet around the wrist, then scale it.","jewelry.hint.ring":"Drop the ring onto a finger and scale it to the knuckle.","jewelry.error.uploadFirst":"Upload a jewelry photo first.","jewelry.error.capture":"The positioned preview could not be captured. Reposition the jewelry and try again.","jewelry.error.timeout":"This is taking longer than expected. Check your creations page in a few minutes.","jewelry.positioner.title":"Jewelry","jewelry.positioner.reset":"Reset position","colour.black":"Black","colour.white":"White","colour.ivory":"Ivory","colour.beige":"Beige","colour.sand":"Sand","colour.blush":"Blush","colour.pink":"Pink","colour.lavender":"Lavender","colour.gray":"Grey","colour.slate":"Slate","products.title":"My products","products.library":"Library","products.new":"New product","products.edit":"Edit product","products.delete":"Delete product","products.empty":"No products yet","products.name":"Name","products.namePlaceholder":"Beige linen blazer","products.photos":"Photos","products.addPhotos":"Add photos","products.photosHint":"Front, back and a detail shot work best","products.save":"Save product","products.saveAnyway":"Save anyway","products.checking":"Checking photos","products.addForBetter":"Add these for a better result","products.untitled":"Untitled product","products.error.save":"Could not save. Please try again.","products.error.upload":"Upload failed. Check your connection and try again.","ugc.title":"UGC Creator","ugc.subtitle":"AI product ad videos with human presenters","ugc.newVideo":"New video","ugc.productPhoto":"Product photo","ugc.aiModel":"AI model","ugc.aiPick":"AI pick","ugc.whatToSay":"What to say","ugc.whatToSayHint":"Words or phrases the model should mention","ugc.duration":"Duration","ugc.aspectRatio":"Aspect ratio","ugc.quality.standard":"Standard","ugc.quality.pro":"Pro","ugc.noEffects":"No effects found","ugc.uploading":"Uploading…","ugc.submitting":"Submitting…","ugc.generating":"Generating your video…","ugc.ready":"Your video is ready","ugc.error.failed":"The UGC video could not be generated.","ugc.error.refunded":"Generation failed. Your credits have been refunded.","ugc.error.timeout":"This is taking longer than expected. Check your history in a few minutes.","lingerie.title":"Lingerie Studio","lingerie.subtitle":"Virtual try-on","lingerie.engine":"NSFW-SAFE ENGINE","lingerie.upload":"Upload lingerie / garments","lingerie.addMore":"Add more garments","lingerie.exampleOutput":"EXAMPLE OUTPUT","lingerie.exampleResult":"Example result","lingerie.canvasEmpty":"Upload your garments and hit Generate","lingerie.resultHere":"Your result will appear here in publish-ready quality.","lingerie.generating":"Generating… this can take up to a minute.","lingerie.shotType":"Shot type","lingerie.photographyStyle":"Photography style","lingerie.posture":"Posture","lingerie.shot.auto":"Auto","lingerie.shot.autoCaps":"AUTO","lingerie.shot.autoHint":"Best framing for the garment","lingerie.shot.full":"Wide shot","lingerie.shot.fullHint":"Full body, head to toe","lingerie.shot.medium":"Medium shot","lingerie.shot.mediumHint":"Waist up · ignores lower
480-body items","lingerie.shot.headshot":"Headshot","lingerie.shot.headshotHint":"Shoulders up · ignores footwear","lingerie.shot.side":"Side profile","lingerie.style.studio":"Studio","lingerie.style.studioHint":"Clean professional studio lighting","lingerie.style.indoor":"Indoor lifestyle","lingerie.style.indoorHint":"Warm bedroom / interior setting","lingerie.style.outdoor":"Outdoor location","lingerie.style.outdoorHint":"Natural daylight on location","lingerie.style.keep":"Keep the original scene & background","lingerie.posture.standing":"Standing","lingerie.posture.sitting":"Sitting","lingerie.error.noModelImage":"The selected model has no image.","spin.addAngle":"Add angle","spin.front":"FRONT","spin.onModel":"On model","spin.standalone":"Standalone","spin.output":"Output","spin.generating":"Generating your 360° video… this can take a minute.","spin.spinningUp":"Spinning up your 360° video…","spin.takesSeconds":"This usually takes 30–90 seconds","spin.tip":"Tip:","spin.ready":"Your video is ready","spin.error.failed":"The video could not be generated.","pack.type":"Pack type","pack.clothing":"Clothing pack","pack.clothingShots":"White-bg · on-model · alt pose · detail","pack.jewelry":"Jewelry pack","pack.jewelryShots":"White-bg · on-model · lifestyle · macro","pack.productPhotos":"Product photos","pack.photosHint":"The first photo is the reference; extra angles help identity","pack.anyModel":"Any model","pack.onModelUse":"On-model shots use","pack.generate":"Generate pack","pack.rendering":"Rendering","pack.exampleOutput":"Example output · one product photo in, every shot below out","pack.shot.whiteBg":"White BG","pack.shot.onModel":"On model","pack.shot.altPose":"Alt pose","pack.shot.detail":"Detail","pack.shot.lifestyle":"Lifestyle","pack.shot.macro":"Macro","pack.error.uploadFirst":"Upload at least one product photo first.","pack.error.startFailed":"The pack could not be started. Please try again.","pack.error.failed":"The pack failed.","pack.error.noImages":"The pack returned no images.","pack.error.timeout":"This is taking longer than expected. Check your gallery in a few minutes.","body.title":"Body Editor","body.subtitle":"Change body proportions while keeping the outfit intact","body.sourceImage":"Source image","body.bodyType":"Body type","body.resized":"Resized","body.processing":"Processing… this can take a moment.","body.type.slim":"Slim","body.type.slimHint":"Lean and slender figure","body.type.regular":"Regular","body.type.regularHint":"Average, healthy body proportions","body.type.curvy":"Curvy","body.type.curvyHint":"Fuller, curvier figure","body.type.athletic":"Athletic","body.type.athleticHint":"Toned, muscular build","body.type.petite":"Petite","body.type.petiteHint":"Smaller, compact frame","body.type.plusSize":"Plus size","body.type.plusSizeHint":"Larger, plus-size figure","body.error.failed":"The body resize failed.","body.error.startFailed":"The body resize could not be started. Please try again.","pro.studio.title":"Pro Studio","pro.studio.subtitle":"Editorial fashion photos from garment uploads","pro.studio.canvasEmpty":"Upload the garment, pick a model, shot type and style — then generate.","pro.studio.garmentPhotos":"Garment photos","pro.studio.garmentHint":"Whole garment in frame, bright even light","pro.studio.fashionModel":"Fashion model","pro.studio.shotType":"Shot type","pro.studio.stylePreset":"Style preset","pro.studio.editorial":"Editorial","pro.studio.campaign":"Campaign","pro.studio.error.incomplete":"Complete every selection first.","tryon.title":"Outfit Try-On","tryon.subtitle":"Every piece layered onto one model","tryon.canvasEmpty":"Upload every piece of the outfit — the model wears them together.","tryon.pieces":"Outfit pieces","tryon.piecesHint":"One clean photo per item — top, bottom, shoes, bag","tryon.venue":"Venue","tryon.studioBackground":"Studio background","tryon.defaultPose":"Default pose","tryon.extraDirection":"Extra direction — lighting, mood, styling notes…","tryon.error.uploadGarment":"Upload at least one garment image.","tryon.error.timeout":"This is taking longer than expected. Check your gallery.","threed.title":"Image to 3D","threed.subtitle":"Convert product images into a rotatable 3D model","threed.generated":"Generated 3D model","threed.generating":"Generating the 3D model…","threed.generatingLong":"Generating the 3D model… this can take a few minutes.","threed.generatingShort":"Generating…","threed.downloadGlb":"Download GLB","threed.promptPlaceholder":"Describe the object (for example: a sleek leather handbag with a gold buckle)","threed.error.needPrompt":"Describe the object first.","threed.error.needImage":"Upload at least one image.","threed.error.failed":"The 3D model could not be generated. Please try again.","creations.tag.pack":"PACK","creations.shareText":"Look what I made with Fashio","products.subtitle":"Save a product once and reuse the same photos in every tool — the same input every run is what keeps results consistent.","products.emptyBody":"Add your first product with a few good photos. We check them before saving and tell you which shot is worth adding.","products.mixedWarning":"These photos look like different products. Keep one product per entry so the AI does not blend them.","products.deleteTitle":"Delete “{name}”?","products.deleteBody":"The photos are removed from your library. Images you already generated 
480with it are not affected.","uploads.subtitle":"Drop photos here once — every tool can pull them back in instantly, no naming or checks.","uploads.empty":"No uploads yet","uploads.emptyBody":"Drop a photo below and it's ready to reuse in any tool.","uploads.deleteTitle":"Delete this upload?","uploads.deleteBody":"It's removed from your library. Images you already generated with it are not affected.","uploadsPicker.subtitle":"Reuse a photo you've already uploaded","uploadsPicker.emptyBlurb":"Upload a photo once and every tool can pull it back in.","ugc.scriptPlaceholder":"for example: the perfect scent for every occasion","ugc.generate":"Generate UGC video","lingerie.pitch":"Publish-ready try-on images for intimate apparel — where mainstream models refuse.","lingerie.garmentAlt":"Garment {n}","studio.garmentPhotosCount":"Garment photos ({count}/{max})","studio.generateAction":"Generate","common.withCost":"{label} · {count} credits","spin.pitch":"A full 360° rotating product video — shape, fit and detail from every angle","spin.moreAngles":"more angles = a more accurate spin","spin.tipOnModel":"The first photo is the front. Add side and back on-model angles of the same look, so the spin shows the real back and sides instead of guessing them.","spin.tipStandalone":"Upload product photos without a person, from several angles (front, back, sides). More real angles means a more accurate spin.","spin.generate":"Generate 360° video","pack.title":"E-commerce Pack","pack.renderingShots":"Rendering {count} shots","body.transform":"Transform","threed.productImages":"Product images ({count}/{max})","threed.clickToUpload":"Click to upload ({count} remaining)","threed.ready":"The 3D model is ready — drag to rotate.","threed.generate":"Generate 3D model"},QS=[{code:"en",native:"English",english:"English",dir:"ltr"},{code:"zh",native:"简体中文",english:"Chinese (Simplified)",dir:"ltr"},{code:"hi",native:"हिन्दी",english:"Hindi",dir:"ltr"},{code:"es",native:"Español",english:"Spanish",dir:"ltr"},{code:"ar",native:"العربية",english:"Arabic",dir:"rtl"},{code:"fr",native:"Français",english:"French",dir:"ltr"},{code:"pt",native:"Português",english:"Portuguese",dir:"ltr"},{code:"ru",native:"Русский",english:"Russian",dir:"ltr"},{code:"id",native:"Bahasa Indonesia",english:"Indonesian",dir:"ltr"},{code:"de",native:"Deutsch",english:"German",dir:"ltr"},{code:"ja",native:"日本語",english:"Japanese",dir:"ltr"},{code:"tr",native:"Türkçe",english:"Turkish",dir:"ltr"},{code:"vi",native:"Tiếng Việt",english:"Vietnamese",dir:"ltr"},{code:"ko",native:"한국어",english:"Korean",dir:"ltr"},{code:"it",native:"Italiano",english:"Italian",dir:"ltr"},{code:"th",native:"ไทย",english:"Thai",dir:"ltr"},{code:"pl",native:"Polski",english:"Polish",dir:"ltr"},{code:"uk",native:"Українська",english:"Ukrainian",dir:"ltr"},{code:"ms",native:"Bahasa Melayu",english:"Malay",dir:"ltr"},{code:"zh-tw",native:"繁體中文",english:"Chinese (Traditional)",dir:"ltr"},{code:"nl",native:"Nederlands",english:"Dutch",dir:"ltr"},{code:"sv",native:"Svenska",english:"Swedish",dir:"ltr"},{code:"he",native:"עברית",english:"Hebrew",dir:"rtl"},{code:"bg",native:"Български",english:"Bulgarian",dir:"ltr"}],Av="en",Kd=new Map(QS.map(t=>[t.code,t]));function JS(t){return typeof t=="string"&&Kd.has(t)}function ZS(t){return Kd.get(t)??Kd.get(Av)}function eN(t){return ZS(t).dir}const JE={"zh-hk":"zh-tw","zh-mo":"zh-tw","zh-hant":"zh-tw","zh-hant-hk":"zh-tw","zh-hant-tw":"zh-tw","zh-hans":"zh","zh-cn":"zh","zh-sg":"zh"};function LM(t){for(const e of t){if(!e)continue;const n=e.toLowerCase();if(Kd.has(n))return n;if(JE[n])return JE[n];const s=n.split(/[-_]/)[0];if(Kd.has(s))return s}return null}const tN="fashio-lang",bb=new Set;function nN(){try{const t=localStorage.getItem(tN);return JS(t)?t:null}catch{return null}}function UM(){if(typeof navigator>"u")return[];const t=navigator.languages;return t&&t.length?[...t]:navigator.language?[navigator.language]:[]}function ZE(){return nN()??LM(UM())??Av}function ek(t){const e=document.documentElement;e.setAttribute("lang",t),e.setAttribute("dir",eN(t))}const Cd={get current(){const t=document.documentElement.getAttribute("lang");return JS(t)?t:ZE()},get isExplicit(){return nN()!==null},set(t){ek(t);try{localStorage.setItem(tN,t)}catch{}for(const e of bb)e(t)},subscribe(t){return bb.add(t),()=>{bb.delete(t)}},sync(){const t=ZE();return ek(t),t}},FM={en:()=>Promise.resolve({default:rl}),ar:()=>Xt(()=>import("./ar-CHsteZS6.js"),[]),de:()=>Xt(()=>import("./de-ZhWzHO_1.js"),[]),es:()=>Xt(()=>import("./es-DITn8vqN.js"),[]),fr:()=>Xt(()=>import("./fr-DZtj8B8f.js"),[]),he:()=>Xt(()=>
480import("./he-xdTd0qco.js"),[]),hi:()=>Xt(()=>import("./hi-B13noG31.js"),[]),id:()=>Xt(()=>import("./id-CYCVpS87.js"),[]),it:()=>Xt(()=>import("./it-CzgwKYG6.js"),[]),ja:()=>Xt(()=>import("./ja-DIRLvosQ.js"),[]),ko:()=>Xt(()=>import("./ko-CADKTyvi.js"),[]),ms:()=>Xt(()=>import("./ms-Brvldjzr.js"),[]),nl:()=>Xt(()=>import("./nl-B0ZaMgg2.js"),[]),pl:()=>Xt(()=>import("./pl-DOyO5Yla.js"),[]),pt:()=>Xt(()=>import("./pt-C1ME8SdP.js"),[]),ru:()=>Xt(()=>import("./ru-IoXkVuVx.js"),[]),sv:()=>Xt(()=>import("./sv-BRopo2t8.js"),[]),th:()=>Xt(()=>import("./th-CpeqMwZQ.js"),[]),tr:()=>Xt(()=>import("./tr-CWnKyZ6t.js"),[]),uk:()=>Xt(()=>import("./uk-CP6V32K0.js"),[]),vi:()=>Xt(()=>import("./vi-Did8wpAi.js"),[]),zh:()=>Xt(()=>import("./zh-D2ssVTln.js"),[]),"zh-tw":()=>Xt(()=>import("./zh-tw-BX1URcGm.js"),[]),bg:()=>Xt(()=>import("./bg-DXsDMsge.js"),[])},Cc=new Map([["en",rl]]);async function VM(t){const e=Cc.get(t);if(e)return e;try{const n=await FM[t]();return Cc.set(t,n.default),n.default}catch{return rl}}const sN=v.createContext(null);function rN(t,e){return e?t.replace(/\{(\w+)\}/g,(n,s)=>{const a=e[s];return a==null?n:String(a)}):t}const zM=({children:t})=>{const[e,n]=v.useState(()=>Cd.sync()),[s,a]=v.useState(()=>Cc.get(e)??rl),[c,u]=v.useState(()=>Cc.has(e));v.useEffect(()=>Cd.subscribe(n),[]),v.useEffect(()=>{let p=!1;const b=Cc.get(e);if(b){a(b),u(!0);return}return VM(e).then(x=>{p||(a(x),u(!0))}),()=>{p=!0}},[e]);const h=v.useCallback((p,b)=>{const x=s[p]??rl[p]??p;return rN(x,b)},[s]),m=v.useMemo(()=>({locale:e,dir:eN(e),t:h,setLocale:p=>Cd.set(p)}),[e,h]);return c?o.jsx(sN.Provider,{value:m,children:t}):o.jsx("div",{className:"flex min-h-screen items-center justify-center bg-base",children:o.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-b-2 border-ink"})})};function nu(){const t=v.useContext(sN);if(!t)throw new Error("useI18n must be used inside <I18nProvider>");return t}function De(){return nu().t}function Wa(t,e){const n=Cd.current??Av,s=Cc.get(n)??rl;return rN(s[t]??rl[t]??t,e)}const BM=[{path:"/",label:"nav.group.create",Icon:us},{path:"/catalogue",label:"nav.catalogue.short",Icon:z3},{path:"/history",label:"nav.history.label",Icon:Sv},{path:"/profile",label:"nav.account",Icon:YS}];function KM(){const t=De(),e=v.useRef(null),[n,s]=v.useState(!1);return v.useEffect(()=>{const a=window.visualViewport,c=()=>s(!!a&&window.innerHeight-a.height>150);return c(),a==null||a.addEventListener("resize",c),()=>a==null?void 0:a.removeEventListener("resize",c)},[]),v.useLayoutEffect(()=>{const a=e.current,c=a==null?void 0:a.closest("[data-app-layout]");if(!a||!c)return;const u=()=>c.style.setProperty("--mobile-nav-height",`${a.getBoundingClientRect().height}px`),h=new ResizeObserver(u);return u(),h.observe(a,{box:"border-box"}),()=>{h.disconnect(),c.style.setProperty("--mobile-nav-height","0px")}},[n]),n?null:o.jsx("nav",{ref:e,"aria-label":t("nav.menu"),className:"fixed inset-x-0 bottom-0 z-30 grid grid-cols-4 border-t border-line bg-surface/95 px-2 pt-2 backdrop-blur-xl [padding-bottom:max(0.5rem,env(safe-area-inset-bottom))] md:hidden",children:BM.map(({path:a,label:c,Icon:u})=>o.jsxs(jS,{to:a,end:a==="/",className:({isActive:h})=>`flex min-h-12 min-w-0 flex-col items-center justify-center gap-1 rounded-xl px-1 text-[10px] font-semibold transition-colors focus-visible:ring-2 focus-visible:ring-accent ${h?"bg-accent-soft text-accent":"text-dim"}`,children:[o.jsx(u,{size:20}),o.jsx("span",{className:"max-w-full truncate",children:t(c)})]},a))})}const $M=()=>{};var tk={};/**
481 * @license
482 * Copyright 2017 Google LLC
483 *
484 * Licensed under the Apache License, Version 2.0 (the "License");
485 * you may not use this file except in compliance with the License.
486 * You may obtain a copy of the License at
487 *
488 *   http://www.apache.org/licenses/LICENSE-2.0
489 *
490 * Unless required by applicable law or agreed to in writing, software
491 * distributed under the License is distributed on an "AS IS" BASIS,
492 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
493 * See the License for the specific language governing permissions and
494 * limitations under the License.
495 */const qM={SDK_VERSION:"${JSCORE_VERSION}"};/**
496 * @license
497 * Copyright 2017 Google LLC
498 *
499 * Licensed under the Apache License, Version 2.0 (the "License");
500 * you may not use this file except in compliance with the License.
501 * You may obtain a copy of the License at
502 *
503 *   http://www.apache.org/licenses/LICENSE-2.0
504 *
505 * Unless required by applicable law or agreed to in writing, software
506 * distributed under the License is distributed on an "AS IS" BASIS,
507 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
508 * See the License for the specific language governing permissions and
509 * limitations under the License.
510 */const Nx=function(t,e){if(!t)throw HM(e)},HM=function(t){return new Error("Firebase Database ("+qM.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)};/**
511 * @license
512 * Copyright 2017 Google LLC
513 *
514 * Licensed under the Apache License, Version 2.0 (the "License");
515 * you may not use this file except in compliance with the License.
516 * You may obtain a copy of the License at
517 *
518 *   http://www.apache.org/licenses/LICENSE-2.0
519 *
520 * Unless required by applicable law or agreed to in writing, software
521 * distributed under the License is distributed on an "AS IS" BASIS,
522 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
523 * See the License for the specific language governing permissions and
524 * limitations under the License.
525 */const iN=function(t){const e=[];let n=0;for(let s=0;s<t.length;s++){let a=t.charCodeAt(s);a<128?e[n++]=a:a<2048?(e[n++]=a>>6|192,e[n++]=a&63|128):(a&64512)===55296&&s+1<t.length&&(t.charCodeAt(s+1)&64512)===56320?(a=65536+((a&1023)<<10)+(t.charCodeAt(++s)&1023),e[n++]=a>>18|240,e[n++]=a>>12&63|128,e[n++]=a>>6&63|128,e[n++]=a&63|128):(e[n++]=a>>12|224,e[n++]=a>>6&63|128,e[n++]=a&63|128)}return e},GM=function(t){const e=[];let n=0,s=0;for(;n<t.length;){const a=t[n++];if(a<128)e[s++]=String.fromCharCode(a);else if(a>191&&a<224){const c=t[n++];e[s++]=String.fromCharCode((a&31)<<6|c&63)}else if(a>239&&a<365){const c=t[n++],u=t[n++],h=t[n++],m=((a&7)<<18|(c&63)<<12|(u&63)<<6|h&63)-65536;e[s++]=String.fromCharCode(55296+(m>>10)),e[s++]=String.fromCharCode(56320+(m&1023))}else{const c=t[n++],u=t[n++];e[s++]=String.fromCharCode((a&15)<<12|(c&63)<<6|u&63)}}return e.join("")},Cv={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_,s=[];for(let a=0;a<t.length;a+=3){const c=t[a],u=a+1<t.length,h=u?t[a+1]:0,m=a+2<t.length,p=m?t[a+2]:0,b=c>>2,x=(c&3)<<4|h>>4;let w=(h&15)<<2|p>>6,T=p&63;m||(T=64,u||(w=64)),s.push(n[b],n[x],n[w],n[T])}return s.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(iN(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):GM(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,s=[];for(let a=0;a<t.length;){const c=n[t.charAt(a++)],h=a<t.length?n[t.charAt(a)]:0;++a;const p=a<t.length?n[t.charAt(a)]:64;++a;const x=a<t.length?n[t.charAt(a)]:64;if(++a,c==null||h==null||p==null||x==null)throw new YM;const w=c<<2|h>>4;if(s.push(w),p!==64){const T=h<<4&240|p>>2;if(s.push(T),x!==64){const N=p<<6&192|x;s.push(N)}}}return s},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)}}};
525class YM extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const WM=function(t){const e=iN(t);return Cv.encodeByteArray(e,!0)},Vm=function(t){return WM(t).replace(/\./g,"")},aN=function(t){try{return Cv.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
526 * @license
527 * Copyright 2022 Google LLC
528 *
529 * Licensed under the Apache License, Version 2.0 (the "License");
530 * you may not use this file except in compliance with the License.
531 * You may obtain a copy of the License at
532 *
533 *   http://www.apache.org/licenses/LICENSE-2.0
534 *
535 * Unless required by applicable law or agreed to in writing, software
536 * distributed under the License is distributed on an "AS IS" BASIS,
537 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
538 * See the License for the specific language governing permissions and
539 * limitations under the License.
540 */function oN(){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.")}/**
541 * @license
542 * Copyright 2022 Google LLC
543 *
544 * Licensed under the Apache License, Version 2.0 (the "License");
545 * you may not use this file except in compliance with the License.
546 * You may obtain a copy of the License at
547 *
548 *   http://www.apache.org/licenses/LICENSE-2.0
549 *
550 * Unless required by applicable law or agreed to in writing, software
551 * distributed under the License is distributed on an "AS IS" BASIS,
552 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
553 * See the License for the specific language governing permissions and
554 * limitations under the License.
555 */const XM=()=>oN().__FIREBASE_DEFAULTS__,QM=()=>
555{if(typeof process>"u"||typeof tk>"u")return;const t=tk.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},JM=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=t&&aN(t[1]);return e&&JSON.parse(e)},jp=()=>{try{return $M()||XM()||QM()||JM()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},lN=t=>{var e,n;return(n=(e=jp())==null?void 0:e.emulatorHosts)==null?void 0:n[t]},Rv=t=>{const e=lN(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 s=parseInt(e.substring(n+1),10);return e[0]==="["?[e.substring(1,n-1),s]:[e.substring(0,n),s]},cN=()=>{var t;return(t=jp())==null?void 0:t.config},uN=t=>{var e;return(e=jp())==null?void 0:e[`_${t}`]};/**
556 * @license
557 * Copyright 2017 Google LLC
558 *
559 * Licensed under the Apache License, Version 2.0 (the "License");
560 * you may not use this file except in compliance with the License.
561 * You may obtain a copy of the License at
562 *
563 *   http://www.apache.org/licenses/LICENSE-2.0
564 *
565 * Unless required by applicable law or agreed to in writing, software
566 * distributed under the License is distributed on an "AS IS" BASIS,
567 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
568 * See the License for the specific language governing permissions and
569 * limitations under the License.
570 */class $d{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,s)=>{n?this.reject(n):this.resolve(s),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,s))}}}/**
571 * @license
572 * Copyright 2025 Google LLC
573 *
574 * Licensed under the Apache License, Version 2.0 (the "License");
575 * you may not use this file except in compliance with the License.
576 * You may obtain a copy of the License at
577 *
578 *   http://www.apache.org/licenses/LICENSE-2.0
579 *
580 * Unless required by applicable law or agreed to in writing, software
581 * distributed under the License is distributed on an "AS IS" BASIS,
582 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
583 * See the License for the specific language governing permissions and
584 * limitations under the License.
585 */function hi(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Ap(t){return(await fetch(t,{credentials:"include"})).ok}/**
586 * @license
587 * Copyright 2021 Google LLC
588 *
589 * Licensed under the Apache License, Version 2.0 (the "License");
590 * you may not use this file except in compliance with the License.
591 * You may obtain a copy of the License at
592 *
593 *   http://www.apache.org/licenses/LICENSE-2.0
594 *
595 * Unless required by applicable law or agreed to in writing, software
596 * distributed under the License is distributed on an "AS IS" BASIS,
597 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
598 * See the License for the specific language governing permissions and
599 * limitations under the License.
600 */function dN(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"},s=e||"demo-project",a=t.iat||0,c=t.sub||t.user_id;if(!c)throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");const u={iss:`https://securetoken.google.com/${s}`,aud:s,iat:a,exp:a+3600,auth_time:a,sub:c,user_id:c,firebase:{sign_in_provider:"custom",identities:{}},...t};return[Vm(JSON.stringify(n)),Vm(JSON.stringify(u)),""].join(".")}const Rd={};function ZM(){const t={prod:[],emulator:[]};for(const e of Object.keys(Rd))Rd[e]?t.emulator.push(e):t.prod.push(e);return t}function eP(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 nk=!1;function Cp(t,e){if(typeof window>"u"||typeof document>"u"||!hi(window.location.host)||Rd[t]===e||Rd[t]||nk)return;Rd[t]=e;function n(w){return`__firebase__banner__${w}`}const s="__firebase__banner",c=ZM().prod.length>0;function u(){const w=document.getElementById(s);w&&w.remove()}
vendor: 4,590 bytes, lines 600-629
600function h(w){w.style.display="flex",w.style.background="#7faaf0",w.style.position="fixed",w.style.bottom="5px",w.style.left="5px",w.style.padding=".5em",w.style.borderRadius="5px",w.style.alignItems="center"}function m(w,T){w.setAttribute("width","24"),w.setAttribute("id",T),w.setAttribute("height","24"),w.setAttribute("viewBox","0 0 24 24"),w.setAttribute("fill","none"),w.style.marginLeft="-6px"}function p(){const w=document.createElement("span");return w.style.cursor="pointer",w.style.marginLeft="16px",w.style.fontSize="24px",w.innerHTML=" &times;",w.onclick=()=>{nk=!0,u()},w}function b(w,T){w.setAttribute("id",T),w.innerText="Learn more",w.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",w.setAttribute("target","__blank"),w.style.paddingLeft="5px",w.style.textDecoration="underline"}function x(){const w=eP(s),T=n("text"),N=document.getElementById(T)||document.createElement("span"),j=n("learnmore"),A=document.getElementById(j)||document.createElement("a"),F=n("preprendIcon"),V=document.getElementById(F)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(w.created){const L=w.element;h(L),b(A,j);const Y=p();m(V,F),L.append(V,N,A,Y),document.body.appendChild(L)}c?(N.innerText="Preview backend disconnected.",V.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
601<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"/>
602</g>
603<defs>
604<clipPath id="clip0_6013_33858">
605<rect width="24" height="24" fill="white"/>
606</clipPath>
607</defs>`):(V.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
608<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"/>
609</g>
610<defs>
611<clipPath id="clip0_6083_34804">
612<rect width="24" height="24" fill="white"/>
613</clipPath>
614</defs>`,N.innerText="Preview backend running in this workspace."),N.setAttribute("id",T)}document.readyState==="loading"?window.addEventListener("DOMContentLoaded",x):x()}/**
615 * @license
616 * Copyright 2017 Google LLC
617 *
618 * Licensed under the Apache License, Version 2.0 (the "License");
619 * you may not use this file except in compliance with the License.
620 * You may obtain a copy of the License at
621 *
622 *   http://www.apache.org/licenses/LICENSE-2.0
623 *
624 * Unless required by applicable law or agreed to in writing, software
625 * distributed under the License is distributed on an "AS IS" BASIS,
626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
627 * See the License for the specific language governing permissions and
628 * limitations under the License.
629 */function ss(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function tP(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ss())}function nP(){var e;const t=(e=jp())==null?void 0:e.forceEnvironment;if(t==="node")return!0;
629if(t==="browser")return!1;try{return Object.prototype.toString.call(global.process)==="[object process]"}catch{return!1}}function sP(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function hN(){const t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function rP(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function iP(){const t=ss();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function aP(){return!nP()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function fh(){try{return typeof indexedDB=="object"}catch{return!1}}function fN(){return new Promise((t,e)=>{try{let n=!0;const s="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(s);a.onsuccess=()=>{a.result.close(),n||self.indexedDB.deleteDatabase(s),t(!0)},a.onupgradeneeded=()=>{n=!1},a.onerror=()=>{var c;e(((c=a.error)==null?void 0:c.message)||"")}}catch(n){e(n)}})}function oP(){return!(typeof navigator>"u"||!navigator.cookieEnabled)}/**
630 * @license
631 * Copyright 2017 Google LLC
632 *
633 * Licensed under the Apache License, Version 2.0 (the "License");
634 * you may not use this file except in compliance with the License.
635 * You may obtain a copy of the License at
636 *
637 *   http://www.apache.org/licenses/LICENSE-2.0
638 *
639 * Unless required by applicable law or agreed to in writing, software
640 * distributed under the License is distributed on an "AS IS" BASIS,
641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
642 * See the License for the specific language governing permissions and
643 * limitations under the License.
644 */const lP="FirebaseError";class ds extends Error{constructor(e,n,s){super(n),this.code=e,this.customData=s,this.name=lP,Object.setPrototypeOf(this,ds.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,fi.prototype.create)}}class fi{constructor(e,n,s){this.service=e,this.serviceName=n,this.errors=s}create(e,...n){const s=n[0]||{},a=`${this.service}/${e}`,c=this.errors[e],u=c?cP(c,s):"Error",h=`${this.serviceName}: ${u} (${a}).`;return new ds(a,h,s)}}function cP(t,e){return t.replace(uP,(n,s)=>{const a=e[s];return a!=null?String(a):`<${s}?>`})}const uP=/\{\$([^}]+)}/g;function dP(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function Qi(t,e){if(t===e)return!0;const n=Object.keys(t),s=Object.keys(e);for(const a of n){if(!s.includes(a))return!1;const c=t[a],u=e[a];if(sk(c)&&sk(u)){if(!Qi(c,u))return!1}else if(c!==u)return!1}for(const a of s)if(!n.includes(a))return!1;return!0}function sk(t){return t!==null&&typeof t=="object"}/**
645 * @license
646 * Copyright 2017 Google LLC
647 *
648 * Licensed under the Apache License, Version 2.0 (the "License");
649 * you may not use this file except in compliance with the License.
650 * You may obtain a copy of the License at
651 *
652 *   http://www.apache.org/licenses/LICENSE-2.0
653 *
654 * Unless required by applicable law or agreed to in writing, software
655 * distributed under the License is distributed on an "AS IS" BASIS,
656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
657 * See the License for the specific language governing permissions and
658 * limitations under the License.
659 */function mh(t){const e=[];for(const[n,s]of Object.entries(t))Array.isArray(s)?s.forEach(a=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(a))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(s));return e.length?"&"+e.join("&"):""}function Ed(t){const e={};return t.replace(/^\?/,"").split("&").forEach(s=>{if(s){const[a,c]=s.split("=");e[decodeURIComponent(a)]=decodeURIComponent(c)}}),e}function kd(t){const e=t.indexOf("?");if(!e)return"";const n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function hP(t,e){const n=new fP(t,e);return n.subscribe.bind(n)}class fP{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(s=>{this.error(s)})}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,s){let a;if(e===void 0&&n===void 0&&s===void 0)throw new Error("Missing Observer.");mP(e,["next","error","complete"])?a=e:a={next:e,error:n,complete:s},a.next===void 0&&(a.next=xb),a.error===void 0&&(a.error=xb),a.complete===void 0&&(a.complete=xb);const c=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?a.error(this.finalError):a.complete()}catch{}}),this.observers.push(a),c}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(()=>
659{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(this.observers[e])}catch(s){typeof console<"u"&&console.error&&console.error(s)}})}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 mP(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 xb(){}/**
660 * @license
661 * Copyright 2019 Google LLC
662 *
663 * Licensed under the Apache License, Version 2.0 (the "License");
664 * you may not use this file except in compliance with the License.
665 * You may obtain a copy of the License at
666 *
667 *   http://www.apache.org/licenses/LICENSE-2.0
668 *
669 * Unless required by applicable law or agreed to in writing, software
670 * distributed under the License is distributed on an "AS IS" BASIS,
671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
672 * See the License for the specific language governing permissions and
673 * limitations under the License.
674 */const pP=1e3,gP=2,yP=14400*1e3,bP=.5;function qd(t,e=pP,n=gP){const s=e*Math.pow(n,t),a=Math.round(bP*s*(Math.random()-.5)*2);return Math.min(yP,s+a)}/**
675 * @license
676 * Copyright 2021 Google LLC
677 *
678 * Licensed under the Apache License, Version 2.0 (the "License");
679 * you may not use this file except in compliance with the License.
680 * You may obtain a copy of the License at
681 *
682 *   http://www.apache.org/licenses/LICENSE-2.0
683 *
684 * Unless required by applicable law or agreed to in writing, software
685 * distributed under the License is distributed on an "AS IS" BASIS,
686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
687 * See the License for the specific language governing permissions and
688 * limitations under the License.
689 */function st(t){return t&&t._delegate?t._delegate:t}class Un{constructor(e,n,s){this.name=e,this.instanceFactory=n,this.type=s,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}}/**
690 * @license
691 * Copyright 2019 Google LLC
692 *
693 * Licensed under the Apache License, Version 2.0 (the "License");
694 * you may not use this file except in compliance with the License.
695 * You may obtain a copy of the License at
696 *
697 *   http://www.apache.org/licenses/LICENSE-2.0
698 *
699 * Unless required by applicable law or agreed to in writing, software
700 * distributed under the License is distributed on an "AS IS" BASIS,
701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
702 * See the License for the specific language governing permissions and
703 * limitations under the License.
704 */const $o="[DEFAULT]";/**
705 * @license
706 * Copyright 2019 Google LLC
707 *
708 * Licensed under the Apache License, Version 2.0 (the "License");
709 * you may not use this file except in compliance with the License.
710 * You may obtain a copy of the License at
711 *
712 *   http://www.apache.org/licenses/LICENSE-2.0
713 *
714 * Unless required by applicable law or agreed to in writing, software
715 * distributed under the License is distributed on an "AS IS" BASIS,
716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
717 * See the License for the specific language governing permissions and
718 * limitations under the License.
719 */class xP{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 s=new $d;if(this.instancesDeferred.set(n,s),this.isInitialized(n)||this.shouldAutoInitialize())try{const a=this.getOrInitializeService({instanceIdentifier:n});a&&s.resolve(a)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){const n=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),s=(e==null?void 0:e.optional)??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(a){if(s)return null;throw a}else{if(s)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(_P(e))try{this.getOrInitializeService({instanceIdentifier:$o})}catch{}for(const[n,s]of this.instancesDeferred.entries()){const a=this.normalizeInstanceIdentifier(n);try{const c=this.getOrInitializeService({instanceIdentifier:a});s.resolve(c)}catch{}}}}clearInstance(e=$o){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=$o){return this.instances.has(e)}getOptions(e=$o){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:n={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const a=this.getOrInitializeService({instanceIdentifier:s,options:n});for(const[c,u]of this.instancesDeferred.entries()){const h=this.normalizeInstanceIdentifier(c);s===h&&u.resolve(a)}return a}onInit(e,n){const s=this.normalizeInstanceIdentifier(n),a=this.onInitCallbacks.get(s)??new Set;a.add(e),this.onInitCallbacks.set(s,a);const c=this.instances.get(s);return c&&e(c,s),()=>{a.delete(e)}}invokeOnInitCallbacks(e,n){const s=this.onInitCallbacks.get(n);if(s)for(const a of s)try{a(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:vP(e),options:n}),this.instances.set(e,s),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch{}return s||null}normalizeInstanceIdentifier(e=$o){return this.component?this.component.multipleInstances?e:$o:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function vP(t){return t===$o?void 0:t}function _P(t){return t.instantiationMode==="EAGER"}/**
720 * @license
721 * Copyright 2019 Google LLC
722 *
723 * Licensed under the Apache License, Version 2.0 (the "License");
724 * you may not use this file except in compliance with the License.
725 * You may obtain a copy of the License at
726 *
727 *   http://www.apache.org/licenses/LICENSE-2.0
728 *
729 * Unless required by applicable law or agreed to in writing, software
730 * distributed under the License is distributed on an "AS IS" BASIS,
731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
732 * See the License for the specific language governing permissions and
733 * limitations under the License.
734 */class wP{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 xP(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}/**
735 * @license
736 * Copyright 2017 Google LLC
737 *
738 * Licensed under the Apache License, Version 2.0 (the "License");
739 * you may not use this file except in compliance with the License.
740 * You may obtain a copy of the License at
741 *
742 *   http://www.apache.org/licenses/LICENSE-2.0
743 *
744 * Unless required by applicable law or agreed to in writing, software
745 * distributed under the License is distributed on an "AS IS" BASIS,
746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
747 * See the License for the specific language governing permissions and
748 * limitations under the License.
749 */var ft;(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"})(ft||(ft={}));const EP={debug:ft.DEBUG,verbose:ft.VERBOSE,info:ft.INFO,warn:ft.WARN,error:ft.ERROR,silent:ft.SILENT},kP=ft.INFO,TP={[ft.DEBUG]:"log",[ft.VERBOSE]:"log",[ft.INFO]:"info",[ft.WARN]:"warn",[ft.ERROR]:"error"},SP=(t,e,...n)=>{if(e<t.logLevel)return;const s=new Date().toISOString(),a=TP[e];if(a)console[a](`[${s}]  ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class su{constructor(e){this.name=e,this._logLevel=kP,this._logHandler=SP,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in ft))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?EP[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,ft.DEBUG,...e),this._logHandler(this,ft.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,ft.VERBOSE,...e),this._logHandler(this,ft.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,ft.INFO,...e),this._logHandler(this,ft.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,ft.WARN,...e),this._logHandler(this,ft.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,ft.ERROR,...e),this._logHandler(this,ft.ERROR,...e)}}const NP=(t,e)=>e.some(n=>t instanceof n);let rk,ik;function jP(){return rk||(rk=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function AP(){return ik||(ik=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const mN=new WeakMap,jx=new WeakMap,pN=new WeakMap,vb=new WeakMap,Iv=new WeakMap;function CP(t){const e=new Promise((n,s)=>{const a=()=>{t.removeEventListener("success",c),t.removeEventListener("error",u)},c=()=>{n(Gi(t.result)),a()},u=()=>{s(t.error),a()};t.addEventListener("success",c),t.addEventListener("error",u)});return e.then(n=>{n instanceof IDBCursor&&mN.set(n,t)}).catch(()=>{}),Iv.set(e,t),e}function RP(t){if(jx.has(t))return;const e=new Promise((n,s)=>{const a=()=>{t.removeEventListener("complete",c),t.removeEventListener("error",u),t.removeEventListener("abort",u)},c=()=>{n(),a()},u=()=>{s(t.error||new DOMException("AbortError","AbortError")),a()};t.addEventListener("complete",c),t.addEventListener("error",u),t.addEventListener("abort",u)});jx.set(t,e)}let Ax={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return jx.get(t);if(e==="objectStoreNames")return t.objectStoreNames||pN.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return Gi(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 IP(t){Ax=t(Ax)}function MP(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){const s=t.call(_b(this),e,...n);return pN.set(s,e.sort?e.sort():[e]),Gi(s)}:AP().includes(t)?function(...e){return t.apply(_b(this),e),Gi(mN.get(this))}:function(...e){return Gi(t.apply(_b(this),e))}}function PP(t){return typeof t=="function"?MP(t):(t instanceof IDBTransaction&&RP(t),NP(t,jP())?new Proxy(t,Ax):t)}function Gi(t){if(t instanceof IDBRequest)return CP(t);if(vb.has(t))return vb.get(t);const e=PP(t);return e!==t&&(vb.set(t,e),Iv.set(e,t)),e}const _b=t=>Iv.get(t);function Rp(t,e,{blocked:n,upgrade:s,blocking:a,terminated:c}={}){const u=indexedDB.open(t,e),h=Gi(u);return s&&u.addEventListener("upgradeneeded",m=>{s(Gi(u.result),m.oldVersion,m.newVersion,Gi(u.transaction),m)}),n&&u.addEventListener("blocked",m=>n(m.oldVersion,m.newVersion,m)),h.then(m=>{c&&m.addEventListener("close",()=>c()),a&&m.addEventListener("versionchange",p=>a(p.oldVersion,p.newVersion,p))}).catch(()=>{}),h}function wb(t,{blocked:e}={}){const n=indexedDB.deleteDatabase(t);return e&&n.addEventListener("blocked",s=>e(s.oldVersion,s)),Gi(n).then(()=>{})}const DP=["get","getKey","getAll","getAllKeys","count"],OP=["put","add","delete","clear"],Eb=new Map;function ak(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(Eb.get(e))return Eb.get(e);const n=e.replace(/FromIndex$/,""),s=e!==n,a=OP.includes(n);if(!(n in(s?IDBIndex:IDBObjectStore).prototype)||!(a||DP.includes(n)))return;const c=async function(u,...h){const m=this.transaction(u,a?"readwrite":"readonly");let p=m.store;
749return s&&(p=p.index(h.shift())),(await Promise.all([p[n](...h),a&&m.done]))[0]};return Eb.set(e,c),c}IP(t=>({...t,get:(e,n,s)=>ak(e,n)||t.get(e,n,s),has:(e,n)=>!!ak(e,n)||t.has(e,n)}));/**
750 * @license
751 * Copyright 2019 Google LLC
752 *
753 * Licensed under the Apache License, Version 2.0 (the "License");
754 * you may not use this file except in compliance with the License.
755 * You may obtain a copy of the License at
756 *
757 *   http://www.apache.org/licenses/LICENSE-2.0
758 *
759 * Unless required by applicable law or agreed to in writing, software
760 * distributed under the License is distributed on an "AS IS" BASIS,
761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
762 * See the License for the specific language governing permissions and
763 * limitations under the License.
764 */class LP{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(UP(n)){const s=n.getImmediate();return`${s.library}/${s.version}`}else return null}).filter(n=>n).join(" ")}}function UP(t){const e=t.getComponent();return(e==null?void 0:e.type)==="VERSION"}const Cx="@firebase/app",ok="0.14.8";/**
765 * @license
766 * Copyright 2019 Google LLC
767 *
768 * Licensed under the Apache License, Version 2.0 (the "License");
769 * you may not use this file except in compliance with the License.
770 * You may obtain a copy of the License at
771 *
772 *   http://www.apache.org/licenses/LICENSE-2.0
773 *
774 * Unless required by applicable law or agreed to in writing, software
775 * distributed under the License is distributed on an "AS IS" BASIS,
776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
777 * See the License for the specific language governing permissions and
778 * limitations under the License.
779 */const Ji=new su("@firebase/app"),FP="@firebase/app-compat",VP="@firebase/analytics-compat",zP="@firebase/analytics",BP="@firebase/app-check-compat",KP="@firebase/app-check",$P="@firebase/auth",qP="@firebase/auth-compat",HP="@firebase/database",GP="@firebase/data-connect",YP="@firebase/database-compat",WP="@firebase/functions",XP="@firebase/functions-compat",QP="@firebase/installations",JP="@firebase/installations-compat",ZP="@firebase/messaging",eD="@firebase/messaging-compat",tD="@firebase/performance",nD="@firebase/performance-compat",sD="@firebase/remote-config",rD="@firebase/remote-config-compat",iD="@firebase/storage",aD="@firebase/storage-compat",oD="@firebase/firestore",lD="@firebase/ai",cD="@firebase/firestore-compat",uD="firebase",dD="12.9.0";/**
780 * @license
781 * Copyright 2019 Google LLC
782 *
783 * Licensed under the Apache License, Version 2.0 (the "License");
784 * you may not use this file except in compliance with the License.
785 * You may obtain a copy of the License at
786 *
787 *   http://www.apache.org/licenses/LICENSE-2.0
788 *
789 * Unless required by applicable law or agreed to in writing, software
790 * distributed under the License is distributed on an "AS IS" BASIS,
791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
792 * See the License for the specific language governing permissions and
793 * limitations under the License.
794 */const Rx="[DEFAULT]",hD={[Cx]:"fire-core",[FP]:"fire-core-compat",[zP]:"fire-analytics",[VP]:"fire-analytics-compat",[KP]:"fire-app-check",[BP]:"fire-app-check-compat",[$P]:"fire-auth",[qP]:"fire-auth-compat",[HP]:"fire-rtdb",[GP]:"fire-data-connect",[YP]:"fire-rtdb-compat",[WP]:"fire-fn",[XP]:"fire-fn-compat",[QP]:"fire-iid",[JP]:"fire-iid-compat",[ZP]:"fire-fcm",[eD]:"fire-fcm-compat",[tD]:"fire-perf",[nD]:"fire-perf-compat",[sD]:"fire-rc",[rD]:"fire-rc-compat",[iD]:"fire-gcs",[aD]:"fire-gcs-compat",[oD]:"fire-fst",[cD]:"fire-fst-compat",[lD]:"fire-vertex","fire-js":"fire-js",[uD]:"fire-js-all"};/**
795 * @license
796 * Copyright 2019 Google LLC
797 *
798 * Licensed under the Apache License, Version 2.0 (the "License");
799 * you may not use this file except in compliance with the License.
800 * You may obtain a copy of the License at
801 *
802 *   http://www.apache.org/licenses/LICENSE-2.0
803 *
804 * Unless required by applicable law or agreed to in writing, software
805 * distributed under the License is distributed on an "AS IS" BASIS,
806 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
807 * See the License for the specific language governing permissions and
808 * limitations under the License.
809 */const zm=new Map,fD=new Map,Ix=new Map;function lk(t,e){try{t.container.addComponent(e)}catch(n){Ji.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Yn(t){const e=t.name;if(Ix.has(e))return Ji.debug(`There were multiple attempts to register component ${e}.`),!1;Ix.set(e,t);for(const n of zm.values())lk(n,t);for(const n of fD.values())lk(n,t);return!0}function ur(t,e){const n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function qn(t){return t==null?!1:t.settings!==void 0}/**
810 * @license
811 * Copyright 2019 Google LLC
812 *
813 * Licensed under the Apache License, Version 2.0 (the "License");
814 * you may not use this file except in compliance with the License.
815 * You may obtain a copy of the License at
816 *
817 *   http://www.apache.org/licenses/LICENSE-2.0
818 *
819 * Unless required by applicable law or agreed to in writing, software
820 * distributed under the License is distributed on an "AS IS" BASIS,
821 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
822 * See the License for the specific language governing permissions and
823 * limitations under the License.
824 */const mD={"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
824d-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."},Xa=new fi("app","Firebase",mD);/**
825 * @license
826 * Copyright 2019 Google LLC
827 *
828 * Licensed under the Apache License, Version 2.0 (the "License");
829 * you may not use this file except in compliance with the License.
830 * You may obtain a copy of the License at
831 *
832 *   http://www.apache.org/licenses/LICENSE-2.0
833 *
834 * Unless required by applicable law or agreed to in writing, software
835 * distributed under the License is distributed on an "AS IS" BASIS,
836 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
837 * See the License for the specific language governing permissions and
838 * limitations under the License.
839 */class pD{constructor(e,n,s){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new Un("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 Xa.create("app-deleted",{appName:this._name})}}/**
840 * @license
841 * Copyright 2019 Google LLC
842 *
843 * Licensed under the Apache License, Version 2.0 (the "License");
844 * you may not use this file except in compliance with the License.
845 * You may obtain a copy of the License at
846 *
847 *   http://www.apache.org/licenses/LICENSE-2.0
848 *
849 * Unless required by applicable law or agreed to in writing, software
850 * distributed under the License is distributed on an "AS IS" BASIS,
851 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
852 * See the License for the specific language governing permissions and
853 * limitations under the License.
854 */const Zi=dD;function gN(t,e={}){let n=t;typeof e!="object"&&(e={name:e});const s={name:Rx,automaticDataCollectionEnabled:!0,...e},a=s.name;if(typeof a!="string"||!a)throw Xa.create("bad-app-name",{appName:String(a)});if(n||(n=cN()),!n)throw Xa.create("no-options");const c=zm.get(a);if(c){if(Qi(n,c.options)&&Qi(s,c.config))return c;throw Xa.create("duplicate-app",{appName:a})}const u=new wP(a);for(const m of Ix.values())u.addComponent(m);const h=new pD(n,s,u);return zm.set(a,h),h}function ml(t=Rx){const e=zm.get(t);if(!e&&t===Rx&&cN())return gN();if(!e)throw Xa.create("no-app",{appName:t});return e}function mn(t,e,n){let s=hD[t]??t;n&&(s+=`-${n}`);const a=s.match(/\s|\//),c=e.match(/\s|\//);if(a||c){const u=[`Unable to register library "${s}" with version "${e}":`];a&&u.push(`library name "${s}" contains illegal characters (whitespace or "/")`),a&&c&&u.push("and"),c&&u.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Ji.warn(u.join(" "));return}Yn(new Un(`${s}-version`,()=>({library:s,version:e}),"VERSION"))}/**
855 * @license
856 * Copyright 2021 Google LLC
857 *
858 * Licensed under the Apache License, Version 2.0 (the "License");
859 * you may not use this file except in compliance with the License.
860 * You may obtain a copy of the License at
861 *
862 *   http://www.apache.org/licenses/LICENSE-2.0
863 *
864 * Unless required by applicable law or agreed to in writing, softw
864are
865 * distributed under the License is distributed on an "AS IS" BASIS,
866 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
867 * See the License for the specific language governing permissions and
868 * limitations under the License.
869 */const gD="firebase-heartbeat-database",yD=1,Hd="firebase-heartbeat-store";let kb=null;function yN(){return kb||(kb=Rp(gD,yD,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(Hd)}catch(n){console.warn(n)}}}}).catch(t=>{throw Xa.create("idb-open",{originalErrorMessage:t.message})})),kb}async function bD(t){try{const n=(await yN()).transaction(Hd),s=await n.objectStore(Hd).get(bN(t));return await n.done,s}catch(e){if(e instanceof ds)Ji.warn(e.message);else{const n=Xa.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Ji.warn(n.message)}}}async function ck(t,e){try{const s=(await yN()).transaction(Hd,"readwrite");await s.objectStore(Hd).put(e,bN(t)),await s.done}catch(n){if(n instanceof ds)Ji.warn(n.message);else{const s=Xa.create("idb-set",{originalErrorMessage:n==null?void 0:n.message});Ji.warn(s.message)}}}function bN(t){return`${t.name}!${t.options.appId}`}/**
870 * @license
871 * Copyright 2021 Google LLC
872 *
873 * Licensed under the Apache License, Version 2.0 (the "License");
874 * you may not use this file except in compliance with the License.
875 * You may obtain a copy of the License at
876 *
877 *   http://www.apache.org/licenses/LICENSE-2.0
878 *
879 * Unless required by applicable law or agreed to in writing, software
880 * distributed under the License is distributed on an "AS IS" BASIS,
881 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
882 * See the License for the specific language governing permissions and
883 * limitations under the License.
884 */const xD=1024,vD=30;class _D{constructor(e){this.container=e,this._heartbeatsCache=null;const n=this.container.getProvider("app").getImmediate();this._storage=new ED(n),this._heartbeatsCachePromise=this._storage.read().then(s=>(this._heartbeatsCache=s,s))}async triggerHeartbeat(){var e,n;try{const a=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),c=uk();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===c||this._heartbeatsCache.heartbeats.some(u=>u.date===c))return;if(this._heartbeatsCache.heartbeats.push({date:c,agent:a}),this._heartbeatsCache.heartbeats.length>vD){const u=kD(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(u,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(s){Ji.warn(s)}}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=uk(),{heartbeatsToSend:s,unsentEntries:a}=wD(this._heartbeatsCache.heartbeats),c=Vm(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=n,a.length>0?(this._heartbeatsCache.heartbeats=a,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),c}catch(n){return Ji.warn(n),""}}}function uk(){return new Date().toISOString().substring(0,10)}function wD(t,e=xD){const n=[];let s=t.slice();for(const a of t){const c=n.find(u=>u.agent===a.agent);if(c){if(c.dates.push(a.date),dk(n)>e){c.dates.pop();break}}else if(n.push({agent:a.agent,dates:[a.date]}),dk(n)>e){n.pop();break}s=s.slice(1)}return{heartbeatsToSend:n,unsentEntries:s}}class ED{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return fh()?fN().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){const n=await bD(this.app);return n!=null&&n.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){const s=await this.read();return ck(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){const s=await this.read();return ck(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}else return}}function dk(t){return Vm(JSON.stringify({version:2,heartbeats:t})).length}function kD(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let s=1;s<t.length;s++)t[s].date<n&&(n=t[s].date,e=s);return e}/**
885 * @license
886 * Copyright 2019 Google LLC
887 *
888 * Licensed under the Apache License, Version 2.0 (the "License");
889 * you may not use this file except in compliance with the License.
890 * You may obtain a copy of the License at
891 *
892 *   http://www.apache.org/licenses/LICENSE-2.0
893 *
894 * Unless required by applicable law or agreed to in writing, software
895 * distributed under the License is distributed on an "AS IS" BASIS,
896 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
897 * See the License for the specific language governing permissions and
898 * limitations under the License.
899 */function TD(t){Yn(new Un("platform-logger",e=>new LP(e),"PRIVATE")),Yn(new Un("heartbeat",e=>new _D(e),"PRIVATE")),mn(Cx,ok,t),mn(Cx,ok,"esm2020"),mn("fire-js","")}TD("");var SD="firebase",ND="12.9.0";/**
900 * @license
901 * Copyright 2020 Google LLC
902 *
903 * Licensed under the Apache License, Version 2.0 (the "License");
904 * you may not use this file except in compliance with the License.
905 * You may obtain a copy of the License at
906 *
907 *   http://www.apache.org/licenses/LICENSE-2.0
908 *
909 * Unless required by applicable law or agreed to in writing, software
910 * distributed under the License is distributed on an "AS IS" BASIS,
911 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
912 * See the License for the specific language governing permissions and
913 * limitations under the License.
914 */mn(SD,ND,"app");function xN(){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 jD=xN,vN=new fi("auth","Firebase",xN());/**
915 * @license
916 * Copyright 2020 Google LLC
917 *
918 * Licensed under the Apache License, Version 2.0 (the "License");
919 * you may not use this file except in compliance with the License.
920 * You may obtain a copy of the License at
921 *
922 *   http://www.apache.org/licenses/LICENSE-2.0
923 *
924 * Unless required by applicable law or agreed to in writing, software
925 * distributed under the License is distributed on an "AS IS" BASIS,
926 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
927 * See the License for the specific language governing permissions and
928 * limitations under the License.
929 */const Bm=new su("@firebase/auth");function AD(t,...e){Bm.logLevel<=ft.WARN&&Bm.warn(`Auth (${Zi}): ${t}`,...e)}function Tm(t,...e){Bm.logLevel<=ft.ERROR&&Bm.error(`Auth (${Zi}): ${t}`,...e)}/**
930 * @license
931 * Copyright 2020 Google LLC
932 *
933 * Licensed under the Apache License, Version 2.0 (the "License");
934 * you may not use this file except in compliance with the License.
935 * You may obtain a copy of the License at
936 *
937 *   http://www.apache.org/licenses/LICENSE-2.0
938 *
939 * Unless required by applicable law or agreed to in writing, software
940 * distributed under the License is distributed on an "AS IS" BASIS,
941 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
942 * See the License for the specific language governing permissions and
943 * limitations under the License.
944 */function lr(t,...e){throw Pv(t,...e)}function Sr(t,...e){return Pv(t,...e)}function Mv(t,e,n){const s={...jD(),[e]:n};return new fi("auth","Firebase",s).create(e,{appName:t.name})}function Nr(t){return Mv(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function CD(t,e,n){const s=n;
944if(!(e instanceof s))throw s.name!==e.constructor.name&&lr(t,"argument-error"),Mv(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Pv(t,...e){if(typeof t!="string"){const n=e[0],s=[...e.slice(1)];return s[0]&&(s[0].appName=t.name),t._errorFactory.create(n,...s)}return vN.create(t,...e)}function Ye(t,e,...n){if(!t)throw Pv(e,...n)}function Bi(t){const e="INTERNAL ASSERTION FAILED: "+t;throw Tm(e),new Error(e)}function ea(t,e){t||Bi(e)}/**
945 * @license
946 * Copyright 2020 Google LLC
947 *
948 * Licensed under the Apache License, Version 2.0 (the "License");
949 * you may not use this file except in compliance with the License.
950 * You may obtain a copy of the License at
951 *
952 *   http://www.apache.org/licenses/LICENSE-2.0
953 *
954 * Unless required by applicable law or agreed to in writing, software
955 * distributed under the License is distributed on an "AS IS" BASIS,
956 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
957 * See the License for the specific language governing permissions and
958 * limitations under the License.
959 */function Mx(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.href)||""}function RD(){return hk()==="http:"||hk()==="https:"}function hk(){var t;return typeof self<"u"&&((t=self.location)==null?void 0:t.protocol)||null}/**
960 * @license
961 * Copyright 2020 Google LLC
962 *
963 * Licensed under the Apache License, Version 2.0 (the "License");
964 * you may not use this file except in compliance with the License.
965 * You may obtain a copy of the License at
966 *
967 *   http://www.apache.org/licenses/LICENSE-2.0
968 *
969 * Unless required by applicable law or agreed to in writing, software
970 * distributed under the License is distributed on an "AS IS" BASIS,
971 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
972 * See the License for the specific language governing permissions and
973 * limitations under the License.
974 */function ID(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(RD()||hN()||"connection"in navigator)?navigator.onLine:!0}function MD(){if(typeof navigator>"u")return null;const t=navigator;return t.languages&&t.languages[0]||t.language||null}/**
975 * @license
976 * Copyright 2020 Google LLC
977 *
978 * Licensed under the Apache License, Version 2.0 (the "License");
979 * you may not use this file except in compliance with the License.
980 * You may obtain a copy of the License at
981 *
982 *   http://www.apache.org/licenses/LICENSE-2.0
983 *
984 * Unless required by applicable law or agreed to in writing, software
985 * distributed under the License is distributed on an "AS IS" BASIS,
986 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
987 * See the License for the specific language governing permissions and
988 * limitations under the License.
989 */class ph{constructor(e,n){this.shortDelay=e,this.longDelay=n,ea(n>e,"Short delay should be less than long delay!"),this.isMobile=tP()||rP()}get(){return ID()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
990 * @license
991 * Copyright 2020 Google LLC
992 *
993 * Licensed under the Apache License, Version 2.0 (the "License");
994 * you may not use this file except in compliance with the License.
995 * You may obtain a copy of the License at
996 *
997 *   http://www.apache.org/licenses/LICENSE-2.0
998 *
999 * Unless required by applicable law or agreed to in writing, software
1000 * distributed under the License is distributed on an "AS IS" BASIS,
1001 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1002 * See the License for the specific language governing permissions and
1003 * limitations under the License.
1004 */function Dv(t,e){ea(t.emulator,"Emulator should always be set here");const{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}/**
1005 * @license
1006 * Copyright 2020 Google LLC
1007 *
1008 * Licensed under the Apache License, Version 2.0 (the "License");
1009 * you may not use this file except in compliance with the License.
1010 * You may obtain a copy of the License at
1011 *
1012 *   http://www.apache.org/licenses/LICENSE-2.0
1013 *
1014 * Unless required by applicable law or agreed to in writing, softw
1014are
1015 * distributed under the License is distributed on an "AS IS" BASIS,
1016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1017 * See the License for the specific language governing permissions and
1018 * limitations under the License.
1019 */class _N{static initialize(e,n,s){this.fetchImpl=e,n&&(this.headersImpl=n),s&&(this.responseImpl=s)}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;Bi("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;Bi("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;Bi("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
1020 * @license
1021 * Copyright 2020 Google LLC
1022 *
1023 * Licensed under the Apache License, Version 2.0 (the "License");
1024 * you may not use this file except in compliance with the License.
1025 * You may obtain a copy of the License at
1026 *
1027 *   http://www.apache.org/licenses/LICENSE-2.0
1028 *
1029 * Unless required by applicable law or agreed to in writing, software
1030 * distributed under the License is distributed on an "AS IS" BASIS,
1031 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1032 * See the License for the specific language governing permissions and
1033 * limitations under the License.
1034 */const PD={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-rec
1034aptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
1035 * @license
1036 * Copyright 2020 Google LLC
1037 *
1038 * Licensed under the Apache License, Version 2.0 (the "License");
1039 * you may not use this file except in compliance with the License.
1040 * You may obtain a copy of the License at
1041 *
1042 *   http://www.apache.org/licenses/LICENSE-2.0
1043 *
1044 * Unless required by applicable law or agreed to in writing, software
1045 * distributed under the License is distributed on an "AS IS" BASIS,
1046 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1047 * See the License for the specific language governing permissions and
1048 * limitations under the License.
1049 */const DD=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],OD=new ph(3e4,6e4);function mi(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function pi(t,e,n,s,a={}){return wN(t,a,async()=>{let c={},u={};s&&(e==="GET"?u=s:c={body:JSON.stringify(s)});const h=mh({key:t.config.apiKey,...u}).slice(1),m=await t._getAdditionalHeaders();m["Content-Type"]="application/json",t.languageCode&&(m["X-Firebase-Locale"]=t.languageCode);const p={method:e,headers:m,...c};return sP()||(p.referrerPolicy="no-referrer"),t.emulatorConfig&&hi(t.emulatorConfig.host)&&(p.credentials="include"),_N.fetch()(await EN(t,t.config.apiHost,n,h),p)})}async function wN(t,e,n){t._canInitEmulator=!1;const s={...PD,...e};try{const a=new UD(t),c=await Promise.race([n(),a.promise]);a.clearNetworkTimeout();const u=await c.json();if("needConfirmation"in u)throw nm(t,"account-exists-with-different-credential",u);if(c.ok&&!("errorMessage"in u))return u;{const h=c.ok?u.errorMessage:u.error.message,[m,p]=h.split(" : ");if(m==="FEDERATED_USER_ID_ALREADY_LINKED")throw nm(t,"credential-already-in-use",u);if(m==="EMAIL_EXISTS")throw nm(t,"email-already-in-use",u);if(m==="USER_DISABLED")throw nm(t,"user-disabled",u);const b=s[m]||m.toLowerCase().replace(/[_\s]+/g,"-");if(p)throw Mv(t,b,p);lr(t,b)}}catch(a){if(a instanceof ds)throw a;lr(t,"network-request-failed",{message:String(a)})}}async function ru(t,e,n,s,a={}){const c=await pi(t,e,n,s,a);return"mfaPendingCredential"in c&&lr(t,"multi-factor-auth-required",{_serverResponse:c}),c}async function EN(t,e,n,s){const a=`${e}${n}?${s}`,c=t,u=c.config.emulator?Dv(t.config,a):`${t.config.apiScheme}://${a}`;return DD.includes(n)&&(await c._persistenceManagerAvailable,c._getPersistenceType()==="COOKIE")?c._getPersistence()._getFinalTarget(u).toString():u}function LD(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}class UD{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,s)=>{this.timer=setTimeout(()=>s(Sr(this.auth,"network-request-failed")),OD.get())})}}function nm(t,e,n){const s={appName:t.name};n.email&&(s.email=n.email),n.phoneNumber&&(s.phoneNumber=n.phoneNumber);const a=Sr(t,e,s);return a.customData._tokenResponse=n,a}function fk(t){return t!==void 0&&t.enterprise!==void 0}class FD{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 LD(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 VD(t,e){return pi(t,"GET","/v2/recaptchaConfig",mi(t,e))}/**
1050 * @license
1051 * Copyright 2020 Google LLC
1052 *
1053 * Licensed under the Apache License, Version 2.0 (the "License");
1054 * you may not use this file except in compliance with the License.
1055 * You may obtain a copy of the License at
1056 *
1057 *   http://www.apache.org/licenses/LICENSE-2.0
1058 *
1059 * Unless required by applicable law or agreed to in writing, software
1060 * distributed under the License is distributed on an "AS IS" BASIS,
1061 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1062 * See the License for the specific language governing permissions and
1063 * limitations under the License.
1064 */async function zD(t,e){return pi(t,"POST","/v1/accounts:delete",e)}async function Km(t,e){return pi(t,"POST","/v1/accounts:lookup",e)}/**
1065 * @license
1066 * Copyright 2020 Google LLC
1067 *
1068 * Licensed under the Apache License, Version 2.0 (the "License");
1069 * you may not use this file except in compliance with the License.
1070 * You may obtain a copy of the License at
1071 *
1072 *   http://www.apache.org/licenses/LICENSE-2.0
1073 *
1074 * Unless required by applicable law or agreed to in writing, software
1075 * distributed under the License is distributed on an "AS IS" BASIS,
1076 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1077 * See the License for the specific language governing permissions and
1078 * limitations under the License.
1079 */function Id(t){if(t)try{const e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function BD(t,e=!1){const n=st(t),s=await n.getIdToken(e),a=Ov(s);Ye(a&&a.exp&&a.auth_time&&a.iat,n.auth,"internal-error");const c=typeof a.firebase=="object"?a.firebase:void 0,u=c==null?void 0:c.sign_in_provider;return{claims:a,token:s,authTime:Id(Tb(a.auth_time)),issuedAtTime:Id(Tb(a.iat)),expirationTime:Id(Tb(a.exp)),signInProvider:u||null,signInSecondFactor:(c==null?void 0:c.sign_in_second_factor)||null}}function Tb(t){return Number(t)*1e3}function Ov(t){const[e,n,s]=t.split(".");if(e===void 0||n===void 0||s===void 0)return Tm("JWT malformed, contained fewer than 3 sections"),null;try{const a=aN(n);return a?JSON.parse(a):(Tm("Failed to decode base64 JWT payload"),null)}catch(a){return Tm("Caught error parsing JWT payload as JSON",a==null?void 0:a.toString()),null}}function mk(t){const e=Ov(t);return Ye(e,"internal-error"),Ye(typeof e.exp<"u","internal-error"),Ye(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
1080 * @license
1081 * Copyright 2020 Google LLC
1082 *
1083 * Licensed under the Apache License, Version 2.0 (the "License");
1084 * you may not use this file except in compliance with the License.
1085 * You may obtain a copy of the License at
1086 *
1087 *   http://www.apache.org/licenses/LICENSE-2.0
1088 *
1089 * Unless required by applicable law or agreed to in writing, software
1090 * distributed under the License is distributed on an "AS IS" BASIS,
1091 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1092 * See the License for the specific language governing permissions and
1093 * limitations under the License.
1094 */async function $c(t,e,n=!1){if(n)return e;try{return await e}catch(s){throw s instanceof ds&&KD(s)&&t.auth.currentUser===t&&await t.auth.signOut(),s}}function KD({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}/**
1095 * @license
1096 * Copyright 2020 Google LLC
1097 *
1098 * Licensed under the Apache License, Version 2.0 (the "License");
1099 * you may not use this file except in compliance with the License.
1100 * You may obtain a copy of the License at
1101 *
1102 *   http://www.apache.org/licenses/LICENSE-2.0
1103 *
1104 * Unless required by applicable law or agreed to in writing, software
1105 * distributed under the License is distributed on an "AS IS" BASIS,
1106 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1107 * See the License for the specific language governing permissions and
1108 * limitations under the License.
1109 */class $D{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 s=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,s)}}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()}}/**
1110 * @license
1111 * Copyright 2020 Google LLC
1112 *
1113 * Licensed under the Apache License, Version 2.0 (the "License");
1114 * you may not use this file except in compliance with the License.
1115 * You may obtain a copy of the License at
1116 *
1117 *   http://www.apache.org/licenses/LICENSE-2.0
1118 *
1119 * Unless required by applicable law or agreed to in writing, software
1120 * distributed under the License is distributed on an "AS IS" BASIS,
1121 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1122 * See the License for the specific language governing permissions and
1123 * limitations under the License.
1124 */class Px{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Id(this.lastLoginAt),this.creationTime=Id(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
1125 * @license
1126 * Copyright 2019 Google LLC
1127 *
1128 * Licensed under the Apache License, Version 2.0 (the "License");
1129 * you may not use this file except in compliance with the License.
1130 * You may obtain a copy of the License at
1131 *
1132 *   http://www.apache.org/licenses/LICENSE-2.0
1133 *
1134 * Unless required by applicable law or agreed to in writing, software
1135 * distributed under the License is distributed on an "AS IS" BASIS,
1136 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1137 * See the License for the specific language governing permissions and
1138 * limitations under the License.
1139 */async function $m(t){var x;const e=t.auth,n=await t.getIdToken(),s=await $c(t,Km(e,{idToken:n}));Ye(s==null?void 0:s.users.length,e,"internal-error");const a=s.users[0];t._notifyReloadListener(a);const c=(x=a.providerUserInfo)!=null&&x.length?kN(a.providerUserInfo):[],u=HD(t.providerData,c),h=t.isAnonymous,m=!(t.email&&a.passwordHash)&&!(u!=null&&u.length),p=h?m:!1,b={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:u,metadata:new Px(a.createdAt,a.lastLoginAt),isAnonymous:p};Object.assign(t,b)}async function qD(t){const e=st(t);await $m(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function HD(t,e){return[...t.filter(s=>!e.some(a=>a.providerId===s.providerId)),...e]}function kN(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}/**
1140 * @license
1141 * Copyright 2020 Google LLC
1142 *
1143 * Licensed under the Apache License, Version 2.0 (the "License");
1144 * you may not use this file except in compliance with the License.
1145 * You may obtain a copy of the License at
1146 *
1147 *   http://www.apache.org/licenses/LICENSE-2.0
1148 *
1149 * Unless required by applicable law or agreed to in writing, software
1150 * distributed under the License is distributed on an "AS IS" BASIS,
1151 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1152 * See the License for the specific language governing permissions and
1153 * limitations under the License.
1154 */async function GD(t,e){const n=await wN(t,{},async()=>{const s=mh({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:a,apiKey:c}=t.config,u=await EN(t,a,"/v1/token",`key=${c}`),h=await t._getAdditionalHeaders();h["Content-Type"]="application/x-www-form-urlencoded";const m={method:"POST",headers:h,body:s};return t.emulatorConfig&&hi(t.emulatorConfig.host)&&(m.credentials="include"),_N.fetch()(u,m)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function YD(t,e){return pi(t,"POST","/v2/accounts:revokeToken",mi(t,e))}/**
1155 * @license
1156 * Copyright 2020 Google LLC
1157 *
1158 * Licensed under the Apache License, Version 2.0 (the "License");
1159 * you may not use this file except in compliance with the License.
1160 * You may obtain a copy of the License at
1161 *
1162 *   http://www.apache.org/licenses/LICENSE-2.0
1163 *
1164 * Unless required by applicable law or agreed to in writing, software
1165 * distributed under the License is distributed on an "AS IS" BASIS,
1166 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1167 * See the License for the specific language governing permissions and
1168 * limitations under the License.
1169 */class Rc{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ye(e.idToken,"internal-error"),Ye(typeof e.idToken<"u","internal-error"),Ye(typeof e.refreshToken<"u","internal-error");
1169const n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):mk(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){Ye(e.length!==0,"internal-error");const n=mk(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(Ye(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:s,refreshToken:a,expiresIn:c}=await GD(e,n);this.updateTokensAndExpiration(s,a,Number(c))}updateTokensAndExpiration(e,n,s){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+s*1e3}static fromJSON(e,n){const{refreshToken:s,accessToken:a,expirationTime:c}=n,u=new Rc;return s&&(Ye(typeof s=="string","internal-error",{appName:e}),u.refreshToken=s),a&&(Ye(typeof a=="string","internal-error",{appName:e}),u.accessToken=a),c&&(Ye(typeof c=="number","internal-error",{appName:e}),u.expirationTime=c),u}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 Rc,this.toJSON())}_performRefresh(){return Bi("not implemented")}}/**
1170 * @license
1171 * Copyright 2020 Google LLC
1172 *
1173 * Licensed under the Apache License, Version 2.0 (the "License");
1174 * you may not use this file except in compliance with the License.
1175 * You may obtain a copy of the License at
1176 *
1177 *   http://www.apache.org/licenses/LICENSE-2.0
1178 *
1179 * Unless required by applicable law or agreed to in writing, software
1180 * distributed under the License is distributed on an "AS IS" BASIS,
1181 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1182 * See the License for the specific language governing permissions and
1183 * limitations under the License.
1184 */function Ua(t,e){Ye(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}class kr{constructor({uid:e,auth:n,stsTokenManager:s,...a}){this.providerId="firebase",this.proactiveRefresh=new $D(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=n,this.stsTokenManager=s,this.accessToken=s.accessToken,this.displayName=a.displayName||null,this.email=a.email||null,this.emailVerified=a.emailVerified||!1,this.phoneNumber=a.phoneNumber||null,this.photoURL=a.photoURL||null,this.isAnonymous=a.isAnonymous||!1,this.tenantId=a.tenantId||null,this.providerData=a.providerData?[...a.providerData]:[],this.metadata=new Px(a.createdAt||void 0,a.lastLoginAt||void 0)}async getIdToken(e){const n=await $c(this,this.stsTokenManager.getToken(this.auth,e));return Ye(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return BD(this,e)}reload(){return qD(this)}_assign(e){this!==e&&(Ye(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const n=new kr({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){Ye(!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 s=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),s=!0),n&&await $m(this),await this.auth._persistUserIfCurrent(this),s&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(qn(this.auth.app))return Promise.reject(Nr(this.auth));const e=await this.getIdToken();return await $c(this,zD(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,isA
1184nonymous: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 s=n.displayName??void 0,a=n.email??void 0,c=n.phoneNumber??void 0,u=n.photoURL??void 0,h=n.tenantId??void 0,m=n._redirectEventId??void 0,p=n.createdAt??void 0,b=n.lastLoginAt??void 0,{uid:x,emailVerified:w,isAnonymous:T,providerData:N,stsTokenManager:j}=n;Ye(x&&j,e,"internal-error");const A=Rc.fromJSON(this.name,j);Ye(typeof x=="string",e,"internal-error"),Ua(s,e.name),Ua(a,e.name),Ye(typeof w=="boolean",e,"internal-error"),Ye(typeof T=="boolean",e,"internal-error"),Ua(c,e.name),Ua(u,e.name),Ua(h,e.name),Ua(m,e.name),Ua(p,e.name),Ua(b,e.name);const F=new kr({uid:x,auth:e,email:a,emailVerified:w,displayName:s,isAnonymous:T,photoURL:u,phoneNumber:c,tenantId:h,stsTokenManager:A,createdAt:p,lastLoginAt:b});return N&&Array.isArray(N)&&(F.providerData=N.map(V=>({...V}))),m&&(F._redirectEventId=m),F}static async _fromIdTokenResponse(e,n,s=!1){const a=new Rc;a.updateFromServerResponse(n);const c=new kr({uid:n.localId,auth:e,stsTokenManager:a,isAnonymous:s});return await $m(c),c}static async _fromGetAccountInfoResponse(e,n,s){const a=n.users[0];Ye(a.localId!==void 0,"internal-error");const c=a.providerUserInfo!==void 0?kN(a.providerUserInfo):[],u=!(a.email&&a.passwordHash)&&!(c!=null&&c.length),h=new Rc;h.updateFromIdToken(s);const m=new kr({uid:a.localId,auth:e,stsTokenManager:h,isAnonymous:u}),p={uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:c,metadata:new Px(a.createdAt,a.lastLoginAt),isAnonymous:!(a.email&&a.passwordHash)&&!(c!=null&&c.length)};return Object.assign(m,p),m}}/**
1185 * @license
1186 * Copyright 2020 Google LLC
1187 *
1188 * Licensed under the Apache License, Version 2.0 (the "License");
1189 * you may not use this file except in compliance with the License.
1190 * You may obtain a copy of the License at
1191 *
1192 *   http://www.apache.org/licenses/LICENSE-2.0
1193 *
1194 * Unless required by applicable law or agreed to in writing, software
1195 * distributed under the License is distributed on an "AS IS" BASIS,
1196 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1197 * See the License for the specific language governing permissions and
1198 * limitations under the License.
1199 */const pk=new Map;function Ki(t){ea(t instanceof Function,"Expected a class definition");let e=pk.get(t);return e?(ea(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,pk.set(t,e),e)}/**
1200 * @license
1201 * Copyright 2019 Google LLC
1202 *
1203 * Licensed under the Apache License, Version 2.0 (the "License");
1204 * you may not use this file except in compliance with the License.
1205 * You may obtain a copy of the License at
1206 *
1207 *   http://www.apache.org/licenses/LICENSE-2.0
1208 *
1209 * Unless required by applicable law or agreed to in writing, software
1210 * distributed under the License is distributed on an "AS IS" BASIS,
1211 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212 * See the License for the specific language governing permissions and
1213 * limitations under the License.
1214 */class TN{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){}}TN.type="NONE";const gk=TN;/**
1215 * @license
1216 * Copyright 2019 Google LLC
1217 *
1218 * Licensed under the Apache License, Version 2.0 (the "License");
1219 * you may not use this file except in compliance with the License.
1220 * You may obtain a copy of the License at
1221 *
1222 *   http://www.apache.org/licenses/LICENSE-2.0
1223 *
1224 * Unless required by applicable law or agreed to in writing, softw
1224are
1225 * distributed under the License is distributed on an "AS IS" BASIS,
1226 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1227 * See the License for the specific language governing permissions and
1228 * limitations under the License.
1229 */function Sm(t,e,n){return`firebase:${t}:${e}:${n}`}class Ic{constructor(e,n,s){this.persistence=e,this.auth=n,this.userKey=s;const{config:a,name:c}=this.auth;this.fullUserKey=Sm(this.userKey,a.apiKey,c),this.fullPersistenceKey=Sm("persistence",a.apiKey,c),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 Km(this.auth,{idToken:e}).catch(()=>{});return n?kr._fromGetAccountInfoResponse(this.auth,n,e):null}return kr._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,s="authUser"){if(!n.length)return new Ic(Ki(gk),e,s);const a=(await Promise.all(n.map(async p=>{if(await p._isAvailable())return p}))).filter(p=>p);let c=a[0]||Ki(gk);const u=Sm(s,e.config.apiKey,e.name);let h=null;for(const p of n)try{const b=await p._get(u);if(b){let x;if(typeof b=="string"){const w=await Km(e,{idToken:b}).catch(()=>{});if(!w)break;x=await kr._fromGetAccountInfoResponse(e,w,b)}else x=kr._fromJSON(e,b);p!==c&&(h=x),c=p;break}}catch{}const m=a.filter(p=>p._shouldAllowMigration);return!c._shouldAllowMigration||!m.length?new Ic(c,e,s):(c=m[0],h&&await c._set(u,h.toJSON()),await Promise.all(n.map(async p=>{if(p!==c)try{await p._remove(u)}catch{}})),new Ic(c,e,s))}}/**
1230 * @license
1231 * Copyright 2020 Google LLC
1232 *
1233 * Licensed under the Apache License, Version 2.0 (the "License");
1234 * you may not use this file except in compliance with the License.
1235 * You may obtain a copy of the License at
1236 *
1237 *   http://www.apache.org/licenses/LICENSE-2.0
1238 *
1239 * Unless required by applicable law or agreed to in writing, software
1240 * distributed under the License is distributed on an "AS IS" BASIS,
1241 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1242 * See the License for the specific language governing permissions and
1243 * limitations under the License.
1244 */function yk(t){const e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(AN(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(SN(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(RN(e))return"Blackberry";if(IN(e))return"Webos";if(NN(e))return"Safari";if((e.includes("chrome/")||jN(e))&&!e.includes("edge/"))return"Chrome";if(CN(e))return"Android";{const n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,s=t.match(n);if((s==null?void 0:s.length)===2)return s[1]}return"Other"}function SN(t=ss()){return/firefox\//i.test(t)}function NN(t=ss()){const e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function jN(t=ss()){return/crios\//i.test(t)}function AN(t=ss()){return/iemobile/i.test(t)}function CN(t=ss()){return/android/i.test(t)}function RN(t=ss()){return/blackberry/i.test(t)}function IN(t=ss()){return/webos/i.test(t)}function Lv(t=ss()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function WD(t=ss()){var e;return Lv(t)&&!!((e=window.navigator)!=null&&e.standalone)}function XD(){return iP()&&document.documentMode===10}function MN(t=ss()){return Lv(t)||CN(t)||IN(t)||RN(t)||/windows phone/i.test(t)||AN(t)}/**
1245 * @license
1246 * Copyright 2020 Google LLC
1247 *
1248 * Licensed under the Apache License, Version 2.0 (the "License");
1249 * you may not use this file except in compliance with the License.
1250 * You may obtain a copy of the License at
1251 *
1252 *   http://www.apache.org/licenses/LICENSE-2.0
1253 *
1254 * Unless required by applicable law or agreed to in writing, software
1255 * distributed under the License is distributed on an "AS IS" BASIS,
1256 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1257 * See the License for the specific language governing permissions and
1258 * limitations under the License.
1259 */function PN(t,e=[]){let n;switch(t){case"Browser":n=yk(ss());break;case"Worker":n=`${yk(ss())}-${t}`;break;default:n=t}const s=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Zi}/${s}`}/**
1260 * @license
1261 * Copyright 2022 Google LLC
1262 *
1263 * Licensed under the Apache License, Version 2.0 (the "License");
1264 * you may not use this file except in compliance with the License.
1265 * You may obtain a copy of the License at
1266 *
1267 *   http://www.apache.org/licenses/LICENSE-2.0
1268 *
1269 * Unless required by applicable law or agreed to in writing, software
1270 * distributed under the License is distributed on an "AS IS" BASIS,
1271 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1272 * See the License for the specific language governing permissions and
1273 * limitations under the License.
1274 */class QD{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){const s=c=>new Promise((u,h)=>{try{const m=e(c);u(m)}catch(m){h(m)}});s.onAbort=n,this.queue.push(s);const a=this.queue.length-1;return()=>{this.queue[a]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const n=[];try{for(const s of this.queue)await s(e),s.onAbort&&n.push(s.onAbort)}catch(s){n.reverse();for(const a of n)try{a()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:s==null?void 0:s.message})}}}/**
1275 * @license
1276 * Copyright 2023 Google LLC
1277 *
1278 * Licensed under the Apache License, Version 2.0 (the "License");
1279 * you may not use this file except in compliance with the License.
1280 * You may obtain a copy of the License at
1281 *
1282 *   http://www.apache.org/licenses/LICENSE-2.0
1283 *
1284 * Unless required by applicable law or agreed to in writing, software
1285 * distributed under the License is distributed on an "AS IS" BASIS,
1286 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1287 * See the License for the specific language governing permissions and
1288 * limitations under the License.
1289 */async function JD(t,e={}){return pi(t,"GET","/v2/passwordPolicy",mi(t,e))}/**
1290 * @license
1291 * Copyright 2023 Google LLC
1292 *
1293 * Licensed under the Apache License, Version 2.0 (the "License");
1294 * you may not use this file except in compliance with the License.
1295 * You may obtain a copy of the License at
1296 *
1297 *   http://www.apache.org/licenses/LICENSE-2.0
1298 *
1299 * Unless required by applicable law or agreed to in writing, software
1300 * distributed under the License is distributed on an "AS IS" BASIS,
1301 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1302 * See the License for the specific language governing permissions and
1303 * limitations under the License.
1304 */const ZD=6;class eO{constructor(e){var s;const n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??ZD,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=((s=e.allowedNonAlphanumericCharacters)==null?void 0:s.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&&
1304(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 s=this.customStrengthOptions.minPasswordLength,a=this.customStrengthOptions.maxPasswordLength;s&&(n.meetsMinPasswordLength=e.length>=s),a&&(n.meetsMaxPasswordLength=e.length<=a)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let s;for(let a=0;a<e.length;a++)s=e.charAt(a),this.updatePasswordCharacterOptionsStatuses(n,s>="a"&&s<="z",s>="A"&&s<="Z",s>="0"&&s<="9",this.allowedNonAlphanumericCharacters.includes(s))}updatePasswordCharacterOptionsStatuses(e,n,s,a,c){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=s)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=a)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=c))}}/**
1305 * @license
1306 * Copyright 2020 Google LLC
1307 *
1308 * Licensed under the Apache License, Version 2.0 (the "License");
1309 * you may not use this file except in compliance with the License.
1310 * You may obtain a copy of the License at
1311 *
1312 *   http://www.apache.org/licenses/LICENSE-2.0
1313 *
1314 * Unless required by applicable law or agreed to in writing, software
1315 * distributed under the License is distributed on an "AS IS" BASIS,
1316 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1317 * See the License for the specific language governing permissions and
1318 * limitations under the License.
1319 */class tO{constructor(e,n,s,a){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=s,this.config=a,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new bk(this),this.idTokenSubscription=new bk(this),this.beforeStateQueue=new QD(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=vN,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=a.sdkClientVersion,this._persistenceManagerAvailable=new Promise(c=>this._resolvePersistenceManagerAvailable=c)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=Ki(n)),this._initializationPromise=this.queue(async()=>{var s,a,c;if(!this._deleted&&(this.persistenceManager=await Ic.create(this,e),(s=this._resolvePersistenceManagerAvailable)==null||s.call(this),!this._deleted)){if((a=this._popupRedirectResolver)!=null&&a._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=((c=this.currentUser)==null?void 0:c.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 Km(this,{idToken:e}),s=await kr._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(s)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var c;if(qn(this.app)){const u=this.app.settings.authIdToken;return u?new Promise(h=>{setTimeout(()=>
1319this.initializeCurrentUserFromIdToken(u).then(h,h))}):this.directlySetCurrentUser(null)}const n=await this.assertedPersistence.getCurrentUser();let s=n,a=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const u=(c=this.redirectUser)==null?void 0:c._redirectEventId,h=s==null?void 0:s._redirectEventId,m=await this.tryRedirectSignIn(e);(!u||u===h)&&(m!=null&&m.user)&&(s=m.user,a=!0)}if(!s)return this.directlySetCurrentUser(null);if(!s._redirectEventId){if(a)try{await this.beforeStateQueue.runMiddleware(s)}catch(u){s=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(u))}return s?this.reloadAndSetCurrentUserOrClear(s):this.directlySetCurrentUser(null)}return Ye(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===s._redirectEventId?this.directlySetCurrentUser(s):this.reloadAndSetCurrentUserOrClear(s)}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 $m(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=MD()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(qn(this.app))return Promise.reject(Nr(this));const n=e?st(e):null;return n&&Ye(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&&Ye(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 qn(this.app)?Promise.reject(Nr(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return qn(this.app)?Promise.reject(Nr(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(Ki(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 JD(this),n=new eO(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 fi("auth","Firebase",e())}onAuthStateChanged(e,n,s){return this.registerStateListener(this.authStateSubscription,e,n,s)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,s){return this.registerStateListener(this.idTokenSubscription,e,n,s)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{const s=this.onAuthStateChanged(()=>{s(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){const n=await this.currentUser.getIdToken(),s={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(s.tenantId=this.tenantId),await YD(this,s)}}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 s=await this.getOrInitRedirectPersistenceManager(n);return e===null?s.removeCurrentUser():s.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const n=e&&Ki(e)||this._popupRedirectResolver;Ye(n,this,"argument-error"),this.redirectPersistenceManager=await Ic.create(this,[Ki(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var n,s;return this._isInitialized&&await this.queue(async()=>{}),((n=this._currentUser)==null?void 0:n._redirectEventId)===e?this._currentUser:((s=this.redirectUser)==null?void 0:s._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,s,a){if(this._deleted)return()=>{};const c=typeof n=="function"?n:n.next.bind(n);let u=!1;const h=this._isInitialized?Promise.resolve():this._initializationPromise;if(Ye(h,this,"internal-error"),h.then(()=>{u||c(this.currentUser)}),typeof n=="function"){const m=e.addObserver(n,s,a);return()=>{u=!0,m()}}else{const m=e.addObserver(n);return()=>{u=!0,m()}}}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 Ye(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=PN(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var a;const e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);const n=await((a=this.heartbeatServiceProvider.getImmediate({optional:!0}))==null?void 0:a.getHeartbeatsHeader());n&&(e["X-Firebase-Client"]=n);const s=await this._getAppCheckToken();return s&&(e["X-Firebase-AppCheck"]=s),e}async _getAppCheckToken(){var n;if(qn(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&&AD(`Error while retrieving App Check token: ${e.error}`),e==null?void 0:e.token}}function Mr(t){return st(t)}class bk{constructor(e){this.auth=e,this.observer=null,this.addObserver=hP(n=>this.observer=n)}get next(){return Ye(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
1320 * @license
1321 * Copyright 2020 Google LLC
1322 *
1323 * Licensed under the Apache License, Version 2.0 (the "License");
1324 * you may not use this file except in compliance with the License.
1325 * You may obtain a copy of the License at
1326 *
1327 *   http://www.apache.org/licenses/LICENSE-2.0
1328 *
1329 * Unless required by applicable law or agreed to in writing, software
1330 * distributed under the License is distributed on an "AS IS" BASIS,
1331 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1332 * See the License for the specific language governing permissions and
1333 * limitations under the License.
1334 */let Ip={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function nO(t){Ip=t}function DN(t){return Ip.loadJS(t)}function sO(){return Ip.recaptchaEnterpriseScript}function rO(){return Ip.gapiScript}function iO(t){return`__${t}${Math.floor(Math.random()*1e6)}`}class aO{constructor(){this.enterprise=new oO}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}class oO{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}}const lO="recaptcha-enterprise",ON="NO_RECAPTCHA";class cO{constructor(e){this.type=lO,this.auth=Mr(e)}async verify(e="verify",n=!1){async function s(c){if(!n){if(c.tenantId==null&&c._agentRecaptchaConfig!=null)return c._agentRecaptchaConfig.siteKey;if(c.tenantId!=null&&c._tenantRecaptchaConfigs[c.tenantId]!==void 0)return c._tenantRecaptchaConfigs[c.tenantId].siteKey}return new Promise(async(u,h)=>{VD(c,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(m=>{if(m.recaptchaKey===void 0)h(new Error("recaptcha Enterprise site key undefined"));else{const p=new FD(m);return c.tenantId==null?c._agentRecaptchaConfig=p:c._tenantRecaptchaConfigs[c.tenantId]=p,u(p.siteKey)}}).catch(m=>{h(m)})})}function a(c,u,h){const m=window.grecaptcha;fk(m)?m.enterprise.ready(()=>{m.enterprise.execute(c,{action:e}).then(p=>{u(p)}).catch(()=>{u(ON)})}):h(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new aO().execute("siteKey",{action:"verify"}):new Promise((c,u)=>{s(this.auth).then(h=>{if(!n&&fk(window.grecaptcha))a(h,c,u);else{if(typeof window>"u"){u(new Error("RecaptchaVerifier is only supported in browser"));return}let m=sO();m.length!==0&&(m+=h),DN(m).then(()=>{a(h,c,u)}).catch(p=>{u(p)})}}).catch(h=>{u(h)})})}}async function xk(t,e,n,s=!1,a=!1){const c=new cO(t);let u;if(a)u=ON;else try{u=await c.verify(n)}catch{u=await c.verify(n,!0)}const h={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in h){const m=h.phoneEnrollmentInfo.phoneNumber,p=h.phoneEnrollmentInfo.recaptchaToken;Object.assign(h,{phoneEnrollmentInfo:{phoneNumber:m,recaptchaToken:p,captchaResponse:u,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in h){const m=h.phoneSignInInfo.recaptchaToken;Object.assign(h,{phoneSignInInfo:{recaptchaToken:m,captchaResponse:u,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return h}return s?Object.assign(h,{captchaResp:u}):Object.assign(h,{captchaResponse:u}),Object.assign(h,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(h,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),h}async function qm(t,e,n,s,a){var c;if((c=t._getRecaptchaConfig())!=null&&c.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){const u=await xk(t,e,n,n==="getOobCode");return s(t,u)}else return s(t,e).catch(async u=>{if(u.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 h=await xk(t,e,n,n==="getOobCode");return s(t,h)}else return Promise.reject(u)})}/**
1335 * @license
1336 * Copyright 2020 Google LLC
1337 *
1338 * Licensed under the Apache License, Version 2.0 (the "License");
1339 * you may not use this file except in compliance with the License.
1340 * You may obtain a copy of the License at
1341 *
1342 *   http://www.apache.org/licenses/LICENSE-2.0
1343 *
1344 * Unless required by applicable law or agreed to in writing, software
1345 * distributed under the License is distributed on an "AS IS" BASIS,
1346 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1347 * See the License for the specific language governing permissions and
1348 * limitations under the License.
1349 */function uO(t,e){const n=ur(t,"auth");if(n.isInitialized()){const a=n.getImmediate(),c=n.getOptions();if(Qi(c,e??{}))return a;lr(a,"already-initialized")}return n.initialize({options:e})}function dO(t,e){const n=(e==null?void 0:e.persistence)||[],s=(Array.isArray(n)?n:[n]).map(Ki);e!=null&&e.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(s,e==null?void 0:e.popupRedirectResolver)}function hO(t,e,n){const s=Mr(t);Ye(/^https?:\/\//.test(e),s,"invalid-emulator-scheme");const a=!1,c=LN(e),{host:u,port:h}=fO(e),m=h===null?"":`:${h}`,p={url:`${c}//${u}${m}/`},b=Object.freeze({host:u,port:h,protocol:c.replace(":",""),options:Object.freeze({disableWarnings:a})});if(!s._canInitEmulator){Ye(s.config.emulator&&s.emulatorConfig,s,"emulator-config-failed"),Ye(Qi(p,s.config.emulator)&&Qi(b,s.emulatorConfig),s,"emulator-config-failed");return}s.config.emulator=p,s.emulatorConfig=b,s.settings.appVerificationDisabledForTesting=!0,hi(u)?(Ap(`${c}//${u}${m}`),Cp("Auth",!0)):mO()}function LN(t){const e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function fO(t){const e=LN(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};const s=n[2].split("@").pop()||"",a=/^(\[[^\]]+\])(:|$)/.exec(s);if(a){const c=a[1];return{host:c,port:vk(s.substr(c.length+1))}}else{const[c,u]=s.split(":");return{host:c,port:vk(u)}}}function vk(t){if(!t)return null;const e=Number(t);return isNaN(e)?null:e}function mO(){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())}/**
1350 * @license
1351 * Copyright 2020 Google LLC
1352 *
1353 * Licensed under the Apache License, Version 2.0 (the "License");
1354 * you may not use this file except in compliance with the License.
1355 * You may obtain a copy of the License at
1356 *
1357 *   http://www.apache.org/licenses/LICENSE-2.0
1358 *
1359 * Unless required by applicable law or agreed to in writing, software
1360 * distributed under the License is distributed on an "AS IS" BASIS,
1361 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1362 * See the License for the specific language governing permissions and
1363 * limitations under the License.
1364 */class Uv{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Bi("not implemented")}_getIdTokenResponse(e){return Bi("not implemented")}_linkToIdToken(e,n){return Bi("not implemented")}_getReauthenticationResolver(e){return Bi("not implemented")}}async function pO(t,e){return pi(t,"POST","/v1/accounts:signUp",e)}/**
1365 * @license
1366 * Copyright 2020 Google LLC
1367 *
1368 * Licensed under the Apache License, Version 2.0 (the "License");
1369 * you may not use this file except in compliance with the License.
1370 * You may obtain a copy of the License at
1371 *
1372 *   http://www.apache.org/licenses/LICENSE-2.0
1373 *
1374 * Unless required by applicable law or agreed to in writing, software
1375 * distributed under the License is distributed on an "AS IS" BASIS,
1376 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1377 * See the License for the specific language governing permissions and
1378 * limitations under the License.
1379 */async function gO(t,e){return ru(t,"POST","/v1/accounts:signInWithPassword",mi(t,e))}async function yO(t,e){return pi(t,"POST","/v1/accounts:sendOobCode",mi(t,e))}async function bO(t,e){return yO(t,e)}/**
1380 * @license
1381 * Copyright 2020 Google LLC
1382 *
1383 * Licensed under the Apache License, Version 2.0 (the "License");
1384 * you may not use this file except in compliance with the License.
1385 * You may obtain a copy of the License at
1386 *
1387 *   http://www.apache.org/licenses/LICENSE-2.0
1388 *
1389 * Unless required by applicable law or agreed to in writing, software
1390 * distributed under the License is distributed on an "AS IS" BASIS,
1391 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1392 * See the License for the specific language governing permissions and
1393 * limitations under the License.
1394 */async function xO(t,e){return ru(t,"POST","/v1/accounts:signInWithEmailLink",mi(t,e))}async function vO(t,e){return ru(t,"POST","/v1/accounts:signInWithEmailLink",mi(t,e))}/**
1395 * @license
1396 * Copyright 2020 Google LLC
1397 *
1398 * Licensed under the Apache License, Version 2.0 (the "License");
1399 * you may not use this file except in compliance with the License.
1400 * You may obtain a copy of the License at
1401 *
1402 *   http://www.apache.org/licenses/LICENSE-2.0
1403 *
1404 * Unless required by applicable law or agreed to in writing, software
1405 * distributed under the License is distributed on an "AS IS" BASIS,
1406 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1407 * See the License for the specific language governing permissions and
1408 * limitations under the License.
1409 */class Gd extends Uv{constructor(e,n,s,a=null){super("password",s),this._email=e,this._password=n,this._tenantId=a}static _fromEmailAndPassword(e,n){return new Gd(e,n,"password")}static _fromEmailAndCode(e,n,s=null){return new Gd(e,n,"emailLink",s)}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 qm(e,n,"signInWithPassword",gO);case"emailLink":return xO(e,{email:this._email,oobCode:this._password});default:lr(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":const s={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return qm(e,s,"signUpPassword",pO);case"emailLink":return vO(e,{idToken:n,email:this._email,oobCode:this._password});default:lr(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
1410 * @license
1411 * Copyright 2020 Google LLC
1412 *
1413 * Licensed under the Apache License, Version 2.0 (the "License");
1414 * you may not use this file except in compliance with the License.
1415 * You may obtain a copy of the License at
1416 *
1417 *   http://www.apache.org/licenses/LICENSE-2.0
1418 *
1419 * Unless required by applicable law or agreed to in writing, software
1420 * distributed under the License is distributed on an "AS IS" BASIS,
1421 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1422 * See the License for the specific language governing permissions and
1423 * limitations under the License.
1424 */async function Mc(t,e){return ru(t,"POST","/v1/accounts:signInWithIdp",mi(t,e))}/**
1425 * @license
1426 * Copyright 2020 Google LLC
1427 *
1428 * Licensed under the Apache License, Version 2.0 (the "License");
1429 * you may not use this file except in compliance with the License.
1430 * You may obtain a copy of the License at
1431 *
1432 *   http://www.apache.org/licenses/LICENSE-2.0
1433 *
1434 * Unless required by applicable law or agreed to in writing, software
1435 * distributed under the License is distributed on an "AS IS" BASIS,
1436 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1437 * See the License for the specific language governing permissions and
1438 * limitations under the License.
1439 */const _O="http://localhost";class il extends Uv{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const n=new il(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):lr("argument-error"),n}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,n
1439once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const n=typeof e=="string"?JSON.parse(e):e,{providerId:s,signInMethod:a,...c}=n;if(!s||!a)return null;const u=new il(s,a);return u.idToken=c.idToken||void 0,u.accessToken=c.accessToken||void 0,u.secret=c.secret,u.nonce=c.nonce,u.pendingToken=c.pendingToken||null,u}_getIdTokenResponse(e){const n=this.buildRequest();return Mc(e,n)}_linkToIdToken(e,n){const s=this.buildRequest();return s.idToken=n,Mc(e,s)}_getReauthenticationResolver(e){const n=this.buildRequest();return n.autoCreate=!1,Mc(e,n)}buildRequest(){const e={requestUri:_O,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=mh(n)}return e}}/**
1440 * @license
1441 * Copyright 2020 Google LLC
1442 *
1443 * Licensed under the Apache License, Version 2.0 (the "License");
1444 * you may not use this file except in compliance with the License.
1445 * You may obtain a copy of the License at
1446 *
1447 *   http://www.apache.org/licenses/LICENSE-2.0
1448 *
1449 * Unless required by applicable law or agreed to in writing, software
1450 * distributed under the License is distributed on an "AS IS" BASIS,
1451 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1452 * See the License for the specific language governing permissions and
1453 * limitations under the License.
1454 */function wO(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 EO(t){const e=Ed(kd(t)).link,n=e?Ed(kd(e)).deep_link_id:null,s=Ed(kd(t)).deep_link_id;return(s?Ed(kd(s)).link:null)||s||n||e||t}class Fv{constructor(e){const n=Ed(kd(e)),s=n.apiKey??null,a=n.oobCode??null,c=wO(n.mode??null);Ye(s&&a&&c,"argument-error"),this.apiKey=s,this.operation=c,this.code=a,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){const n=EO(e);try{return new Fv(n)}catch{return null}}}/**
1455 * @license
1456 * Copyright 2020 Google LLC
1457 *
1458 * Licensed under the Apache License, Version 2.0 (the "License");
1459 * you may not use this file except in compliance with the License.
1460 * You may obtain a copy of the License at
1461 *
1462 *   http://www.apache.org/licenses/LICENSE-2.0
1463 *
1464 * Unless required by applicable law or agreed to in writing, software
1465 * distributed under the License is distributed on an "AS IS" BASIS,
1466 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1467 * See the License for the specific language governing permissions and
1468 * limitations under the License.
1469 */class iu{constructor(){this.providerId=iu.PROVIDER_ID}static credential(e,n){return Gd._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){const s=Fv.parseLink(n);return Ye(s,"argument-error"),Gd._fromEmailAndCode(e,s.code,s.tenantId)}}iu.PROVIDER_ID="password";iu.EMAIL_PASSWORD_SIGN_IN_METHOD="password";iu.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
1470 * @license
1471 * Copyright 2020 Google LLC
1472 *
1473 * Licensed under the Apache License, Version 2.0 (the "License");
1474 * you may not use this file except in compliance with the License.
1475 * You may obtain a copy of the License at
1476 *
1477 *   http://www.apache.org/licenses/LICENSE-2.0
1478 *
1479 * Unless required by applicable law or agreed to in writing, software
1480 * distributed under the License is distributed on an "AS IS" BASIS,
1481 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1482 * See the License for the specific language governing permissions and
1483 * limitations under the License.
1484 */class Vv{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}}/**
1485 * @license
1486 * Copyright 2019 Google LLC
1487 *
1488 * Licensed under the Apache License, Version 2.0 (the "License");
1489 * you may not use this file except in compliance with the License.
1490 * You may obtain a copy of the License at
1491 *
1492 *   http://www.apache.org/licenses/LICENSE-2.0
1493 *
1494 * Unless required by applicable law or agreed to in writing, software
1495 * distributed under the License is distributed on an "AS IS" BASIS,
1496 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1497 * See the License for the specific language governing permissions and
1498 * limitations under the License.
1499 */class gh extends Vv{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
1500 * @license
1501 * Copyright 2020 Google LLC
1502 *
1503 * Licensed under the Apache License, Version 2.0 (the "License");
1504 * you may not use this file except in compliance with the License.
1505 * You may obtain a copy of the License at
1506 *
1507 *   http://www.apache.org/licenses/LICENSE-2.0
1508 *
1509 * Unless required by applicable law or agreed to in writing, software
1510 * distributed under the License is distributed on an "AS IS" BASIS,
1511 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1512 * See the License for the specific language governing permissions and
1513 * limitations under the License.
1514 */class Ba extends gh{constructor(){super("facebook.com")}static credential(e){return il._fromParams({providerId:Ba.PROVIDER_ID,signInMethod:Ba.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ba.credentialFromTaggedObject(e)}static credentialFromError(e){return Ba.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Ba.credential(e.oauthAccessToken)}catch{return null}}}Ba.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ba.PROVIDER_ID="facebook.com";/**
1515 * @license
1516 * Copyright 2020 Google LLC
1517 *
1518 * Licensed under the Apache License, Version 2.0 (the "License");
1519 * you may not use this file except in compliance with the License.
1520 * You may obtain a copy of the License at
1521 *
1522 *   http://www.apache.org/licenses/LICENSE-2.0
1523 *
1524 * Unless required by applicable law or agreed to in writing, software
1525 * distributed under the License is distributed on an "AS IS" BASIS,
1526 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1527 * See the License for the specific language governing permissions and
1528 * limitations under the License.
1529 */class Fi extends gh{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return il._fromParams({providerId:Fi.PROVIDER_ID,signInMethod:Fi.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return Fi.credentialFromTaggedObject(e)}static credentialFromError(e){return Fi.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:n,oauthAccessToken:s}=e;if(!n&&!s)return null;try{return Fi.credential(n,s)}catch{return null}}}Fi.GOOGLE_SIGN_IN_METHOD="google.com";Fi.PROVIDER_ID="google.com";/**
1530 * @license
1531 * Copyright 2020 Google LLC
1532 *
1533 * Licensed under the Apache License, Version 2.0 (the "License");
1534 * you may not use this file except in compliance with the License.
1535 * You may obtain a copy of the License at
1536 *
1537 *   http://www.apache.org/licenses/LICENSE-2.0
1538 *
1539 * Unless required by applicable law or agreed to in writing, software
1540 * distributed under the License is distributed on an "AS IS" BASIS,
1541 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1542 * See the License for the specific language governing permissions and
1543 * limitations under the License.
1544 */class Ka extends gh{constructor(){super("github.com")}static credential(e){return il._fromParams({providerId:Ka.PROVIDER_ID,signInMethod:Ka.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ka.credentialFromTaggedObject(e)}static credentialFromError(e){return Ka.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return Ka.credential(e.oauthAccessToken)}catch{return null}}}Ka.GITHUB_SIGN_IN_METHOD="github.com";Ka.PROVIDER_ID="github.com";/**
1545 * @license
1546 * Copyright 2020 Google LLC
1547 *
1548 * Licensed under the Apache License, Version 2.0 (the "License");
1549 * you may not use this file except in compliance with the License.
1550 * You may obtain a copy of the License at
1551 *
1552 *   http://www.apache.org/licenses/LICENSE-2.0
1553 *
1554 * Unless required by applicable law or agreed to in writing, software
1555 * distributed under the License is distributed on an "AS IS" BASIS,
1556 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1557 * See the License for the specific language governing permissions and
1558 * limitations under the License.
1559 */class $a extends gh{constructor(){super("twitter.com")}static credential(e,n){return il._fromParams({providerId:$a.PROVIDER_ID,signInMethod:$a.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return $a.credentialFromTaggedObject(e)}static credentialFromError(e){return $a.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:n,oauthTokenSecret:s}=e;if(!n||!s)return null;try{return $a.credential(n,s)}catch{return null}}}$a.TWITTER_SIGN_IN_METHOD="twitter.com";$a.PROVIDER_ID="twitter.com";/**
1560 * @license
1561 * Copyright 2020 Google LLC
1562 *
1563 * Licensed under the Apache License, Version 2.0 (the "License");
1564 * you may not use this file except in compliance with the License.
1565 * You may obtain a copy of the License at
1566 *
1567 *   http://www.apache.org/licenses/LICENSE-2.0
1568 *
1569 * Unless required by applicable law or agreed to in writing, software
1570 * distributed under the License is distributed on an "AS IS" BASIS,
1571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1572 * See the License for the specific language governing permissions and
1573 * limitations under the License.
1574 */async function UN(t,e){return ru(t,"POST","/v1/accounts:signUp",mi(t,e))}/**
1575 * @license
1576 * Copyright 2020 Google LLC
1577 *
1578 * Licensed under the Apache License, Version 2.0 (the "License");
1579 * you may not use this file except in compliance with the License.
1580 * You may obtain a copy of the License at
1581 *
1582 *   http://www.apache.org/licenses/LICENSE-2.0
1583 *
1584 * Unless required by applicable law or agreed to in writing, software
1585 * distributed under the License is distributed on an "AS IS" BASIS,
1586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1587 * See the License for the specific language governing permissions and
1588 * limitations under the License.
1589 */class ci{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,s,a=!1){const c=await kr._fromIdTokenResponse(e,s,a),u=_k(s);return new ci({user:c,providerId:u,_tokenResponse:s,operationType:n})}static async _forOperation(e,n,s){await e._updateTokensIfNecessary(s,!0);const a=_k(s);return new ci({user:e,providerId:a,_tokenResponse:s,operationType:n})}}function _k(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}/**
1590 * @license
1591 * Copyright 2020 Google LLC
1592 *
1593 * Licensed under the Apache License, Version 2.0 (the "License");
1594 * you may not use this file except in compliance with the License.
1595 * You may obtain a copy of the License at
1596 *
1597 *   http://www.apache.org/licenses/LICENSE-2.0
1598 *
1599 * Unless required by applicable law or agreed to in writing, software
1600 * distributed under the License is distributed on an "AS IS" BASIS,
1601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1602 * See the License for the specific language governing permissions and
1603 * limitations under the License.
1604 */async function kO(t){var a;if(qn(t.app))return Promise.reject(Nr(t));const e=Mr(t);if(await e._initializationPromise,(a=e.currentUser)!=null&&a.isAnonymous)return new ci({user:e.currentUser,providerId:null,operationType:"signIn"});const n=await UN(e,{returnSecureToken:!0}),s=await ci._fromIdTokenResponse(e,"signIn",n,!0);return await e._updateCurrentUser(s.user),s}/**
1605 * @license
1606 * Copyright 2020 Google LLC
1607 *
1608 * Licensed under the Apache License, Version 2.0 (the "License");
1609 * you may not use this file except in compliance with the License.
1610 * You may obtain a copy of the License at
1611 *
1612 *   http://www.apache.org/licenses/LICENSE-2.0
1613 *
1614 * Unless required by applicable law or agreed to in writing, softw
1614are
1615 * distributed under the License is distributed on an "AS IS" BASIS,
1616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1617 * See the License for the specific language governing permissions and
1618 * limitations under the License.
1619 */class Hm extends ds{constructor(e,n,s,a){super(n.code,n.message),this.operationType=s,this.user=a,Object.setPrototypeOf(this,Hm.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:s}}static _fromErrorAndOperation(e,n,s,a){return new Hm(e,n,s,a)}}function FN(t,e,n,s){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(c=>{throw c.code==="auth/multi-factor-auth-required"?Hm._fromErrorAndOperation(t,c,e,s):c})}async function TO(t,e,n=!1){const s=await $c(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return ci._forOperation(t,"link",s)}/**
1620 * @license
1621 * Copyright 2019 Google LLC
1622 *
1623 * Licensed under the Apache License, Version 2.0 (the "License");
1624 * you may not use this file except in compliance with the License.
1625 * You may obtain a copy of the License at
1626 *
1627 *   http://www.apache.org/licenses/LICENSE-2.0
1628 *
1629 * Unless required by applicable law or agreed to in writing, software
1630 * distributed under the License is distributed on an "AS IS" BASIS,
1631 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1632 * See the License for the specific language governing permissions and
1633 * limitations under the License.
1634 */async function SO(t,e,n=!1){const{auth:s}=t;if(qn(s.app))return Promise.reject(Nr(s));const a="reauthenticate";try{const c=await $c(t,FN(s,a,e,t),n);Ye(c.idToken,s,"internal-error");const u=Ov(c.idToken);Ye(u,s,"internal-error");const{sub:h}=u;return Ye(t.uid===h,s,"user-mismatch"),ci._forOperation(t,a,c)}catch(c){throw(c==null?void 0:c.code)==="auth/user-not-found"&&lr(s,"user-mismatch"),c}}/**
1635 * @license
1636 * Copyright 2020 Google LLC
1637 *
1638 * Licensed under the Apache License, Version 2.0 (the "License");
1639 * you may not use this file except in compliance with the License.
1640 * You may obtain a copy of the License at
1641 *
1642 *   http://www.apache.org/licenses/LICENSE-2.0
1643 *
1644 * Unless required by applicable law or agreed to in writing, software
1645 * distributed under the License is distributed on an "AS IS" BASIS,
1646 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1647 * See the License for the specific language governing permissions and
1648 * limitations under the License.
1649 */async function VN(t,e,n=!1){if(qn(t.app))return Promise.reject(Nr(t));const s="signIn",a=await FN(t,s,e),c=await ci._fromIdTokenResponse(t,s,a);return n||await t._updateCurrentUser(c.user),c}async function NO(t,e){return VN(Mr(t),e)}/**
1650 * @license
1651 * Copyright 2020 Google LLC
1652 *
1653 * Licensed under the Apache License, Version 2.0 (the "License");
1654 * you may not use this file except in compliance with the License.
1655 * You may obtain a copy of the License at
1656 *
1657 *   http://www.apache.org/licenses/LICENSE-2.0
1658 *
1659 * Unless required by applicable law or agreed to in writing, software
1660 * distributed under the License is distributed on an "AS IS" BASIS,
1661 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1662 * See the License for the specific language governing permissions and
1663 * limitations under the License.
1664 */async function jO(t,e){return ru(t,"POST","/v1/accounts:signInWithCustomToken",mi(t,e))}/**
1665 * @license
1666 * Copyright 2020 Google LLC
1667 *
1668 * Licensed under the Apache License, Version 2.0 (the "License");
1669 * you may not use this file except in compliance with the License.
1670 * You may obtain a copy of the License at
1671 *
1672 *   http://www.apache.org/licenses/LICENSE-2.0
1673 *
1674 * Unless required by applicable law or agreed to in writing, software
1675 * distributed under the License is distributed on an "AS IS" BASIS,
1676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1677 * See the License for the specific language governing permissions and
1678 * limitations under the License.
1679 */async function AO(t,e){if(qn(t.app))return Promise.reject(Nr(t));const n=Mr(t),s=await jO(n,{token:e,returnSecureToken:!0}),a=await ci._fromIdTokenResponse(n,"signIn",s);return await n._updateCurrentUser(a.user),a}/**
1680 * @license
1681 * Copyright 2020 Google LLC
1682 *
1683 * Licensed under the Apache License, Version 2.0 (the "License");
1684 * you may not use this file except in compliance with the License.
1685 * You may obtain a copy of the License at
1686 *
1687 *   http://www.apache.org/licenses/LICENSE-2.0
1688 *
1689 * Unless required by applicable law or agreed to in writing, software
1690 * distributed under the License is distributed on an "AS IS" BASIS,
1691 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1692 * See the License for the specific language governing permissions and
1693 * limitations under the License.
1694 */async function zN(t){const e=Mr(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function CO(t,e,n){const s=Mr(t);await qm(s,{requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"},"getOobCode",bO)}async function RO(t,e,n){if(qn(t.app))return Promise.reject(Nr(t));const s=Mr(t),u=await qm(s,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",UN).catch(m=>{throw m.code==="auth/password-does-not-meet-requirements"&&zN(t),m}),h=await ci._fromIdTokenResponse(s,"signIn",u);return await s._updateCurrentUser(h.user),h}function IO(t,e,n){return qn(t.app)?Promise.reject(Nr(t)):NO(st(t),iu.credential(e,n)).catch(async s=>{throw s.code==="auth/password-does-not-meet-requirements"&&zN(t),s})}/**
1695 * @license
1696 * Copyright 2020 Google LLC
1697 *
1698 * Licensed under the Apache License, Version 2.0 (the "License");
1699 * you may not use this file except in compliance with the License.
1700 * You may obtain a copy of the License at
1701 *
1702 *   http://www.apache.org/licenses/LICENSE-2.0
1703 *
1704 * Unless required by applicable law or agreed to in writing, software
1705 * distributed under the License is distributed on an "AS IS" BASIS,
1706 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1707 * See the License for the specific language governing permissions and
1708 * limitations under the License.
1709 */async function MO(t,e){return pi(t,"POST","/v1/accounts:update",e)}/**
1710 * @license
1711 * Copyright 2020 Google LLC
1712 *
1713 * Licensed under the Apache License, Version 2.0 (the "License");
1714 * you may not use this file except in compliance with the License.
1715 * You may obtain a copy of the License at
1716 *
1717 *   http://www.apache.org/licenses/LICENSE-2.0
1718 *
1719 * Unless required by applicable law or agreed to in writing, software
1720 * distributed under the License is distributed on an "AS IS" BASIS,
1721 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1722 * See the License for the specific language governing permissions and
1723 * limitations under the License.
1724 */async function PO(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;const s=st(t),c={idToken:await s.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},u=await $c(s,MO(s.auth,c));s.displayName=u.displayName||null,s.photoURL=u.photoUrl||null;const h=s.providerData.find(({providerId:m})=>m==="password");h&&(h.displayName=s.displayName,h.photoURL=s.photoURL),await s._updateTokensIfNecessary(u)}function DO(t,e,n,s){return st(t).onIdTokenChanged(e,n,s)}function OO(t,e,n){return st(t).beforeAuthStateChanged(e,n)}function zv(t,e,n,s){return st(t).onAuthStateChanged(e,n,s)}function LO(t){return st(t).signOut()}const Gm="__sak";/**
1725 * @license
1726 * Copyright 2019 Google LLC
1727 *
1728 * Licensed under the Apache License, Version 2.0 (the "License");
1729 * you may not use this file except in compliance with the License.
1730 * You may obtain a copy of the License at
1731 *
1732 *   http://www.apache.org/licenses/LICENSE-2.0
1733 *
1734 * Unless required by applicable law or agreed to in writing, software
1735 * distributed under the License is distributed on an "AS IS" BASIS,
1736 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1737 * See the License for the specific language governing permissions and
1738 * limitations under the License.
1739 */class BN{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Gm,"1"),this.storage.removeItem(Gm),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()}}/**
1740 * @license
1741 * Copyright 2020 Google LLC
1742 *
1743 * Licensed under the Apache License, Version 2.0 (the "License");
1744 * you may not use this file except in compliance with the License.
1745 * You may obtain a copy of the License at
1746 *
1747 *   http://www.apache.org/licenses/LICENSE-2.0
1748 *
1749 * Unless required by applicable law or agreed to in writing, software
1750 * distributed under the License is distributed on an "AS IS" BASIS,
1751 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1752 * See the License for the specific language governing permissions and
1753 * limitations under the License.
1754 */const UO=1e3,FO=10;class KN extends BN{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=MN(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const n of Object.keys(this.listeners)){const s=this.storage.getItem(n),a=this.localCache[n];s!==a&&e(n,a,s)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((u,h,m)=>{this.notifyListeners(u,m)});return}const s=e.key;n?this.detachListener():this.stopPolling();const a=()=>{const u=this.storage.getItem(s);!n&&this.localCache[s]===u||this.notifyListeners(s,u)},c=this.storage.getItem(s);XD()&&c!==e.newValue&&e.newValue!==e.oldValue?setTimeout(a,FO):a()}notifyListeners(e,n){this.localCache[e]=n;const s=this.listeners[e];if(s)for(const a of Array.from(s))a(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,s)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:s}),!0)})},UO)}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
1754ject.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]}}KN.type="LOCAL";const VO=KN;/**
1755 * @license
1756 * Copyright 2020 Google LLC
1757 *
1758 * Licensed under the Apache License, Version 2.0 (the "License");
1759 * you may not use this file except in compliance with the License.
1760 * You may obtain a copy of the License at
1761 *
1762 *   http://www.apache.org/licenses/LICENSE-2.0
1763 *
1764 * Unless required by applicable law or agreed to in writing, software
1765 * distributed under the License is distributed on an "AS IS" BASIS,
1766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1767 * See the License for the specific language governing permissions and
1768 * limitations under the License.
1769 */class $N extends BN{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}}$N.type="SESSION";const qN=$N;/**
1770 * @license
1771 * Copyright 2019 Google LLC
1772 *
1773 * Licensed under the Apache License, Version 2.0 (the "License");
1774 * you may not use this file except in compliance with the License.
1775 * You may obtain a copy of the License at
1776 *
1777 *   http://www.apache.org/licenses/LICENSE-2.0
1778 *
1779 * Unless required by applicable law or agreed to in writing, software
1780 * distributed under the License is distributed on an "AS IS" BASIS,
1781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1782 * See the License for the specific language governing permissions and
1783 * limitations under the License.
1784 */function zO(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}/**
1785 * @license
1786 * Copyright 2019 Google LLC
1787 *
1788 * Licensed under the Apache License, Version 2.0 (the "License");
1789 * you may not use this file except in compliance with the License.
1790 * You may obtain a copy of the License at
1791 *
1792 *   http://www.apache.org/licenses/LICENSE-2.0
1793 *
1794 * Unless required by applicable law or agreed to in writing, software
1795 * distributed under the License is distributed on an "AS IS" BASIS,
1796 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1797 * See the License for the specific language governing permissions and
1798 * limitations under the License.
1799 */class Mp{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const n=this.receivers.find(a=>a.isListeningto(e));if(n)return n;const s=new Mp(e);return this.receivers.push(s),s}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const n=e,{eventId:s,eventType:a,data:c}=n.data,u=this.handlersMap[a];if(!(u!=null&&u.size))return;n.ports[0].postMessage({status:"ack",eventId:s,eventType:a});const h=Array.from(u).map(async p=>p(n.origin,c)),m=await zO(h);n.ports[0].postMessage({status:"done",eventId:s,eventType:a,response:m})}_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)}}Mp.receivers=[];/**
1800 * @license
1801 * Copyright 2020 Google LLC
1802 *
1803 * Licensed under the Apache License, Version 2.0 (the "License");
1804 * you may not use this file except in compliance with the License.
1805 * You may obtain a copy of the License at
1806 *
1807 *   http://www.apache.org/licenses/LICENSE-2.0
1808 *
1809 * Unless required by applicable law or agreed to in writing, software
1810 * distributed under the License is distributed on an "AS IS" BASIS,
1811 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1812 * See the License for the specific language governing permissions and
1813 * limitations under the License.
1814 */function Bv(t="",e=10){let n="";for(let s=0;s<e;s++)n+=Math.floor(Math.random()*10);return t+n}/**
1815 * @license
1816 * Copyright 2019 Google LLC
1817 *
1818 * Licensed under the Apache License, Version 2.0 (the "License");
1819 * you may not use this file except in compliance with the License.
1820 * You may obtain a copy of the License at
1821 *
1822 *   http://www.apache.org/licenses/LICENSE-2.0
1823 *
1824 * Unless required by applicable law or agreed to in writing, software
1825 * distributed under the License is distributed on an "AS IS" BASIS,
1826 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1827 * See the License for the specific language governing permissions and
1828 * limitations under the License.
1829 */class BO{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,s=50){const a=typeof MessageChannel<"u"?new MessageChannel:null;if(!a)throw new Error("connection_unavailable");let c,u;return new Promise((h,m)=>{const p=Bv("",20);a.port1.start();const b=setTimeout(()=>{m(new Error("unsupported_event"))},s);u={messageChannel:a,onMessage(x){const w=x;if(w.data.eventId===p)switch(w.data.status){case"ack":clearTimeout(b),c=setTimeout(()=>{m(new Error("timeout"))},3e3);break;case"done":clearTimeout(c),h(w.data.response);break;default:clearTimeout(b),clearTimeout(c),m(new Error("invalid_response"));break}}},this.handlers.add(u),a.port1.addEventListener("message",u.onMessage),this.target.postMessage({eventType:e,eventId:p,data:n},[a.port2])}).finally(()=>{u&&this.removeMessageHandler(u)})}}/**
1830 * @license
1831 * Copyright 2020 Google LLC
1832 *
1833 * Licensed under the Apache License, Version 2.0 (the "License");
1834 * you may not use this file except in compliance with the License.
1835 * You may obtain a copy of the License at
1836 *
1837 *   http://www.apache.org/licenses/LICENSE-2.0
1838 *
1839 * Unless required by applicable law or agreed to in writing, software
1840 * distributed under the License is distributed on an "AS IS" BASIS,
1841 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1842 * See the License for the specific language governing permissions and
1843 * limitations under the License.
1844 */function ii(){return window}function KO(t){ii().location.href=t}/**
1845 * @license
1846 * Copyright 2020 Google LLC.
1847 *
1848 * Licensed under the Apache License, Version 2.0 (the "License");
1849 * you may not use this file except in compliance with the License.
1850 * You may obtain a copy of the License at
1851 *
1852 *   http://www.apache.org/licenses/LICENSE-2.0
1853 *
1854 * Unless required by applicable law or agreed to in writing, software
1855 * distributed under the License is distributed on an "AS IS" BASIS,
1856 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1857 * See the License for the specific language governing permissions and
1858 * limitations under the License.
1859 */function HN(){return typeof ii().WorkerGlobalScope<"u"&&typeof ii().importScripts=="function"}async function $O(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function qO(){var t;return((t=navigator==null?void 0:navigator.serviceWorker)==null?void 0:t.controller)||null}function HO(){return HN()?self:null}/**
1860 * @license
1861 * Copyright 2019 Google LLC
1862 *
1863 * Licensed under the Apache License, Version 2.0 (the "License");
1864 * you may not use this file except in compliance with the License.
1865 * You may obtain a copy of the License at
1866 *
1867 *   http://www.apache.org/licenses/LICENSE-2.0
1868 *
1869 * Unless required by applicable law or agreed to in writing, software
1870 * distributed under the License is distributed on an "AS IS" BASIS,
1871 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1872 * See the License for the specific language governing permissions and
1873 * limitations under the License.
1874 */const GN="firebaseLocalStorageDb",GO=1,Ym="firebaseLocalStorage",YN="fbase_key";class yh{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 Pp(t,e){return t.transaction([Ym],e?"readwrite":"readonly").objectStore(Ym)}function YO(){const t=indexedDB.deleteDatabase(GN);
1874return new yh(t).toPromise()}function Dx(){const t=indexedDB.open(GN,GO);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{const s=t.result;try{s.createObjectStore(Ym,{keyPath:YN})}catch(a){n(a)}}),t.addEventListener("success",async()=>{const s=t.result;s.objectStoreNames.contains(Ym)?e(s):(s.close(),await YO(),e(await Dx()))})})}async function wk(t,e,n){const s=Pp(t,!0).put({[YN]:e,value:n});return new yh(s).toPromise()}async function WO(t,e){const n=Pp(t,!1).get(e),s=await new yh(n).toPromise();return s===void 0?null:s.value}function Ek(t,e){const n=Pp(t,!0).delete(e);return new yh(n).toPromise()}const XO=800,QO=3;class WN{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 Dx(),this.db)}async _withRetries(e){let n=0;for(;;)try{const s=await this._openDb();return await e(s)}catch(s){if(n++>QO)throw s;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return HN()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Mp._getInstance(HO()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)}
1874)),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){var n,s;if(this.activeServiceWorker=await $O(),!this.activeServiceWorker)return;this.sender=new BO(this.activeServiceWorker);const e=await this.sender._send("ping",{},800);e&&(n=e[0])!=null&&n.fulfilled&&(s=e[0])!=null&&s.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||qO()!==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 Dx();return await wk(e,Gm,"1"),await Ek(e,Gm),!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(s=>wk(s,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){const n=await this._withRetries(s=>WO(s,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Ek(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(a=>{const c=Pp(a,!1).getAll();return new yh(c).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const n=[],s=new Set;if(e.length!==0)for(const{fbase_key:a,value:c}of e)s.add(a),JSON.stringify(this.localCache[a])!==JSON.stringify(c)&&(this.notifyListeners(a,c),n.push(a));for(const a of Object.keys(this.localCache))this.localCache[a]&&!s.has(a)&&(this.notifyListeners(a,null),n.push(a));return n}notifyListeners(e,n){this.localCache[e]=n;const s=this.listeners[e];if(s)for(const a of Array.from(s))a(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),XO)}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
1874ject.keys(this.listeners).length===0&&this.stopPolling()}}WN.type="LOCAL";const JO=WN;new ph(3e4,6e4);/**
1875 * @license
1876 * Copyright 2021 Google LLC
1877 *
1878 * Licensed under the Apache License, Version 2.0 (the "License");
1879 * you may not use this file except in compliance with the License.
1880 * You may obtain a copy of the License at
1881 *
1882 *   http://www.apache.org/licenses/LICENSE-2.0
1883 *
1884 * Unless required by applicable law or agreed to in writing, software
1885 * distributed under the License is distributed on an "AS IS" BASIS,
1886 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1887 * See the License for the specific language governing permissions and
1888 * limitations under the License.
1889 */function XN(t,e){return e?Ki(e):(Ye(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}/**
1890 * @license
1891 * Copyright 2019 Google LLC
1892 *
1893 * Licensed under the Apache License, Version 2.0 (the "License");
1894 * you may not use this file except in compliance with the License.
1895 * You may obtain a copy of the License at
1896 *
1897 *   http://www.apache.org/licenses/LICENSE-2.0
1898 *
1899 * Unless required by applicable law or agreed to in writing, software
1900 * distributed under the License is distributed on an "AS IS" BASIS,
1901 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1902 * See the License for the specific language governing permissions and
1903 * limitations under the License.
1904 */class Kv extends Uv{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Mc(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Mc(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Mc(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}}
1904function ZO(t){return VN(t.auth,new Kv(t),t.bypassAuthState)}function e6(t){const{auth:e,user:n}=t;return Ye(n,e,"internal-error"),SO(n,new Kv(t),t.bypassAuthState)}async function t6(t){const{auth:e,user:n}=t;return Ye(n,e,"internal-error"),TO(n,new Kv(t),t.bypassAuthState)}/**
1905 * @license
1906 * Copyright 2020 Google LLC
1907 *
1908 * Licensed under the Apache License, Version 2.0 (the "License");
1909 * you may not use this file except in compliance with the License.
1910 * You may obtain a copy of the License at
1911 *
1912 *   http://www.apache.org/licenses/LICENSE-2.0
1913 *
1914 * Unless required by applicable law or agreed to in writing, software
1915 * distributed under the License is distributed on an "AS IS" BASIS,
1916 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1917 * See the License for the specific language governing permissions and
1918 * limitations under the License.
1919 */class QN{constructor(e,n,s,a,c=!1){this.auth=e,this.resolver=s,this.user=a,this.bypassAuthState=c,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(s){this.reject(s)}})}async onAuthEvent(e){const{urlResponse:n,sessionId:s,postBody:a,tenantId:c,error:u,type:h}=e;if(u){this.reject(u);return}const m={auth:this.auth,requestUri:n,sessionId:s,tenantId:c||void 0,postBody:a||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(h)(m))}catch(p){this.reject(p)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ZO;case"linkViaPopup":case"linkViaRedirect":return t6;case"reauthViaPopup":case"reauthViaRedirect":return e6;default:lr(this.auth,"internal-error")}}resolve(e){ea(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ea(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()}}/**
1920 * @license
1921 * Copyright 2020 Google LLC
1922 *
1923 * Licensed under the Apache License, Version 2.0 (the "License");
1924 * you may not use this file except in compliance with the License.
1925 * You may obtain a copy of the License at
1926 *
1927 *   http://www.apache.org/licenses/LICENSE-2.0
1928 *
1929 * Unless required by applicable law or agreed to in writing, software
1930 * distributed under the License is distributed on an "AS IS" BASIS,
1931 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1932 * See the License for the specific language governing permissions and
1933 * limitations under the License.
1934 */const n6=new ph(2e3,1e4);async function s6(t,e,n){if(qn(t.app))return Promise.reject(Sr(t,"operation-not-supported-in-this-environment"));const s=Mr(t);CD(t,e,Vv);const a=XN(s,n);return new Ho(s,"signInViaPopup",e,a).executeNotNull()}class Ho extends QN{constructor(e,n,s,a,c){super(e,n,a,c),this.provider=s,this.authWindow=null,this.pollId=null,Ho.currentPopupAction&&Ho.currentPopupAction.cancel(),Ho.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ye(e,this.auth,"internal-error"),e}async onExecution(){ea(this.filter.length===1,"Popup operations only handle one event");const e=Bv();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(Sr(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)==null?void 0:e.associatedEvent)||null}cancel(){this.reject(Sr(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Ho.currentPopupAction=null}pollUserCancellation(){const e=()=>{var n,s;if((s=(n=this.authWindow)==null?void 0:n.window)!=null&&s.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(Sr(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,n6.get())};e()}}Ho.currentPopupAction=null;/**
1935 * @license
1936 * Copyright 2020 Google LLC
1937 *
1938 * Licensed under the Apache License, Version 2.0 (the "License");
1939 * you may not use this file except in compliance with the License.
1940 * You may obtain a copy of the License at
1941 *
1942 *   http://www.apache.org/licenses/LICENSE-2.0
1943 *
1944 * Unless required by applicable law or agreed to in writing, software
1945 * distributed under the License is distributed on an "AS IS" BASIS,
1946 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1947 * See the License for the specific language governing permissions and
1948 * limitations under the License.
1949 */const r6="pendingRedirect",Nm=new Map;class i6 extends QN{constructor(e,n,s=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,s),this.eventId=null}async execute(){let e=Nm.get(this.auth._key());if(!e){try{const s=await a6(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(s)}catch(n){e=()=>Promise.reject(n)}Nm.set(this.auth._key(),e)}return this.bypassAuthState||Nm.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 a6(t,e){const n=c6(e),s=l6(t);if(!await s._isAvailable())return!1;const a=await s._get(n)==="true";return await s._remove(n),a}function o6(t,e){Nm.set(t._key(),e)}function l6(t){return Ki(t._redirectPersistence)}function c6(t){return Sm(r6,t.config.apiKey,t.name)}async function u6(t,e,n=!1){if(qn(t.app))return Promise.reject(Nr(t));const s=Mr(t),a=XN(s,e),u=await new i6(s,a,n).execute();return u&&!n&&(delete u.user._redirectEventId,await s._persistUserIfCurrent(u.user),await s._setRedirectUser(null,e)),u}/**
1950 * @license
1951 * Copyright 2020 Google LLC
1952 *
1953 * Licensed under the Apache License, Version 2.0 (the "License");
1954 * you may not use this file except in compliance with the License.
1955 * You may obtain a copy of the License at
1956 *
1957 *   http://www.apache.org/licenses/LICENSE-2.0
1958 *
1959 * Unless required by applicable law or agreed to in writing, software
1960 * distributed under the License is distributed on an "AS IS" BASIS,
1961 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1962 * See the License for the specific language governing permissions and
1963 * limitations under the License.
1964 */const d6=600*1e3;class h6{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(s=>{this.isEventForConsumer(e,s)&&(n=!0,this.sendToConsumer(e,s),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!f6(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){var s;if(e.error&&!JN(e)){const a=((s=e.error.code)==null?void 0:s.split("auth/")[1])||"internal-error";n.onError(Sr(this.auth,a))}else n.onAuthEvent(e)}isEventForConsumer(e,n){const s=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&s}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=d6&&this.cachedEventUids.clear(),this.cachedEventUids.has(kk(e))}saveEventToCache(e){this.cachedEventUids.add(kk(e)),this.lastProcessedEventTime=Date.now()}}function kk(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function JN({type:t,error:e}){return t==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function f6(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return JN(t);default:return!1}}/**
1965 * @license
1966 * Copyright 2020 Google LLC
1967 *
1968 * Licensed under the Apache License, Version 2.0 (the "License");
1969 * you may not use this file except in compliance with the License.
1970 * You may obtain a copy of the License at
1971 *
1972 *   http://www.apache.org/licenses/LICENSE-2.0
1973 *
1974 * Unless required by applicable law or agreed to in writing, software
1975 * distributed under the License is distributed on an "AS IS" BASIS,
1976 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1977 * See the License for the specific language governing permissions and
1978 * limitations under the License.
1979 */async function m6(t,e={}){return pi(t,"GET","/v1/projects",e)}/**
1980 * @license
1981 * Copyright 2020 Google LLC
1982 *
1983 * Licensed under the Apache License, Version 2.0 (the "License");
1984 * you may not use this file except in compliance with the License.
1985 * You may obtain a copy of the License at
1986 *
1987 *   http://www.apache.org/licenses/LICENSE-2.0
1988 *
1989 * Unless required by applicable law or agreed to in writing, software
1990 * distributed under the License is distributed on an "AS IS" BASIS,
1991 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1992 * See the License for the specific language governing permissions and
1993 * limitations under the License.
1994 */const p6=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,g6=/^https?/;async function y6(t){if(t.config.emulator)return;const{authorizedDomains:e}=await m6(t);for(const n of e)try{if(b6(n))return}catch{}lr(t,"unauthorized-domain")}function b6(t){const e=Mx(),{protocol:n,hostname:s}=new URL(e);if(t.startsWith("chrome-extension://")){const u=new URL(t);return u.hostname===""&&s===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&u.hostname===s}if(!g6.test(n))return!1;if(p6.test(t))return s===t;const a=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+a+"|"+a+")$","i").test(s)}/**
1995 * @license
1996 * Copyright 2020 Google LLC.
1997 *
1998 * Licensed under the Apache License, Version 2.0 (the "License");
1999 * you may not use this file except in compliance with the License.
2000 * You may obtain a copy of the License at
2001 *
2002 *   http://www.apache.org/licenses/LICENSE-2.0
2003 *
2004 * Unless required by applicable law or agreed to in writing, software
2005 * distributed under the License is distributed on an "AS IS" BASIS,
2006 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2007 * See the License for the specific language governing permissions and
2008 * limitations under the License.
2009 */const x6=new ph(3e4,6e4);function Tk(){const t=ii().___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 v6(t){return new Promise((e,n)=>{var a,c,u;function s(){Tk(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Tk(),n(Sr(t,"network-request-failed"))},timeout:x6.get()})}if((c=(a=ii().gapi)==null?void 0:a.iframes)!=null&&c.Iframe)e(gapi.iframes.getContext());else if((u=ii().gapi)!=null&&u.load)s();else{const h=iO("iframefcb");return ii()[h]=()=>{gapi.load?s():n(Sr(t,"network-request-failed"))},DN(`${rO()}?onload=${h}`).catch(m=>n(m))}}).catch(e=>{throw jm=null,e})}let jm=null;function _6(t){return jm=jm||v6(t),jm}/**
2010 * @license
2011 * Copyright 2020 Google LLC.
2012 *
2013 * Licensed under the Apache License, Version 2.0 (the "License");
2014 * you may not use this file except in compliance with the License.
2015 * You may obtain a copy of the License at
2016 *
2017 *   http://www.apache.org/licenses/LICENSE-2.0
2018 *
2019 * Unless required by applicable law or agreed to in writing, software
2020 * distributed under the License is distributed on an "AS IS" BASIS,
2021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2022 * See the License for the specific language governing permissions and
2023 * limitations under the License.
2024 */const w6=new ph(5e3,15e3),E6="__/auth/iframe",k6="emulator/auth/iframe",T6={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},S6=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function N6(t){const e=t.config;Ye(e.authDomain,t,"auth-domain-config-required");const n=e.emulator?Dv(e,k6):`https://${t.config.authDomain}/${E6}`,s={apiKey:e.apiKey,appName:t.name,v:Zi},a=S6.get(t.config.apiHost);a&&(s.eid=a);const c=t._getFrameworks();return c.length&&(s.fw=c.join(",")),`${n}?${mh(s).slice(1)}`}async function j6(t){const e=await _6(t),n=ii().gapi;return Ye(n,t,"internal-error"),e.open({where:document.body,url:N6(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:T6,dontclear:!0},s=>new Promise(async(a,c)=>{await s.restyle({setHideOnLeave:!1});const u=Sr(t,"network-request-failed"),h=ii().setTimeout(()=>{c(u)},w6.get());function m(){ii().clearTimeout(h),a(s)}s.ping(m).then(m,()=>{c(u)})}))}/**
2025 * @license
2026 * Copyright 2020 Google LLC.
2027 *
2028 * Licensed under the Apache License, Version 2.0 (the "License");
2029 * you may not use this file except in compliance with the License.
2030 * You may obtain a copy of the License at
2031 *
2032 *   http://www.apache.org/licenses/LICENSE-2.0
2033 *
2034 * Unless required by applicable law or agreed to in writing, software
2035 * distributed under the License is distributed on an "AS IS" BASIS,
2036 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2037 * See the License for the specific language governing permissions and
2038 * limitations under the License.
2039 */const A6={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},C6=500,R6=600,I6="_blank",M6="http://localhost";class Sk{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function P6(t,e,n,s=C6,a=R6){const c=Math.max((window.screen.availHeight-a)/2,0).toString(),u=Math.max((window.screen.availWidth-s)/2,0).toString();let h="";const m={...A6,width:s.toString(),height:a.toString(),top:c,left:u},p=ss().toLowerCase();n&&(h=jN(p)?I6:n),SN(p)&&(e=e||M6,m.scrollbars="yes");const b=Object.entries(m).reduce((w,[T,N])=>`${w}${T}=${N},`,"");if(WD(p)&&h!=="_self")return D6(e||"",h),new Sk(null);const x=window.open(e||"",h,b);Ye(x,t,"popup-blocked");try{x.focus()}catch{}return new Sk(x)}function D6(t,e){const n=document.createElement("a");n.href=t,n.target=e;const s=document.createEvent("MouseEvent");s.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(s)}/**
2040 * @license
2041 * Copyright 2021 Google LLC
2042 *
2043 * Licensed under the Apache License, Version 2.0 (the "License");
2044 * you may not use this file except in compliance with the License.
2045 * You may obtain a copy of the License at
2046 *
2047 *   http://www.apache.org/licenses/LICENSE-2.0
2048 *
2049 * Unless required by applicable law or agreed to in writing, software
2050 * distributed under the License is distributed on an "AS IS" BASIS,
2051 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2052 * See the License for the specific language governing permissions and
2053 * limitations under the License.
2054 */const O6="__/auth/handler",L6="emulator/auth/handler",U6=encodeURIComponent("fac");async function Nk(t,e,n,s,a,c){Ye(t.config.authDomain,t,"auth-domain-config-required"),Ye(t.config.apiKey,t,"invalid-api-key");const u={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:s,v:Zi,eventId:a};if(e instanceof Vv){e.setDefaultLanguage(t.languageCode),u.providerId=e.providerId||"",dP(e.getCustomParameters())||(u.customParameters=JSON.stringify(e.getCustomParameters()));for(const[b,x]of Object.entries({}))u[b]=x}if(e instanceof gh){const b=e.getScopes().filter(x=>x!=="");b.length>0&&(u.scopes=b.join(","))}t.tenantId&&(u.tid=t.tenantId);const h=u;for(const b of Object.keys(h))h[b]===void 0&&delete h[b];const m=await t._getAppCheckToken(),p=m?`#${U6}=${encodeURIComponent(m)}`:"";return`${F6(t)}?${mh(h).slice(1)}${p}`}function F6({config:t}){return t.emulator?Dv(t,L6):`https://${t.authDomain}/${O6}`}/**
2055 * @license
2056 * Copyright 2020 Google LLC
2057 *
2058 * Licensed under the Apache License, Version 2.0 (the "License");
2059 * you may not use this file except in compliance with the License.
2060 * You may obtain a copy of the License at
2061 *
2062 *   http://www.apache.org/licenses/LICENSE-2.0
2063 *
2064 * Unless required by applicable law or agreed to in writing, software
2065 * distributed under the License is distributed on an "AS IS" BASIS,
2066 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2067 * See the License for the specific language governing permissions and
2068 * limitations under the License.
2069 */const Sb="webStorageSupport";class V6{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=qN,this._completeRedirectFn=u6,this._overrideRedirectResult=o6}async _openPopup(e,n,s,a){var u;ea((u=this.eventManagers[e._key()])==null?void 0:u.manager,"_initialize() not called before _openPopup()");const c=await Nk(e,n,s,Mx(),a);return P6(e,c,Bv())}async _openRedirect(e,n,s,a){await this._originValidation(e);const c=await Nk(e,n,s,Mx(),a);return KO(c),new Promise(()=>{})}_initialize(e){const n=e._key();if(this.eventManagers[n]){const{manager:a,promise:c}=this.eventManagers[n];return a?Promise.resolve(a):(ea(c,"If manager is not set, promise should be"),c)}const s=this.initAndGetManager(e);return this.eventManagers[n]={promise:s},s.catch(()=>{delete this.eventManagers[n]}),s}async initAndGetManager(e){const n=await j6(e),s=new h6(e);return n.register("authEvent",a=>
2069(Ye(a==null?void 0:a.authEvent,e,"invalid-auth-event"),{status:s.onEvent(a.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:s},this.iframes[e._key()]=n,s}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(Sb,{type:Sb},a=>{var u;const c=(u=a==null?void 0:a[0])==null?void 0:u[Sb];c!==void 0&&n(!!c),lr(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=y6(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return MN()||NN()||Lv()}}const z6=V6;var jk="@firebase/auth",Ak="1.12.0";/**
2070 * @license
2071 * Copyright 2020 Google LLC
2072 *
2073 * Licensed under the Apache License, Version 2.0 (the "License");
2074 * you may not use this file except in compliance with the License.
2075 * You may obtain a copy of the License at
2076 *
2077 *   http://www.apache.org/licenses/LICENSE-2.0
2078 *
2079 * Unless required by applicable law or agreed to in writing, software
2080 * distributed under the License is distributed on an "AS IS" BASIS,
2081 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2082 * See the License for the specific language governing permissions and
2083 * limitations under the License.
2084 */class B6{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(s=>{e((s==null?void 0:s.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(){Ye(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
2085 * @license
2086 * Copyright 2020 Google LLC
2087 *
2088 * Licensed under the Apache License, Version 2.0 (the "License");
2089 * you may not use this file except in compliance with the License.
2090 * You may obtain a copy of the License at
2091 *
2092 *   http://www.apache.org/licenses/LICENSE-2.0
2093 *
2094 * Unless required by applicable law or agreed to in writing, software
2095 * distributed under the License is distributed on an "AS IS" BASIS,
2096 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2097 * See the License for the specific language governing permissions and
2098 * limitations under the License.
2099 */function K6(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 $6(t){Yn(new Un("auth",(e,{options:n})=>{const s=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat"),c=e.getProvider("app-check-internal"),{apiKey:u,authDomain:h}=s.options;Ye(u&&!u.includes(":"),"invalid-api-key",{appName:s.name});const m={apiKey:u,authDomain:h,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:PN(t)},p=new tO(s,a,c,m);return dO(p,n),p},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,s)=>{e.getProvider("auth-internal").initialize()})),Yn(new Un("auth-internal",e=>{const n=Mr(e.getProvider("auth").getImmediate());return(s=>new B6(s))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),mn(jk,Ak,K6(t)),mn(jk,Ak,"esm2020")}/**
2100 * @license
2101 * Copyright 2021 Google LLC
2102 *
2103 * Licensed under the Apache License, Version 2.0 (the "License");
2104 * you may not use this file except in compliance with the License.
2105 * You may obtain a copy of the License at
2106 *
2107 *   http://www.apache.org/licenses/LICENSE-2.0
2108 *
2109 * Unless required by applicable law or agreed to in writing, softw
2109are
2110 * distributed under the License is distributed on an "AS IS" BASIS,
2111 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2112 * See the License for the specific language governing permissions and
2113 * limitations under the License.
2114 */const q6=300,H6=uN("authIdTokenMaxAge")||q6;let Ck=null;const G6=t=>async e=>{const n=e&&await e.getIdTokenResult(),s=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(s&&s>H6)return;const a=n==null?void 0:n.token;Ck!==a&&(Ck=a,await fetch(t,{method:a?"POST":"DELETE",headers:a?{Authorization:`Bearer ${a}`}:{}}))};function Y6(t=ml()){const e=ur(t,"auth");if(e.isInitialized())return e.getImmediate();const n=uO(t,{popupRedirectResolver:z6,persistence:[JO,VO,qN]}),s=uN("authTokenSyncURL");if(s&&typeof isSecureContext=="boolean"&&isSecureContext){const c=new URL(s,location.origin);if(location.origin===c.origin){const u=G6(c.toString());OO(n,u,()=>u(n.currentUser)),DO(n,h=>u(h))}}const a=lN("auth");return a&&hO(n,`http://${a}`),n}function W6(){var t;return((t=document.getElementsByTagName("head"))==null?void 0:t[0])??document}nO({loadJS(t){return new Promise((e,n)=>{const s=document.createElement("script");s.setAttribute("src",t),s.onload=e,s.onerror=a=>{const c=Sr("internal-error");c.customData=a,n(c)},s.type="text/javascript",s.charset="UTF-8",W6().appendChild(s)})},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="});$6("Browser");const ZN="@firebase/installations",$v="0.6.19";/**
2115 * @license
2116 * Copyright 2019 Google LLC
2117 *
2118 * Licensed under the Apache License, Version 2.0 (the "License");
2119 * you may not use this file except in compliance with the License.
2120 * You may obtain a copy of the License at
2121 *
2122 *   http://www.apache.org/licenses/LICENSE-2.0
2123 *
2124 * Unless required by applicable law or agreed to in writing, software
2125 * distributed under the License is distributed on an "AS IS" BASIS,
2126 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2127 * See the License for the specific language governing permissions and
2128 * limitations under the License.
2129 */const ej=1e4,tj=`w:${$v}`,nj="FIS_v2",X6="https://firebaseinstallations.googleapis.com/v1",Q6=3600*1e3,J6="installations",Z6="Installations";/**
2130 * @license
2131 * Copyright 2019 Google LLC
2132 *
2133 * Licensed under the Apache License, Version 2.0 (the "License");
2134 * you may not use this file except in compliance with the License.
2135 * You may obtain a copy of the License at
2136 *
2137 *   http://www.apache.org/licenses/LICENSE-2.0
2138 *
2139 * Unless required by applicable law or agreed to in writing, software
2140 * distributed under the License is distributed on an "AS IS" BASIS,
2141 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2142 * See the License for the specific language governing permissions and
2143 * limitations under the License.
2144 */const eL={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."},al=new fi(J6,Z6,eL);function sj(t){return t instanceof ds&&t.code.includes("request-failed")}/**
2145 * @license
2146 * Copyright 2019 Google LLC
2147 *
2148 * Licensed under the Apache License, Version 2.0 (the "License");
2149 * you may not use this file except in compliance with the License.
2150 * You may obtain a copy of the License at
2151 *
2152 *   http://www.apache.org/licenses/LICENSE-2.0
2153 *
2154 * Unless required by applicable law or agreed to in writing, software
2155 * distributed under the License is distributed on an "AS IS" BASIS,
2156 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2157 * See the License for the specific language governing permissions and
2158 * limitations under the License.
2159 */function rj({projectId:t}){return`${X6}/projects/${t}/installations`}
2159function ij(t){return{token:t.token,requestStatus:2,expiresIn:nL(t.expiresIn),creationTime:Date.now()}}async function aj(t,e){const s=(await e.json()).error;return al.create("request-failed",{requestName:t,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function oj({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function tL(t,{refreshToken:e}){const n=oj(t);return n.append("Authorization",sL(e)),n}async function lj(t){const e=await t();return e.status>=500&&e.status<600?t():e}function nL(t){return Number(t.replace("s","000"))}function sL(t){return`${nj} ${t}`}/**
2160 * @license
2161 * Copyright 2019 Google LLC
2162 *
2163 * Licensed under the Apache License, Version 2.0 (the "License");
2164 * you may not use this file except in compliance with the License.
2165 * You may obtain a copy of the License at
2166 *
2167 *   http://www.apache.org/licenses/LICENSE-2.0
2168 *
2169 * Unless required by applicable law or agreed to in writing, software
2170 * distributed under the License is distributed on an "AS IS" BASIS,
2171 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2172 * See the License for the specific language governing permissions and
2173 * limitations under the License.
2174 */async function rL({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const s=rj(t),a=oj(t),c=e.getImmediate({optional:!0});if(c){const p=await c.getHeartbeatsHeader();p&&a.append("x-firebase-client",p)}const u={fid:n,authVersion:nj,appId:t.appId,sdkVersion:tj},h={method:"POST",headers:a,body:JSON.stringify(u)},m=await lj(()=>fetch(s,h));if(m.ok){const p=await m.json();return{fid:p.fid||n,registrationStatus:2,refreshToken:p.refreshToken,authToken:ij(p.authToken)}}else throw await aj("Create Installation",m)}/**
2175 * @license
2176 * Copyright 2019 Google LLC
2177 *
2178 * Licensed under the Apache License, Version 2.0 (the "License");
2179 * you may not use this file except in compliance with the License.
2180 * You may obtain a copy of the License at
2181 *
2182 *   http://www.apache.org/licenses/LICENSE-2.0
2183 *
2184 * Unless required by applicable law or agreed to in writing, software
2185 * distributed under the License is distributed on an "AS IS" BASIS,
2186 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2187 * See the License for the specific language governing permissions and
2188 * limitations under the License.
2189 */function cj(t){return new Promise(e=>{setTimeout(e,t)})}/**
2190 * @license
2191 * Copyright 2019 Google LLC
2192 *
2193 * Licensed under the Apache License, Version 2.0 (the "License");
2194 * you may not use this file except in compliance with the License.
2195 * You may obtain a copy of the License at
2196 *
2197 *   http://www.apache.org/licenses/LICENSE-2.0
2198 *
2199 * Unless required by applicable law or agreed to in writing, software
2200 * distributed under the License is distributed on an "AS IS" BASIS,
2201 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2202 * See the License for the specific language governing permissions and
2203 * limitations under the License.
2204 */function iL(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")}/**
2205 * @license
2206 * Copyright 2019 Google LLC
2207 *
2208 * Licensed under the Apache License, Version 2.0 (the "License");
2209 * you may not use this file except in compliance with the License.
2210 * You may obtain a copy of the License at
2211 *
2212 *   http://www.apache.org/licenses/LICENSE-2.0
2213 *
2214 * Unless required by applicable law or agreed to in writing, software
2215 * distributed under the License is distributed on an "AS IS" BASIS,
2216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2217 * See the License for the specific language governing permissions and
2218 * limitations under the License.
2219 */const aL=/^[cdef][\w-]{21}$/,Ox="";function oL(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const n=lL(t);return aL.test(n)?n:Ox}catch{return Ox}}function lL(t){return iL(t).substr(0,22)}/**
2220 * @license
2221 * Copyright 2019 Google LLC
2222 *
2223 * Licensed under the Apache License, Version 2.0 (the "License");
2224 * you may not use this file except in compliance with the License.
2225 * You may obtain a copy of the License at
2226 *
2227 *   http://www.apache.org/licenses/LICENSE-2.0
2228 *
2229 * Unless required by applicable law or agreed to in writing, softw
2229are
2230 * distributed under the License is distributed on an "AS IS" BASIS,
2231 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2232 * See the License for the specific language governing permissions and
2233 * limitations under the License.
2234 */function Dp(t){return`${t.appName}!${t.appId}`}/**
2235 * @license
2236 * Copyright 2019 Google LLC
2237 *
2238 * Licensed under the Apache License, Version 2.0 (the "License");
2239 * you may not use this file except in compliance with the License.
2240 * You may obtain a copy of the License at
2241 *
2242 *   http://www.apache.org/licenses/LICENSE-2.0
2243 *
2244 * Unless required by applicable law or agreed to in writing, software
2245 * distributed under the License is distributed on an "AS IS" BASIS,
2246 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2247 * See the License for the specific language governing permissions and
2248 * limitations under the License.
2249 */const uj=new Map;function dj(t,e){const n=Dp(t);hj(n,e),cL(n,e)}function hj(t,e){const n=uj.get(t);if(n)for(const s of n)s(e)}function cL(t,e){const n=uL();n&&n.postMessage({key:t,fid:e}),dL()}let Go=null;function uL(){return!Go&&"BroadcastChannel"in self&&(Go=new BroadcastChannel("[Firebase] FID Change"),Go.onmessage=t=>{hj(t.data.key,t.data.fid)}),Go}function dL(){uj.size===0&&Go&&(Go.close(),Go=null)}/**
2250 * @license
2251 * Copyright 2019 Google LLC
2252 *
2253 * Licensed under the Apache License, Version 2.0 (the "License");
2254 * you may not use this file except in compliance with the License.
2255 * You may obtain a copy of the License at
2256 *
2257 *   http://www.apache.org/licenses/LICENSE-2.0
2258 *
2259 * Unless required by applicable law or agreed to in writing, software
2260 * distributed under the License is distributed on an "AS IS" BASIS,
2261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2262 * See the License for the specific language governing permissions and
2263 * limitations under the License.
2264 */const hL="firebase-installations-database",fL=1,ol="firebase-installations-store";let Nb=null;function qv(){return Nb||(Nb=Rp(hL,fL,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(ol)}}})),Nb}async function Wm(t,e){const n=Dp(t),a=(await qv()).transaction(ol,"readwrite"),c=a.objectStore(ol),u=await c.get(n);return await c.put(e,n),await a.done,(!u||u.fid!==e.fid)&&dj(t,e.fid),e}async function fj(t){const e=Dp(t),s=(await qv()).transaction(ol,"readwrite");await s.objectStore(ol).delete(e),await s.done}async function Op(t,e){const n=Dp(t),a=(await qv()).transaction(ol,"readwrite"),c=a.objectStore(ol),u=await c.get(n),h=e(u);return h===void 0?await c.delete(n):await c.put(h,n),await a.done,h&&(!u||u.fid!==h.fid)&&dj(t,h.fid),h}/**
2265 * @license
2266 * Copyright 2019 Google LLC
2267 *
2268 * Licensed under the Apache License, Version 2.0 (the "License");
2269 * you may not use this file except in compliance with the License.
2270 * You may obtain a copy of the License at
2271 *
2272 *   http://www.apache.org/licenses/LICENSE-2.0
2273 *
2274 * Unless required by applicable law or agreed to in writing, software
2275 * distributed under the License is distributed on an "AS IS" BASIS,
2276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2277 * See the License for the specific language governing permissions and
2278 * limitations under the License.
2279 */async function Hv(t){let e;const n=await Op(t.appConfig,s=>{const a=mL(s),c=pL(t,a);return e=c.registrationPromise,c.installationEntry});return n.fid===Ox?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}function mL(t){const e=t||{fid:oL(),registrationStatus:0};return mj(e)}function pL(t,e){if(e.registrationStatus===0){if(!navigator.onLine){const a=Promise.reject(al.create("app-offline"));return{installationEntry:e,registrationPromise:a}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()}
2279,s=gL(t,n);return{installationEntry:n,registrationPromise:s}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:yL(t)}:{installationEntry:e}}async function gL(t,e){try{const n=await rL(t,e);return Wm(t.appConfig,n)}catch(n){throw sj(n)&&n.customData.serverCode===409?await fj(t.appConfig):await Wm(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}async function yL(t){let e=await Rk(t.appConfig);for(;e.registrationStatus===1;)await cj(100),e=await Rk(t.appConfig);if(e.registrationStatus===0){const{installationEntry:n,registrationPromise:s}=await Hv(t);return s||n}return e}function Rk(t){return Op(t,e=>{if(!e)throw al.create("installation-not-found");return mj(e)})}function mj(t){return bL(t)?{fid:t.fid,registrationStatus:0}:t}function bL(t){return t.registrationStatus===1&&t.registrationTime+ej<Date.now()}/**
2280 * @license
2281 * Copyright 2019 Google LLC
2282 *
2283 * Licensed under the Apache License, Version 2.0 (the "License");
2284 * you may not use this file except in compliance with the License.
2285 * You may obtain a copy of the License at
2286 *
2287 *   http://www.apache.org/licenses/LICENSE-2.0
2288 *
2289 * Unless required by applicable law or agreed to in writing, software
2290 * distributed under the License is distributed on an "AS IS" BASIS,
2291 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2292 * See the License for the specific language governing permissions and
2293 * limitations under the License.
2294 */async function xL({appConfig:t,heartbeatServiceProvider:e},n){const s=vL(t,n),a=tL(t,n),c=e.getImmediate({optional:!0});if(c){const p=await c.getHeartbeatsHeader();p&&a.append("x-firebase-client",p)}const u={installation:{sdkVersion:tj,appId:t.appId}},h={method:"POST",headers:a,body:JSON.stringify(u)},m=await lj(()=>fetch(s,h));if(m.ok){const p=await m.json();return ij(p)}else throw await aj("Generate Auth Token",m)}function vL(t,{fid:e}){return`${rj(t)}/${e}/authTokens:generate`}/**
2295 * @license
2296 * Copyright 2019 Google LLC
2297 *
2298 * Licensed under the Apache License, Version 2.0 (the "License");
2299 * you may not use this file except in compliance with the License.
2300 * You may obtain a copy of the License at
2301 *
2302 *   http://www.apache.org/licenses/LICENSE-2.0
2303 *
2304 * Unless required by applicable law or agreed to in writing, software
2305 * distributed under the License is distributed on an "AS IS" BASIS,
2306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2307 * See the License for the specific language governing permissions and
2308 * limitations under the License.
2309 */async function Gv(t,e=!1){let n;const s=await Op(t.appConfig,c=>{if(!pj(c))throw al.create("not-registered");const u=c.authToken;if(!e&&EL(u))return c;if(u.requestStatus===1)return n=_L(t,e),c;{if(!navigator.onLine)throw al.create("app-offline");const h=TL(c);return n=wL(t,h),h}});return n?await n:s.authToken}async function _L(t,e){let n=await Ik(t.appConfig);for(;n.authToken.requestStatus===1;)await cj(100),n=await Ik(t.appConfig);const s=n.authToken;return s.requestStatus===0?Gv(t,e):s}function Ik(t){return Op(t,e=>{if(!pj(e))throw al.create("not-registered");const n=e.authToken;return SL(n)?{...e,authToken:{requestStatus:0}}:e})}async function wL(t,e){try{const n=await xL(t,e),s={...e,authToken:n};return await Wm(t.appConfig,s),n}catch(n){if(sj(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await fj(t.appConfig);else{const s={...e,authToken:{requestStatus:0}};await Wm(t.appConfig,s)}throw n}}function pj(t){return t!==void 0&&t.registrationStatus===2}function EL(t){return t.requestStatus===2&&!kL(t)}function kL(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+Q6}function TL(t){const e={requestStatus:1,requestTime:Date.now()};return{...t,authToken:e}}function SL(t){return t.requestStatus===1&&t.requestTime+ej<Date.now()}/**
2310 * @license
2311 * Copyright 2019 Google LLC
2312 *
2313 * Licensed under the Apache License, Version 2.0 (the "License");
2314 * you may not use this file except in compliance with the License.
2315 * You may obtain a copy of the License at
2316 *
2317 *   http://www.apache.org/licenses/LICENSE-2.0
2318 *
2319 * Unless required by applicable law or agreed to in writing, softw
2319are
2320 * distributed under the License is distributed on an "AS IS" BASIS,
2321 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2322 * See the License for the specific language governing permissions and
2323 * limitations under the License.
2324 */async function NL(t){const e=t,{installationEntry:n,registrationPromise:s}=await Hv(e);return s?s.catch(console.error):Gv(e).catch(console.error),n.fid}/**
2325 * @license
2326 * Copyright 2019 Google LLC
2327 *
2328 * Licensed under the Apache License, Version 2.0 (the "License");
2329 * you may not use this file except in compliance with the License.
2330 * You may obtain a copy of the License at
2331 *
2332 *   http://www.apache.org/licenses/LICENSE-2.0
2333 *
2334 * Unless required by applicable law or agreed to in writing, software
2335 * distributed under the License is distributed on an "AS IS" BASIS,
2336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2337 * See the License for the specific language governing permissions and
2338 * limitations under the License.
2339 */async function jL(t,e=!1){const n=t;return await AL(n),(await Gv(n,e)).token}async function AL(t){const{registrationPromise:e}=await Hv(t);e&&await e}/**
2340 * @license
2341 * Copyright 2019 Google LLC
2342 *
2343 * Licensed under the Apache License, Version 2.0 (the "License");
2344 * you may not use this file except in compliance with the License.
2345 * You may obtain a copy of the License at
2346 *
2347 *   http://www.apache.org/licenses/LICENSE-2.0
2348 *
2349 * Unless required by applicable law or agreed to in writing, software
2350 * distributed under the License is distributed on an "AS IS" BASIS,
2351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2352 * See the License for the specific language governing permissions and
2353 * limitations under the License.
2354 */function CL(t){if(!t||!t.options)throw jb("App Configuration");if(!t.name)throw jb("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw jb(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}function jb(t){return al.create("missing-app-config-values",{valueName:t})}/**
2355 * @license
2356 * Copyright 2020 Google LLC
2357 *
2358 * Licensed under the Apache License, Version 2.0 (the "License");
2359 * you may not use this file except in compliance with the License.
2360 * You may obtain a copy of the License at
2361 *
2362 *   http://www.apache.org/licenses/LICENSE-2.0
2363 *
2364 * Unless required by applicable law or agreed to in writing, software
2365 * distributed under the License is distributed on an "AS IS" BASIS,
2366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2367 * See the License for the specific language governing permissions and
2368 * limitations under the License.
2369 */const gj="installations",RL="installations-internal",IL=t=>{const e=t.getProvider("app").getImmediate(),n=CL(e),s=ur(e,"heartbeat");return{app:e,appConfig:n,heartbeatServiceProvider:s,_delete:()=>Promise.resolve()}},ML=t=>{const e=t.getProvider("app").getImmediate(),n=ur(e,gj).getImmediate();return{getId:()=>NL(n),getToken:a=>jL(n,a)}};function PL(){Yn(new Un(gj,IL,"PUBLIC")),Yn(new Un(RL,ML,"PRIVATE"))}PL();mn(ZN,$v);mn(ZN,$v,"esm2020");/**
2370 * @license
2371 * Copyright 2019 Google LLC
2372 *
2373 * Licensed under the Apache License, Version 2.0 (the "License");
2374 * you may not use this file except in compliance with the License.
2375 * You may obtain a copy of the License at
2376 *
2377 *   http://www.apache.org/licenses/LICENSE-2.0
2378 *
2379 * Unless required by applicable law or agreed to in writing, software
2380 * distributed under the License is distributed on an "AS IS" BASIS,
2381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2382 * See the License for the specific language governing permissions and
2383 * limitations under the License.
2384 */const Xm="analytics",DL="firebase_id",OL="origin",LL=60*1e3,UL="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",Yv="https://www.googletagmanager.com/gtag/js";/**
2385 * @license
2386 * Copyright 2019 Google LLC
2387 *
2388 * Licensed under the Apache License, Version 2.0 (the "License");
2389 * you may not use this file except in compliance with the License.
2390 * You may obtain a copy of the License at
2391 *
2392 *   http://www.apache.org/licenses/LICENSE-2.0
2393 *
2394 * Unless required by applicable law or agreed to in writing, softw
2394are
2395 * distributed under the License is distributed on an "AS IS" BASIS,
2396 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2397 * See the License for the specific language governing permissions and
2398 * limitations under the License.
2399 */const cs=new su("@firebase/analytics");/**
2400 * @license
2401 * Copyright 2019 Google LLC
2402 *
2403 * Licensed under the Apache License, Version 2.0 (the "License");
2404 * you may not use this file except in compliance with the License.
2405 * You may obtain a copy of the License at
2406 *
2407 *   http://www.apache.org/licenses/LICENSE-2.0
2408 *
2409 * Unless required by applicable law or agreed to in writing, software
2410 * distributed under the License is distributed on an "AS IS" BASIS,
2411 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2412 * See the License for the specific language governing permissions and
2413 * limitations under the License.
2414 */const FL={"already-exists":"A Firebase Analytics instance with the appId {$id}  already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized instance.","already-initialized-settings":"Firebase Analytics has already been initialized.settings() must be called before initializing any Analytics instanceor it will have no effect.","interop-component-reg-failed":"Firebase Analytics Interop Component failed to instantiate: {$reason}","invalid-analytics-context":"Firebase Analytics is not supported in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","indexeddb-unavailable":"IndexedDB unavailable or restricted in this environment. Wrap initialization of analytics in analytics.isSupported() to prevent initialization in unsupported environments. Details: {$errorInfo}","fetch-throttle":"The config fetch request timed out while in an exponential backoff state. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.","config-fetch-failed":"Dynamic config fetch failed: [{$httpStatus}] {$responseMessage}","no-api-key":'The "apiKey" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid API key.',"no-app-id":'The "appId" field is empty in the local Firebase config. Firebase Analytics requires this field tocontain a valid app ID.',"no-client-id":'The "client_id" field is empty.',"invalid-gtag-resource":"Trusted Types detected an invalid gtag resource: {$gtagURL}."},Fs=new fi("analytics","Analytics",FL);/**
2415 * @license
2416 * Copyright 2019 Google LLC
2417 *
2418 * Licensed under the Apache License, Version 2.0 (the "License");
2419 * you may not use this file except in compliance with the License.
2420 * You may obtain a copy of the License at
2421 *
2422 *   http://www.apache.org/licenses/LICENSE-2.0
2423 *
2424 * Unless required by applicable law or agreed to in writing, software
2425 * distributed under the License is distributed on an "AS IS" BASIS,
2426 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2427 * See the License for the specific language governing permissions and
2428 * limitations under the License.
2429 */function VL(t){if(!t.startsWith(Yv)){const e=Fs.create("invalid-gtag-resource",{gtagURL:t});return cs.warn(e.message),""}return t}function yj(t){return Promise.all(t.map(e=>e.catch(n=>n)))}function zL(t,e){let n;return window.trustedTypes&&(n=window.trustedTypes.createPolicy(t,e)),n}function BL(t,e){const n=zL("firebase-js-sdk-policy",{createScriptURL:VL}),s=document.createElement("script"),a=`${Yv}?l=${t}&id=${e}`;s.src=n?n==null?void 0:n.createScriptURL(a):a,s.async=!0,document.head.appendChild(s)}function KL(t){let e=[];return Array.isArray(window[t])?e=window[t]:window[t]=e,e}async function $L(t,e,n,s,a,c){const u=s[a];try{if(u)await e[u];else{const m=(await yj(n)).find(p=>p.measurementId===a);m&&await e[m.appId]}}catch(h){cs.error(h)}t("config",a,c)}async function qL(t,e,n,s,a){try{let c=[];if(a&&a.send_to){let u=a.send_to;Array.isArray(u)||(u=[u]);const h=await yj(n);for(const m of u){const p=h.find(x=>x.measurementId===m),b=p&&e[p.appId];if(b)c.push(b);else{c=[];break}}}c.length===0&&(c=Object.values(e)),await Promise.all(c),t("event",s,a||{})}catch(c){cs.error(c)}}function HL(t,e,n,s){async function a(c,...u){try{if(c==="event"){const[h,m]=u;await qL(t,e,n,h,m)}else if(c==="config"){const[h,m]=u;await $L(t,e,n,s,h,m)}else if(c==="consent"){const[h,m]=u;
2429t("consent",h,m)}else if(c==="get"){const[h,m,p]=u;t("get",h,m,p)}else if(c==="set"){const[h]=u;t("set",h)}else t(c,...u)}catch(h){cs.error(h)}}return a}function GL(t,e,n,s,a){let c=function(...u){window[s].push(arguments)};return window[a]&&typeof window[a]=="function"&&(c=window[a]),window[a]=HL(c,t,e,n),{gtagCore:c,wrappedGtag:window[a]}}function YL(t){const e=window.document.getElementsByTagName("script");for(const n of Object.values(e))if(n.src&&n.src.includes(Yv)&&n.src.includes(t))return n;return null}/**
2430 * @license
2431 * Copyright 2020 Google LLC
2432 *
2433 * Licensed under the Apache License, Version 2.0 (the "License");
2434 * you may not use this file except in compliance with the License.
2435 * You may obtain a copy of the License at
2436 *
2437 *   http://www.apache.org/licenses/LICENSE-2.0
2438 *
2439 * Unless required by applicable law or agreed to in writing, software
2440 * distributed under the License is distributed on an "AS IS" BASIS,
2441 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2442 * See the License for the specific language governing permissions and
2443 * limitations under the License.
2444 */const WL=30,XL=1e3;class QL{constructor(e={},n=XL){this.throttleMetadata=e,this.intervalMillis=n}getThrottleMetadata(e){return this.throttleMetadata[e]}setThrottleMetadata(e,n){this.throttleMetadata[e]=n}deleteThrottleMetadata(e){delete this.throttleMetadata[e]}}const bj=new QL;function JL(t){return new Headers({Accept:"application/json","x-goog-api-key":t})}async function ZL(t){var u;const{appId:e,apiKey:n}=t,s={method:"GET",headers:JL(n)},a=UL.replace("{app-id}",e),c=await fetch(a,s);if(c.status!==200&&c.status!==304){let h="";try{const m=await c.json();(u=m.error)!=null&&u.message&&(h=m.error.message)}catch{}throw Fs.create("config-fetch-failed",{httpStatus:c.status,responseMessage:h})}return c.json()}async function eU(t,e=bj,n){const{appId:s,apiKey:a,measurementId:c}=t.options;if(!s)throw Fs.create("no-app-id");if(!a){if(c)return{measurementId:c,appId:s};throw Fs.create("no-api-key")}const u=e.getThrottleMetadata(s)||{backoffCount:0,throttleEndTimeMillis:Date.now()},h=new sU;return setTimeout(async()=>{h.abort()},LL),xj({appId:s,apiKey:a,measurementId:c},u,h,e)}async function xj(t,{throttleEndTimeMillis:e,backoffCount:n},s,a=bj){var h;const{appId:c,measurementId:u}=t;try{await tU(s,e)}catch(m){if(u)return cs.warn(`Timed out fetching this Firebase app's measurement ID from the server. Falling back to the measurement ID ${u} provided in the "measurementId" field in the local Firebase config. [${m==null?void 0:m.message}]`),{appId:c,measurementId:u};throw m}try{const m=await ZL(t);return a.deleteThrottleMetadata(c),m}catch(m){const p=m;if(!nU(p)){if(a.deleteThrottleMetadata(c),u)return cs.warn(`Failed to fetch this Firebase app's measurement ID from the server. Falling back to the measurement ID ${u} provided in the "measurementId" field in the local Firebase config. [${p==null?void 0:p.message}]`),{appId:c,measurementId:u};throw m}const b=Number((h=p==null?void 0:p.customData)==null?void 0:h.httpStatus)===503?qd(n,a.intervalMillis,WL):qd(n,a.intervalMillis),x={throttleEndTimeMillis:Date.now()+b,backoffCount:n+1};return a.setThrottleMetadata(c,x),cs.debug(`Calling attemptFetch again in ${b} millis`),xj(t,x,s,a)}}function tU(t,e){return new Promise((n,s)=>{const a=Math.max(e-Date.now(),0),c=setTimeout(n,a);t.addEventListener(()=>{clearTimeout(c),s(Fs.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}function nU(t){if(!(t instanceof ds)||!t.customData)return!1;const e=Number(t.customData.httpStatus);return e===429||e===500||e===503||e===504}class sU{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}async function rU(t,e,n,s,a){if(a&&a.global){t("event",n,s);return}else{const c=await e,u={...s,send_to:c};t("event",n,u)}}async function iU(t,e,n,s){if(s&&s.global){const a={};for(const c of Object.keys(n))a[`user_properties.${c}`]=n[c];return t("set",a),Promise.resolve()}else{const a=await e;t("config",a,{update:!0,user_properties:n})}}/**
2445 * @license
2446 * Copyright 2020 Google LLC
2447 *
2448 * Licensed under the Apache License, Version 2.0 (the "License");
2449 * you may not use this file except in compliance with the License.
2450 * You may obtain a copy of the License at
2451 *
2452 *   http://www.apache.org/licenses/LICENSE-2.0
2453 *
2454 * Unless required by applicable law or agreed to in writing, software
2455 * distributed under the License is distributed on an "AS IS" BASIS,
2456 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2457 * See the License for the specific language governing permissions and
2458 * limitations under the License.
2459 */async function aU(){if(fh())try{await fN()}catch(t){return cs.warn(Fs.create("indexeddb-unavailable",{errorInfo:t==null?void 0:t.toString()}).message),!1}else return cs.warn(Fs.create("indexeddb-unavailable",{errorInfo:"IndexedDB is not available in this environment."}).message),!1;return!0}async function oU(t,e,n,s,a,c,u){const h=eU(t);h.then(w=>{n[w.measurementId]=w.appId,t.options.measurementId&&w.measurementId!==t.options.measurementId&&cs.warn(`The measurement ID in the local Firebase config (${t.options.measurementId}) does not match the measurement ID fetched from the server (${w.measurementId}). To ensure analytics events are always sent to the correct Analytics property, update the measurement ID field in the local config or remove it from the local config.`)}).catch(w=>cs.error(w)),e.push(h);const m=aU().then(w=>{if(w)return s.getId()}),[p,b]=await Promise.all([h,m]);YL(c)||BL(c,p.measurementId),a("js",new Date);const x=(u==null?void 0:u.config)??{};return x[OL]="firebase",x.update=!0,b!=null&&(x[DL]=b),a("config",p.measurementId,x),p.measurementId}/**
2460 * @license
2461 * Copyright 2019 Google LLC
2462 *
2463 * Licensed under the Apache License, Version 2.0 (the "License");
2464 * you may not use this file except in compliance with the License.
2465 * You may obtain a copy of the License at
2466 *
2467 *   http://www.apache.org/licenses/LICENSE-2.0
2468 *
2469 * Unless required by applicable law or agreed to in writing, software
2470 * distributed under the License is distributed on an "AS IS" BASIS,
2471 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2472 * See the License for the specific language governing permissions and
2473 * limitations under the License.
2474 */class lU{constructor(e){this.app=e}_delete(){return delete Pc[this.app.options.appId],Promise.resolve()}}let Pc={},Mk=[];const Pk={};let Ab="dataLayer",cU="gtag",Dk,Wv,Ok=!1;function uU(){const t=[];if(hN()&&t.push("This is a browser extension environment."),oP()||t.push("Cookies are not available."),t.length>0){const e=t.map((s,a)=>`(${a+1}) ${s}`).join(" "),n=Fs.create("invalid-analytics-context",{errorInfo:e});cs.warn(n.message)}}function dU(t,e,n){uU();const s=t.options.appId;if(!s)throw Fs.create("no-app-id");if(!t.options.apiKey)if(t.options.measurementId)cs.warn(`The "apiKey" field is empty in the local Firebase config. This is needed to fetch the latest measurement ID for this Firebase app. Falling back to the measurement ID ${t.options.measurementId} provided in the "measurementId" field in the local Firebase config.`);else throw Fs.create("no-api-key");if(Pc[s]!=null)throw Fs.create("already-exists",{id:s});if(!Ok){KL(Ab);const{wrappedGtag:c,gtagCore:u}=GL(Pc,Mk,Pk,Ab,cU);Wv=c,Dk=u,Ok=!0}return Pc[s]=oU(t,Mk,Pk,e,Dk,Ab,n),new lU(t)}function hU(t=ml()){t=st(t);const e=ur(t,Xm);return e.isInitialized()?e.getImmediate():fU(t)}function fU(t,e={}){const n=ur(t,Xm);if(n.isInitialized()){const a=n.getImmediate();if(Qi(e,n.getOptions()))return a;throw Fs.create("already-initialized")}return n.initialize({options:e})}function mU(t,e,n){t=st(t),iU(Wv,Pc[t.app.options.appId],e,n).catch(s=>cs.error(s))}function pU(t,e,n,s){t=st(t),rU(Wv,Pc[t.app.options.appId],e,n,s).catch(a=>cs.error(a))}const Lk="@firebase/analytics",Uk="0.10.19";function gU(){Yn(new Un(Xm,(e,{options:n})=>{const s=e.getProvider("app").getImmediate(),a=e.getProvider("installations-internal").getImmediate();return dU(s,a,n)},"PUBLIC")),Yn(new Un("analytics-internal",t,"PRIVATE")),mn(Lk,Uk),mn(Lk,Uk,"esm2020");function t(e){try{const n=e.getProvider(Xm).getImmediate();return{logEvent:(s,a,c)=>pU(n,s,a,c),setUserProperties:(s,a)=>mU(n,s,a)}}catch(n){throw Fs.create("interop-component-reg-failed",{reason:n})}}}gU();var Fk=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
2475Copyright The Closure Library Authors.
2476SPDX-License-Identifier: Apache-2.0
2477*/var Qa,vj;(function(){var t;/** @license
2478
2479 Copyright The Closure Library Authors.
2480 SPDX-License-Identifier: Apache-2.0
2481*/function e(I,S){function C(){}C.prototype=S.prototype,I.F=S.prototype,I.prototype=new C,I.prototype.constructor=I,I.D=function(R,D,z){for(var P=Array(arguments.length-2),ie=2;ie<arguments.length;ie++)P[ie-2]=arguments[ie];return S.prototype[D].apply(R,P)}}function n(){this.blockSize=-1}function s(){this.blockSize=-1,this.blockSize=64,this.g=Array(4),this.C=Array(this.blockSize),this.o=this.h=0,this.u()}e(s,n),s.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 a(I,S,C){C||(C=0);const R=Array(16);if(typeof S=="string")for(var D=0;D<16;
vendor: 5,052 bytes, line 2481
2481++D)R[D]=S.charCodeAt(C++)|S.charCodeAt(C++)<<8|S.charCodeAt(C++)<<16|S.charCodeAt(C++)<<24;else for(D=0;D<16;++D)R[D]=S[C++]|S[C++]<<8|S[C++]<<16|S[C++]<<24;S=I.g[0],C=I.g[1],D=I.g[2];let z=I.g[3],P;P=S+(z^C&(D^z))+R[0]+3614090360&4294967295,S=C+(P<<7&4294967295|P>>>25),P=z+(D^S&(C^D))+R[1]+3905402710&4294967295,z=S+(P<<12&4294967295|P>>>20),P=D+(C^z&(S^C))+R[2]+606105819&4294967295,D=z+(P<<17&4294967295|P>>>15),P=C+(S^D&(z^S))+R[3]+3250441966&4294967295,C=D+(P<<22&4294967295|P>>>10),P=S+(z^C&(D^z))+R[4]+4118548399&4294967295,S=C+(P<<7&4294967295|P>>>25),P=z+(D^S&(C^D))+R[5]+1200080426&4294967295,z=S+(P<<12&4294967295|P>>>20),P=D+(C^z&(S^C))+R[6]+2821735955&4294967295,D=z+(P<<17&4294967295|P>>>15),P=C+(S^D&(z^S))+R[7]+4249261313&4294967295,C=D+(P<<22&4294967295|P>>>10),P=S+(z^C&(D^z))+R[8]+1770035416&4294967295,S=C+(P<<7&4294967295|P>>>25),P=z+(D^S&(C^D))+R[9]+2336552879&4294967295,z=S+(P<<12&4294967295|P>>>20),P=D+(C^z&(S^C))+R[10]+4294925233&4294967295,D=z+(P<<17&4294967295|P>>>15),P=C+(S^D&(z^S))+R[11]+2304563134&4294967295,C=D+(P<<22&4294967295|P>>>10),P=S+(z^C&(D^z))+R[12]+1804603682&4294967295,S=C+(P<<7&4294967295|P>>>25),P=z+(D^S&(C^D))+R[13]+4254626195&4294967295,z=S+(P<<12&4294967295|P>>>20),P=D+(C^z&(S^C))+R[14]+2792965006&4294967295,D=z+(P<<17&4294967295|P>>>15),P=C+(S^D&(z^S))+R[15]+1236535329&4294967295,C=D+(P<<22&4294967295|P>>>10),P=S+(D^z&(C^D))+R[1]+4129170786&4294967295,S=C+(P<<5&4294967295|P>>>27),P=z+(C^D&(S^C))+R[6]+3225465664&4294967295,z=S+(P<<9&4294967295|P>>>23),P=D+(S^C&(z^S))+R[11]+643717713&4294967295,D=z+(P<<14&4294967295|P>>>18),P=C+(z^S&(D^z))+R[0]+3921069994&4294967295,C=D+(P<<20&4294967295|P>>>12),P=S+(D^z&(C^D))+R[5]+3593408605&4294967295,S=C+(P<<5&4294967295|P>>>27),P=z+(C^D&(S^C))+R[10]+38016083&4294967295,z=S+(P<<9&4294967295|P>>>23),P=D+(S^C&(z^S))+R[15]+3634488961&4294967295,D=z+(P<<14&4294967295|P>>>18),P=C+(z^S&(D^z))+R[4]+3889429448&4294967295,C=D+(P<<20&4294967295|P>>>12),P=S+(D^z&(C^D))+R[9]+568446438&4294967295,S=C+(P<<5&4294967295|P>>>27),P=z+(C^D&(S^C))+R[14]+3275163606&4294967295,z=S+(P<<9&4294967295|P>>>23),P=D+(S^C&(z^S))+R[3]+4107603335&4294967295,D=z+(P<<14&4294967295|P>>>18),P=C+(z^S&(D^z))+R[8]+1163531501&4294967295,C=D+(P<<20&4294967295|P>>>12),P=S+(D^z&(C^D))+R[13]+2850285829&4294967295,S=C+(P<<5&4294967295|P>>>27),P=z+(C^D&(S^C))+R[2]+4243563512&4294967295,z=S+(P<<9&4294967295|P>>>23),P=D+(S^C&(z^S))+R[7]+1735328473&4294967295,D=z+(P<<14&4294967295|P>>>18),P=C+(z^S&(D^z))+R[12]+2368359562&4294967295,C=D+(P<<20&4294967295|P>>>12),P=S+(C^D^z)+R[5]+4294588738&4294967295,S=C+(P<<4&4294967295|P>>>28),P=z+(S^C^D)+R[8]+2272392833&4294967295,z=S+(P<<11&4294967295|P>>>21),P=D+(z^S^C)+R[11]+1839030562&4294967295,D=z+(P<<16&4294967295|P>>>16),P=C+(D^z^S)+R[14]+4259657740&4294967295,C=D+(P<<23&4294967295|P>>>9),P=S+(C^D^z)+R[1]+2763975236&4294967295,S=C+(P<<4&4294967295|P>>>28),P=z+(S^C^D)+R[4]+1272893353&4294967295,z=S+(P<<11&4294967295|P>>>21),P=D+(z^S^C)+R[7]+4139469664&4294967295,D=z+(P<<16&4294967295|P>>>16),P=C+(D^z^S)+R[10]+3200236656&4294967295,C=D+(P<<23&4294967295|P>>>9),P=S+(C^D^z)+R[13]+681279174&4294967295,S=C+(P<<4&4294967295|P>>>28),P=z+(S^C^D)+R[0]+3936430074&4294967295,z=S+(P<<11&4294967295|P>>>21),P=D+(z^S^C)+R[3]+3572445317&4294967295,D=z+(P<<16&4294967295|P>>>16),P=C+(D^z^S)+R[6]+76029189&4294967295,C=D+(P<<23&4294967295|P>>>9),P=S+(C^D^z)+R[9]+3654602809&4294967295,S=C+(P<<4&4294967295|P>>>28),P=z+(S^C^D)+R[12]+3873151461&4294967295,z=S+(P<<11&4294967295|P>>>21),P=D+(z^S^C)+R[15]+530742520&4294967295,D=z+(P<<16&4294967295|P>>>16),P=C+(D^z^S)+R[2]+3299628645&4294967295,C=D+(P<<23&4294967295|P>>>9),P=S+(D^(C|~z))+R[0]+4096336452&4294967295,S=C+(P<<6&4294967295|P>>>26),P=z+(C^(S|~D))+R[7]+1126891415&4294967295,z=S+(P<<10&4294967295|P>>>22),P=D+(S^(z|~C))+R[14]+2878612391&4294967295,D=z+(P<<15&4294967295|P>>>17),P=C+(z^(D|~S))+R[5]+4237533241&4294967295,C=D+(P<<21&4294967295|P>>>11),P=S+(D^(C|~z))+R[12]+1700485571&4294967295,S=C+(P<<6&4294967295|P>>>26),P=z+(C^(S|~D))+R[3]+2399980690&4294967295,z=S+(P<<10&4294967295|P>>>22),P=D+(S^(z|~C))+R[10]+4293915773&4294967295,D=z+(P<<15&4294967295|P>>>17),P=C+(z^(D|~S))+R[1]+2240044497&4294967295,C=D+(P<<21&4294967295|P>>>11),P=S+(D^(C|~z))+R[8]+1873313359&4294967295,S=C+(P<<6&4294967295|P>>>26),P=z+(C^(S|~D))+R[15]+4264355552&4294967295,z=S+(P<<10&4294967295|P>>>22),P=D+(S^(z|~C))+R[6]+2734768916&4294967295,D=z+(P<<15&4294967295|P>>>17),P=C+(z^(D|~S))+R[13]+1309151649&4294967295,C=D+(P<<21&4294967295|P>>>11),P=S+(D^(C|~z))+R[4]+4149444226&4294967295,S=C+(P<<6&4294967295|P>>>26),P=z+(C^(S|~D))+R[11]+3174756917&4294967295,z=S+(P<<10&4294967295|P>>>22),P=D+(S^(z|~C))+R[2]+718787259&4294967295,D=z+(P<<15&4294967295|P>>>17),P=C+(z^(D|~S))+R[9]+3951481745&4294967295,I.g[0]=I.g[0]+S&4294967295,I.g[1]=I.g[1]+(D+(P<<21&4294967295|P>>>11))&4294967295,I.g[2]=I.g[2]+D&4294967295,I.g[3]=I.g[3]+z&4294967295}s.prototype.v=function(I,S){S===void 0&&(S=I.length);const C=S-this.blockSize,R=this.C;let D=this.h,z=0;for(;z<S;){if(D==0)for(;z<=C;)a(this,I,z),z+=this.blockSize;
2481if(typeof I=="string"){for(;z<S;)if(R[D++]=I.charCodeAt(z++),D==this.blockSize){a(this,R),D=0;break}}else for(;z<S;)if(R[D++]=I[z++],D==this.blockSize){a(this,R),D=0;break}}this.h=D,this.o+=S},s.prototype.A=function(){var I=Array((this.h<56?this.blockSize:this.blockSize*2)-this.h);I[0]=128;for(var S=1;S<I.length-8;++S)I[S]=0;S=this.o*8;for(var C=I.length-8;C<I.length;++C)I[C]=S&255,S/=256;for(this.v(I),I=Array(16),S=0,C=0;C<4;++C)for(let R=0;R<32;R+=8)I[S++]=this.g[C]>>>R&255;return I};function c(I,S){var C=h;return Object.prototype.hasOwnProperty.call(C,I)?C[I]:C[I]=S(I)}function u(I,S){this.h=S;const C=[];let R=!0;for(let D=I.length-1;D>=0;D--){const z=I[D]|0;R&&z==S||(C[D]=z,R=!1)}this.g=C}var h={};function m(I){return-128<=I&&I<128?c(I,function(S){return new u([S|0],S<0?-1:0)}):new u([I|0],I<0?-1:0)}function p(I){if(isNaN(I)||!isFinite(I))return x;if(I<0)return A(p(-I));const S=[];let C=1;for(let R=0;I>=C;R++)S[R]=I/C|0,C*=4294967296;return new u(S,0)}function b(I,S){if(I.length==0)throw Error("number format error: empty string");if(S=S||10,S<2||36<S)throw Error("radix out of range: "+S);if(I.charAt(0)=="-")return A(b(I.substring(1),S));if(I.indexOf("-")>=0)throw Error('number format error: interior "-" character');const C=p(Math.pow(S,8));let R=x;for(let z=0;z<I.length;z+=8){var D=Math.min(8,I.length-z);const P=parseInt(I.substring(z,z+D),S);D<8?(D=p(Math.pow(S,D)),R=R.j(D).add(p(P))):(R=R.j(C),R=R.add(p(P)))}return R}var x=m(0),w=m(1),T=m(16777216);t=u.prototype,t.m=function(){if(j(this))return-A(this).m();let I=0,S=1;for(let C=0;C<this.g.length;C++){const R=this.i(C);I+=(R>=0?R:4294967296+R)*S,S*=4294967296}return I},t.toString=function(I){if(I=I||10,I<2||36<I)throw Error("radix out of range: "+I);if(N(this))return"0";if(j(this))return"-"+A(this).toString(I);const S=p(Math.pow(I,6));var C=this;let R="";for(;;){const D=Y(C,S).g;C=F(C,D.j(S));let z=((C.g.length>0?C.g[0]:C.h)>>>0).toString(I);if(C=D,N(C))return z+R;for(;z.length<6;)z="0"+z;R=z+R}},t.i=function(I){return I<0?0:I<this.g.length?this.g[I]:this.h};function N(I){if(I.h!=0)return!1;for(let S=0;S<I.g.length;S++)if(I.g[S]!=0)return!1;return!0}function j(I){return I.h==-1}t.l=function(I){return I=F(this,I),j(I)?-1:N(I)?0:1};function A(I){const S=I.g.length,C=[];for(let R=0;R<S;R++)C[R]=~I.g[R];return new u(C,~I.h).add(w)}t.abs=function(){return j(this)?A(this):this},t.add=function(I){const S=Math.max(this.g.length,I.g.length),C=[];let R=0;for(let D=0;D<=S;D++){let z=R+(this.i(D)&65535)+(I.i(D)&65535),P=(z>>>16)+(this.i(D)>>>16)+(I.i(D)>>>16);R=P>>>16,z&=65535,P&=65535,C[D]=P<<16|z}return new u(C,C[C.length-1]&-2147483648?-1:0)};function F(I,S){return I.add(A(S))}t.j=function(I){if(N(this)||N(I))return x;if(j(this))return j(I)?A(this).j(A(I)):A(A(this).j(I));if(j(I))return A(this.j(A(I)));if(this.l(T)<0&&I.l(T)<0)return p(this.m()*I.m());const S=this.g.length+I.g.length,C=[];for(var R=0;R<2*S;R++)C[R]=0;for(R=0;R<this.g.length;R++)for(let D=0;D<I.g.length;D++){const z=this.i(R)>>>16,P=this.i(R)&65535,ie=I.i(D)>>>16,_e=I.i(D)&65535;C[2*R+2*D]+=P*_e,V(C,2*R+2*D),C[2*R+2*D+1]+=z*_e,V(C,2*R+2*D+1),C[2*R+2*D+1]+=P*ie,V(C,2*R+2*D+1),C[2*R+2*D+2]+=z*ie,V(C,2*R+2*D+2)}for(I=0;I<S;I++)C[I]=C[2*I+1]<<16|C[2*I];for(I=S;I<2*S;I++)C[I]=0;return new u(C,0)};function V(I,S){for(;(I[S]&65535)!=I[S];)I[S+1]+=I[S]>>>16,I[S]&=65535,S++}function L(I,S){this.g=I,this.h=S}function Y(I,S){if(N(S))throw Error("division by zero");if(N(I))return new L(x,x);if(j(I))return S=Y(A(I),S),new L(A(S.g),A(S.h));if(j(S))return S=Y(I,A(S)),new L(A(S.g),S.h);if(I.g.length>30){if(j(I)||j(S))throw Error("slowDivide_ only works with positive integers.");for(var C=w,R=S;R.l(I)<=0;)C=$(C),R=$(R);var D=q(C,1),z=q(R,1);for(R=q(R,2),C=q(C,2);!N(R);){var P=z.add(R);P.l(I)<=0&&(D=D.add(C),z=P),R=q(R,1),C=q(C,1)}return S=F(I,D.j(S)),new L(D,S)}for(D=x;I.l(S)>=0;
2481){for(C=Math.max(1,Math.floor(I.m()/S.m())),R=Math.ceil(Math.log(C)/Math.LN2),R=R<=48?1:Math.pow(2,R-48),z=p(C),P=z.j(S);j(P)||P.l(I)>0;)C-=R,z=p(C),P=z.j(S);N(z)&&(z=w),D=D.add(z),I=F(I,P)}return new L(D,I)}t.B=function(I){return Y(this,I).h},t.and=function(I){const S=Math.max(this.g.length,I.g.length),C=[];for(let R=0;R<S;R++)C[R]=this.i(R)&I.i(R);return new u(C,this.h&I.h)},t.or=function(I){const S=Math.max(this.g.length,I.g.length),C=[];for(let R=0;R<S;R++)C[R]=this.i(R)|I.i(R);return new u(C,this.h|I.h)},t.xor=function(I){const S=Math.max(this.g.length,I.g.length),C=[];for(let R=0;R<S;R++)C[R]=this.i(R)^I.i(R);return new u(C,this.h^I.h)};function $(I){const S=I.g.length+1,C=[];for(let R=0;R<S;R++)C[R]=I.i(R)<<1|I.i(R-1)>>>31;return new u(C,I.h)}function q(I,S){const C=S>>5;S%=32;const R=I.g.length-C,D=[];for(let z=0;z<R;z++)D[z]=S>0?I.i(z+C)>>>S|I.i(z+C+1)<<32-S:I.i(z+C);return new u(D,I.h)}s.prototype.digest=s.prototype.A,s.prototype.reset=s.prototype.u,s.prototype.update=s.prototype.v,vj=s,u.prototype.add=u.prototype.add,u.prototype.multiply=u.prototype.j,u.prototype.modulo=u.prototype.B,u.prototype.compare=u.prototype.l,u.prototype.toNumber=u.prototype.m,u.prototype.toString=u.prototype.toString,u.prototype.getBits=u.prototype.i,u.fromNumber=p,u.fromString=b,Qa=u}).apply(typeof Fk<"u"?Fk:typeof self<"u"?self:typeof window<"u"?window:{});var sm=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};/** @license
2482Copyright The Closure Library Authors.
2483SPDX-License-Identifier: Apache-2.0
2484*/var _j,Td,wj,Am,Lx,Ej,kj,Tj;(function(){var t,e=Object.defineProperty;function n(f){f=[typeof globalThis=="object"&&globalThis,f,typeof window=="object"&&window,typeof self=="object"&&self,typeof sm=="object"&&sm];for(var _=0;_<f.length;++_){var k=f[_];if(k&&k.Math==Math)return k}throw Error("Cannot find global object")}var s=n(this);function a(f,_){if(_)e:{var k=s;f=f.split(".");for(var U=0;U<f.length-1;U++){var Q=f[U];if(!(Q in k))break e;k=k[Q]}f=f[f.length-1],U=k[f],_=_(U),_!=U&&_!=null&&e(k,f,{configurable:!0,writable:!0,value:_})}}a("Symbol.dispose",function(f){return f||Symbol("Symbol.dispose")}),a("Array.prototype.values",function(f){return f||function(){return this[Symbol.iterator]()}}),a("Object.entries",function(f){return f||function(_){var k=[],U;for(U in _)Object.prototype.hasOwnProperty.call(_,U)&&k.push([U,_[U]]);return k}});/** @license
2485
2486 Copyright The Closure Library Authors.
2487 SPDX-License-Identifier: Apache-2.0
2488*/var c=c||{},u=this||self;function h(f){var _=typeof f;return _=="object"&&f!=null||_=="function"}function m(f,_,k){return f.call.apply(f.bind,arguments)}function p(f,_,k){return p=m,p.apply(null,arguments)}function b(f,_){var k=Array.prototype.slice.call(arguments,1);return function(){var U=k.slice();return U.push.apply(U,arguments),f.apply(this,U)}}function x(f,_){function k(){}k.prototype=_.prototype,f.Z=_.prototype,f.prototype=new k,f.prototype.constructor=f,f.Ob=function(U,Q,le){for(var Te=Array(arguments.length-2),rt=2;rt<arguments.length;rt++)Te[rt-2]=arguments[rt];return _.prototype[Q].apply(U,Te)}}var w=typeof AsyncContext<"u"&&typeof AsyncContext.Snapshot=="function"?f=>f&&AsyncContext.Snapshot.wrap(f):f=>f;function T(f){const _=f.length;if(_>0){const k=Array(_);for(let U=0;U<_;U++)k[U]=f[U];return k}return[]}function N(f,_){for(let U=1;U<arguments.length;U++){const Q=arguments[U];var k=typeof Q;if(k=k!="object"?k:Q?Array.isArray(Q)?"array":k:"null",k=="array"||k=="object"&&typeof Q.length=="number"){k=f.length||0;const le=Q.length||0;f.length=k+le;for(let Te=0;Te<le;Te++)f[k+Te]=Q[Te]}else f.push(Q)}}class j{constructor(_,k){this.i=_,this.j=k,this.h=0,this.g=null}get(){let _;return this.h>0?(this.h--,_=this.g,this.g=_.next,_.next=null):_=this.i(),_}}function A(f){u.setTimeout(()=>{throw f},0)}function F(){var f=I;let _=null;return f.g&&(_=f.g,f.g=f.g.next,f.g||(f.h=null),_.next=null),_}class V{constructor(){this.h=this.g=null}add(_,k){const U=L.get();U.set(_,k),this.h?this.h.next=U:this.g=U,this.h=U}}var L=new j(()=>new Y,f=>f.reset());class Y{constructor(){this.next=this.g=this.h=null}set(_,k){this.h=_,this.g=k,this.next=null}reset(){this.next=this.g=this.h=null}}let $,q=!1,I=new V,S=()=>{const f=Promise.resolve(void 0);$=()=>{f.then(C)}};function C(){for(var f;f=F();){try{f.h.call(f.g)}catch(k){A(k)}var _=L;_.j(f),_.h<100&&(_.h++,f.next=_.g,_.g=f)}q=!1}function R(){this.u=this.u,this.C=this.C}R.prototype.u=!1,R.prototype.dispose=function(){this.u||(this.u=!0,this.N())},R.prototype[Symbol.dispose]=function(){this.dispose()},R.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()};function D(f,_){this.type=f,this.g=this.target=_,this.defaultPrevented=!1}D.prototype.h=function(){this.defaultPrevented=!0};var z=(function(){if(!u.addEventListener||!Object.defineProperty)return!1;var f=!1,_=Object.defineProperty({},"passive",{get:function(){f=!0}});try{const k=()=>{};u.addEventListener("test",k,_),u.removeEventListener("test",k,_)}catch{}return f})();function P(f){return/^[\s\xa0]*$/.test(f)}function ie(f,_){D.call(this,f?f.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,f&&this.init(f,_)}x(ie,D),ie.prototype.init=function(f,_){const k=this.type=f.type,U=f.changedTouches&&f.changedTouches.length?f.changedTouches[0]:null;this.target=f.target||f.srcElement,this.g=_,_=f.relatedTarget,_||(k=="mouseover"?_=f.fromElement:k=="mouseout"&&(_=f.toElement)),this.relatedTarget=_,U?(this.clientX=U.clientX!==void 0?U.clientX:U.pageX,this.clientY=U.clientY!==void 0?U.clientY:U.pageY,this.screenX=U.screenX||0,this.screenY=U.screenY||0):(this.clientX=f.clientX!==void 0?f.clientX:f.pageX,this.clientY=f.clientY!==void 0?f.clientY:f.pageY,this.screenX=f.screenX||0,this.screenY=f.screenY||0),this.button=f.button,this.key=f.key||"",this.ctrlKey=f.ctrlKey,this.altKey=f.altKey,this.shiftKey=f.shiftKey,this.metaKey=f.metaKey,this.pointerId=f.pointerId||0,this.pointerType=f.pointerType,this.state=f.state,this.i=f,f.defaultPrevented&&ie.Z.h.call(this)},ie.prototype.h=function(){ie.Z.h.call(this);const f=this.i;f.preventDefault?f.preventDefault():f.returnValue=!1};var _e="closure_listenable_"+(Math.random()*1e6|0),W=0;function J(f,_,k,U,Q){this.listener=f,this.proxy=null,this.src=_,this.type=k,this.capture=!!U,this.ha=Q,this.key=++W,this.da=this.fa=!1}function fe(f){f.da=!0,f.listener=null,f.proxy=null,f.src=null,f.ha=null}function ce(f,_,k){for(const U in f)_.call(k,f[U],U,f)}function ae(f,_){for(const k in f)_.call(void 0,f[k],k,f)}function O(f){const _={};for(const k in f)_[k]=f[k];return _}const B="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleStr
2488ing toString valueOf".split(" ");function re(f,_){let k,U;for(let Q=1;Q<arguments.length;Q++){U=arguments[Q];for(k in U)f[k]=U[k];for(let le=0;le<B.length;le++)k=B[le],Object.prototype.hasOwnProperty.call(U,k)&&(f[k]=U[k])}}function pe(f){this.src=f,this.g={},this.h=0}pe.prototype.add=function(f,_,k,U,Q){const le=f.toString();f=this.g[le],f||(f=this.g[le]=[],this.h++);const Te=me(f,_,U,Q);return Te>-1?(_=f[Te],k||(_.fa=!1)):(_=new J(_,this.src,le,!!U,Q),_.fa=k,f.push(_)),_};function de(f,_){const k=_.type;if(k in f.g){var U=f.g[k],Q=Array.prototype.indexOf.call(U,_,void 0),le;(le=Q>=0)&&Array.prototype.splice.call(U,Q,1),le&&(fe(_),f.g[k].length==0&&(delete f.g[k],f.h--))}}function me(f,_,k,U){for(let Q=0;Q<f.length;++Q){const le=f[Q];if(!le.da&&le.listener==_&&le.capture==!!k&&le.ha==U)return Q}return-1}var we="closure_lm_"+(Math.random()*1e6|0),Se={};function Re(f,_,k,U,Q){if(Array.isArray(_)){for(let le=0;le<_.length;le++)Re(f,_[le],k,U,Q);return null}return k=se(k),f&&f[_e]?f.J(_,k,h(U)?!!U.capture:!1,Q):Ce(f,_,k,!1,U,Q)}function Ce(f,_,k,U,Q,le){if(!_)throw Error("Invalid event type");const Te=h(Q)?!!Q.capture:!!Q;let rt=H(f);if(rt||(f[we]=rt=new pe(f)),k=rt.add(_,k,U,Te,le),k.proxy)return k;if(U=$e(),k.proxy=U,U.src=f,U.listener=k,f.addEventListener)z||(Q=Te),Q===void 0&&(Q=!1),f.addEventListener(_.toString(),U,Q);else if(f.attachEvent)f.attachEvent(Ke(_.toString()),U);else if(f.addListener&&f.removeListener)f.addListener(U);else throw Error("addEventListener and attachEvent are unavailable.");return k}function $e(){function f(k){return _.call(f.src,f.listener,k)}const _=Ne;return f}function Ue(f,_,k,U,Q){if(Array.isArray(_))for(var le=0;le<_.length;le++)Ue(f,_[le],k,U,Q);else U=h(U)?!!U.capture:!!U,k=se(k),f&&f[_e]?(f=f.i,le=String(_).toString(),le in f.g&&(_=f.g[le],k=me(_,k,U,Q),k>-1&&(fe(_[k]),Array.prototype.splice.call(_,k,1),_.length==0&&(delete f.g[le],f.h--)))):f&&(f=H(f))&&(_=f.g[_.toString()],f=-1,_&&(f=me(_,k,U,Q)),(k=f>-1?_[f]:null)&&Qe(k))}function Qe(f){if(typeof f!="number"&&f&&!f.da){var _=f.src;if(_&&_[_e])de(_.i,f);else{var k=f.type,U=f.proxy;_.removeEventListener?_.removeEventListener(k,U,f.capture):_.detachEvent?_.detachEvent(Ke(k),U):_.addListener&&_.removeListener&&_.removeListener(U),(k=H(_))?(de(k,f),k.h==0&&(k.src=null,_[we]=null)):fe(f)}}}function Ke(f){return f in Se?Se[f]:Se[f]="on"+f}function Ne(f,_){if(f.da)f=!0;else{_=new ie(_,this);const k=f.listener,U=f.ha||f.src;f.fa&&Qe(f),f=k.call(U,_)}return f}function H(f){return f=f[we],f instanceof pe?f:null}var oe="__closure_events_fn_"+(Math.random()*1e9>>>0);function se(f){return typeof f=="function"?f:(f[oe]||(f[oe]=function(_){return f.handleEvent(_)}),f[oe])}function Ee(){R.call(this),this.i=new pe(this),this.M=this,this.G=null}x(Ee,R),Ee.prototype[_e]=!0,Ee.prototype.removeEventListener=function(f,_,k,U){Ue(this,f,_,k,U)};function Me(f,_){var k,U=f.G;if(U)for(k=[];U;U=U.G)k.push(U);if(f=f.M,U=_.type||_,typeof _=="string")_=new D(_,f);else if(_ instanceof D)_.target=_.target||f;else{var Q=_;_=new D(U,f),re(_,Q)}Q=!0;let le,Te;if(k)for(Te=k.length-1;Te>=0;Te--)le=_.g=k[Te],Q=ot(le,U,!0,_)&&Q;if(le=_.g=f,Q=ot(le,U,!0,_)&&Q,Q=ot(le,U,!1,_)&&Q,k)for(Te=0;Te<k.length;Te++)le=_.g=k[Te],Q=ot(le,U,!1,_)&&Q}Ee.prototype.N=function(){if(Ee.Z.N.call(this),this.i){var f=this.i;for(const _ in f.g){const k=f.g[_];for(let U=0;U<k.length;U++)fe(k[U]);delete f.g[_],f.h--}}this.G=null},Ee.prototype.J=function(f,_,k,U){return this.i.add(String(f),_,!1,k,U)},Ee.prototype.K=function(f,_,k,U){return this.i.add(String(f),_,!0,k,U)};function ot(f,_,k,U){if(_=f.i.g[String(_)],!_)return!0;_=_.concat();let Q=!0;for(let le=0;le<_.length;++le){const Te=_[le];if(Te&&!Te.da&&Te.capture==k){const rt=Te.listener,an=Te.ha||Te.src;Te.fa&&de(f.i,Te),Q=rt.call(an,U)!==!1&&Q}}return Q&&!U.defaultPrevented}function sn(f,_){if(typeof f!="function")if(f&&typeof f.handleEvent=="function")f=p(f.handleEvent,f);else throw Error("Invalid listener argument");return Number(_)>2147483647?-1:u.setTimeout(f,_||0)}function pn(f){f.g=sn(()=>{f.g=null,f.i&&(f.i=!1,pn(f))},f.l);const _=f.h;f.h=null,f.m.apply(null,_)}class wt extends R{constructor(_,k){super(),this.m=_,this.l=k,this.h=null,this.i=!1,this.g=null}j(_){this.h=arguments,this.g?this.i=!0:pn(this)}N(){super.N(),this.g&&(u.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function is(f){R.call(this),this.h=f,this.g={}}x(is,R);var He=[];function lt(f){ce(f.g,function(_,k){this.g.hasOwnProperty(k)&&Qe(_)},f),f.g={}}is.prototype.N=function(){is.Z.N.call(this),lt(this)},is.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var te=u.JSON.stringify,ke=u.JSON.parse,nt=class{stringify(f){return u.JSON.stringify(f,void 0)}parse(f){return u.JSON.parse(f,void 0)}};function he(){}function Fe(){}var Oe={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function Xe(){D.call(this,"d")}x(Xe,D);function rn(){D.call(this,"c")}x(rn,D);var jt={},mo=null;function Nl(){return mo=mo||new Ee}jt.Ia="serverreachability";function Ch(f){D.call(this,jt.Ia,f)}x(Ch,D);function Pr(f){const _=Nl();Me(_,new Ch(_))}jt.STAT_EVENT="statevent";function po(f,_){D.call(this,jt.STAT_EVENT,f),this.stat=_}x(po,D);function gn(f){const _=Nl();Me(_,new po(_,f))}jt.Ja="timingevent";function Dr(f,_){D.call(this,jt.Ja,f),this.size=_}x(Dr,D);function Or(f,_){if(typeof f!="function")throw Error("Fn must not be null and must be a function");return u.setTimeout(function(){f()},_)}function fr(){this.g=!0}fr.prototype.ua=function(){this.g=!1};function fg(f,_,k,U,Q,le){f.info(function(){if(f.g)if(le){var Te="",rt=le.split("&");for(let Tt=0;Tt<rt.length;Tt++){var an=rt[Tt].split("=");if(an.length>1){const Ht=an[0];an=an[1];const Gs=Ht.split("_");Te=Gs.length>
2488=2&&Gs[1]=="type"?Te+(Ht+"="+an+"&"):Te+(Ht+"=redacted&")}}}else Te=null;else Te=le;return"XMLHTTP REQ ("+U+") [attempt "+Q+"]: "+_+`
2489`+k+`
2490`+Te})}function Rh(f,_,k,U,Q,le,Te){f.info(function(){return"XMLHTTP RESP ("+U+") [ attempt "+Q+"]: "+_+`
2491`+k+`
2492`+le+" "+Te})}function Lr(f,_,k,U){f.info(function(){return"XMLHTTP TEXT ("+_+"): "+mg(f,k)+(U?" "+U:"")})}function go(f,_){f.info(function(){return"TIMEOUT: "+_})}fr.prototype.info=function(){};function mg(f,_){if(!f.g)return _;if(!_)return null;try{const le=JSON.parse(_);if(le){for(f=0;f<le.length;f++)if(Array.isArray(le[f])){var k=le[f];if(!(k.length<2)){var U=k[1];if(Array.isArray(U)&&!(U.length<1)){var Q=U[0];if(Q!="noop"&&Q!="stop"&&Q!="close")for(let Te=1;Te<U.length;Te++)U[Te]=""}}}}return te(le)}catch{return _}}var yo={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},mu={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"},pu;function bo(){}x(bo,he),bo.prototype.g=function(){return new XMLHttpRequest},pu=new bo;function yi(f){return encodeURIComponent(String(f))}function Ih(f){var _=1;f=f.split(":");const k=[];for(;_>0&&f.length;)k.push(f.shift()),_--;return f.length&&k.push(f.join(":")),k}function mr(f,_,k,U){this.j=f,this.i=_,this.l=k,this.S=U||1,this.V=new is(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 pr}function pr(){this.i=null,this.g="",this.h=!1}var yn={},Mn={};function Ur(f,_,k){f.M=1,f.A=xo(xn(_)),f.u=k,f.R=!0,jl(f,null)}function jl(f,_){f.F=Date.now(),Fr(f),f.B=xn(f.A);var k=f.B,U=f.S;Array.isArray(U)||(U=[String(U)]),Il(k.i,"t",U),f.C=0,k=f.j.L,f.h=new pr,f.g=Gh(f.j,k?_:null,!f.u),f.P>0&&(f.O=new wt(p(f.Y,f,f.g),f.P)),_=f.V,k=f.g,U=f.ba;var Q="readystatechange";Array.isArray(Q)||(Q&&(He[0]=Q.toString()),Q=He);for(let le=0;le<Q.length;le++){const Te=Re(k,Q[le],U||_.handleEvent,!1,_.h||_);if(!Te)break;_.g[Te.key]=Te}_=f.J?O(f.J):{},f.u?(f.v||(f.v="POST"),_["Content-Type"]="application/x-www-form-urlencoded",f.g.ea(f.B,f.v,f.u,_)):(f.v="GET",f.g.ea(f.B,f.v,null,_)),Pr(),fg(f.i,f.v,f.B,f.l,f.S,f.u)}mr.prototype.ba=function(f){f=f.target;const _=this.O;_&&br(f)==3?_.j():this.Y(f)},mr.prototype.Y=function(f){try{if(f==this.g)e:{const rt=br(this.g),an=this.g.ya(),Tt=this.g.ca();if(!(rt<3)&&(rt!=3||this.g&&(this.h.h||this.g.la()||Fn(this.g)))){this.K||rt!=4||an==7||(an==8||Tt<=0?Pr(3):Pr(2)),Vr(this);var _=this.g.ca();this.X=_;var k=pg(this);if(this.o=_==200,Rh(this.i,this.v,this.B,this.l,this.S,rt,_),this.o){if(this.U&&!this.L){t:{if(this.g){var U,Q=this.g;if((U=Q.g?Q.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!P(U)){var le=U;break t}}le=null}if(f=le)Lr(this.i,this.l,f,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,zr(this,f);else{this.o=!1,this.m=3,gn(12),Ss(this),$s(this);break e}}if(this.R){f=!0;let Ht;for(;!this.K&&this.C<k.length;)if(Ht=Ph(this,k),Ht==Mn){rt==4&&(this.m=4,gn(14),f=!1),Lr(this.i,this.l,null,"[Incomplete Response]");break}else if(Ht==yn){this.m=4,gn(15),Lr(this.i,this.l,k,"[Invalid Chunk]"),f=!1;break}else Lr(this.i,this.l,Ht,null),zr(this,Ht);if(Mh(this)&&this.C!=0&&(this.h.g=this.h.g.slice(this.C),this.C=0),rt!=4||k.length!=0||this.h.h||(this.m=1,gn(16),f=!1),this.o=this.o&&f,!f)Lr(this.i,this.l,k,"[Invalid Chunked Response]"),Ss(this),$s(this);else if(k.length>0&&!this.W){this.W=!0;var Te=this.j;Te.g==this&&Te.aa&&!Te.P&&(Te.j.info("Great, no buffering proxy detected. Bytes received: "+k.length),Cu(Te),Te.P=!0,gn(11))}}else Lr(this.i,this.l,k,null),zr(this,k);rt==4&&Ss(this),this.o&&!this.K&&(rt==4?Kh(this.j,this):(this.o=!1,Fr(this)))}else xi(this.g),_==400&&k.indexOf("Unknown SID")>0?(this.m=3,gn(12)):(this.m=0,gn(13)),Ss(this),$s(this)}}}catch{}finally{}};function pg(f){if(!Mh(f))return f.g.la();const _=Fn(f.g);if(_==="")return"";let k="";const U=_.length,Q=br(f.g)==4;if(!f.h.i){if(typeof TextDecoder>"u")return Ss(f),$s(f),"";f.h.i=new u.TextDecoder}for(let le=0;le<U;le++)f.h.h=!0,k+=f.h.i.decode(_[le],{stream:!(Q&&le==U-1)});return _.length=0,f.h.g+=k,f.C=0,f.h.g}function Mh(f){return f.g?f.v=="GET"&&f.M!=2&&f.j.Aa:!1}function Ph(f,_){var k=f.C,U=_.indexOf(`
2493`,k);return U==-1?Mn:(k=Number(_.substring(k,U)),isNaN(k)?yn:(U+=1,U+k>_.length?Mn:(_=_.slice(U,U+k),f.C=U+k,_)))}mr.prototype.cancel=function(){this.K=!0,Ss(this)};function Fr(f){f.T=Date.now()+f.H,Al(f,f.H)}function Al(f,_){if(f.D!=null)throw Error("WatchDog timer not null");f.D=Or(p(f.aa,f),_)}function Vr(f){f.D&&(u.clearTimeout(f.D),f.D=null)}mr.prototype.aa=function(){this.D=null;const f=Date.now();f-this.T>=0?(go(this.i,this.B),this.M!=2&&(Pr(),gn(17)),Ss(this),this.m=2,$s(this)):Al(this,this.T-f)};function $s(f){f.j.I==0||f.K||Kh(f.j,f)}function Ss(f){Vr(f);var _=f.O;_&&typeof _.dispose=="function"&&_.dispose(),f.O=null,lt(f.V),f.g&&(_=f.g,f.g=null,_.abort(),_.dispose())}function zr(f,_){try{var k=f.j;if(k.I!=0&&(k.g==f||Kr(k.h,f))){if(!f.L&&Kr(k.h,f)&&k.I==3){try{var U=k.Ba.g.parse(_)}catch{U=null}if(Array.isArray(U)&&U.length==3){var Q=U;if(Q[0]==0){e:if(!k.v){if(k.g)if(k.g.F+3e3<f.F)Ll(k),ma(k);else break e;So(k),gn(18)}}else k.xa=Q[1],0<k.xa-k.K&&Q[2]<37500&&k.F&&k.A==0&&!k.C&&(k.C=Or(p(k.Va,k),6e3));Br(k.h)<=1&&k.ta&&(k.ta=void 0)}else Wr(k,11)}else if((f.L||k.g==f)&&Ll(k),!P(_))for(Q=k.Ba.g.parse(_),_=0;_<Q.length;_++){let Tt=Q[_];const Ht=Tt[0];if(!(Ht<=k.K))if(k.K=Ht,Tt=Tt[1],k.I==2)if(Tt[0]=="c"){k.M=Tt[1],k.ba=Tt[2];const Gs=Tt[3];Gs!=null&&(k.ka=Gs,k.j.info("VER="+k.ka));const Xr=Tt[4];Xr!=null&&(k.za=Xr,k.j.info("SVER="+k.za));const xr=Tt[5];xr!=null&&typeof xr=="number"&&xr>0&&(U=1.5*xr,k.O=U,k.j.info("backChannelRequestTimeoutMs_="+U)),U=k;const vr=f.g;if(vr){const No=vr.g?vr.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(No){var le=U.h;le.g||No.indexOf("spdy")==-1&&No.indexOf("quic")==-1&&No.indexOf("h2")==-1||(le.j=le.l,le.g=new Set,le.h&&(bu(le,le.h),le.h=null))}if(U.G){const Ul=vr.g?vr.g.getResponseHeader("X-HTTP-Session-Id"):null;Ul&&(U.wa=Ul,Ct(U.J,U.G,Ul))}}k.I=3,k.l&&k.l.ra(),k.aa&&(k.T=Date.now()-f.F,k.j.info("Handshake RTT: "+k.T+"ms")),U=k;var Te=f;if(U.na=Hh(U,U.L?U.ba:null,U.W),Te.L){xu(U.h,Te);var rt=Te,an=U.O;an&&(rt.H=an),rt.D&&(Vr(rt),Fr(rt)),U.g=Te}else zh(U);k.i.length>0&&Yr(k)}else Tt[0]!="stop"&&Tt[0]!="close"||Wr(k,7);else k.I==3&&(Tt[0]=="stop"||Tt[0]=="close"?Tt[0]=="stop"?Wr(k,7):ju(k):Tt[0]!="noop"&&k.l&&k.l.qa(Tt),k.A=0)}}Pr(4)}catch{}}var bn=class{constructor(f,_){this.g=f,this.map=_}};function gu(f){this.l=f||10,u.PerformanceNavigationTiming?(f=u.performance.getEntriesByType("navigation"),f=f.length>0&&(f[0].nextHopProtocol=="hq"||f[0].nextHopProtocol=="h2")):f=!!(u.chrome&&u.chrome.loadTimes&&u.chrome.loadTimes()&&u.chrome.loadTimes().wasFetchedViaSpdy),this.j=f?this.l:1,this.g=null,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function yu(f){return f.h?!0:f.g?f.g.size>=f.j:!1}function Br(f){return f.h?1:f.g?f.g.size:0}function Kr(f,_){return f.h?f.h==_:f.g?f.g.has(_):!1}function bu(f,_){f.g?f.g.add(_):f.h=_}function xu(f,_){f.h&&f.h==_?f.h=null:f.g&&f.g.has(_)&&f.g.delete(_)}gu.prototype.cancel=function(){if(this.i=vu(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const f of this.g.values())f.cancel();this.g.clear()}};function vu(f){if(f.h!=null)return f.i.concat(f.h.G);if(f.g!=null&&f.g.size!==0){let _=f.i;for(const k of f.g.values())_=_.concat(k.G);return _}return T(f.i)}var Dh=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function Cl(f,_){if(f){f=f.split("&");for(let k=0;k<f.length;k++){const U=f[k].indexOf("=");let Q,le=null;U>=0?(Q=f[k].substring(0,U),le=f[k].substring(U+1)):Q=f[k],_(Q,le?decodeURIComponent(le.replace(/\+/g," ")):"")}}}function Ns(f){this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1;let _;f instanceof Ns?(this.l=f.l,Pn(this,f.j),this.o=f.o,this.g=f.g,oa(this,f.u),this.h=f.h,_u(this,Fh(f.i)),this.m=f.m):f&&(_=String(f).match(Dh))?(this.l=!1,Pn(this,_[1]||"",!0),this.o=$r(_[2]||""),this.g=$r(_[3]||"",!0),oa(this,_[4]),this.h=$r(_[5]||"",!0),_u(this,_[6]||"",!0),this.m=$r(_[7]||"")):(this.l=!1,this.i=new ca(null,this.l))}Ns.prototype.toString=function(){const f=[];var _=this.j;_&&f.push(vo(_,Rl,!0),":");var k=this.g;return(k||_=="file")&&(f.push("//"),(_=this.o)&&f.push(vo(_,Rl,!0),"@"),f.push(yi(k).replace(/%25([0-9a-fA-F]{2}
2493)/g,"%$1")),k=this.u,k!=null&&f.push(":",String(k))),(k=this.h)&&(this.g&&k.charAt(0)!="/"&&f.push("/"),f.push(vo(k,k.charAt(0)=="/"?wu:Oh,!0))),(k=this.i.toString())&&f.push("?",k),(k=this.m)&&f.push("#",vo(k,Lh)),f.join("")},Ns.prototype.resolve=function(f){const _=xn(this);let k=!!f.j;k?Pn(_,f.j):k=!!f.o,k?_.o=f.o:k=!!f.g,k?_.g=f.g:k=f.u!=null;var U=f.h;if(k)oa(_,f.u);else if(k=!!f.h){if(U.charAt(0)!="/")if(this.g&&!this.h)U="/"+U;else{var Q=_.h.lastIndexOf("/");Q!=-1&&(U=_.h.slice(0,Q+1)+U)}if(Q=U,Q==".."||Q==".")U="";else if(Q.indexOf("./")!=-1||Q.indexOf("/.")!=-1){U=Q.lastIndexOf("/",0)==0,Q=Q.split("/");const le=[];for(let Te=0;Te<Q.length;){const rt=Q[Te++];rt=="."?U&&Te==Q.length&&le.push(""):rt==".."?((le.length>1||le.length==1&&le[0]!="")&&le.pop(),U&&Te==Q.length&&le.push("")):(le.push(rt),U=!0)}U=le.join("/")}else U=Q}return k?_.h=U:k=f.i.toString()!=="",k?_u(_,Fh(f.i)):k=!!f.m,k&&(_.m=f.m),_};function xn(f){return new Ns(f)}function Pn(f,_,k){f.j=k?$r(_,!0):_,f.j&&(f.j=f.j.replace(/:$/,""))}function oa(f,_){if(_){if(_=Number(_),isNaN(_)||_<0)throw Error("Bad port number "+_);f.u=_}else f.u=null}function _u(f,_,k){_ instanceof ca?(f.i=_,Ml(f.i,f.l)):(k||(_=vo(_,la)),f.i=new ca(_,f.l))}function Ct(f,_,k){f.i.set(_,k)}function xo(f){return Ct(f,"zx",Math.floor(Math.random()*2147483648).toString(36)+Math.abs(Math.floor(Math.random()*2147483648)^Date.now()).toString(36)),f}function $r(f,_){return f?_?decodeURI(f.replace(/%25/g,"%2525")):decodeURIComponent(f):""}function vo(f,_,k){return typeof f=="string"?(f=encodeURI(f).replace(_,hs),k&&(f=f.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),f):null}function hs(f){return f=f.charCodeAt(0),"%"+(f>>4&15).toString(16)+(f&15).toString(16)}var Rl=/[#\/\?@]/g,Oh=/[#\?:]/g,wu=/[#\?]/g,la=/[#\?@]/g,Lh=/#/g;function ca(f,_){this.h=this.g=null,this.i=f||null,this.j=!!_}function fs(f){f.g||(f.g=new Map,f.h=0,f.i&&Cl(f.i,function(_,k){f.add(decodeURIComponent(_.replace(/\+/g," ")),k)}))}t=ca.prototype,t.add=function(f,_){fs(this),this.i=null,f=ua(this,f);let k=this.g.get(f);return k||this.g.set(f,k=[]),k.push(_),this.h+=1,this};function Uh(f,_){fs(f),_=ua(f,_),f.g.has(_)&&(f.i=null,f.h-=f.g.get(_).length,f.g.delete(_))}function Eu(f,_){return fs(f),_=ua(f,_),f.g.has(_)}t.forEach=function(f,_){fs(this),this.g.forEach(function(k,U){k.forEach(function(Q){f.call(_,Q,U,this)},this)},this)};function ku(f,_){fs(f);let k=[];if(typeof _=="string")Eu(f,_)&&(k=k.concat(f.g.get(ua(f,_))));else for(f=Array.from(f.g.values()),_=0;_<f.length;_++)k=k.concat(f[_]);return k}t.set=function(f,_){return fs(this),this.i=null,f=ua(this,f),Eu(this,f)&&(this.h-=this.g.get(f).length),this.g.set(f,[_]),this.h+=1,this},t.get=function(f,_){return f?(f=ku(this,f),f.length>0?String(f[0]):_):_};function Il(f,_,k){Uh(f,_),k.length>0&&(f.i=null,f.g.set(ua(f,_),T(k)),f.h+=k.length)}t.toString=function(){if(this.i)return this.i;if(!this.g)return"";const f=[],_=Array.from(this.g.keys());for(let U=0;U<_.length;U++){var k=_[U];const Q=yi(k);k=ku(this,k);for(let le=0;le<k.length;le++){let Te=Q;k[le]!==""&&(Te+="="+yi(k[le])),f.push(Te)}}return this.i=f.join("&")};function Fh(f){const _=new ca;return _.i=f.i,f.g&&(_.g=new Map(f.g),_.h=f.h),_}function ua(f,_){return _=String(_),f.j&&(_=_.toLowerCase()),_}function Ml(f,_){_&&!f.j&&(fs(f),f.i=null,f.g.forEach(function(k,U){const Q=U.toLowerCase();U!=Q&&(Uh(this,U),Il(this,Q,k))},f)),f.j=_}function gr(f,_){const k=new fr;if(u.Image){const U=new Image;U.onload=b(qs,k,"TestLoadImage: loaded",!0,_,U),U.onerror=b(qs,k,"TestLoadImage: error",!1,_,U),U.onabort=b(qs,k,"TestLoadImage: abort",!1,_,U),U.ontimeout=b(qs,k,"TestLoadImage: timeout",!1,_,U),u.setTimeout(function(){U.ontimeout&&U.ontimeout()},1e4),U.src=f}else _(!1)}function Tu(f,_){const k=new fr,U=new AbortController,Q=setTimeout(()=>{U.abort(),qs(k,"TestPingServer: timeout",!1,_)},1e4);fetch(f,{signal:U.signal}).then(le=>{clearTimeout(Q),le.ok?qs(k,"TestPingServer: ok",!0,_):qs(k,"TestPingServer: server error",!1,_)}).catch(()=>{clearTimeout(Q),qs(k,"TestPingServer: error",!1,_)})}function qs(f,_,k,U,Q){try{Q&&(Q.onload=null,Q.onerror=null,Q.onabort=null,Q.ontimeout=null),U(k)}catch{}}function da(){this.g=new nt}function qr(f){this.i=f.Sb||null,this.h=f.ab||!1}x(qr,he),qr.prototype.g=function(){return new _o(this.i,this.h)};function _o(f,_){Ee.call(this),this.H=f,this.o=_,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}x(_o,Ee),t=_o.prototype,t.open=function(f,_){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.F=f,this.D=_,this.readyState=1,yr(this)},t.send=function(f){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");
vendor: 15,734 bytes, lines 2493-2500
2493if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;const _={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};f&&(_.body=f),(this.H||u).fetch(new Request(this.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,ha(this)),this.readyState=0},t.Pa=function(f){if(this.g&&(this.l=f,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=f.headers,this.readyState=2,yr(this)),this.g&&(this.readyState=3,yr(this),this.g)))if(this.responseType==="arraybuffer")f.arrayBuffer().then(this.Na.bind(this),this.ga.bind(this));else if(typeof u.ReadableStream<"u"&&"body"in f){if(this.j=f.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;Pl(this)}else f.text().then(this.Oa.bind(this),this.ga.bind(this))};function Pl(f){f.j.read().then(f.Ma.bind(f)).catch(f.ga.bind(f))}t.Ma=function(f){if(this.g){if(this.o&&f.value)this.response.push(f.value);else if(!this.o){var _=f.value?f.value:new Uint8Array(0);(_=this.B.decode(_,{stream:!f.done}))&&(this.response=this.responseText+=_)}f.done?ha(this):yr(this),this.readyState==3&&Pl(this)}},t.Oa=function(f){this.g&&(this.response=this.responseText=f,ha(this))},t.Na=function(f){this.g&&(this.response=f,ha(this))},t.ga=function(){this.g&&ha(this)};function ha(f){f.readyState=4,f.l=null,f.j=null,f.B=null,yr(f)}t.setRequestHeader=function(f,_){this.A.append(f,_)},t.getResponseHeader=function(f){return this.h&&this.h.get(f.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const f=[],_=this.h.entries();for(var k=_.next();!k.done;)k=k.value,f.push(k[0]+": "+k[1]),k=_.next();return f.join(`\r
2494`)};function yr(f){f.onreadystatechange&&f.onreadystatechange.call(f)}Object.defineProperty(_o.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(f){this.m=f?"include":"same-origin"}});function Hs(f){let _="";return ce(f,function(k,U){_+=U,_+=":",_+=k,_+=`\r
2495`}),_}function wo(f,_,k){e:{for(U in k){var U=!1;break e}U=!0}U||(k=Hs(k),typeof f=="string"?k!=null&&yi(k):Ct(f,_,k))}function Mt(f){Ee.call(this),this.headers=new Map,this.L=f||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}x(Mt,Ee);var Hr=/^https?$/i,Su=["POST","PUT"];t=Mt.prototype,t.Fa=function(f){this.H=f},t.ea=function(f,_,k,U){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+f);_=_?_.toUpperCase():"GET",this.D=f,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():pu.g(),this.g.onreadystatechange=w(p(this.Ca,this));try{this.B=!0,this.g.open(_,String(f),!0),this.B=!1}catch(le){Eo(this,le);return}if(f=k||"",k=new Map(this.headers),U)if(Object.getPrototypeOf(U)===Object.prototype)for(var Q in U)k.set(Q,U[Q]);else if(typeof U.keys=="function"&&typeof U.get=="function")for(const le of U.keys())k.set(le,U.get(le));else throw Error("Unknown input type for opt_headers: "+String(U));U=Array.from(k.keys()).find(le=>le.toLowerCase()=="content-type"),Q=u.FormData&&f instanceof u.FormData,!(Array.prototype.indexOf.call(Su,_,void 0)>=0)||U||Q||k.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[le,Te]of k)this.g.setRequestHeader(le,Te);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(f),this.v=!1}catch(le){Eo(this,le)}};function Eo(f,_){f.h=!1,f.g&&(f.j=!0,f.g.abort(),f.j=!1),f.l=_,f.o=5,Nu(f),bi(f)}function Nu(f){f.A||(f.A=!0,Me(f,"complete"),Me(f,"error"))}t.abort=function(f){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=f||7,Me(this,"complete"),Me(this,"abort"),bi(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),bi(this,!0)),Mt.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?ko(this):this.Xa())},t.Xa=function(){ko(this)};function ko(f){if(f.h&&typeof c<"u"){if(f.v&&br(f)==4)setTimeout(f.Ca.bind(f),0);else if(Me(f,"readystatechange"),br(f)==4){f.h=!1;try{const le=f.ca();e:switch(le){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var _=!0;break e;default:_=!1}var k;if(!(k=_)){var U;if(U=le===0){let Te=String(f.D).match(Dh)[1]||null;!Te&&u.self&&u.self.location&&(Te=u.self.location.protocol.slice(0,-1)),U=!Hr.test(Te?Te.toLowerCase():"")}k=U}if(k)Me(f,"complete"),Me(f,"success");else{f.o=6;try{var Q=br(f)>2?f.g.statusText:""}catch{Q=""}f.l=Q+" ["+f.ca()+"]",Nu(f)}}finally{bi(f)}}}}function bi(f,_){if(f.g){f.m&&(clearTimeout(f.m),f.m=null);const k=f.g;f.g=null,_||Me(f,"ready");try{k.onreadystatechange=null}catch{}}}t.isActive=function(){return!!this.g};function br(f){return f.g?f.g.readyState:0}t.ca=function(){try{return br(this)>2?this.g.status:-1}catch{return-1}},t.la=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.La=function(f){if(this.g){var _=this.g.responseText;return f&&_.indexOf(f)==0&&(_=_.substring(f.length)),ke(_)}};function Fn(f){try{if(!f.g)return null;if("response"in f.g)return f.g.response;switch(f.F){case"":case"text":return f.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in f.g)return f.g.mozResponseArrayBuffer}return null}catch{return null}}function xi(f){const _={};f=(f.g&&br(f)>=2&&f.g.getAllResponseHeaders()||"").split(`\r
2496`);for(let U=0;U<f.length;U++){if(P(f[U]))continue;var k=Ih(f[U]);const Q=k[0];if(k=k[1],typeof k!="string")continue;k=k.trim();const le=_[Q]||[];_[Q]=le,le.push(k)}ae(_,function(U){return U.join(", ")})}t.ya=function(){return this.o},t.Ha=function(){return typeof this.l=="string"?this.l:String(this.l)};function Gr(f,_,k){return k&&k.internalChannelParams&&k.internalChannelParams[f]||_}function fa(f){this.za=0,this.i=[],this.j=new fr,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=Gr("failFast",!1,f),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=Gr("baseRetryDelayMs",5e3,f),this.Za=Gr("retryDelaySeedMs",1e4,f),this.Ta=Gr("forwardChannelMaxRetries",2,f),this.va=Gr("forwardChannelRequestTimeoutMs",2e4,f),this.ma=f&&f.xmlHttpFactory||void 0,this.Ua=f&&f.Rb||void 0,this.Aa=f&&f.useFetchStreams||!1,this.O=void 0,this.L=f&&f.supportsCrossDomainXhr||!1,this.M="",this.h=new gu(f&&f.concurrentRequestLimit),this.Ba=new da,this.S=f&&f.fastHandshake||!1,this.R=f&&f.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=f&&f.Pb||!1,f&&f.ua&&this.j.ua(),f&&f.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&f&&f.detectBufferingProxy||!1,this.ia=void 0,f&&f.longPollingTimeout&&f.longPollingTimeout>0&&(this.ia=f.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}t=fa.prototype,t.ka=8,t.I=1,t.connect=function(f,_,k,U){gn(0),this.W=f,this.H=_||{},k&&U!==void 0&&(this.H.OSID=k,this.H.OAID=U),this.F=this.X,this.J=Hh(this,null,this.W),Yr(this)};function ju(f){if(Dl(f),f.I==3){var _=f.V++,k=xn(f.J);if(Ct(k,"SID",f.M),Ct(k,"RID",_),Ct(k,"TYPE","terminate"),To(f,k),_=new mr(f,f.j,_),_.M=2,_.A=xo(xn(k)),k=!1,u.navigator&&u.navigator.sendBeacon)try{k=u.navigator.sendBeacon(_.A.toString(),"")}catch{}!k&&u.Image&&(new Image().src=_.A,k=!0),k||(_.g=Gh(_.j,null),_.g.ea(_.A)),_.F=Date.now(),Fr(_)}qh(f)}function ma(f){f.g&&(Cu(f),f.g.cancel(),f.g=null)}function Dl(f){ma(f),f.v&&(u.clearTimeout(f.v),f.v=null),Ll(f),f.h.cancel(),f.m&&(typeof f.m=="number"&&u.clearTimeout(f.m),f.m=null)}function Yr(f){if(!yu(f.h)&&!f.m){f.m=!0;var _=f.Ea;$||S(),q||($(),q=!0),I.add(_,f),f.D=0}}function Ol(f,_){return Br(f.h)>=f.h.j-(f.m?1:0)?!1:f.m?(f.i=_.G.concat(f.i),!0):f.I==1||f.I==2||f.D>=(f.Sa?0:f.Ta)?!1:(f.m=Or(p(f.Ea,f,_),$h(f,f.D)),f.D++,!0)}t.Ea=function(f){if(this.m)if(this.m=null,this.I==1){if(!f){this.V=Math.floor(Math.random()*1e5),f=this.V++;const Q=new mr(this,this.j,f);let le=this.o;if(this.U&&(le?(le=O(le),re(le,this.U)):le=this.U),this.u!==null||this.R||(Q.J=le,le=null),this.S)e:{for(var _=0,k=0;k<this.i.length;k++){t:{var U=this.i[k];if("__data__"in U.map&&(U=U.map.__data__,typeof U=="string")){U=U.length;break t}U=void 0}if(U===void 0)break;if(_+=U,_>4096){_=k;break e}if(_===4096||k===this.i.length-1){_=k+1;break e}}_=1e3}else _=1e3;_=Vh(this,Q,_),k=xn(this.J),Ct(k,"RID",f),Ct(k,"CVER",22),this.G&&Ct(k,"X-HTTP-Session-Id",this.G),To(this,k),le&&(this.R?_="headers="+yi(Hs(le))+"&"+_:this.u&&wo(k,this.u,le)),bu(this.h,Q),this.Ra&&Ct(k,"TYPE","init"),this.S?(Ct(k,"$req",_),Ct(k,"SID","null"),Q.U=!0,Ur(Q,k,null)):Ur(Q,k,_),this.I=2}}else this.I==3&&(f?Au(this,f):this.i.length==0||yu(this.h)||Au(this))};function Au(f,_){var k;_?k=_.l:k=f.V++;const U=xn(f.J);Ct(U,"SID",f.M),Ct(U,"RID",k),Ct(U,"AID",f.K),To(f,U),f.u&&f.o&&wo(U,f.u,f.o),k=new mr(f,f.j,k,f.D+1),f.u===null&&(k.J=f.o),_&&(f.i=_.G.concat(f.i)),_=Vh(f,k,1e3),k.H=Math.round(f.va*.5)+Math.round(f.va*.5*Math.random()),bu(f.h,k),Ur(k,U,_)}function To(f,_){f.H&&ce(f.H,function(k,U){Ct(_,U,k)}),f.l&&ce({},function(k,U){Ct(_,U,k)})}function Vh(f,_,k){k=Math.min(f.i.length,k);const U=f.l?p(f.l.Ka,f.l,f):null;e:{var Q=f.i;let rt=-1;for(;;){const an=["count="+k];rt==-1?k>0?(rt=Q[0].g,an.push("ofs="+rt)):rt=0:an.push("ofs="+rt);let Tt=!0;for(let Ht=0;Ht<k;Ht++){var le=Q[Ht].g;const Gs=Q[Ht].map;if(le-=rt,le<0)rt=Math.max(0,Q[Ht].g-100),Tt=!1;else try{le="req"+le+"_"||"";try{var Te=Gs instanceof Map?Gs:Object.entries(Gs);for(const[Xr,xr]of Te){let vr=xr;h(xr)&&(vr=te(xr)),an.push(le+Xr+"="+encodeURIComponent(vr))}}catch(Xr){throw an.push(le+"type="+encodeURIComponent("_badmap")),Xr}}catch{U&&U(Gs)}}if(Tt){Te=an.join("&");break e}}Te=void 0}return f=f.i.splice(0,k),_.G=f,Te}function zh(f){if(!f.g&&!f.v){f.Y=1;var _=f.Da;$||S(),q||($(),q=!0),I.add(_,f),f.A=0}}function So(f){return f.g||f.v||f.A>=3?!1:(f.Y++,f.v=Or(p(f.Da,f),$h(f,f.A)),f.A++,!0)}t.Da=function(){if(this.v=null,Bh(this),this.aa&&!(this.P||this.g==null||this.T<=0)){var f=4*this.T;this.j.info("BP detection timer enabled: "+f),this.B=Or(p(this.Wa,this),f)}},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,gn(10),ma(this),Bh(this))};function Cu(f){f.B!=null&&(u.clearTimeout(f.B),f.B=null)}function Bh(f){f.g=new mr(f,f.j,"rpc",f.Y),f.u===null&&(f.g.J=f.o),f.g.P=0;var _=xn(f.na);Ct(_,"RID","rpc"),Ct(_,"SID",f.M),Ct(_,"AID",f.K),Ct(_,"CI",f.F?"0":"1"),!f.F&&f.ia&&Ct(_,"TO",f.ia),Ct(_,"TYPE","xmlhttp"),To(f,_),f.u&&f.o&&wo(_,f.u,f.o),f.O&&(f.g.H=f.O);var k=f.g;f=f.ba,k.M=1,k.A=xo(xn(_)),k.u=null,k.R=!0,jl(k,f)}t.Va=function(){this.C!=null&&(this.C=null,ma(this),So(this),gn(19))};function Ll(f){f.C!=null&&(u.clearTimeout(f.C),f.C=null)}function Kh(f,_){var k=null;if(f.g==_){Ll(f),Cu(f),f.g=null;var U=2}else if(Kr(f.h,_))k=_.G,xu(f.h,_),U=1;else return;if(f.I!=0){if(_.o)if(U==1){k=_.u?_.u.length:0,_=Date.now()-_.F;var Q=f.D;U=Nl(),Me(U,new Dr(U,k)),Yr(f)}else zh(f);else if(Q=_.m,Q==3||Q==0&&_.X>0||!(U==1&&Ol(f,_)||U==2&&So(f)))switch(k&&k.length>0&&(_=f.h,_.i=_.i.concat(k)),Q){case 1:Wr(f,5);break;case 4:Wr(f,10);break;case 3:Wr(f,6);break;default:Wr(f,2)}}}function $h(f,_){let k=f.Qa+Math.floor(Math.random()*f.Za);return f.isActive()||(k*=2),k*_}function Wr(f,_){if(f.j.info("Error code "+_),_==2){var k=p(f.bb,f),U=f.Ua;const Q=!U;U=new Ns(U||"//www.google.com/images/cleardot.gif"),u.location&&u.location.protocol=="http"||Pn(U,"https"),xo(U),Q?gr(U.toString(),k):Tu(U.toString(),k)}else gn(2);f.I=0,f.l&&f.l.pa(_),qh(f),Dl(f)}t.bb=function(f){f?(this.j.info("Successfully pinged google.com"),gn(2)):(this.j.info("Failed to ping google.com"),gn(1))};function qh(f){if(f.I=0,f.ja=[],f.l){const _=vu(f.h);(_.length!=0||f.i.length!=0)&&(N(f.ja,_),N(f.ja,f.i),f.h.i.length=0,T(f.i),f.i.length=0),f.l.oa()}}function Hh(f,_,k){var U=k instanceof Ns?xn(k):new Ns(k);if(U.g!="")_&&(U.g=_+"."+U.g),oa(U,U.u);else{var Q=u.location;U=Q.protocol,_=_?_+"."+Q.hostname:Q.hostname,Q=+Q.port;const le=new Ns(null);U&&Pn(le,U),_&&(le.g=_),Q&&oa(le,Q),k&&(le.h=k),U=le}return k=f.G,_=f.wa,k&&_&&Ct(U,k,_),Ct(U,"VER",f.ka),To(f,U),U}function Gh(f,_,k){if(_&&!f.L)throw Error("Can't create secondary domain capable XhrIo object.");return _=f.Aa&&!f.ma?new Mt(new qr({ab:k})):new Mt(f.ma),_.Fa(f.L),_}t.isActive=function(){return!!this.l&&this.l.isActive(this)};function Yh(){}t=Yh.prototype,t.ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){};function pa(){}pa.prototype.g=function(f,_){return new as(f,_)};function as(f,_){Ee.call(this),this.g=new fa(_),this.l=f,this.h=_&&_.messageUrlParams||null,f=_&&_.messageHeaders||null,_&&_.clientProtocolHeaderRequired&&(f?f["X-Client-Protocol"]="webchannel":f={"X-Client-Protocol":"webchannel"}),this.g.o=f,f=_&&_.initMessageHeaders||null,_&&_.messageContentType&&(f?f["X-WebChannel-Content-Type"]=_.messageContentType:f={"X-WebChannel-Content-Type":_.messageContentType}),_&&_.sa&&(f?f["X-WebChannel-Client-Profile"]=_.sa:f={"X-WebChannel-Client-Profile":_.sa}),this.g.U=f,(f=_&&_.Qb)&&!P(f)&&(this.g.u=f),this.A=_&&_.supportsCrossDomainXhr||!1,this.v=_&&_.sendRawJson||!1,(_=_&&_.httpSessionIdParam)&&!P(_)&&(this.g.G=_,f=this.h,f!==null&&_ in f&&(f=this.h,_ in f&&delete f[_])),this.j=new vi(this)}x(as,Ee),as.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},as.prototype.close=function(){ju(this.g)},as.prototype.o=function(f){var _=this.g;if(typeof f=="string"){var k={};k.__data__=f,f=k}else this.v&&(k={},k.__data__=te(f),f=k);_.i.push(new bn(_.Ya++,f)),_.I==3&&Yr(_)},as.prototype.N=function(){this.g.l=null,delete this.j,ju(this.g),delete this.g,as.Z.N.call(this)};function Wh(f){Xe.call(this),f.__headers__&&(this.headers=f.__headers__,this.statusCode=f.__status__,delete f.__headers__,delete f.__status__);var _=f.__sm__;if(_){e:{for(const k in _){f=k;break e}f=void 0}(this.i=f)&&(f=this.i,_=_!==null&&f in _?_[f]:void 0),this.data=_}else this.data=f}x(Wh,Xe);function Xh(){rn.call(this),this.status=1}x(Xh,rn);function vi(f){this.g=f}x(vi,Yh),vi.prototype.ra=function(){Me(this.g,"a")},vi.prototype.qa=function(f){Me(this.g,new Wh(f))},vi.prototype.pa=function(f){Me(this.g,new Xh)},vi.prototype.oa=function(){Me(this.g,"b")},pa.prototype.createWebChannel=pa.prototype.g,as.prototype.send=as.prototype.o,as.prototype.open=as.prototype.m,as.prototype.close=as.prototype.close,Tj=function(){return new pa},kj=function(){return Nl()},Ej=jt,Lx={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},yo.NO_ERROR=0,yo.TIMEOUT=8,yo.HTTP_ERROR=6,Am=yo,mu.COMPLETE="complete",wj=mu,Fe.EventType=Oe,Oe.OPEN="a",Oe.CLOSE="b",Oe.ERROR="c",Oe.MESSAGE="d",Ee.prototype.listen=Ee.prototype.J,Td=Fe,Mt.prototype.listenOnce=Mt.prototype.K,Mt.prototype.getLastError=Mt.prototype.Ha,Mt.prototype.getLastErrorCode=Mt.prototype.ya,Mt.prototype.getStatus=Mt.prototype.ca,Mt.prototype.getResponseJson=Mt.prototype.La,Mt.prototype.getResponseText=Mt.prototype.la,Mt.prototype.send=Mt.prototype.ea,Mt.prototype.setWithCredentials=Mt.prototype.Fa,_j=Mt}).apply(typeof sm<"u"?sm:typeof self<"u"?self:typeof window<"u"?window:{});/**
2497 * @license
2498 * Copyright 2017 Google LLC
2499 *
2500 * Licensed under the Apache License, Version 2.0 (the "License");
2501 * you may not use this file except in compliance with the License.
2502 * You may obtain a copy of the License at
2503 *
2504 *   http://www.apache.org/licenses/LICENSE-2.0
2505 *
2506 * Unless required by applicable law or agreed to in writing, software
2507 * distributed under the License is distributed on an "AS IS" BASIS,
2508 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2509 * See the License for the specific language governing permissions and
2510 * limitations under the License.
2511 */class es{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}}es.UNAUTHENTICATED=new es(null),es.GOOGLE_CREDENTIALS=new es("google-credentials-uid"),es.FIRST_PARTY=new es("first-party-uid"),es.MOCK_USER=new es("mock-user");/**
2512 * @license
2513 * Copyright 2017 Google LLC
2514 *
2515 * Licensed under the Apache License, Version 2.0 (the "License");
2516 * you may not use this file except in compliance with the License.
2517 * You may obtain a copy of the License at
2518 *
2519 *   http://www.apache.org/licenses/LICENSE-2.0
2520 *
2521 * Unless required by applicable law or agreed to in writing, software
2522 * distributed under the License is distributed on an "AS IS" BASIS,
2523 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2524 * See the License for the specific language governing permissions and
2525 * limitations under the License.
2526 */let au="12.9.0";function yU(t){au=t}/**
2527 * @license
2528 * Copyright 2020 Google LLC
2529 *
2530 * Licensed under the Apache License, Version 2.0 (the "License");
2531 * you may not use this file except in compliance with the License.
2532 * You may obtain a copy of the License at
2533 *
2534 *   http://www.apache.org/licenses/LICENSE-2.0
2535 *
2536 * Unless required by applicable law or agreed to in writing, software
2537 * distributed under the License is distributed on an "AS IS" BASIS,
2538 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2539 * See the License for the specific language governing permissions and
2540 * limitations under the License.
2541 *//**
2542 * @license
2543 * Copyright 2017 Google LLC
2544 *
2545 * Licensed under the Apache License, Version 2.0 (the "License");
2546 * you may not use this file except in compliance with the License.
2547 * You may obtain a copy of the License at
2548 *
2549 *   http://www.apache.org/licenses/LICENSE-2.0
2550 *
2551 * Unless required by applicable law or agreed to in writing, software
2552 * distributed under the License is distributed on an "AS IS" BASIS,
2553 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2554 * See the License for the specific language governing permissions and
2555 * limitations under the License.
2556 */const ll=new su("@firebase/firestore");function Ec(){return ll.logLevel}function Ie(t,...e){if(ll.logLevel<=ft.DEBUG){const n=e.map(Xv);ll.debug(`Firestore (${au}): ${t}`,...n)}}function ta(t,...e){if(ll.logLevel<=ft.ERROR){const n=e.map(Xv);ll.error(`Firestore (${au}): ${t}`,...n)}}function cl(t,...e){if(ll.logLevel<=ft.WARN){const n=e.map(Xv);ll.warn(`Firestore (${au}): ${t}`,...n)}}function Xv(t){if(typeof t=="string")return t;try{return(function(n){return JSON.stringify(n)})(t)}catch{return t}}/**
2557 * @license
2558 * Copyright 2017 Google LLC
2559 *
2560 * Licensed under the Apache License, Version 2.0 (the "License");
2561 * you may not use this file except in compliance with the License.
2562 * You may obtain a copy of the License at
2563 *
2564 *   http://www.apache.org/licenses/LICENSE-2.0
2565 *
2566 * Unless required by applicable law or agreed to in writing, software
2567 * distributed under the License is distributed on an "AS IS" BASIS,
2568 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2569 * See the License for the specific language governing permissions and
2570 * limitations under the License.
2571 */function We(t,e,n){let s="Unexpected state";typeof e=="string"?s=e:n=e,Sj(t,s,n)}function Sj(t,e,n){let s=`FIRESTORE (${au}) INTERNAL ASSERTION FAILED: ${e} (ID: ${t.toString(16)})`;if(n!==void 0)try{s+=" CONTEXT: "+JSON.stringify(n)}catch{s+=" CONTEXT: "+n}throw ta(s),new Error(s)}function At(t,e,n,s){let a="Unexpected state";
vendor: 10,922 bytes, lines 2571-2661
2571typeof n=="string"?a=n:s=n,t||Sj(e,a,s)}function tt(t,e){return t}/**
2572 * @license
2573 * Copyright 2017 Google LLC
2574 *
2575 * Licensed under the Apache License, Version 2.0 (the "License");
2576 * you may not use this file except in compliance with the License.
2577 * You may obtain a copy of the License at
2578 *
2579 *   http://www.apache.org/licenses/LICENSE-2.0
2580 *
2581 * Unless required by applicable law or agreed to in writing, software
2582 * distributed under the License is distributed on an "AS IS" BASIS,
2583 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2584 * See the License for the specific language governing permissions and
2585 * limitations under the License.
2586 */const ye={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 je extends ds{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
2587 * @license
2588 * Copyright 2017 Google LLC
2589 *
2590 * Licensed under the Apache License, Version 2.0 (the "License");
2591 * you may not use this file except in compliance with the License.
2592 * You may obtain a copy of the License at
2593 *
2594 *   http://www.apache.org/licenses/LICENSE-2.0
2595 *
2596 * Unless required by applicable law or agreed to in writing, software
2597 * distributed under the License is distributed on an "AS IS" BASIS,
2598 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2599 * See the License for the specific language governing permissions and
2600 * limitations under the License.
2601 */class Yi{constructor(){this.promise=new Promise(((e,n)=>{this.resolve=e,this.reject=n}))}}/**
2602 * @license
2603 * Copyright 2017 Google LLC
2604 *
2605 * Licensed under the Apache License, Version 2.0 (the "License");
2606 * you may not use this file except in compliance with the License.
2607 * You may obtain a copy of the License at
2608 *
2609 *   http://www.apache.org/licenses/LICENSE-2.0
2610 *
2611 * Unless required by applicable law or agreed to in writing, software
2612 * distributed under the License is distributed on an "AS IS" BASIS,
2613 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2614 * See the License for the specific language governing permissions and
2615 * limitations under the License.
2616 */class Nj{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class bU{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable((()=>n(es.UNAUTHENTICATED)))}shutdown(){}}class xU{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 vU{constructor(e){this.t=e,this.currentUser=es.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){At(this.o===void 0,42304);let s=this.i;const a=m=>this.i!==s?(s=this.i,n(m)):Promise.resolve();let c=new Yi;this.o=()=>{this.i++,this.currentUser=this.u(),c.resolve(),c=new Yi,e.enqueueRetryable((()=>a(this.currentUser)))};const u=()=>{const m=c;e.enqueueRetryable((async()=>{await m.promise,await a(this.currentUser)}))},h=m=>{Ie("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=m,this.o&&(this.auth.addAuthTokenListener(this.o),u())};this.t.onInit((m=>h(m))),setTimeout((()=>{if(!this.auth){const m=this.t.getImmediate({optional:!0});m?h(m):(Ie("FirebaseAuthCredentialsProvider","Auth not yet detected"),c.resolve(),c=new Yi)}}),0),u()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then((s=>this.i!==e?(Ie("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):s?(At(typeof s.accessToken=="string",31837,{l:s}),new Nj(s.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 At(e===null||typeof e=="string",2055,{h:e}),new es(e)}}class _U{constructor(e,n,s){this.P=e,this.T=n,this.I=s,this.type="FirstParty",this.user=es.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 wU{constructor(e,n,s){this.P=e,this.T=n,this.I=s}getToken(){return Promise.resolve(new _U(this.P,this.T,this.I))}start(e,n){e.enqueueRetryable((()=>n(es.FIRST_PARTY)))}shutdown(){}invalidateToken(){}}class Vk{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 EU{constructor(e,n){this.V=n,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,qn(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,n){At(this.o===void 0,3512);const s=c=>{c.error!=null&&Ie("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${c.error.message}`);const u=c.token!==this.m;return this.m=c.token,Ie("FirebaseAppCheckTokenProvider",`Received ${u?"new":"existing"} token.`),u?n(c.token):Promise.resolve()};this.o=c=>{e.enqueueRetryable((()=>s(c)))};const a=c=>{Ie("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=c,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit((c=>a(c))),setTimeout((()=>{if(!this.appCheck){const c=this.V.getImmediate({optional:!0});c?a(c):Ie("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}}),0)}getToken(){if(this.p)return Promise.resolve(new Vk(this.p));const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then((n=>n?(At(typeof n.token=="string",44558,{tokenResult:n}),this.m=n.token,new Vk(n.token)):null)):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
2617 * @license
2618 * Copyright 2020 Google LLC
2619 *
2620 * Licensed under the Apache License, Version 2.0 (the "License");
2621 * you may not use this file except in compliance with the License.
2622 * You may obtain a copy of the License at
2623 *
2624 *   http://www.apache.org/licenses/LICENSE-2.0
2625 *
2626 * Unless required by applicable law or agreed to in writing, software
2627 * distributed under the License is distributed on an "AS IS" BASIS,
2628 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2629 * See the License for the specific language governing permissions and
2630 * limitations under the License.
2631 */function kU(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 s=0;s<t;s++)n[s]=Math.floor(256*Math.random());return n}/**
2632 * @license
2633 * Copyright 2017 Google LLC
2634 *
2635 * Licensed under the Apache License, Version 2.0 (the "License");
2636 * you may not use this file except in compliance with the License.
2637 * You may obtain a copy of the License at
2638 *
2639 *   http://www.apache.org/licenses/LICENSE-2.0
2640 *
2641 * Unless required by applicable law or agreed to in writing, software
2642 * distributed under the License is distributed on an "AS IS" BASIS,
2643 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2644 * See the License for the specific language governing permissions and
2645 * limitations under the License.
2646 */class Qv{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=62*Math.floor(4.129032258064516);let s="";for(;s.length<20;){const a=kU(40);for(let c=0;c<a.length;++c)s.length<20&&a[c]<n&&(s+=e.charAt(a[c]%62))}return s}}function gt(t,e){return t<e?-1:t>e?1:0}function Ux(t,e){const n=Math.min(t.length,e.length);for(let s=0;s<n;s++){const a=t.charAt(s),c=e.charAt(s);if(a!==c)return Cb(a)===Cb(c)?gt(a,c):Cb(a)?1:-1}return gt(t.length,e.length)}const TU=55296,SU=57343;function Cb(t){const e=t.charCodeAt(0);return e>=TU&&e<=SU}function qc(t,e,n){return t.length===e.length&&t.every(((s,a)=>n(s,e[a])))}/**
2647 * @license
2648 * Copyright 2017 Google LLC
2649 *
2650 * Licensed under the Apache License, Version 2.0 (the "License");
2651 * you may not use this file except in compliance with the License.
2652 * You may obtain a copy of the License at
2653 *
2654 *   http://www.apache.org/licenses/LICENSE-2.0
2655 *
2656 * Unless required by applicable law or agreed to in writing, software
2657 * distributed under the License is distributed on an "AS IS" BASIS,
2658 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2659 * See the License for the specific language governing permissions and
2660 * limitations under the License.
2661 */const zk="__name__";class ti{constructor(e,n,s){n===void 0?n=0:n>e.length&&We(637,{offset:n,range:e.length}),s===void 0?s=e.length-n:s>e.length-n&&We(1746,{length:s,range:e.length-n}),this.segments=e,this.offset=n,this.len=s}get length(){return this.len}isEqual(e){return ti.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof ti?e.forEach((s=>{n.push(s)})):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,s=this.limit();n<s;n++)e(this.segments[n])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,n){const s=Math.min(e.length,n.length);for(let a=0;a<s;a++){const c=ti.compareSegments(e.get(a),n.get(a));if(c!==0)return c}return gt(e.length,n.length)}static compareSegments(e,n){const s=ti.isNumericId(e),a=ti.isNumericId(n);return s&&!a?-1:!s&&a?1:s&&a?ti.extractNumericId(e).compare(ti.extractNumericId(n)):Ux(e,n)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return Qa.fromString(e.substring(4,e.length-2))}}class Vt extends ti{construct(e,n,s){return new Vt(e,n,s)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}
2661toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const s of e){if(s.indexOf("//")>=0)throw new je(ye.INVALID_ARGUMENT,`Invalid segment (${s}). Paths must not contain // in them.`);n.push(...s.split("/").filter((a=>a.length>0)))}return new Vt(n)}static emptyPath(){return new Vt([])}}const NU=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Hn extends ti{construct(e,n,s){return new Hn(e,n,s)}static isValidIdentifier(e){return NU.test(e)}canonicalString(){return this.toArray().map((e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Hn.isValidIdentifier(e)||(e="`"+e+"`"),e))).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)===zk}static keyField(){return new Hn([zk])}static fromServerFormat(e){const n=[];let s="",a=0;const c=()=>{if(s.length===0)throw new je(ye.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(s),s=""};let u=!1;for(;a<e.length;){const h=e[a];if(h==="\\"){if(a+1===e.length)throw new je(ye.INVALID_ARGUMENT,"Path has trailing escape character: "+e);const m=e[a+1];if(m!=="\\"&&m!=="."&&m!=="`")throw new je(ye.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);s+=m,a+=2}else h==="`"?(u=!u,a++):h!=="."||u?(s+=h,a++):(c(),a++)}if(c(),u)throw new je(ye.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new Hn(n)}static emptyPath(){return new Hn([])}}/**
2662 * @license
2663 * Copyright 2017 Google LLC
2664 *
2665 * Licensed under the Apache License, Version 2.0 (the "License");
2666 * you may not use this file except in compliance with the License.
2667 * You may obtain a copy of the License at
2668 *
2669 *   http://www.apache.org/licenses/LICENSE-2.0
2670 *
2671 * Unless required by applicable law or agreed to in writing, software
2672 * distributed under the License is distributed on an "AS IS" BASIS,
2673 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2674 * See the License for the specific language governing permissions and
2675 * limitations under the License.
2676 */class Ve{constructor(e){this.path=e}static fromPath(e){return new Ve(Vt.fromString(e))}static fromName(e){return new Ve(Vt.fromString(e).popFirst(5))}static empty(){return new Ve(Vt.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&&Vt.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Vt.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new Ve(new Vt(e.slice()))}}/**
2677 * @license
2678 * Copyright 2017 Google LLC
2679 *
2680 * Licensed under the Apache License, Version 2.0 (the "License");
2681 * you may not use this file except in compliance with the License.
2682 * You may obtain a copy of the License at
2683 *
2684 *   http://www.apache.org/licenses/LICENSE-2.0
2685 *
2686 * Unless required by applicable law or agreed to in writing, software
2687 * distributed under the License is distributed on an "AS IS" BASIS,
2688 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2689 * See the License for the specific language governing permissions and
2690 * limitations under the License.
2691 */function jj(t,e,n){if(!n)throw new je(ye.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function jU(t,e,n,s){if(e===!0&&s===!0)throw new je(ye.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function Bk(t){if(!Ve.isDocumentKey(t))throw new je(ye.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function Kk(t){if(Ve.isDocumentKey(t))throw new je(ye.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Aj(t){return typeof t=="object"&&t!==null&&(Object.getPrototypeOf(t)===Object.prototype||Object.getPrototypeOf(t)===null)}function Lp(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(s){return s.constructor?s.constructor.name:null})(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":We(12329,{type:typeof t})}function Vs(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new je(ye.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Lp(t);throw new je(ye.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}function AU(t,e){if(e<=0)throw new je(ye.INVALID_ARGUMENT,`Function ${t}() requires a positive number, but it was: ${e}.`)}/**
2692 * @license
2693 * Copyright 2025 Google LLC
2694 *
2695 * Licensed under the Apache License, Version 2.0 (the "License");
2696 * you may not use this file except in compliance with the License.
2697 * You may obtain a copy of the License at
2698 *
2699 *   http://www.apache.org/licenses/LICENSE-2.0
2700 *
2701 * Unless required by applicable law or agreed to in writing, software
2702 * distributed under the License is distributed on an "AS IS" BASIS,
2703 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2704 * See the License for the specific language governing permissions and
2705 * limitations under the License.
2706 */function Nn(t,e){const n={typeString:t};return e&&(n.value=e),n}function bh(t,e){if(!Aj(t))throw new je(ye.INVALID_ARGUMENT,"JSON must be an object");let n;for(const s in e)if(e[s]){const a=e[s].typeString,c="value"in e[s]?{value:e[s].value}:void 0;if(!(s in t)){n=`JSON missing required field: '${s}'`;break}const u=t[s];if(a&&typeof u!==a){n=`JSON field '${s}' must be a ${a}.`;break}if(c!==void 0&&u!==c.value){n=`Expected '${s}' field to equal '${c.value}'`;break}}if(n)throw new je(ye.INVALID_ARGUMENT,n);return!0}/**
2707 * @license
2708 * Copyright 2017 Google LLC
2709 *
2710 * Licensed under the Apache License, Version 2.0 (the "License");
2711 * you may not use this file except in compliance with the License.
2712 * You may obtain a copy of the License at
2713 *
2714 *   http://www.apache.org/licenses/LICENSE-2.0
2715 *
2716 * Unless required by applicable law or agreed to in writing, software
2717 * distributed under the License is distributed on an "AS IS" BASIS,
2718 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2719 * See the License for the specific language governing permissions and
2720 * limitations under the License.
2721 */const $k=-62135596800,qk=1e6;class Ut{static now(){return Ut.fromMillis(Date.now())}static fromDate(e){return Ut.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),s=Math.floor((e-1e3*n)*qk);return new Ut(n,s)}constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new je(ye.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new je(ye.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<$k)throw new je(ye.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new je(ye.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/qk}_compareTo(e){return this.seconds===e.seconds?gt(this.nanoseconds,e.nanoseconds):gt(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:Ut._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(bh(e,Ut._jsonSchema))return new Ut(e.seconds,e.nanoseconds)}valueOf(){const e=this.seconds-$k;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}Ut._jsonSchemaVersion="firestore/timestamp/1.0",Ut._jsonSchema={type:Nn("string",Ut._jsonSchemaVersion),seconds:Nn("number"),nanoseconds:Nn("number")};/**
2722 * @license
2723 * Copyright 2017 Google LLC
2724 *
2725 * Licensed under the Apache License, Version 2.0 (the "License");
2726 * you may not use this file except in compliance with the License.
2727 * You may obtain a copy of the License at
2728 *
2729 *   http://www.apache.org/licenses/LICENSE-2.0
2730 *
2731 * Unless required by applicable law or agreed to in writing, software
2732 * distributed under the License is distributed on an "AS IS" BASIS,
2733 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2734 * See the License for the specific language governing permissions and
2735 * limitations under the License.
2736 */class Je{static fromTimestamp(e){return new Je(e)}static min(){return new Je(new Ut(0,0))}static max(){return new Je(new Ut(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}}/**
2737 * @license
2738 * Copyright 2021 Google LLC
2739 *
2740 * Licensed under the Apache License, Version 2.0 (the "License");
2741 * you may not use this file except in compliance with the License.
2742 * You may obtain a copy of the License at
2743 *
2744 *   http://www.apache.org/licenses/LICENSE-2.0
2745 *
2746 * Unless required by applicable law or agreed to in writing, software
2747 * distributed under the License is distributed on an "AS IS" BASIS,
2748 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2749 * See the License for the specific language governing permissions and
2750 * limitations under the License.
2751 */const Yd=-1;function CU(t,e){const n=t.toTimestamp().seconds,s=t.toTimestamp().nanoseconds+1,a=Je.fromTimestamp(s===1e9?new Ut(n+1,0):new Ut(n,s));return new eo(a,Ve.empty(),e)}function RU(t){return new eo(t.readTime,t.key,Yd)}class eo{constructor(e,n,s){this.readTime=e,this.documentKey=n,this.largestBatchId=s}static min(){return new eo(Je.min(),Ve.empty(),Yd)}static max(){return new eo(Je.max(),Ve.empty(),Yd)}}function IU(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=Ve.comparator(t.documentKey,e.documentKey),n!==0?n:gt(t.largestBatchId,e.largestBatchId))}/**
2752 * @license
2753 * Copyright 2020 Google LLC
2754 *
2755 * Licensed under the Apache License, Version 2.0 (the "License");
2756 * you may not use this file except in compliance with the License.
2757 * You may obtain a copy of the License at
2758 *
2759 *   http://www.apache.org/licenses/LICENSE-2.0
2760 *
2761 * Unless required by applicable law or agreed to in writing, software
2762 * distributed under the License is distributed on an "AS IS" BASIS,
2763 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2764 * See the License for the specific language governing permissions and
2765 * limitations under the License.
2766 */const MU="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class PU{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach((e=>e()))}}/**
2767 * @license
2768 * Copyright 2017 Google LLC
2769 *
2770 * Licensed under the Apache License, Version 2.0 (the "License");
2771 * you may not use this file except in compliance with the License.
2772 * You may obtain a copy of the License at
2773 *
2774 *   http://www.apache.org/licenses/LICENSE-2.0
2775 *
2776 * Unless required by applicable law or agreed to in writing, software
2777 * distributed under the License is distributed on an "AS IS" BASIS,
2778 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2779 * See the License for the specific language governing permissions and
2780 * limitations under the License.
2781 */async function ou(t){if(t.code!==ye.FAILED_PRECONDITION||t.message!==MU)throw t;Ie("LocalStore","Unexpectedly lost primary lease")}/**
2782 * @license
2783 * Copyright 2017 Google LLC
2784 *
2785 * Licensed under the Apache License, Version 2.0 (the "License");
2786 * you may not use this file except in compliance with the License.
2787 * You may obtain a copy of the License at
2788 *
2789 *   http://www.apache.org/licenses/LICENSE-2.0
2790 *
2791 * Unless required by applicable law or agreed to in writing, software
2792 * distributed under the License is distributed on an "AS IS" BASIS,
2793 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2794 * See the License for the specific language governing permissions and
2795 * limitations under the License.
2796 */class ve{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&&We(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new ve(((s,a)=>{this.nextCallback=c=>{this.wrapSuccess(e,c).next(s,a)},this.catchCallback=c=>{this.wrapFailure(n,c).next(s,a)}}))}toPromise(){return new Promise(((e,n)=>{this.next(e,n)}))}wrapUserFunction(e){try{const n=e();return n instanceof ve?n:ve.resolve(n)}catch(n){return ve.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction((()=>e(n))):ve.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction((()=>e(n))):ve.reject(n)}static resolve(e){return new ve(((n,s)=>{n(e)}))}static reject(e){return new ve(((n,s)=>{s(e)}))}static waitFor(e){return new ve(((n,s)=>{let a=0,c=0,u=!1;e.forEach((h=>{++a,h.next((()=>{++c,u&&c===a&&n()}),(m=>s(m)))})),u=!0,c===a&&n()}))}static or(e){let n=ve.resolve(!1);for(const s of e)n=n.next((a=>a?ve.resolve(a):s()));return n}static forEach(e,n){const s=[];
2796return e.forEach(((a,c)=>{s.push(n.call(this,a,c))})),this.waitFor(s)}static mapArray(e,n){return new ve(((s,a)=>{const c=e.length,u=new Array(c);let h=0;for(let m=0;m<c;m++){const p=m;n(e[p]).next((b=>{u[p]=b,++h,h===c&&s(u)}),(b=>a(b)))}}))}static doWhile(e,n){return new ve(((s,a)=>{const c=()=>{e()===!0?n().next((()=>{c()}),a):s()};c()}))}}function DU(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function lu(t){return t.name==="IndexedDbTransactionError"}/**
2797 * @license
2798 * Copyright 2018 Google LLC
2799 *
2800 * Licensed under the Apache License, Version 2.0 (the "License");
2801 * you may not use this file except in compliance with the License.
2802 * You may obtain a copy of the License at
2803 *
2804 *   http://www.apache.org/licenses/LICENSE-2.0
2805 *
2806 * Unless required by applicable law or agreed to in writing, software
2807 * distributed under the License is distributed on an "AS IS" BASIS,
2808 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2809 * See the License for the specific language governing permissions and
2810 * limitations under the License.
2811 */class Up{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=s=>this.ae(s),this.ue=s=>n.writeSequenceNumber(s))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.ue&&this.ue(e),e}}Up.ce=-1;/**
2812 * @license
2813 * Copyright 2017 Google LLC
2814 *
2815 * Licensed under the Apache License, Version 2.0 (the "License");
2816 * you may not use this file except in compliance with the License.
2817 * You may obtain a copy of the License at
2818 *
2819 *   http://www.apache.org/licenses/LICENSE-2.0
2820 *
2821 * Unless required by applicable law or agreed to in writing, software
2822 * distributed under the License is distributed on an "AS IS" BASIS,
2823 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2824 * See the License for the specific language governing permissions and
2825 * limitations under the License.
2826 */const Jv=-1;function Fp(t){return t==null}function Qm(t){return t===0&&1/t==-1/0}function OU(t){return typeof t=="number"&&Number.isInteger(t)&&!Qm(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
2827 * @license
2828 * Copyright 2017 Google LLC
2829 *
2830 * Licensed under the Apache License, Version 2.0 (the "License");
2831 * you may not use this file except in compliance with the License.
2832 * You may obtain a copy of the License at
2833 *
2834 *   http://www.apache.org/licenses/LICENSE-2.0
2835 *
2836 * Unless required by applicable law or agreed to in writing, software
2837 * distributed under the License is distributed on an "AS IS" BASIS,
2838 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2839 * See the License for the specific language governing permissions and
2840 * limitations under the License.
2841 */const Cj="�";function LU(t){let e="";for(let n=0;n<t.length;n++)e.length>0&&(e=Hk(e)),e=UU(t.get(n),e);return Hk(e)}function UU(t,e){let n=e;const s=t.length;for(let a=0;a<s;a++){const c=t.charAt(a);switch(c){case"\0":n+="��";break;case Cj:n+="��";break;default:n+=c}}return n}function Hk(t){return t+Cj+"�"}/**
2842 * @license
2843 * Copyright 2017 Google LLC
2844 *
2845 * Licensed under the Apache License, Version 2.0 (the "License");
2846 * you may not use this file except in compliance with the License.
2847 * You may obtain a copy of the License at
2848 *
2849 *   http://www.apache.org/licenses/LICENSE-2.0
2850 *
2851 * Unless required by applicable law or agreed to in writing, software
2852 * distributed under the License is distributed on an "AS IS" BASIS,
2853 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2854 * See the License for the specific language governing permissions and
2855 * limitations under the License.
2856 */function Gk(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function lo(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Rj(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
2857 * @license
2858 * Copyright 2017 Google LLC
2859 *
2860 * Licensed under the Apache License, Version 2.0 (the "License");
vendor: 5,212 bytes, lines 2861-2871
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 */class Qt{constructor(e,n){this.comparator=e,this.root=n||$n.EMPTY}insert(e,n){return new Qt(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,$n.BLACK,null,null))}remove(e){return new Qt(this.comparator,this.root.remove(e,this.comparator).copy(null,null,$n.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const s=this.comparator(e,n.key);if(s===0)return n.value;s<0?n=n.left:s>0&&(n=n.right)}return null}indexOf(e){let n=0,s=this.root;for(;!s.isEmpty();){const a=this.comparator(e,s.key);if(a===0)return n+s.left.size;a<0?s=s.left:(n+=s.left.size+1,s=s.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,s)=>(e(n,s),!1)))}toString(){const e=[];return this.inorderTraversal(((n,s)=>(e.push(`${n}:${s}`),!1))),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new rm(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new rm(this.root,e,this.comparator,!1)}getReverseIterator(){return new rm(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new rm(this.root,e,this.comparator,!0)}}class rm{constructor(e,n,s,a){this.isReverse=a,this.nodeStack=[];let c=1;for(;!e.isEmpty();)if(c=n?s(e.key,n):1,n&&a&&(c*=-1),c<0)e=this.isReverse?e.left:e.right;else{if(c===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 $n{constructor(e,n,s,a,c){this.key=e,this.value=n,this.color=s??$n.RED,this.left=a??$n.EMPTY,this.right=c??$n.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,s,a,c){return new $n(e??this.key,n??this.value,s??this.color,a??this.left,c??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,s){let a=this;const c=s(e,a.key);return a=c<0?a.copy(null,null,null,a.left.insert(e,n,s),null):c===0?a.copy(null,n,null,null,null):a.copy(null,null,null,null,a.right.insert(e,n,s)),a.fixUp()}removeMin(){if(this.left.isEmpty())return $n.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 s,a=this;if(n(e,a.key)<0)a.left.isEmpty()||a.left.isRed()||a.left.left.isRed()||(a=a.moveRedLeft()),a=a.copy(null,null,null,a.left.remove(e,n),null);else{if(a.left.isRed()&&(a=a.rotateRight()),a.right.isEmpty()||a.right.isRed()||a.right.left.isRed()||(a=a.moveRedRight()),n(e,a.key)===0){if(a.right.isEmpty())return $n.EMPTY;s=a.right.min(),a=a.copy(s.key,s.value,null,null,a.right.removeMin())}a=a.copy(null,null,null,null,a.right.remove(e,n))}return a.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,$n.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,$n.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 We(43730,{key:this.key,value:this.value});if(this.right.isRed())throw We(14113,{key:this.key,value:this.value});const e=this.left.check();if(e!==this.right.check())throw We(27949);return e+(this.isRed()?0:1)}}$n.EMPTY=null,$n.RED=!0,$n.BLACK=!1;
vendor: 4,232 bytes, lines 2871-2915
2871$n.EMPTY=new class{constructor(){this.size=0}get key(){throw We(57766)}get value(){throw We(16141)}get color(){throw We(16727)}get left(){throw We(29726)}get right(){throw We(36894)}copy(e,n,s,a,c){return this}insert(e,n,s){return new $n(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}};/**
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 Rn{constructor(e){this.comparator=e,this.data=new Qt(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,s)=>(e(n),!1)))}forEachInRange(e,n){const s=this.data.getIteratorFrom(e[0]);for(;s.hasNext();){const a=s.getNext();if(this.comparator(a.key,e[1])>=0)return;n(a.key)}}forEachWhile(e,n){let s;for(s=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();s.hasNext();)if(!e(s.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new Yk(this.data.getIterator())}getIteratorFrom(e){return new Yk(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((s=>{n=n.add(s)})),n}isEqual(e){if(!(e instanceof Rn)||this.size!==e.size)return!1;const n=this.data.getIterator(),s=e.data.getIterator();for(;n.hasNext();){const a=n.getNext().key,c=s.getNext().key;if(this.comparator(a,c)!==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 Rn(this.comparator);return n.data=e,n}}class Yk{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
2887 * @license
2888 * Copyright 2020 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 Ls{constructor(e){this.fields=e,e.sort(Hn.comparator)}static empty(){return new Ls([])}unionWith(e){let n=new Rn(Hn.comparator);for(const s of this.fields)n=n.add(s);for(const s of e)n=n.add(s);return new Ls(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return qc(this.fields,e.fields,((n,s)=>n.isEqual(s)))}}/**
2902 * @license
2903 * Copyright 2023 Google LLC
2904 *
2905 * Licensed under the Apache License, Version 2.0 (the "License");
2906 * you may not use this file except in compliance with the License.
2907 * You may obtain a copy of the License at
2908 *
2909 *   http://www.apache.org/licenses/LICENSE-2.0
2910 *
2911 * Unless required by applicable law or agreed to in writing, software
2912 * distributed under the License is distributed on an "AS IS" BASIS,
2913 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2914 * See the License for the specific language governing permissions and
2915 * limitations under the License.
2916 */class Ij extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
2917 * @license
2918 * Copyright 2020 Google LLC
2919 *
2920 * Licensed under the Apache License, Version 2.0 (the "License");
2921 * you may not use this file except in compliance with the License.
2922 * You may obtain a copy of the License at
2923 *
2924 *   http://www.apache.org/licenses/LICENSE-2.0
2925 *
2926 * Unless required by applicable law or agreed to in writing, software
2927 * distributed under the License is distributed on an "AS IS" BASIS,
2928 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2929 * See the License for the specific language governing permissions and
2930 * limitations under the License.
2931 */class Wn{constructor(e){this.binaryString=e}static fromBase64String(e){const n=(function(a){try{return atob(a)}catch(c){throw typeof DOMException<"u"&&c instanceof DOMException?new Ij("Invalid base64 string: "+c):c}})(e);return new Wn(n)}static fromUint8Array(e){const n=(function(a){let c="";for(let u=0;u<a.length;++u)c+=String.fromCharCode(a[u]);return c})(e);return new Wn(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 s=new Uint8Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);return s})(this.binaryString)}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return gt(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}Wn.EMPTY_BYTE_STRING=new Wn("");const FU=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function to(t){if(At(!!t,39018),typeof t=="string"){let e=0;const n=FU.exec(t);if(At(!!n,46558,{timestamp:t}),n[1]){let a=n[1];a=(a+"000000000").substr(0,9),e=Number(a)}const s=new Date(t);return{seconds:Math.floor(s.getTime()/1e3),nanos:e}}return{seconds:dn(t.seconds),nanos:dn(t.nanos)}}function dn(t){return typeof t=="number"?t:typeof t=="string"?Number(t):0}function no(t){return typeof t=="string"?Wn.fromBase64String(t):Wn.fromUint8Array(t)}/**
2932 * @license
2933 * Copyright 2020 Google LLC
2934 *
2935 * Licensed under the Apache License, Version 2.0 (the "License");
2936 * you may not use this file except in compliance with the License.
2937 * You may obtain a copy of the License at
2938 *
2939 *   http://www.apache.org/licenses/LICENSE-2.0
2940 *
2941 * Unless required by applicable law or agreed to in writing, software
2942 * distributed under the License is distributed on an "AS IS" BASIS,
2943 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2944 * See the License for the specific language governing permissions and
2945 * limitations under the License.
2946 */const Mj="server_timestamp",Pj="__type__",Dj="__previous_value__",Oj="__local_write_time__";function Vp(t){var n,s;return((s=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[Pj])==null?void 0:s.stringValue)===Mj}function zp(t){const e=t.mapValue.fields[Dj];return Vp(e)?zp(e):e}function Wd(t){const e=to(t.mapValue.fields[Oj].timestampValue);return new Ut(e.seconds,e.nanos)}/**
2947 * @license
2948 * Copyright 2017 Google LLC
2949 *
2950 * Licensed under the Apache License, Version 2.0 (the "License");
2951 * you may not use this file except in compliance with the License.
2952 * You may obtain a copy of the License at
2953 *
2954 *   http://www.apache.org/licenses/LICENSE-2.0
2955 *
2956 * Unless required by applicable law or agreed to in writing, software
2957 * distributed under the License is distributed on an "AS IS" BASIS,
2958 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2959 * See the License for the specific language governing permissions and
2960 * limitations under the License.
2961 */class VU{constructor(e,n,s,a,c,u,h,m,p,b,x){this.databaseId=e,this.appId=n,this.persistenceKey=s,this.host=a,this.ssl=c,this.forceLongPolling=u,this.autoDetectLongPolling=h,this.longPollingOptions=m,this.useFetchStreams=p,this.isUsingEmulator=b,this.apiKey=x}}const Jm="(default)";class Xd{constructor(e,n){this.projectId=e,this.database=n||Jm}static empty(){return new Xd("","")}get isDefaultDatabase(){return this.database===Jm}isEqual(e){return e instanceof Xd&&e.projectId===this.projectId&&e.database===this.database}}function zU(t,e){if(!Object.prototype.hasOwnProperty.apply(t.options,["projectId"]))throw new je(ye.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Xd(t.options.projectId,e)}/**
2962 * @license
2963 * Copyright 2020 Google LLC
2964 *
2965 * Licensed under the Apache License, Version 2.0 (the "License");
2966 * you may not use this file except in compliance with the License.
2967 * You may obtain a copy of the License at
2968 *
2969 *   http://www.apache.org/licenses/LICENSE-2.0
2970 *
2971 * Unless required by applicable law or agreed to in writing, software
2972 * distributed under the License is distributed on an "AS IS" BASIS,
2973 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2974 * See the License for the specific language governing permissions and
2975 * limitations under the License.
2976 */const Lj="__type__",BU="__max__",im={mapValue:{}},Uj="__vector__",Zm="value";function so(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?Vp(t)?4:$U(t)?9007199254740991:KU(t)?10:11:We(28295,{value:t})}function ui(t,e){if(t===e)return!0;const n=so(t);if(n!==so(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Wd(t).isEqual(Wd(e));case 3:return(function(a,c){if(typeof a.timestampValue=="string"&&typeof c.timestampValue=="string"&&a.timestampValue.length===c.timestampValue.length)return a.timestampValue===c.timestampValue;const u=to(a.timestampValue),h=to(c.timestampValue);return u.seconds===h.seconds&&u.nanos===h.nanos})(t,e);case 5:return t.stringValue===e.stringValue;case 6:return(function(a,c){return no(a.bytesValue).isEqual(no(c.bytesValue))})(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return(function(a,c){return dn(a.geoPointValue.latitude)===dn(c.geoPointValue.latitude)&&dn(a.geoPointValue.longitude)===dn(c.geoPointValue.longitude)})(t,e);case 2:return(function(a,c){if("integerValue"in a&&"integerValue"in c)return dn(a.integerValue)===dn(c.integerValue);if("doubleValue"in a&&"doubleValue"in c){const u=dn(a.doubleValue),h=dn(c.doubleValue);return u===h?Qm(u)===Qm(h):isNaN(u)&&isNaN(h)}return!1})(t,e);case 9:return qc(t.arrayValue.values||[],e.arrayValue.values||[],ui);case 10:case 11:return(function(a,c){const u=a.mapValue.fields||{},h=c.mapValue.fields||{};if(Gk(u)!==Gk(h))return!1;for(const m in u)if(u.hasOwnProperty(m)&&(h[m]===void 0||!ui(u[m],h[m])))return!1;return!0})(t,e);default:return We(52216,{left:t})}}function Qd(t,e){return(t.values||[]).find((n=>ui(n,e)))!==void 0}function Hc(t,e){if(t===e)return 0;const n=so(t),s=so(e);if(n!==s)return gt(n,s);switch(n){case 0:case 9007199254740991:return 0;case 1:return gt(t.booleanValue,e.booleanValue);case 2:return(function(c,u){const h=dn(c.integerValue||c.doubleValue),m=dn(u.integerValue||u.doubleValue);return h<m?-1:h>m?1:h===m?0:isNaN(h)?isNaN(m)?0:-1:1})(t,e);case 3:return Wk(t.timestampValue,e.timestampValue);case 4:return Wk(Wd(t),Wd(e));case 5:return Ux(t.stringValue,e.stringValue);case 6:return(function(c,u){const h=no(c),m=no(u);return h.compareTo(m)})(t.bytesValue,e.bytesValue);case 7:return(function(c,u){const h=c.split("/"),m=u.split("/");for(let p=0;p<h.length&&p<m.length;p++){const b=gt(h[p],m[p]);if(b!==0)return b}return gt(h.length,m.length)})(t.referenceValue,e.referenceValue);case 8:return(function(c,u){const h=gt(dn(c.latitude),dn(u.latitude));return h!==0?h:gt(dn(c.longitude),dn(u.longitude))})(t.geoPointValue,e.geoPointValue);case 9:return Xk(t.arrayValue,e.arrayValue);case 10:return(function(c,u){var w,T,N,j;const h=c.fields||{},m=u.fields||{},p=(w=h[Zm])==null?void 0:w.arrayValue,b=(T=m[Zm])==null?void 0:T.arrayValue,x=gt(((N=p==null?void 0:p.values)==null?void 0:N.length)||0,((j=b==null?void 0:b.values)==null?void 0:j.length)||0);return x!==0?x:Xk(p,b)})(t.mapValue,e.mapValue);case 11:return(function(c,u){if(c===im.mapValue&&u===im.mapValue)return 0;if(c===im.mapValue)return 1;if(u===im.mapValue)return-1;const h=c.fields||{},m=Object.keys(h),p=u.fields||{},b=Object.keys(p);m.sort(),b.sort();for(let x=0;x<m.length&&x<b.length;++x){const w=Ux(m[x],b[x]);if(w!==0)return w;const T=Hc(h[m[x]],p[b[x]]);if(T!==0)return T}return gt(m.length,b.length)})(t.mapValue,e.mapValue);default:throw We(23264,{he:n})}}function Wk(t,e){if(typeof t=="string"&&typeof e=="string"&&t.length===e.length)return gt(t,e);const n=to(t),s=to(e),a=gt(n.seconds,s.seconds);return a!==0?a:gt(n.nanos,s.nanos)}function Xk(t,e){const n=t.values||[],s=e.values||[];for(let a=0;a<n.length&&a<s.length;++a){const c=Hc(n[a],s[a]);if(c)return c}return gt(n.length,s.length)}function Gc(t){return Fx(t)}function Fx(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 s=to(n);return`time(${s.seconds},${s.nanos})`})(t.timestampValue):"stringValue"in t?t.stringValue:"bytesValue"in t?(function(n){return no(n).toBase64()})(t.bytesValue):"referenceValue"in t?(function(n){return Ve.fromName(n).toString()})(t.referenceValue):"geoPointValue"in t?(function(n){return`geo(${n.latitude},${n.longitude})`})(t.geoPointValue):"arrayValue"in t?(function(n){let s="[",a=!0;for(const c of n.values||[])a?a=!1:s+=",",s+=Fx(c);return s+"]"})(t.arrayValue):"mapValue"in t?(function(n){const s=Object.keys(n.fields||{}).sort();let a="{",c=!0;for(const u of s)c?c=!1:a+=",",a+=`${u}:${Fx(n.fields[u])}`;return a+"}"})(t.mapValue):We(61005,{value:t})}function Cm(t){switch(so(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:const e=zp(t);return e?16+Cm(e):16;case 5:return 2*t.stringValue.length;case 6:return no(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(function(s){return(s.values||[]).reduce(((a,c)=>a+Cm(c)),0)})(t.arrayValue);case 10:case 11:return(function(s){let a=0;
vendor: 3,006 bytes, lines 2976-2991
2976return lo(s.fields,((c,u)=>{a+=c.length+Cm(u)})),a})(t.mapValue);default:throw We(13486,{value:t})}}function ep(t,e){return{referenceValue:`projects/${t.projectId}/databases/${t.database}/documents/${e.path.canonicalString()}`}}function Vx(t){return!!t&&"integerValue"in t}function Zv(t){return!!t&&"arrayValue"in t}function Qk(t){return!!t&&"nullValue"in t}function Jk(t){return!!t&&"doubleValue"in t&&isNaN(Number(t.doubleValue))}function Rm(t){return!!t&&"mapValue"in t}function KU(t){var n,s;return((s=(((n=t==null?void 0:t.mapValue)==null?void 0:n.fields)||{})[Lj])==null?void 0:s.stringValue)===Uj}function Md(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 lo(t.mapValue.fields,((n,s)=>e.mapValue.fields[n]=Md(s))),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=Md(t.arrayValue.values[n]);return e}return{...t}}function $U(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue===BU}/**
2977 * @license
2978 * Copyright 2017 Google LLC
2979 *
2980 * Licensed under the Apache License, Version 2.0 (the "License");
2981 * you may not use this file except in compliance with the License.
2982 * You may obtain a copy of the License at
2983 *
2984 *   http://www.apache.org/licenses/LICENSE-2.0
2985 *
2986 * Unless required by applicable law or agreed to in writing, software
2987 * distributed under the License is distributed on an "AS IS" BASIS,
2988 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2989 * See the License for the specific language governing permissions and
2990 * limitations under the License.
2991 */class _s{constructor(e){this.value=e}static empty(){return new _s({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let s=0;s<e.length-1;++s)if(n=(n.mapValue.fields||{})[e.get(s)],!Rm(n))return null;return n=(n.mapValue.fields||{})[e.lastSegment()],n||null}}set(e,n){this.getFieldsMap(e.popLast())[e.lastSegment()]=Md(n)}setAll(e){let n=Hn.emptyPath(),s={},a=[];e.forEach(((u,h)=>{if(!n.isImmediateParentOf(h)){const m=this.getFieldsMap(n);this.applyChanges(m,s,a),s={},a=[],n=h.popLast()}u?s[h.lastSegment()]=Md(u):a.push(h.lastSegment())}));const c=this.getFieldsMap(n);this.applyChanges(c,s,a)}delete(e){const n=this.field(e.popLast());Rm(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return ui(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let s=0;s<e.length;++s){let a=n.mapValue.fields[e.get(s)];Rm(a)&&a.mapValue.fields||(a={mapValue:{fields:{}}},n.mapValue.fields[e.get(s)]=a),n=a}return n.mapValue.fields}applyChanges(e,n,s){lo(n,((a,c)=>e[a]=c));for(const a of s)delete e[a]}clone(){return new _s(Md(this.value))}}function Fj(t){const e=[];return lo(t.fields,((n,s)=>{const a=new Hn([n]);if(Rm(s)){const c=Fj(s.mapValue).fields;
vendor: 4,181 bytes, lines 2991-3031
2991if(c.length===0)e.push(a);else for(const u of c)e.push(a.child(u))}else e.push(a)})),new Ls(e)}/**
2992 * @license
2993 * Copyright 2017 Google LLC
2994 *
2995 * Licensed under the Apache License, Version 2.0 (the "License");
2996 * you may not use this file except in compliance with the License.
2997 * You may obtain a copy of the License at
2998 *
2999 *   http://www.apache.org/licenses/LICENSE-2.0
3000 *
3001 * Unless required by applicable law or agreed to in writing, software
3002 * distributed under the License is distributed on an "AS IS" BASIS,
3003 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3004 * See the License for the specific language governing permissions and
3005 * limitations under the License.
3006 */class ts{constructor(e,n,s,a,c,u,h){this.key=e,this.documentType=n,this.version=s,this.readTime=a,this.createTime=c,this.data=u,this.documentState=h}static newInvalidDocument(e){return new ts(e,0,Je.min(),Je.min(),Je.min(),_s.empty(),0)}static newFoundDocument(e,n,s,a){return new ts(e,1,n,Je.min(),s,a,0)}static newNoDocument(e,n){return new ts(e,2,n,Je.min(),Je.min(),_s.empty(),0)}static newUnknownDocument(e,n){return new ts(e,3,n,Je.min(),Je.min(),_s.empty(),2)}convertToFoundDocument(e,n){return!this.createTime.isEqual(Je.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=_s.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=_s.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=Je.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 ts&&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 ts(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}})`}}/**
3007 * @license
3008 * Copyright 2022 Google LLC
3009 *
3010 * Licensed under the Apache License, Version 2.0 (the "License");
3011 * you may not use this file except in compliance with the License.
3012 * You may obtain a copy of the License at
3013 *
3014 *   http://www.apache.org/licenses/LICENSE-2.0
3015 *
3016 * Unless required by applicable law or agreed to in writing, software
3017 * distributed under the License is distributed on an "AS IS" BASIS,
3018 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3019 * See the License for the specific language governing permissions and
3020 * limitations under the License.
3021 */class Yc{constructor(e,n){this.position=e,this.inclusive=n}}function Zk(t,e,n){let s=0;for(let a=0;a<t.position.length;a++){const c=e[a],u=t.position[a];if(c.field.isKeyField()?s=Ve.comparator(Ve.fromName(u.referenceValue),n.key):s=Hc(u,n.data.field(c.field)),c.dir==="desc"&&(s*=-1),s!==0)break}return s}function e2(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(!ui(t.position[n],e.position[n]))return!1;return!0}/**
3022 * @license
3023 * Copyright 2022 Google LLC
3024 *
3025 * Licensed under the Apache License, Version 2.0 (the "License");
3026 * you may not use this file except in compliance with the License.
3027 * You may obtain a copy of the License at
3028 *
3029 *   http://www.apache.org/licenses/LICENSE-2.0
3030 *
3031 * Unless required by applicable law or agreed to in writing, softw
3031are
3032 * distributed under the License is distributed on an "AS IS" BASIS,
3033 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3034 * See the License for the specific language governing permissions and
3035 * limitations under the License.
3036 */class Jd{constructor(e,n="asc"){this.field=e,this.dir=n}}function qU(t,e){return t.dir===e.dir&&t.field.isEqual(e.field)}/**
3037 * @license
3038 * Copyright 2022 Google LLC
3039 *
3040 * Licensed under the Apache License, Version 2.0 (the "License");
3041 * you may not use this file except in compliance with the License.
3042 * You may obtain a copy of the License at
3043 *
3044 *   http://www.apache.org/licenses/LICENSE-2.0
3045 *
3046 * Unless required by applicable law or agreed to in writing, software
3047 * distributed under the License is distributed on an "AS IS" BASIS,
3048 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3049 * See the License for the specific language governing permissions and
3050 * limitations under the License.
3051 */class Vj{}class Sn extends Vj{constructor(e,n,s){super(),this.field=e,this.op=n,this.value=s}static create(e,n,s){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,s):new GU(e,n,s):n==="array-contains"?new XU(e,s):n==="in"?new QU(e,s):n==="not-in"?new JU(e,s):n==="array-contains-any"?new ZU(e,s):new Sn(e,n,s)}static createKeyFieldInFilter(e,n,s){return n==="in"?new YU(e,s):new WU(e,s)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&n.nullValue===void 0&&this.matchesComparison(Hc(n,this.value)):n!==null&&so(this.value)===so(n)&&this.matchesComparison(Hc(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 We(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Cr extends Vj{constructor(e,n){super(),this.filters=e,this.op=n,this.Pe=null}static create(e,n){return new Cr(e,n)}matches(e){return zj(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 zj(t){return t.op==="and"}function Bj(t){return HU(t)&&zj(t)}function HU(t){for(const e of t.filters)if(e instanceof Cr)return!1;return!0}function zx(t){if(t instanceof Sn)return t.field.canonicalString()+t.op.toString()+Gc(t.value);if(Bj(t))return t.filters.map((e=>zx(e))).join(",");{const e=t.filters.map((n=>zx(n))).join(",");return`${t.op}(${e})`}}function Kj(t,e){return t instanceof Sn?(function(s,a){return a instanceof Sn&&s.op===a.op&&s.field.isEqual(a.field)&&ui(s.value,a.value)})(t,e):t instanceof Cr?(function(s,a){return a instanceof Cr&&s.op===a.op&&s.filters.length===a.filters.length?s.filters.reduce(((c,u,h)=>c&&Kj(u,a.filters[h])),!0):!1})(t,e):void We(19439)}function $j(t){return t instanceof Sn?(function(n){return`${n.field.canonicalString()} ${n.op} ${Gc(n.value)}`})(t):t instanceof Cr?(function(n){return n.op.toString()+" {"+n.getFilters().map($j).join(" ,")+"}"})(t):"Filter"}class GU extends Sn{constructor(e,n,s){super(e,n,s),this.key=Ve.fromName(s.referenceValue)}matches(e){const n=Ve.comparator(e.key,this.key);return this.matchesComparison(n)}}class YU extends Sn{constructor(e,n){super(e,"in",n),this.keys=qj("in",n)}matches(e){return this.keys.some((n=>n.isEqual(e.key)))}}class WU extends Sn{constructor(e,n){super(e,"not-in",n),this.keys=qj("not-in",n)}matches(e){return!this.keys.some((n=>n.isEqual(e.key)))}}function qj(t,e){var n;return(((n=e.arrayValue)==null?void 0:n.values)||[]).map((s=>Ve.fromName(s.referenceValue)))}class XU extends Sn{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Zv(n)&&Qd(n.arrayValue,this.value)}}class QU extends Sn{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Qd(this.value.arrayValue,n)}}class JU extends Sn{constructor(e,n){super(e,"not-in",n)}matches(e){if(Qd(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&n.nullValue===void 0&&!Qd(this.value.arrayValue,n)}}class ZU extends Sn{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Zv(n)||!n.arrayValue.values)&&n.arrayValue.values.some((s=>Qd(this.value.arrayValue,s)))}}/**
3052 * @license
3053 * Copyright 2019 Google LLC
3054 *
3055 * Licensed under the Apache License, Version 2.0 (the "License");
3056 * you may not use this file except in compliance with the License.
3057 * You may obtain a copy of the License at
3058 *
3059 *   http://www.apache.org/licenses/LICENSE-2.0
3060 *
3061 * Unless required by applicable law or agreed to in writing, software
3062 * distributed under the License is distributed on an "AS IS" BASIS,
3063 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3064 * See the License for the specific language governing permissions and
3065 * limitations under the License.
3066 */class e9{constructor(e,n=null,s=[],a=[],c=null,u=null,h=null){this.path=e,this.collectionGroup=n,this.orderBy=s,this.filters=a,this.limit=c,this.startAt=u,this.endAt=h,this.Te=null}}function t2(t,e=null,n=[],s=[],a=null,c=null,u=null){return new e9(t,e,n,s,a,c,u)}function e_(t){const e=tt(t);if(e.Te===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map((s=>zx(s))).join(","),n+="|ob:",n+=e.orderBy.map((s=>(function(c){return c.field.canonicalString()+c.dir})(s))).join(","),Fp(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map((s=>Gc(s))).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map((s=>Gc(s))).join(",")),e.Te=n}return e.Te}function t_(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(!qU(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(!Kj(t.filters[n],e.filters[n]))return!1;return t.collectionGroup===e.collectionGroup&&!!t.path.isEqual(e.path)&&!!e2(t.startAt,e.startAt)&&e2(t.endAt,e.endAt)}function Bx(t){return Ve.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}/**
3067 * @license
3068 * Copyright 2017 Google LLC
3069 *
3070 * Licensed under the Apache License, Version 2.0 (the "License");
3071 * you may not use this file except in compliance with the License.
3072 * You may obtain a copy of the License at
3073 *
3074 *   http://www.apache.org/licenses/LICENSE-2.0
3075 *
3076 * Unless required by applicable law or agreed to in writing, software
3077 * distributed under the License is distributed on an "AS IS" BASIS,
3078 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3079 * See the License for the specific language governing permissions and
3080 * limitations under the License.
3081 */class pl{constructor(e,n=null,s=[],a=[],c=null,u="F",h=null,m=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=s,this.filters=a,this.limit=c,this.limitType=u,this.startAt=h,this.endAt=m,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}}function t9(t,e,n,s,a,c,u,h){return new pl(t,e,n,s,a,c,u,h)}function Bp(t){return new pl(t)}function n2(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 n9(t){return Ve.isDocumentKey(t.path)&&t.collectionGroup===null&&t.filters.length===0}function n_(t){return t.collectionGroup!==null}function Dc(t){const e=tt(t);if(e.Ie===null){e.Ie=[];const n=new Set;for(const c of e.explicitOrderBy)e.Ie.push(c),n.add(c.field.canonicalString());const s=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(u){let h=new Rn(Hn.comparator);return u.filters.forEach((m=>{m.getFlattenedFilters().forEach((p=>{p.isInequality()&&(h=h.add(p.field))}))})),h})(e).forEach((c=>{n.has(c.canonicalString())||c.isKeyField()||e.Ie.push(new Jd(c,s))})),n.has(Hn.keyField().canonicalString())||e.Ie.push(new Jd(Hn.keyField(),s))}return e.Ie}function ai(t){const e=tt(t);return e.Ee||(e.Ee=s9(e,Dc(t))),e.Ee}function s9(t,e){if(t.limitType==="F")return t2(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map((a=>{const c=a.dir==="desc"?"asc":"desc";return new Jd(a.field,c)}));const n=t.endAt?new Yc(t.endAt.position,t.endAt.inclusive):null,s=t.startAt?new Yc(t.startAt.position,t.startAt.inclusive):null;return t2(t.path,t.collectionGroup,e,t.filters,t.limit,n,s)}}function Kx(t,e){const n=t.filters.concat([e]);return new pl(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function r9(t,e){const n=t.explicitOrderBy.concat([e]);return new pl(t.path,t.collectionGroup,n,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)}function tp(t,e,n){return new pl(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function i9(t,e){return new pl(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,e,t.endAt)}function Kp(t,e){return t_(ai(t),ai(e))&&t.limitType===e.limitType}function Hj(t){return`${e_(ai(t))}|lt:${t.limitType}`}function kc(t){return`Query(target=${(function(n){let s=n.path.canonicalString();return n.collectionGroup!==null&&(s+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(s+=`, filters: [${n.filters.map((a=>$j(a))).join(", ")}]`),Fp(n.limit)||(s+=", limit: "+n.limit),n.orderBy.length>0&&(s+=`, orderBy: [${n.orderBy.map((a=>(function(u){return`${u.field.canonicalString()} (${u.dir})`})(a))).join(", ")}]`),n.startAt&&(s+=", startAt: ",s+=n.startAt.inclusive?"b:":"a:",s+=n.startAt.position.map((a=>Gc(a))).join(",")),n.endAt&&(s+=", endAt: ",s+=n.endAt.inclusive?"a:":"b:",s+=n.endAt.position.map((a=>Gc(a))).join(",")),`Target(${s})`})(ai(t))}; limitType=${t.limitType})`}
3081function $p(t,e){return e.isFoundDocument()&&(function(s,a){const c=a.key.path;return s.collectionGroup!==null?a.key.hasCollectionId(s.collectionGroup)&&s.path.isPrefixOf(c):Ve.isDocumentKey(s.path)?s.path.isEqual(c):s.path.isImmediateParentOf(c)})(t,e)&&(function(s,a){for(const c of Dc(s))if(!c.field.isKeyField()&&a.data.field(c.field)===null)return!1;return!0})(t,e)&&(function(s,a){for(const c of s.filters)if(!c.matches(a))return!1;return!0})(t,e)&&(function(s,a){return!(s.startAt&&!(function(u,h,m){const p=Zk(u,h,m);return u.inclusive?p<=0:p<0})(s.startAt,Dc(s),a)||s.endAt&&!(function(u,h,m){const p=Zk(u,h,m);return u.inclusive?p>=0:p>0})(s.endAt,Dc(s),a))})(t,e)}function a9(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Gj(t){return(e,n)=>{let s=!1;for(const a of Dc(t)){const c=o9(a,e,n);if(c!==0)return c;s=s||a.field.isKeyField()}return 0}}function o9(t,e,n){const s=t.field.isKeyField()?Ve.comparator(e.key,n.key):(function(c,u,h){const m=u.data.field(c),p=h.data.field(c);return m!==null&&p!==null?Hc(m,p):We(42886)})(t.field,e,n);switch(t.dir){case"asc":return s;case"desc":return-1*s;default:return We(19790,{direction:t.dir})}}/**
3082 * @license
3083 * Copyright 2017 Google LLC
3084 *
3085 * Licensed under the Apache License, Version 2.0 (the "License");
3086 * you may not use this file except in compliance with the License.
3087 * You may obtain a copy of the License at
3088 *
3089 *   http://www.apache.org/licenses/LICENSE-2.0
3090 *
3091 * Unless required by applicable law or agreed to in writing, software
3092 * distributed under the License is distributed on an "AS IS" BASIS,
3093 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3094 * See the License for the specific language governing permissions and
3095 * limitations under the License.
3096 */class gl{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),s=this.inner[n];if(s!==void 0){for(const[a,c]of s)if(this.equalsFn(a,e))return c}}has(e){return this.get(e)!==void 0}set(e,n){const s=this.mapKeyFn(e),a=this.inner[s];if(a===void 0)return this.inner[s]=[[e,n]],void this.innerSize++;for(let c=0;c<a.length;c++)if(this.equalsFn(a[c][0],e))return void(a[c]=[e,n]);a.push([e,n]),this.innerSize++}delete(e){const n=this.mapKeyFn(e),s=this.inner[n];if(s===void 0)return!1;for(let a=0;a<s.length;a++)if(this.equalsFn(s[a][0],e))return s.length===1?delete this.inner[n]:s.splice(a,1),this.innerSize--,!0;return!1}forEach(e){lo(this.inner,((n,s)=>{for(const[a,c]of s)e(a,c)}))}isEmpty(){return Rj(this.inner)}size(){return this.innerSize}}/**
3097 * @license
3098 * Copyright 2017 Google LLC
3099 *
3100 * Licensed under the Apache License, Version 2.0 (the "License");
3101 * you may not use this file except in compliance with the License.
3102 * You may obtain a copy of the License at
3103 *
3104 *   http://www.apache.org/licenses/LICENSE-2.0
3105 *
3106 * Unless required by applicable law or agreed to in writing, software
3107 * distributed under the License is distributed on an "AS IS" BASIS,
3108 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3109 * See the License for the specific language governing permissions and
3110 * limitations under the License.
3111 */const l9=new Qt(Ve.comparator);function na(){return l9}const Yj=new Qt(Ve.comparator);function Sd(...t){let e=Yj;for(const n of t)e=e.insert(n.key,n);return e}function Wj(t){let e=Yj;return t.forEach(((n,s)=>e=e.insert(n,s.overlayedDocument))),e}function Yo(){return Pd()}function Xj(){return Pd()}function Pd(){return new gl((t=>t.toString()),((t,e)=>t.isEqual(e)))}const c9=new Qt(Ve.comparator),u9=new Rn(Ve.comparator);function yt(...t){let e=u9;for(const n of t)e=e.add(n);return e}const d9=new Rn(gt);function h9(){return d9}/**
3112 * @license
3113 * Copyright 2020 Google LLC
3114 *
3115 * Licensed under the Apache License, Version 2.0 (the "License");
3116 * you may not use this file except in compliance with the License.
3117 * You may obtain a copy of the License at
3118 *
3119 *   http://www.apache.org/licenses/LICENSE-2.0
3120 *
3121 * Unless required by applicable law or agreed to in writing, softw
3121are
3122 * distributed under the License is distributed on an "AS IS" BASIS,
3123 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3124 * See the License for the specific language governing permissions and
3125 * limitations under the License.
3126 */function s_(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:Qm(e)?"-0":e}}function Qj(t){return{integerValue:""+t}}function f9(t,e){return OU(e)?Qj(e):s_(t,e)}/**
3127 * @license
3128 * Copyright 2018 Google LLC
3129 *
3130 * Licensed under the Apache License, Version 2.0 (the "License");
3131 * you may not use this file except in compliance with the License.
3132 * You may obtain a copy of the License at
3133 *
3134 *   http://www.apache.org/licenses/LICENSE-2.0
3135 *
3136 * Unless required by applicable law or agreed to in writing, software
3137 * distributed under the License is distributed on an "AS IS" BASIS,
3138 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3139 * See the License for the specific language governing permissions and
3140 * limitations under the License.
3141 */class qp{constructor(){this._=void 0}}function m9(t,e,n){return t instanceof Zd?(function(a,c){const u={fields:{[Pj]:{stringValue:Mj},[Oj]:{timestampValue:{seconds:a.seconds,nanos:a.nanoseconds}}}};return c&&Vp(c)&&(c=zp(c)),c&&(u.fields[Dj]=c),{mapValue:u}})(n,e):t instanceof eh?Zj(t,e):t instanceof th?eA(t,e):(function(a,c){const u=Jj(a,c),h=s2(u)+s2(a.Ae);return Vx(u)&&Vx(a.Ae)?Qj(h):s_(a.serializer,h)})(t,e)}function p9(t,e,n){return t instanceof eh?Zj(t,e):t instanceof th?eA(t,e):n}function Jj(t,e){return t instanceof np?(function(s){return Vx(s)||(function(c){return!!c&&"doubleValue"in c})(s)})(e)?e:{integerValue:0}:null}class Zd extends qp{}class eh extends qp{constructor(e){super(),this.elements=e}}function Zj(t,e){const n=tA(e);for(const s of t.elements)n.some((a=>ui(a,s)))||n.push(s);return{arrayValue:{values:n}}}class th extends qp{constructor(e){super(),this.elements=e}}function eA(t,e){let n=tA(e);for(const s of t.elements)n=n.filter((a=>!ui(a,s)));return{arrayValue:{values:n}}}class np extends qp{constructor(e,n){super(),this.serializer=e,this.Ae=n}}function s2(t){return dn(t.integerValue||t.doubleValue)}function tA(t){return Zv(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}/**
3142 * @license
3143 * Copyright 2017 Google LLC
3144 *
3145 * Licensed under the Apache License, Version 2.0 (the "License");
3146 * you may not use this file except in compliance with the License.
3147 * You may obtain a copy of the License at
3148 *
3149 *   http://www.apache.org/licenses/LICENSE-2.0
3150 *
3151 * Unless required by applicable law or agreed to in writing, software
3152 * distributed under the License is distributed on an "AS IS" BASIS,
3153 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3154 * See the License for the specific language governing permissions and
3155 * limitations under the License.
3156 */class g9{constructor(e,n){this.field=e,this.transform=n}}function y9(t,e){return t.field.isEqual(e.field)&&(function(s,a){return s instanceof eh&&a instanceof eh||s instanceof th&&a instanceof th?qc(s.elements,a.elements,ui):s instanceof np&&a instanceof np?ui(s.Ae,a.Ae):s instanceof Zd&&a instanceof Zd})(t.transform,e.transform)}class b9{constructor(e,n){this.version=e,this.transformResults=n}}class jr{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new jr}static exists(e){return new jr(void 0,e)}static updateTime(e){return new jr(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 Im(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Hp{}function nA(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new r_(t.key,jr.none()):new xh(t.key,t.data,jr.none());{const n=t.data,s=_s.empty();let a=new Rn(Hn.comparator);for(let c of e.fields)if(!a.has(c)){let u=n.field(c);u===null&&c.length>1&&(c=c.popLast(),u=n.field(c)),u===null?s.delete(c):s.set(c,u),a=a.add(c)}return new co(t.key,s,new Ls(a.toArray()),jr.none())}}function x9(t,e,n){t instanceof xh?(function(a,c,u){const h=a.value.clone(),m=i2(a.fieldTransforms,c,u.transformResults);h.setAll(m),c.convertToFoundDocument(u.version,h).setHasCommittedMutations()})(t,e,n):t instanceof co?(function(a,c,u){if(!Im(a.precondition,c))return void c.convertToUnknownDocument(u.version);const h=i2(a.fieldTransforms,c,u.transformResults),m=c.data;m.setAll(sA(a)),m.setAll(h),c.convertToFoundDocument(u.version,m).setHasCommittedMutations()}
3156)(t,e,n):(function(a,c,u){c.convertToNoDocument(u.version).setHasCommittedMutations()})(0,e,n)}function Dd(t,e,n,s){return t instanceof xh?(function(c,u,h,m){if(!Im(c.precondition,u))return h;const p=c.value.clone(),b=a2(c.fieldTransforms,m,u);return p.setAll(b),u.convertToFoundDocument(u.version,p).setHasLocalMutations(),null})(t,e,n,s):t instanceof co?(function(c,u,h,m){if(!Im(c.precondition,u))return h;const p=a2(c.fieldTransforms,m,u),b=u.data;return b.setAll(sA(c)),b.setAll(p),u.convertToFoundDocument(u.version,b).setHasLocalMutations(),h===null?null:h.unionWith(c.fieldMask.fields).unionWith(c.fieldTransforms.map((x=>x.field)))})(t,e,n,s):(function(c,u,h){return Im(c.precondition,u)?(u.convertToNoDocument(u.version).setHasLocalMutations(),null):h})(t,e,n)}function v9(t,e){let n=null;for(const s of t.fieldTransforms){const a=e.data.field(s.field),c=Jj(s.transform,a||null);c!=null&&(n===null&&(n=_s.empty()),n.set(s.field,c))}return n||null}function r2(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!(function(s,a){return s===void 0&&a===void 0||!(!s||!a)&&qc(s,a,((c,u)=>y9(c,u)))})(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 xh extends Hp{constructor(e,n,s,a=[]){super(),this.key=e,this.value=n,this.precondition=s,this.fieldTransforms=a,this.type=0}getFieldMask(){return null}}class co extends Hp{constructor(e,n,s,a,c=[]){super(),this.key=e,this.data=n,this.fieldMask=s,this.precondition=a,this.fieldTransforms=c,this.type=1}getFieldMask(){return this.fieldMask}}function sA(t){const e=new Map;return t.fieldMask.fields.forEach((n=>{if(!n.isEmpty()){const s=t.data.field(n);e.set(n,s)}})),e}function i2(t,e,n){const s=new Map;At(t.length===n.length,32656,{Ve:n.length,de:t.length});for(let a=0;a<n.length;a++){const c=t[a],u=c.transform,h=e.data.field(c.field);s.set(c.field,p9(u,h,n[a]))}return s}function a2(t,e,n){const s=new Map;for(const a of t){const c=a.transform,u=n.data.field(a.field);s.set(a.field,m9(c,u,e))}return s}class r_ extends Hp{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class _9 extends Hp{constructor(e,n){super(),this.key=e,this.precondition=n,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}/**
3157 * @license
3158 * Copyright 2017 Google LLC
3159 *
3160 * Licensed under the Apache License, Version 2.0 (the "License");
3161 * you may not use this file except in compliance with the License.
3162 * You may obtain a copy of the License at
3163 *
3164 *   http://www.apache.org/licenses/LICENSE-2.0
3165 *
3166 * Unless required by applicable law or agreed to in writing, software
3167 * distributed under the License is distributed on an "AS IS" BASIS,
3168 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3169 * See the License for the specific language governing permissions and
3170 * limitations under the License.
3171 */class w9{constructor(e,n,s,a){this.batchId=e,this.localWriteTime=n,this.baseMutations=s,this.mutations=a}applyToRemoteDocument(e,n){const s=n.mutationResults;for(let a=0;a<this.mutations.length;a++){const c=this.mutations[a];c.key.isEqual(e.key)&&x9(c,e,s[a])}}applyToLocalView(e,n){for(const s of this.baseMutations)s.key.isEqual(e.key)&&(n=Dd(s,e,n,this.localWriteTime));for(const s of this.mutations)s.key.isEqual(e.key)&&(n=Dd(s,e,n,this.localWriteTime));return n}applyToLocalDocumentSet(e,n){const s=Xj();return this.mutations.forEach((a=>{const c=e.get(a.key),u=c.overlayedDocument;let h=this.applyToLocalView(u,c.mutatedFields);h=n.has(a.key)?null:h;const m=nA(u,h);m!==null&&s.set(a.key,m),u.isValidDocument()||u.convertToNoDocument(Je.min())})),s}keys(){return this.mutations.reduce(((e,n)=>e.add(n.key)),yt())}isEqual(e){return this.batchId===e.batchId&&qc(this.mutations,e.mutations,((n,s)=>r2(n,s)))&&qc(this.baseMutations,e.baseMutations,((n,s)=>r2(n,s)))}}class i_{constructor(e,n,s,a){this.batch=e,this.commitVersion=n,this.mutationResults=s,this.docVersions=a}static from(e,n,s){At(e.mutations.length===s.length,58842,{me:e.mutations.length,fe:s.length});let a=(function(){return c9})();const c=e.mutations;for(let u=0;u<c.length;u++)a=a.insert(c[u].key,s[u].version);return new i_(e,n,s,a)}}/**
3172 * @license
3173 * Copyright 2022 Google LLC
3174 *
3175 * Licensed under the Apache License, Version 2.0 (the "License");
3176 * you may not use this file except in compliance with the License.
3177 * You may obtain a copy of the License at
3178 *
3179 *   http://www.apache.org/licenses/LICENSE-2.0
3180 *
3181 * Unless required by applicable law or agreed to in writing, software
3182 * distributed under the License is distributed on an "AS IS" BASIS,
3183 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3184 * See the License for the specific language governing permissions and
3185 * limitations under the License.
3186 */class E9{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{
3187      largestBatchId: ${this.largestBatchId},
3188      mutation: ${this.mutation.toString()}
3189    }`}}/**
3190 * @license
3191 * Copyright 2017 Google LLC
3192 *
3193 * Licensed under the Apache License, Version 2.0 (the "License");
3194 * you may not use this file except in compliance with the License.
3195 * You may obtain a copy of the License at
3196 *
3197 *   http://www.apache.org/licenses/LICENSE-2.0
3198 *
3199 * Unless required by applicable law or agreed to in writing, software
3200 * distributed under the License is distributed on an "AS IS" BASIS,
3201 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3202 * See the License for the specific language governing permissions and
3203 * limitations under the License.
3204 */class k9{constructor(e,n){this.count=e,this.unchangedNames=n}}/**
3205 * @license
3206 * Copyright 2017 Google LLC
3207 *
3208 * Licensed under the Apache License, Version 2.0 (the "License");
3209 * you may not use this file except in compliance with the License.
3210 * You may obtain a copy of the License at
3211 *
3212 *   http://www.apache.org/licenses/LICENSE-2.0
3213 *
3214 * Unless required by applicable law or agreed to in writing, software
3215 * distributed under the License is distributed on an "AS IS" BASIS,
3216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3217 * See the License for the specific language governing permissions and
3218 * limitations under the License.
3219 */var Tn,vt;function T9(t){switch(t){case ye.OK:return We(64938);case ye.CANCELLED:case ye.UNKNOWN:case ye.DEADLINE_EXCEEDED:case ye.RESOURCE_EXHAUSTED:case ye.INTERNAL:case ye.UNAVAILABLE:case ye.UNAUTHENTICATED:return!1;case ye.INVALID_ARGUMENT:case ye.NOT_FOUND:case ye.ALREADY_EXISTS:case ye.PERMISSION_DENIED:case ye.FAILED_PRECONDITION:case ye.ABORTED:case ye.OUT_OF_RANGE:case ye.UNIMPLEMENTED:case ye.DATA_LOSS:return!0;default:return We(15467,{code:t})}}function rA(t){if(t===void 0)return ta("GRPC error has no .code"),ye.UNKNOWN;switch(t){case Tn.OK:return ye.OK;case Tn.CANCELLED:return ye.CANCELLED;case Tn.UNKNOWN:return ye.UNKNOWN;case Tn.DEADLINE_EXCEEDED:return ye.DEADLINE_EXCEEDED;case Tn.RESOURCE_EXHAUSTED:return ye.RESOURCE_EXHAUSTED;case Tn.INTERNAL:return ye.INTERNAL;case Tn.UNAVAILABLE:return ye.UNAVAILABLE;case Tn.UNAUTHENTICATED:return ye.UNAUTHENTICATED;case Tn.INVALID_ARGUMENT:return ye.INVALID_ARGUMENT;case Tn.NOT_FOUND:return ye.NOT_FOUND;case Tn.ALREADY_EXISTS:return ye.ALREADY_EXISTS;case Tn.PERMISSION_DENIED:return ye.PERMISSION_DENIED;case Tn.FAILED_PRECONDITION:return ye.FAILED_PRECONDITION;case Tn.ABORTED:return ye.ABORTED;case Tn.OUT_OF_RANGE:return ye.OUT_OF_RANGE;case Tn.UNIMPLEMENTED:return ye.UNIMPLEMENTED;case Tn.DATA_LOSS:return ye.DATA_LOSS;default:return We(39323,{code:t})}}(vt=Tn||(Tn={}))[vt.OK=0]="OK",vt[vt.CANCELLED=1]="CANCELLED",vt[vt.UNKNOWN=2]="UNKNOWN",vt[vt.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",vt[vt.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",vt[vt.NOT_FOUND=5]="NOT_FOUND",vt[vt.ALREADY_EXISTS=6]="ALREADY_EXISTS",vt[vt.PERMISSION_DENIED=7]="PERMISSION_DENIED",vt[vt.UNAUTHENTICATED=16]="UNAUTHENTICATED",vt[vt.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",vt[vt.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",vt[vt.ABORTED=10]="ABORTED",vt[vt.OUT_OF_RANGE=11]="OUT_OF_RANGE",vt[vt.UNIMPLEMENTED=12]="UNIMPLEMENTED",vt[vt.INTERNAL=13]="INTERNAL",vt[vt.UNAVAILABLE=14]="UNAVAILABLE",vt[vt.DATA_LOSS=15]="DATA_LOSS";/**
3220 * @license
3221 * Copyright 2023 Google LLC
3222 *
3223 * Licensed under the Apache License, Version 2.0 (the "License");
3224 * you may not use this file except in compliance with the License.
3225 * You may obtain a copy of the License at
3226 *
3227 *   http://www.apache.org/licenses/LICENSE-2.0
3228 *
3229 * Unless required by applicable law or agreed to in writing, software
3230 * distributed under the License is distributed on an "AS IS" BASIS,
3231 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3232 * See the License for the specific language governing permissions and
3233 * limitations under the License.
3234 */function S9(){return new TextEncoder}/**
3235 * @license
3236 * Copyright 2022 Google LLC
3237 *
3238 * Licensed under the Apache License, Version 2.0 (the "License");
3239 * you may not use this file except in compliance with the License.
3240 * You may obtain a copy of the License at
3241 *
3242 *   http://www.apache.org/licenses/LICENSE-2.0
3243 *
3244 * Unless required by applicable law or agreed to in writing, software
3245 * distributed under the License is distributed on an "AS IS" BASIS,
3246 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3247 * See the License for the specific language governing permissions and
3248 * limitations under the License.
3249 */const N9=new Qa([4294967295,4294967295],0);function o2(t){const e=S9().encode(t),n=new vj;return n.update(e),new Uint8Array(n.digest())}function l2(t){const e=new DataView(t.buffer),n=e.getUint32(0,!0),s=e.getUint32(4,!0),a=e.getUint32(8,!0),c=e.getUint32(12,!0);return[new Qa([n,s],0),new Qa([a,c],0)]}class a_{constructor(e,n,s){if(this.bitmap=e,this.padding=n,this.hashCount=s,n<0||n>=8)throw new Nd(`Invalid padding: ${n}`);if(s<0)throw new Nd(`Invalid hash count: ${s}`);if(e.length>0&&this.hashCount===0)throw new Nd(`Invalid hash count: ${s}`);if(e.length===0&&n!==0)throw new Nd(`Invalid padding when bitmap length is 0: ${n}`);this.ge=8*e.length-n,this.pe=Qa.fromNumber(this.ge)}ye(e,n,s){let a=e.add(n.multiply(Qa.fromNumber(s)));return a.compare(N9)===1&&(a=new Qa([a.getBits(0),a.getBits(1)],0)),a.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=o2(e),[s,a]=l2(n);for(let c=0;c<this.hashCount;c++){const u=this.ye(s,a,c);if(!this.we(u))return!1}return!0}static create(e,n,s){const a=e%8==0?0:8-e%8,c=new Uint8Array(Math.ceil(e/8)),u=new a_(c,a,n);return s.forEach((h=>u.insert(h))),u}insert(e){if(this.ge===0)return;const n=o2(e),[s,a]=l2(n);for(let c=0;c<this.hashCount;c++){const u=this.ye(s,a,c);this.be(u)}}be(e){const n=Math.floor(e/8),s=e%8;this.bitmap[n]|=1<<s}}class Nd extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}/**
3250 * @license
3251 * Copyright 2017 Google LLC
3252 *
3253 * Licensed under the Apache License, Version 2.0 (the "License");
3254 * you may not use this file except in compliance with the License.
3255 * You may obtain a copy of the License at
3256 *
3257 *   http://www.apache.org/licenses/LICENSE-2.0
3258 *
3259 * Unless required by applicable law or agreed to in writing, software
3260 * distributed under the License is distributed on an "AS IS" BASIS,
3261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3262 * See the License for the specific language governing permissions and
3263 * limitations under the License.
3264 */class Gp{constructor(e,n,s,a,c){this.snapshotVersion=e,this.targetChanges=n,this.targetMismatches=s,this.documentUpdates=a,this.resolvedLimboDocuments=c}static createSynthesizedRemoteEventForCurrentChange(e,n,s){const a=new Map;return a.set(e,vh.createSynthesizedTargetChangeForCurrentChange(e,n,s)),new Gp(Je.min(),a,new Qt(gt),na(),yt())}}class vh{constructor(e,n,s,a,c){this.resumeToken=e,this.current=n,this.addedDocuments=s,this.modifiedDocuments=a,this.removedDocuments=c}static createSynthesizedTargetChangeForCurrentChange(e,n,s){return new vh(s,n,yt(),yt(),yt())}}/**
3265 * @license
3266 * Copyright 2017 Google LLC
3267 *
3268 * Licensed under the Apache License, Version 2.0 (the "License");
3269 * you may not use this file except in compliance with the License.
3270 * You may obtain a copy of the License at
3271 *
3272 *   http://www.apache.org/licenses/LICENSE-2.0
3273 *
3274 * Unless required by applicable law or agreed to in writing, softw
3274are
3275 * distributed under the License is distributed on an "AS IS" BASIS,
3276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3277 * See the License for the specific language governing permissions and
3278 * limitations under the License.
3279 */class Mm{constructor(e,n,s,a){this.Se=e,this.removedTargetIds=n,this.key=s,this.De=a}}class iA{constructor(e,n){this.targetId=e,this.Ce=n}}class aA{constructor(e,n,s=Wn.EMPTY_BYTE_STRING,a=null){this.state=e,this.targetIds=n,this.resumeToken=s,this.cause=a}}class c2{constructor(){this.ve=0,this.Fe=u2(),this.Me=Wn.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)}ke(){let e=yt(),n=yt(),s=yt();return this.Fe.forEach(((a,c)=>{switch(c){case 0:e=e.add(a);break;case 2:n=n.add(a);break;case 1:s=s.add(a);break;default:We(38017,{changeType:c})}})),new vh(this.Me,this.xe,e,n,s)}Ke(){this.Oe=!1,this.Fe=u2()}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,At(this.ve>=0,3241,{ve:this.ve})}Qe(){this.Oe=!0,this.xe=!0}}class j9{constructor(e){this.Ge=e,this.ze=new Map,this.je=na(),this.He=am(),this.Je=am(),this.Ze=new Qt(gt)}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 s=this.nt(n);switch(e.state){case 0:this.rt(n)&&s.Le(e.resumeToken);break;case 1:s.We(),s.Ne||s.Ke(),s.Le(e.resumeToken);break;case 2:s.We(),s.Ne||this.removeTarget(n);break;case 3:this.rt(n)&&(s.Qe(),s.Le(e.resumeToken));break;case 4:this.rt(n)&&(this.it(n),s.Le(e.resumeToken));break;default:We(56790,{state:e.state})}}))}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.ze.forEach(((s,a)=>{this.rt(a)&&n(a)}))}st(e){const n=e.targetId,s=e.Ce.count,a=this.ot(n);if(a){const c=a.target;if(Bx(c))if(s===0){const u=new Ve(c.path);this.et(n,u,ts.newNoDocument(u,Je.min()))}else At(s===1,20013,{expectedCount:s});else{const u=this._t(n);if(u!==s){const h=this.ut(e),m=h?this.ct(h,e,u):1;if(m!==0){this.it(n);const p=m===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Ze=this.Ze.insert(n,p)}}}}}ut(e){const n=e.Ce.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:s="",padding:a=0},hashCount:c=0}=n;let u,h;try{u=no(s).toUint8Array()}catch(m){if(m instanceof Ij)return cl("Decoding the base64 bloom filter in existence filter failed ("+m.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw m}try{h=new a_(u,a,c)}catch(m){return cl(m instanceof Nd?"BloomFilter error: ":"Applying bloom filter failed: ",m),null}return h.ge===0?null:h}ct(e,n,s){return n.Ce.count===s-this.Pt(e,n.targetId)?0:2}Pt(e,n){const s=this.Ge.getRemoteKeysForTarget(n);let a=0;return s.forEach((c=>{const u=this.Ge.ht(),h=`projects/${u.projectId}/databases/${u.database}/documents/${c.path.canonicalString()}`;e.mightContain(h)||(this.et(n,c,null),a++)})),a}Tt(e){const n=new Map;this.ze.forEach(((c,u)=>{const h=this.ot(u);if(h){if(c.current&&Bx(h.target)){const m=new Ve(h.target.path);this.It(m).has(u)||this.Et(u,m)||this.et(u,m,ts.newNoDocument(m,e))}c.Be&&(n.set(u,c.ke()),c.Ke())}}));let s=yt();this.Je.forEach(((c,u)=>{let h=!0;u.forEachWhile((m=>{const p=this.ot(m);return!p||p.purpose==="TargetPurposeLimboResolution"||(h=!1,!1)})),h&&(s=s.add(c))})),this.je.forEach(((c,u)=>u.setReadTime(e)));const a=new Gp(e,n,this.Ze,this.je,s);return this.je=na(),this.He=am(),this.Je=am(),this.Ze=new Qt(gt),a}Ye(e,n){if(!this.rt(e))return;const s=this.Et(e,n.key)?2:0;this.nt(e).qe(n.key,s),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,s){if(!this.rt(e))return;const a=this.nt(e);this.Et(e,n)?a.qe(n,1):a.Ue(n),this.Je=this.Je.insert(n,this.Rt(n).delete(e)),this.Je=this.Je.insert(n,this.Rt(n).add(e)),s&&(this.je=this.je.insert(n,s))}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 c2,this.ze.set(e,n)),n}Rt(e){let n=this.Je.get(e);return n||(n=new Rn(gt),this.Je=this.Je.insert(e,n)),n}It(e){let n=this.He.get(e);return n||(n=new Rn(gt),this.He=this.He.insert(e,n)),n}rt(e){const n=this.ot(e)!==null;return n||Ie("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 c2),this.Ge.getRemoteKeysForTarget(e).forEach((n=>{this.et(e,n,null)}))}Et(e,n){return this.Ge.getRemoteKeysForTarget(e).has(n)}}function am(){return new Qt(Ve.comparator)}function u2(){return new Qt(Ve.comparator)}const A9={asc:"ASCENDING",desc:"DESCENDING"},C9={"<":"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"},R9={and:"AND",or:"OR"};class I9{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function $x(t,e){return t.useProto3Json||Fp(e)?e:{value:e}}function sp(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 oA(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function M9(t,e){return sp(t,e.toTimestamp())}function oi(t){return At(!!t,49232),Je.fromTimestamp((function(n){const s=to(n);return new Ut(s.seconds,s.nanos)})(t))}function o_(t,e){return qx(t,e).canonicalString()}function qx(t,e){const n=(function(a){return new Vt(["projects",a.projectId,"databases",a.database])})(t).child("documents");return e===void 0?n:n.child(e)}function lA(t){const e=Vt.fromString(t);return At(fA(e),10190,{key:e.toString()}),e}function Hx(t,e){return o_(t.databaseId,e.path)}function Rb(t,e){const n=lA(e);
vendor: 5,979 bytes, line 3279
3279if(n.get(1)!==t.databaseId.projectId)throw new je(ye.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 je(ye.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new Ve(uA(n))}function cA(t,e){return o_(t.databaseId,e)}function P9(t){const e=lA(t);return e.length===4?Vt.emptyPath():uA(e)}function Gx(t){return new Vt(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function uA(t){return At(t.length>4&&t.get(4)==="documents",29091,{key:t.toString()}),t.popFirst(5)}function d2(t,e,n){return{name:Hx(t,e),fields:n.value.mapValue.fields}}function D9(t,e){let n;if("targetChange"in e){e.targetChange;const s=(function(p){return p==="NO_CHANGE"?0:p==="ADD"?1:p==="REMOVE"?2:p==="CURRENT"?3:p==="RESET"?4:We(39313,{state:p})})(e.targetChange.targetChangeType||"NO_CHANGE"),a=e.targetChange.targetIds||[],c=(function(p,b){return p.useProto3Json?(At(b===void 0||typeof b=="string",58123),Wn.fromBase64String(b||"")):(At(b===void 0||b instanceof Buffer||b instanceof Uint8Array,16193),Wn.fromUint8Array(b||new Uint8Array))})(t,e.targetChange.resumeToken),u=e.targetChange.cause,h=u&&(function(p){const b=p.code===void 0?ye.UNKNOWN:rA(p.code);return new je(b,p.message||"")})(u);n=new aA(s,a,c,h||null)}else if("documentChange"in e){e.documentChange;const s=e.documentChange;s.document,s.document.name,s.document.updateTime;const a=Rb(t,s.document.name),c=oi(s.document.updateTime),u=s.document.createTime?oi(s.document.createTime):Je.min(),h=new _s({mapValue:{fields:s.document.fields}}),m=ts.newFoundDocument(a,c,u,h),p=s.targetIds||[],b=s.removedTargetIds||[];n=new Mm(p,b,m.key,m)}else if("documentDelete"in e){e.documentDelete;const s=e.documentDelete;s.document;const a=Rb(t,s.document),c=s.readTime?oi(s.readTime):Je.min(),u=ts.newNoDocument(a,c),h=s.removedTargetIds||[];n=new Mm([],h,u.key,u)}else if("documentRemove"in e){e.documentRemove;const s=e.documentRemove;s.document;const a=Rb(t,s.document),c=s.removedTargetIds||[];n=new Mm([],c,a,null)}else{if(!("filter"in e))return We(11601,{Vt:e});{e.filter;const s=e.filter;s.targetId;const{count:a=0,unchangedNames:c}=s,u=new k9(a,c),h=s.targetId;n=new iA(h,u)}}return n}function O9(t,e){let n;if(e instanceof xh)n={update:d2(t,e.key,e.value)};else if(e instanceof r_)n={delete:Hx(t,e.key)};else if(e instanceof co)n={update:d2(t,e.key,e.data),updateMask:q9(e.fieldMask)};else{if(!(e instanceof _9))return We(16599,{dt:e.type});n={verify:Hx(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map((s=>(function(c,u){const h=u.transform;if(h instanceof Zd)return{fieldPath:u.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(h instanceof eh)return{fieldPath:u.field.canonicalString(),appendMissingElements:{values:h.elements}};if(h instanceof th)return{fieldPath:u.field.canonicalString(),removeAllFromArray:{values:h.elements}};if(h instanceof np)return{fieldPath:u.field.canonicalString(),increment:h.Ae};throw We(20930,{transform:u.transform})})(0,s)))),e.precondition.isNone||(n.currentDocument=(function(a,c){return c.updateTime!==void 0?{updateTime:M9(a,c.updateTime)}:c.exists!==void 0?{exists:c.exists}:We(27497)})(t,e.precondition)),n}function L9(t,e){return t&&t.length>0?(At(e!==void 0,14353),t.map((n=>(function(a,c){let u=a.updateTime?oi(a.updateTime):oi(c);return u.isEqual(Je.min())&&(u=oi(c)),new b9(u,a.transformResults||[])})(n,e)))):[]}function U9(t,e){return{documents:[cA(t,e.path)]}}function F9(t,e){const n={structuredQuery:{}},s=e.path;let a;e.collectionGroup!==null?(a=s,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(a=s.popLast(),n.structuredQuery.from=[{collectionId:s.lastSegment()}]),n.parent=cA(t,a);const c=(function(p){if(p.length!==0)return hA(Cr.create(p,"and"))})(e.filters);c&&(n.structuredQuery.where=c);const u=(function(p){if(p.length!==0)return p.map((b=>(function(w){return{field:Tc(w.field),direction:B9(w.dir)}})(b)))})(e.orderBy);u&&(n.structuredQuery.orderBy=u);const h=$x(t,e.limit);return h!==null&&(n.structuredQuery.limit=h),e.startAt&&(n.structuredQuery.startAt=(function(p){return{before:p.inclusive,values:p.position}})(e.startAt)),e.endAt&&(n.structuredQuery.endAt=(function(p){return{before:!p.inclusive,values:p.position}})(e.endAt)),{ft:n,parent:a}}function V9(t){let e=P9(t.parent);const n=t.structuredQuery,s=n.from?n.from.length:0;let a=null;if(s>0){At(s===1,65062);const b=n.from[0];b.allDescendants?a=b.collectionId:e=e.child(b.collectionId)}let c=[];n.where&&(c=(function(x){const w=dA(x);return w instanceof Cr&&Bj(w)?w.getFilters():[w]})(n.where));let u=[];n.orderBy&&(u=(function(x){return x.map((w=>(function(N){return new Jd(Sc(N.field),(function(A){switch(A){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}})(N.direction))})(w)))})(n.orderBy));let h=null;n.limit&&(h=(function(x){let w;return w=typeof x=="object"?x.value:x,Fp(w)?null:w})(n.limit));let m=null;n.startAt&&(m=(function(x){const w=!!x.before,T=x.values||[];return new Yc(T,w)})(n.startAt));let p=null;return n.endAt&&(p=(function(x){const w=!x.before,T=x.values||[];return new Yc(T,w)})(n.endAt)),t9(e,a,u,c,h,"F",m,p)}function z9(t,e){const n=(function(a){switch(a){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return We(28987,{purpose:a})}})(e.purpose);return n==null?null:{"goog-listen-tags":n}}function dA(t){return t.unaryFilter!==void 0?(function(n){switch(n.unaryFilter.op){case"IS_NAN":const s=Sc(n.unaryFilter.field);return Sn.create(s,"==",{doubleValue:NaN});case"IS_NULL":const a=Sc(n.unaryFilter.field);return Sn.create(a,"==",{nullValue:"NULL_VALUE"});
3279case"IS_NOT_NAN":const c=Sc(n.unaryFilter.field);return Sn.create(c,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const u=Sc(n.unaryFilter.field);return Sn.create(u,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return We(61313);default:return We(60726)}})(t):t.fieldFilter!==void 0?(function(n){return Sn.create(Sc(n.fieldFilter.field),(function(a){switch(a){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 We(58110);default:return We(50506)}})(n.fieldFilter.op),n.fieldFilter.value)})(t):t.compositeFilter!==void 0?(function(n){return Cr.create(n.compositeFilter.filters.map((s=>dA(s))),(function(a){switch(a){case"AND":return"and";case"OR":return"or";default:return We(1026)}})(n.compositeFilter.op))})(t):We(30097,{filter:t})}function B9(t){return A9[t]}function K9(t){return C9[t]}function $9(t){return R9[t]}function Tc(t){return{fieldPath:t.canonicalString()}}function Sc(t){return Hn.fromServerFormat(t.fieldPath)}function hA(t){return t instanceof Sn?(function(n){if(n.op==="=="){if(Jk(n.value))return{unaryFilter:{field:Tc(n.field),op:"IS_NAN"}};if(Qk(n.value))return{unaryFilter:{field:Tc(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Jk(n.value))return{unaryFilter:{field:Tc(n.field),op:"IS_NOT_NAN"}};if(Qk(n.value))return{unaryFilter:{field:Tc(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:Tc(n.field),op:K9(n.op),value:n.value}}})(t):t instanceof Cr?(function(n){const s=n.getFilters().map((a=>hA(a)));return s.length===1?s[0]:{compositeFilter:{op:$9(n.op),filters:s}}})(t):We(54877,{filter:t})}function q9(t){const e=[];return t.fields.forEach((n=>e.push(n.canonicalString()))),{fieldPaths:e}}function fA(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}function mA(t){return!!t&&typeof t._toProto=="function"&&t._protoValueType==="ProtoValue"}/**
3280 * @license
3281 * Copyright 2017 Google LLC
3282 *
3283 * Licensed under the Apache License, Version 2.0 (the "License");
3284 * you may not use this file except in compliance with the License.
3285 * You may obtain a copy of the License at
3286 *
3287 *   http://www.apache.org/licenses/LICENSE-2.0
3288 *
3289 * Unless required by applicable law or agreed to in writing, software
3290 * distributed under the License is distributed on an "AS IS" BASIS,
3291 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3292 * See the License for the specific language governing permissions and
3293 * limitations under the License.
3294 */class Ha{constructor(e,n,s,a,c=Je.min(),u=Je.min(),h=Wn.EMPTY_BYTE_STRING,m=null){this.target=e,this.targetId=n,this.purpose=s,this.sequenceNumber=a,this.snapshotVersion=c,this.lastLimboFreeSnapshotVersion=u,this.resumeToken=h,this.expectedCount=m}withSequenceNumber(e){return new Ha(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new Ha(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new Ha(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new Ha(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
3295 * @license
3296 * Copyright 2017 Google LLC
3297 *
3298 * Licensed under the Apache License, Version 2.0 (the "License");
3299 * you may not use this file except in compliance with the License.
3300 * You may obtain a copy of the License at
3301 *
3302 *   http://www.apache.org/licenses/LICENSE-2.0
3303 *
3304 * Unless required by applicable law or agreed to in writing, software
3305 * distributed under the License is distributed on an "AS IS" BASIS,
3306 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3307 * See the License for the specific language governing permissions and
3308 * limitations under the License.
3309 */class H9{constructor(e){this.yt=e}}function G9(t){const e=V9({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?tp(e,e.limit,"L"):e}/**
3310 * @license
3311 * Copyright 2019 Google LLC
3312 *
3313 * Licensed under the Apache License, Version 2.0 (the "License");
3314 * you may not use this file except in compliance with the License.
3315 * You may obtain a copy of the License at
3316 *
3317 *   http://www.apache.org/licenses/LICENSE-2.0
3318 *
3319 * Unless required by applicable law or agreed to in writing, software
3320 * distributed under the License is distributed on an "AS IS" BASIS,
3321 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3322 * See the License for the specific language governing permissions and
3323 * limitations under the License.
3324 */class Y9{constructor(){this.Sn=new W9}addToCollectionParentIndex(e,n){return this.Sn.add(n),ve.resolve()}getCollectionParents(e,n){return ve.resolve(this.Sn.getEntries(n))}addFieldIndex(e,n){return ve.resolve()}deleteFieldIndex(e,n){return ve.resolve()}deleteAllFieldIndexes(e){return ve.resolve()}createTargetIndexes(e,n){return ve.resolve()}getDocumentsMatchingTarget(e,n){return ve.resolve(null)}getIndexType(e,n){return ve.resolve(0)}getFieldIndexes(e,n){return ve.resolve([])}getNextCollectionGroupToUpdate(e){return ve.resolve(null)}getMinOffset(e,n){return ve.resolve(eo.min())}getMinOffsetFromCollectionGroup(e,n){return ve.resolve(eo.min())}updateCollectionGroup(e,n,s){return ve.resolve()}updateIndexEntries(e,n){return ve.resolve()}}class W9{constructor(){this.index={}}add(e){const n=e.lastSegment(),s=e.popLast(),a=this.index[n]||new Rn(Vt.comparator),c=!a.has(s);return this.index[n]=a.add(s),c}has(e){const n=e.lastSegment(),s=e.popLast(),a=this.index[n];return a&&a.has(s)}getEntries(e){return(this.index[e]||new Rn(Vt.comparator)).toArray()}}/**
3325 * @license
3326 * Copyright 2018 Google LLC
3327 *
3328 * Licensed under the Apache License, Version 2.0 (the "License");
3329 * you may not use this file except in compliance with the License.
3330 * You may obtain a copy of the License at
3331 *
3332 *   http://www.apache.org/licenses/LICENSE-2.0
3333 *
3334 * Unless required by applicable law or agreed to in writing, software
3335 * distributed under the License is distributed on an "AS IS" BASIS,
3336 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3337 * See the License for the specific language governing permissions and
3338 * limitations under the License.
3339 */const h2={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0},pA=41943040;class xs{static withCacheSize(e){return new xs(e,xs.DEFAULT_COLLECTION_PERCENTILE,xs.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,n,s){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=n,this.maximumSequenceNumbersToCollect=s}}/**
3340 * @license
3341 * Copyright 2017 Google LLC
3342 *
3343 * Licensed under the Apache License, Version 2.0 (the "License");
3344 * you may not use this file except in compliance with the License.
3345 * You may obtain a copy of the License at
3346 *
3347 *   http://www.apache.org/licenses/LICENSE-2.0
3348 *
3349 * Unless required by applicable law or agreed to in writing, software
3350 * distributed under the License is distributed on an "AS IS" BASIS,
3351 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3352 * See the License for the specific language governing permissions and
3353 * limitations under the License.
3354 */xs.DEFAULT_COLLECTION_PERCENTILE=10,xs.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,xs.DEFAULT=new xs(pA,xs.DEFAULT_COLLECTION_PERCENTILE,xs.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),xs.DISABLED=new xs(-1,0,0);/**
3355 * @license
3356 * Copyright 2017 Google LLC
3357 *
3358 * Licensed under the Apache License, Version 2.0 (the "License");
3359 * you may not use this file except in compliance with the License.
3360 * You may obtain a copy of the License at
3361 *
3362 *   http://www.apache.org/licenses/LICENSE-2.0
3363 *
3364 * Unless required by applicable law or agreed to in writing, software
3365 * distributed under the License is distributed on an "AS IS" BASIS,
3366 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3367 * See the License for the specific language governing permissions and
3368 * limitations under the License.
3369 */class Wc{constructor(e){this.sr=e}next(){return this.sr+=2,this.sr}static _r(){return new Wc(0)}static ar(){return new Wc(-1)}}/**
3370 * @license
3371 * Copyright 2020 Google LLC
3372 *
3373 * Licensed under the Apache License, Version 2.0 (the "License");
3374 * you may not use this file except in compliance with the License.
3375 * You may obtain a copy of the License at
3376 *
3377 *   http://www.apache.org/licenses/LICENSE-2.0
3378 *
3379 * Unless required by applicable law or agreed to in writing, software
3380 * distributed under the License is distributed on an "AS IS" BASIS,
3381 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3382 * See the License for the specific language governing permissions and
3383 * limitations under the License.
3384 */const f2="LruGarbageCollector",X9=1048576;function m2([t,e],[n,s]){const a=gt(t,n);return a===0?gt(e,s):a}class Q9{constructor(e){this.Pr=e,this.buffer=new Rn(m2),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 s=this.buffer.last();m2(n,s)<0&&(this.buffer=this.buffer.delete(s).add(n))}}get maxValue(){return this.buffer.last()[0]}}class J9{constructor(e,n,s){this.garbageCollector=e,this.asyncQueue=n,this.localStore=s,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){Ie(f2,`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){lu(n)?Ie(f2,"Ignoring IndexedDB error during garbage collection: ",n):await ou(n)}await this.Ar(3e5)}))}}class Z9{constructor(e,n){this.Vr=e,this.params=n}calculateTargetCount(e,n){return this.Vr.dr(e).next((s=>Math.floor(n/100*s)))}nthSequenceNumber(e,n){if(n===0)return ve.resolve(Up.ce);const s=new Q9(n);return this.Vr.forEachTarget(e,(a=>s.Er(a.sequenceNumber))).next((()=>this.Vr.mr(e,(a=>s.Er(a))))).next((()=>s.maxValue))}removeTargets(e,n,s){return this.Vr.removeTargets(e,n,s)}removeOrphanedDocuments(e,n){return this.Vr.removeOrphanedDocuments(e,n)}collect(e,n){return this.params.cacheSizeCollectionThreshold===-1?(Ie("LruGarbageCollector","Garbage collection skipped; disabled"),ve.resolve(h2)):this.getCacheSize(e).next((s=>s<this.params.cacheSizeCollectionThreshold?(Ie("LruGarbageCollector",`Garbage collection skipped; Cache size ${s} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),h2):this.gr(e,n)))}getCacheSize(e){return this.Vr.getCacheSize(e)}gr(e,n){let s,a,c,u,h,m,p;const b=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next((x=>(x>this.params.maximumSequenceNumbersToCollect?(Ie("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${x}`),a=this.params.maximumSequenceNumbersToCollect):a=x,u=Date.now(),this.nthSequenceNumber(e,a)))).next((x=>(s=x,h=Date.now(),this.removeTargets(e,s,n)))).next((x=>(c=x,m=Date.now(),this.removeOrphanedDocuments(e,s)))).next((x=>(p=Date.now(),Ec()<=ft.DEBUG&&Ie("LruGarbageCollector",`LRU Garbage Collection
3385	Counted targets in ${u-b}ms
3386	Determined least recently used ${a} in `+(h-u)+`ms
3387	Removed ${c} targets in `+(m-h)+`ms
3388	Removed ${x} documents in `+(p-m)+`ms
3389Total Duration: ${p-b}ms`),ve.resolve({didRun:!0,sequenceNumbersCollected:a,targetsRemoved:c,documentsRemoved:x}))))}}function eF(t,e){return new Z9(t,e)}/**
3390 * @license
3391 * Copyright 2017 Google LLC
3392 *
3393 * Licensed under the Apache License, Version 2.0 (the "License");
3394 * you may not use this file except in compliance with the License.
3395 * You may obtain a copy of the License at
3396 *
3397 *   http://www.apache.org/licenses/LICENSE-2.0
3398 *
3399 * Unless required by applicable law or agreed to in writing, software
3400 * distributed under the License is distributed on an "AS IS" BASIS,
3401 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3402 * See the License for the specific language governing permissions and
3403 * limitations under the License.
3404 */class tF{constructor(){this.changes=new gl((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,ts.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const s=this.changes.get(n);return s!==void 0?ve.resolve(s):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}
vendor: 4,979 bytes, lines 3404-3449
3404assertNotApplied(){}}/**
3405 * @license
3406 * Copyright 2017 Google LLC
3407 *
3408 * Licensed under the Apache License, Version 2.0 (the "License");
3409 * you may not use this file except in compliance with the License.
3410 * You may obtain a copy of the License at
3411 *
3412 *   http://www.apache.org/licenses/LICENSE-2.0
3413 *
3414 * Unless required by applicable law or agreed to in writing, software
3415 * distributed under the License is distributed on an "AS IS" BASIS,
3416 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3417 * See the License for the specific language governing permissions and
3418 * limitations under the License.
3419 *//**
3420 * @license
3421 * Copyright 2022 Google LLC
3422 *
3423 * Licensed under the Apache License, Version 2.0 (the "License");
3424 * you may not use this file except in compliance with the License.
3425 * You may obtain a copy of the License at
3426 *
3427 *   http://www.apache.org/licenses/LICENSE-2.0
3428 *
3429 * Unless required by applicable law or agreed to in writing, software
3430 * distributed under the License is distributed on an "AS IS" BASIS,
3431 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3432 * See the License for the specific language governing permissions and
3433 * limitations under the License.
3434 */class nF{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
3435 * @license
3436 * Copyright 2017 Google LLC
3437 *
3438 * Licensed under the Apache License, Version 2.0 (the "License");
3439 * you may not use this file except in compliance with the License.
3440 * You may obtain a copy of the License at
3441 *
3442 *   http://www.apache.org/licenses/LICENSE-2.0
3443 *
3444 * Unless required by applicable law or agreed to in writing, software
3445 * distributed under the License is distributed on an "AS IS" BASIS,
3446 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3447 * See the License for the specific language governing permissions and
3448 * limitations under the License.
3449 */class sF{constructor(e,n,s,a){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=s,this.indexManager=a}getDocument(e,n){let s=null;return this.documentOverlayCache.getOverlay(e,n).next((a=>(s=a,this.remoteDocumentCache.getEntry(e,n)))).next((a=>(s!==null&&Dd(s.mutation,a,Ls.empty(),Ut.now()),a)))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next((s=>this.getLocalViewOfDocuments(e,s,yt()).next((()=>s))))}getLocalViewOfDocuments(e,n,s=yt()){const a=Yo();return this.populateOverlays(e,a,n).next((()=>this.computeViews(e,n,a,s).next((c=>{let u=Sd();return c.forEach(((h,m)=>{u=u.insert(h,m.overlayedDocument)})),u}))))}getOverlayedDocuments(e,n){const s=Yo();return this.populateOverlays(e,s,n).next((()=>this.computeViews(e,n,s,yt())))}populateOverlays(e,n,s){const a=[];return s.forEach((c=>{n.has(c)||a.push(c)})),this.documentOverlayCache.getOverlays(e,a).next((c=>{c.forEach(((u,h)=>{n.set(u,h)}))}))}computeViews(e,n,s,a){let c=na();const u=Pd(),h=(function(){return Pd()})();return n.forEach(((m,p)=>{const b=s.get(p.key);a.has(p.key)&&(b===void 0||b.mutation instanceof co)?c=c.insert(p.key,p):b!==void 0?(u.set(p.key,b.mutation.getFieldMask()),Dd(b.mutation,p,b.mutation.getFieldMask(),Ut.now())):u.set(p.key,Ls.empty())})),this.recalculateAndSaveOverlays(e,c).next((m=>(m.forEach(((p,b)=>u.set(p,b))),n.forEach(((p,b)=>h.set(p,new nF(b,u.get(p)??null)))),h)))}recalculateAndSaveOverlays(e,n){const s=Pd();let a=new Qt(((u,h)=>u-h)),c=yt();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next((u=>{for(const h of u)h.keys().forEach((m=>{const p=n.get(m);if(p===null)return;let b=s.get(m)||Ls.empty();b=h.applyToLocalView(p,b),s.set(m,b);const x=(a.get(h.batchId)||yt()).add(m);a=a.insert(h.batchId,x)}))})).next((()=>{const u=[],h=a.getReverseIterator();for(;h.hasNext();){const m=h.getNext(),p=m.key,b=m.value,x=Xj();b.forEach((w=>{if(!c.has(w)){const T=nA(n.get(w),s.get(w));T!==null&&x.set(w,T),c=c.add(w)}})),u.push(this.documentOverlayCache.saveOverlays(e,p,x))}return ve.waitFor(u)})).next((()=>s))}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next((s=>this.recalculateAndSaveOverlays(e,s)))}getDocumentsMatchingQuery(e,n,s,a){return n9(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):n_(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,s,a):this.getDocumentsMatchingCollectionQuery(e,n,s,a)}getNextDocuments(e,n,s,a){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,s,a).next((c=>{const u=a-c.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,s.largestBatchId,a-c.size):ve.resolve(Yo());let h=Yd,m=c;return u.next((p=>ve.forEach(p,((b,x)=>(h<x.largestBatchId&&(h=x.largestBatchId),c.get(b)?ve.resolve():this.remoteDocumentCache.getEntry(e,b).next((w=>{m=m.insert(b,w)}))))).next((()=>this.populateOverlays(e,p,c))).next((()=>this.computeViews(e,m,p,yt()))).next((b=>({batchId:h,changes:Wj(b)})))))}))}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new Ve(n)).next((s=>{let a=Sd();
3449return s.isFoundDocument()&&(a=a.insert(s.key,s)),a}))}getDocumentsMatchingCollectionGroupQuery(e,n,s,a){const c=n.collectionGroup;let u=Sd();return this.indexManager.getCollectionParents(e,c).next((h=>ve.forEach(h,(m=>{const p=(function(x,w){return new pl(w,null,x.explicitOrderBy.slice(),x.filters.slice(),x.limit,x.limitType,x.startAt,x.endAt)})(n,m.child(c));return this.getDocumentsMatchingCollectionQuery(e,p,s,a).next((b=>{b.forEach(((x,w)=>{u=u.insert(x,w)}))}))})).next((()=>u))))}getDocumentsMatchingCollectionQuery(e,n,s,a){let c;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,s.largestBatchId).next((u=>(c=u,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,s,c,a)))).next((u=>{c.forEach(((m,p)=>{const b=p.getKey();u.get(b)===null&&(u=u.insert(b,ts.newInvalidDocument(b)))}));let h=Sd();return u.forEach(((m,p)=>{const b=c.get(m);b!==void 0&&Dd(b.mutation,p,Ls.empty(),Ut.now()),$p(n,p)&&(h=h.insert(m,p))})),h}))}}/**
3450 * @license
3451 * Copyright 2020 Google LLC
3452 *
3453 * Licensed under the Apache License, Version 2.0 (the "License");
3454 * you may not use this file except in compliance with the License.
3455 * You may obtain a copy of the License at
3456 *
3457 *   http://www.apache.org/licenses/LICENSE-2.0
3458 *
3459 * Unless required by applicable law or agreed to in writing, software
3460 * distributed under the License is distributed on an "AS IS" BASIS,
3461 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3462 * See the License for the specific language governing permissions and
3463 * limitations under the License.
3464 */class rF{constructor(e){this.serializer=e,this.Nr=new Map,this.Br=new Map}getBundleMetadata(e,n){return ve.resolve(this.Nr.get(n))}saveBundleMetadata(e,n){return this.Nr.set(n.id,(function(a){return{id:a.id,version:a.version,createTime:oi(a.createTime)}})(n)),ve.resolve()}getNamedQuery(e,n){return ve.resolve(this.Br.get(n))}saveNamedQuery(e,n){return this.Br.set(n.name,(function(a){return{name:a.name,query:G9(a.bundledQuery),readTime:oi(a.readTime)}})(n)),ve.resolve()}}/**
3465 * @license
3466 * Copyright 2022 Google LLC
3467 *
3468 * Licensed under the Apache License, Version 2.0 (the "License");
3469 * you may not use this file except in compliance with the License.
3470 * You may obtain a copy of the License at
3471 *
3472 *   http://www.apache.org/licenses/LICENSE-2.0
3473 *
3474 * Unless required by applicable law or agreed to in writing, software
3475 * distributed under the License is distributed on an "AS IS" BASIS,
3476 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3477 * See the License for the specific language governing permissions and
3478 * limitations under the License.
3479 */class iF{constructor(){this.overlays=new Qt(Ve.comparator),this.Lr=new Map}getOverlay(e,n){return ve.resolve(this.overlays.get(n))}getOverlays(e,n){const s=Yo();return ve.forEach(n,(a=>this.getOverlay(e,a).next((c=>{c!==null&&s.set(a,c)})))).next((()=>s))}saveOverlays(e,n,s){return s.forEach(((a,c)=>{this.bt(e,n,c)})),ve.resolve()}removeOverlaysForBatchId(e,n,s){const a=this.Lr.get(s);return a!==void 0&&(a.forEach((c=>this.overlays=this.overlays.remove(c))),this.Lr.delete(s)),ve.resolve()}getOverlaysForCollection(e,n,s){const a=Yo(),c=n.length+1,u=new Ve(n.child("")),h=this.overlays.getIteratorFrom(u);for(;h.hasNext();){const m=h.getNext().value,p=m.getKey();if(!n.isPrefixOf(p.path))break;p.path.length===c&&m.largestBatchId>s&&a.set(m.getKey(),m)}return ve.resolve(a)}getOverlaysForCollectionGroup(e,n,s,a){let c=new Qt(((p,b)=>p-b));const u=this.overlays.getIterator();for(;u.hasNext();){const p=u.getNext().value;if(p.getKey().getCollectionGroup()===n&&p.largestBatchId>s){let b=c.get(p.largestBatchId);b===null&&(b=Yo(),c=c.insert(p.largestBatchId,b)),b.set(p.getKey(),p)}}const h=Yo(),m=c.getIterator();for(;m.hasNext()&&(m.getNext().value.forEach(((p,b)=>h.set(p,b))),!(h.size()>=a)););return ve.resolve(h)}bt(e,n,s){const a=this.overlays.get(s.key);if(a!==null){const u=this.Lr.get(a.largestBatchId).delete(s.key);this.Lr.set(a.largestBatchId,u)}this.overlays=this.overlays.insert(s.key,new E9(n,s));let c=this.Lr.get(n);c===void 0&&(c=yt(),this.Lr.set(n,c)),this.Lr.set(n,c.add(s.key))}}/**
3480 * @license
3481 * Copyright 2024 Google LLC
3482 *
3483 * Licensed under the Apache License, Version 2.0 (the "License");
3484 * you may not use this file except in compliance with the License.
3485 * You may obtain a copy of the License at
3486 *
3487 *   http://www.apache.org/licenses/LICENSE-2.0
3488 *
3489 * Unless required by applicable law or agreed to in writing, software
3490 * distributed under the License is distributed on an "AS IS" BASIS,
3491 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3492 * See the License for the specific language governing permissions and
3493 * limitations under the License.
3494 */class aF{constructor(){this.sessionToken=Wn.EMPTY_BYTE_STRING}getSessionToken(e){return ve.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,ve.resolve()}}/**
3495 * @license
3496 * Copyright 2017 Google LLC
3497 *
3498 * Licensed under the Apache License, Version 2.0 (the "License");
3499 * you may not use this file except in compliance with the License.
3500 * You may obtain a copy of the License at
3501 *
3502 *   http://www.apache.org/licenses/LICENSE-2.0
3503 *
3504 * Unless required by applicable law or agreed to in writing, software
3505 * distributed under the License is distributed on an "AS IS" BASIS,
3506 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3507 * See the License for the specific language governing permissions and
3508 * limitations under the License.
3509 */class l_{constructor(){this.kr=new Rn(On.Kr),this.qr=new Rn(On.Ur)}isEmpty(){return this.kr.isEmpty()}addReference(e,n){const s=new On(e,n);this.kr=this.kr.add(s),this.qr=this.qr.add(s)}$r(e,n){e.forEach((s=>this.addReference(s,n)))}removeReference(e,n){this.Wr(new On(e,n))}Qr(e,n){e.forEach((s=>this.removeReference(s,n)))}Gr(e){const n=new Ve(new Vt([])),s=new On(n,e),a=new On(n,e+1),c=[];return this.qr.forEachInRange([s,a],(u=>{this.Wr(u),c.push(u.key)})),c}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 Ve(new Vt([])),s=new On(n,e),a=new On(n,e+1);let c=yt();return this.qr.forEachInRange([s,a],(u=>{c=c.add(u.key)})),c}containsKey(e){const n=new On(e,0),s=this.kr.firstAfterOrEqual(n);return s!==null&&e.isEqual(s.key)}}class On{constructor(e,n){this.key=e,this.Hr=n}static Kr(e,n){return Ve.comparator(e.key,n.key)||gt(e.Hr,n.Hr)}static Ur(e,n){return gt(e.Hr,n.Hr)||Ve.comparator(e.key,n.key)}}/**
3510 * @license
3511 * Copyright 2017 Google LLC
3512 *
3513 * Licensed under the Apache License, Version 2.0 (the "License");
3514 * you may not use this file except in compliance with the License.
3515 * You may obtain a copy of the License at
3516 *
3517 *   http://www.apache.org/licenses/LICENSE-2.0
3518 *
3519 * Unless required by applicable law or agreed to in writing, software
3520 * distributed under the License is distributed on an "AS IS" BASIS,
3521 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3522 * See the License for the specific language governing permissions and
3523 * limitations under the License.
3524 */class oF{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Yn=1,this.Jr=new Rn(On.Kr)}checkEmpty(e){return ve.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,s,a){const c=this.Yn;this.Yn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const u=new w9(c,n,s,a);this.mutationQueue.push(u);for(const h of a)this.Jr=this.Jr.add(new On(h.key,c)),this.indexManager.addToCollectionParentIndex(e,h.key.path.popLast());return ve.resolve(u)}lookupMutationBatch(e,n){return ve.resolve(this.Zr(n))}getNextMutationBatchAfterBatchId(e,n){const s=n+1,a=this.Xr(s),c=a<0?0:a;return ve.resolve(this.mutationQueue.length>c?this.mutationQueue[c]:null)}getHighestUnacknowledgedBatchId(){return ve.resolve(this.mutationQueue.length===0?Jv:this.Yn-1)}getAllMutationBatches(e){return ve.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const s=new On(n,0),a=new On(n,Number.POSITIVE_INFINITY),c=[];return this.Jr.forEachInRange([s,a],(u=>{const h=this.Zr(u.Hr);c.push(h)})),ve.resolve(c)}getAllMutationBatchesAffectingDocumentKeys(e,n){let s=new Rn(gt);return n.forEach((a=>{const c=new On(a,0),u=new On(a,Number.POSITIVE_INFINITY);this.Jr.forEachInRange([c,u],(h=>{s=s.add(h.Hr)}))}
vendor: 12,166 bytes, lines 3524-3603
3524)),ve.resolve(this.Yr(s))}getAllMutationBatchesAffectingQuery(e,n){const s=n.path,a=s.length+1;let c=s;Ve.isDocumentKey(c)||(c=c.child(""));const u=new On(new Ve(c),0);let h=new Rn(gt);return this.Jr.forEachWhile((m=>{const p=m.key.path;return!!s.isPrefixOf(p)&&(p.length===a&&(h=h.add(m.Hr)),!0)}),u),ve.resolve(this.Yr(h))}Yr(e){const n=[];return e.forEach((s=>{const a=this.Zr(s);a!==null&&n.push(a)})),n}removeMutationBatch(e,n){At(this.ei(n.batchId,"removed")===0,55003),this.mutationQueue.shift();let s=this.Jr;return ve.forEach(n.mutations,(a=>{const c=new On(a.key,n.batchId);return s=s.delete(c),this.referenceDelegate.markPotentiallyOrphaned(e,a.key)})).next((()=>{this.Jr=s}))}nr(e){}containsKey(e,n){const s=new On(n,0),a=this.Jr.firstAfterOrEqual(s);return ve.resolve(n.isEqual(a&&a.key))}performConsistencyCheck(e){return this.mutationQueue.length,ve.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]}}/**
3525 * @license
3526 * Copyright 2017 Google LLC
3527 *
3528 * Licensed under the Apache License, Version 2.0 (the "License");
3529 * you may not use this file except in compliance with the License.
3530 * You may obtain a copy of the License at
3531 *
3532 *   http://www.apache.org/licenses/LICENSE-2.0
3533 *
3534 * Unless required by applicable law or agreed to in writing, software
3535 * distributed under the License is distributed on an "AS IS" BASIS,
3536 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3537 * See the License for the specific language governing permissions and
3538 * limitations under the License.
3539 */class lF{constructor(e){this.ti=e,this.docs=(function(){return new Qt(Ve.comparator)})(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const s=n.key,a=this.docs.get(s),c=a?a.size:0,u=this.ti(n);return this.docs=this.docs.insert(s,{document:n.mutableCopy(),size:u}),this.size+=u-c,this.indexManager.addToCollectionParentIndex(e,s.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 s=this.docs.get(n);return ve.resolve(s?s.document.mutableCopy():ts.newInvalidDocument(n))}getEntries(e,n){let s=na();return n.forEach((a=>{const c=this.docs.get(a);s=s.insert(a,c?c.document.mutableCopy():ts.newInvalidDocument(a))})),ve.resolve(s)}getDocumentsMatchingQuery(e,n,s,a){let c=na();const u=n.path,h=new Ve(u.child("__id-9223372036854775808__")),m=this.docs.getIteratorFrom(h);for(;m.hasNext();){const{key:p,value:{document:b}}=m.getNext();if(!u.isPrefixOf(p.path))break;p.path.length>u.length+1||IU(RU(b),s)<=0||(a.has(b.key)||$p(n,b))&&(c=c.insert(b.key,b.mutableCopy()))}return ve.resolve(c)}getAllFromCollectionGroup(e,n,s,a){We(9500)}ni(e,n){return ve.forEach(this.docs,(s=>n(s)))}newChangeBuffer(e){return new cF(this)}getSize(e){return ve.resolve(this.size)}}class cF extends tF{constructor(e){super(),this.Mr=e}applyChanges(e){const n=[];return this.changes.forEach(((s,a)=>{a.isValidDocument()?n.push(this.Mr.addEntry(e,a)):this.Mr.removeEntry(s)})),ve.waitFor(n)}getFromCache(e,n){return this.Mr.getEntry(e,n)}getAllFromCache(e,n){return this.Mr.getEntries(e,n)}}/**
3540 * @license
3541 * Copyright 2017 Google LLC
3542 *
3543 * Licensed under the Apache License, Version 2.0 (the "License");
3544 * you may not use this file except in compliance with the License.
3545 * You may obtain a copy of the License at
3546 *
3547 *   http://www.apache.org/licenses/LICENSE-2.0
3548 *
3549 * Unless required by applicable law or agreed to in writing, software
3550 * distributed under the License is distributed on an "AS IS" BASIS,
3551 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3552 * See the License for the specific language governing permissions and
3553 * limitations under the License.
3554 */class uF{constructor(e){this.persistence=e,this.ri=new gl((n=>e_(n)),t_),this.lastRemoteSnapshotVersion=Je.min(),this.highestTargetId=0,this.ii=0,this.si=new l_,this.targetCount=0,this.oi=Wc._r()}forEachTarget(e,n){return this.ri.forEach(((s,a)=>n(a))),ve.resolve()}getLastRemoteSnapshotVersion(e){return ve.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return ve.resolve(this.ii)}allocateTargetId(e){return this.highestTargetId=this.oi.next(),ve.resolve(this.highestTargetId)}setTargetsMetadata(e,n,s){return s&&(this.lastRemoteSnapshotVersion=s),n>this.ii&&(this.ii=n),ve.resolve()}lr(e){this.ri.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.oi=new Wc(n),this.highestTargetId=n),e.sequenceNumber>this.ii&&(this.ii=e.sequenceNumber)}addTargetData(e,n){return this.lr(n),this.targetCount+=1,ve.resolve()}updateTargetData(e,n){return this.lr(n),ve.resolve()}removeTargetData(e,n){return this.ri.delete(n.target),this.si.Gr(n.targetId),this.targetCount-=1,ve.resolve()}removeTargets(e,n,s){let a=0;const c=[];return this.ri.forEach(((u,h)=>{h.sequenceNumber<=n&&s.get(h.targetId)===null&&(this.ri.delete(u),c.push(this.removeMatchingKeysForTargetId(e,h.targetId)),a++)})),ve.waitFor(c).next((()=>a))}getTargetCount(e){return ve.resolve(this.targetCount)}getTargetData(e,n){const s=this.ri.get(n)||null;return ve.resolve(s)}addMatchingKeys(e,n,s){return this.si.$r(n,s),ve.resolve()}removeMatchingKeys(e,n,s){this.si.Qr(n,s);const a=this.persistence.referenceDelegate,c=[];return a&&n.forEach((u=>{c.push(a.markPotentiallyOrphaned(e,u))})),ve.waitFor(c)}removeMatchingKeysForTargetId(e,n){return this.si.Gr(n),ve.resolve()}getMatchingKeysForTargetId(e,n){const s=this.si.jr(n);return ve.resolve(s)}containsKey(e,n){return ve.resolve(this.si.containsKey(n))}}/**
3555 * @license
3556 * Copyright 2017 Google LLC
3557 *
3558 * Licensed under the Apache License, Version 2.0 (the "License");
3559 * you may not use this file except in compliance with the License.
3560 * You may obtain a copy of the License at
3561 *
3562 *   http://www.apache.org/licenses/LICENSE-2.0
3563 *
3564 * Unless required by applicable law or agreed to in writing, software
3565 * distributed under the License is distributed on an "AS IS" BASIS,
3566 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3567 * See the License for the specific language governing permissions and
3568 * limitations under the License.
3569 */class gA{constructor(e,n){this._i={},this.overlays={},this.ai=new Up(0),this.ui=!1,this.ui=!0,this.ci=new aF,this.referenceDelegate=e(this),this.li=new uF(this),this.indexManager=new Y9,this.remoteDocumentCache=(function(a){return new lF(a)})((s=>this.referenceDelegate.hi(s))),this.serializer=new H9(n),this.Pi=new rF(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 iF,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let s=this._i[e.toKey()];return s||(s=new oF(n,this.referenceDelegate),this._i[e.toKey()]=s),s}getGlobalsCache(){return this.ci}getTargetCache(){return this.li}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Pi}runTransaction(e,n,s){Ie("MemoryPersistence","Starting transaction:",e);const a=new dF(this.ai.next());return this.referenceDelegate.Ti(),s(a).next((c=>this.referenceDelegate.Ii(a).next((()=>c)))).toPromise().then((c=>(a.raiseOnCommittedEvent(),c)))}Ei(e,n){return ve.or(Object.values(this._i).map((s=>()=>s.containsKey(e,n))))}}class dF extends PU{constructor(e){super(),this.currentSequenceNumber=e}}class c_{constructor(e){this.persistence=e,this.Ri=new l_,this.Ai=null}static Vi(e){return new c_(e)}get di(){if(this.Ai)return this.Ai;throw We(60996)}addReference(e,n,s){return this.Ri.addReference(s,n),this.di.delete(s.toString()),ve.resolve()}removeReference(e,n,s){return this.Ri.removeReference(s,n),this.di.add(s.toString()),ve.resolve()}markPotentiallyOrphaned(e,n){return this.di.add(n.toString()),ve.resolve()}removeTarget(e,n){this.Ri.Gr(n.targetId).forEach((a=>this.di.add(a.toString())));const s=this.persistence.getTargetCache();return s.getMatchingKeysForTargetId(e,n.targetId).next((a=>{a.forEach((c=>this.di.add(c.toString())))})).next((()=>s.removeTargetData(e,n)))}Ti(){this.Ai=new Set}Ii(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return ve.forEach(this.di,(s=>{const a=Ve.fromPath(s);return this.mi(e,a).next((c=>{c||n.removeEntry(a,Je.min())}))})).next((()=>(this.Ai=null,n.apply(e))))}updateLimboDocument(e,n){return this.mi(e,n).next((s=>{s?this.di.delete(n.toString()):this.di.add(n.toString())}))}hi(e){return 0}mi(e,n){return ve.or([()=>ve.resolve(this.Ri.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Ei(e,n)])}}class rp{constructor(e,n){this.persistence=e,this.fi=new gl((s=>LU(s.path)),((s,a)=>s.isEqual(a))),this.garbageCollector=eF(this,n)}static Vi(e,n){return new rp(e,n)}Ti(){}Ii(e){return ve.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((s=>n.next((a=>s+a))))}pr(e){let n=0;return this.mr(e,(s=>{n++})).next((()=>n))}mr(e,n){return ve.forEach(this.fi,((s,a)=>this.wr(e,s,a).next((c=>c?ve.resolve():n(a)))))}removeTargets(e,n,s){return this.persistence.getTargetCache().removeTargets(e,n,s)}removeOrphanedDocuments(e,n){let s=0;const a=this.persistence.getRemoteDocumentCache(),c=a.newChangeBuffer();return a.ni(e,(u=>this.wr(e,u,n).next((h=>{h||(s++,c.removeEntry(u,Je.min()))})))).next((()=>c.apply(e))).next((()=>s))}markPotentiallyOrphaned(e,n){return this.fi.set(n,e.currentSequenceNumber),ve.resolve()}removeTarget(e,n){const s=n.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,s)}addReference(e,n,s){return this.fi.set(s,e.currentSequenceNumber),ve.resolve()}removeReference(e,n,s){return this.fi.set(s,e.currentSequenceNumber),ve.resolve()}updateLimboDocument(e,n){return this.fi.set(n,e.currentSequenceNumber),ve.resolve()}hi(e){let n=e.key.toString().length;return e.isFoundDocument()&&(n+=Cm(e.data.value)),n}wr(e,n,s){return ve.or([()=>this.persistence.Ei(e,n),()=>this.persistence.getTargetCache().containsKey(e,n),()=>{const a=this.fi.get(n);return ve.resolve(a!==void 0&&a>s)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}/**
3570 * @license
3571 * Copyright 2017 Google LLC
3572 *
3573 * Licensed under the Apache License, Version 2.0 (the "License");
3574 * you may not use this file except in compliance with the License.
3575 * You may obtain a copy of the License at
3576 *
3577 *   http://www.apache.org/licenses/LICENSE-2.0
3578 *
3579 * Unless required by applicable law or agreed to in writing, software
3580 * distributed under the License is distributed on an "AS IS" BASIS,
3581 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3582 * See the License for the specific language governing permissions and
3583 * limitations under the License.
3584 */class u_{constructor(e,n,s,a){this.targetId=e,this.fromCache=n,this.Ts=s,this.Is=a}static Es(e,n){let s=yt(),a=yt();for(const c of n.docChanges)switch(c.type){case 0:s=s.add(c.doc.key);break;case 1:a=a.add(c.doc.key)}return new u_(e,n.fromCache,s,a)}}/**
3585 * @license
3586 * Copyright 2023 Google LLC
3587 *
3588 * Licensed under the Apache License, Version 2.0 (the "License");
3589 * you may not use this file except in compliance with the License.
3590 * You may obtain a copy of the License at
3591 *
3592 *   http://www.apache.org/licenses/LICENSE-2.0
3593 *
3594 * Unless required by applicable law or agreed to in writing, software
3595 * distributed under the License is distributed on an "AS IS" BASIS,
3596 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3597 * See the License for the specific language governing permissions and
3598 * limitations under the License.
3599 */class hF{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
3600 * @license
3601 * Copyright 2019 Google LLC
3602 *
3603 * Licensed under the Apache License, Version 2.0 (the "License");
3604 * you may not use this file except in compliance with the License.
3605 * You may obtain a copy of the License at
3606 *
3607 *   http://www.apache.org/licenses/LICENSE-2.0
3608 *
3609 * Unless required by applicable law or agreed to in writing, software
3610 * distributed under the License is distributed on an "AS IS" BASIS,
3611 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3612 * See the License for the specific language governing permissions and
3613 * limitations under the License.
3614 */class fF{constructor(){this.Rs=!1,this.As=!1,this.Vs=100,this.ds=(function(){return aP()?8:DU(ss())>0?6:4})()}initialize(e,n){this.fs=e,this.indexManager=n,this.Rs=!0}getDocumentsMatchingQuery(e,n,s,a){const c={result:null};return this.gs(e,n).next((u=>{c.result=u})).next((()=>{if(!c.result)return this.ps(e,n,a,s).next((u=>{c.result=u}))})).next((()=>{if(c.result)return;const u=new hF;return this.ys(e,n,u).next((h=>{if(c.result=h,this.As)return this.ws(e,n,u,h.size)}))})).next((()=>c.result))}ws(e,n,s,a){return s.documentReadCount<this.Vs?(Ec()<=ft.DEBUG&&Ie("QueryEngine","SDK will not create cache indexes for query:",kc(n),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),ve.resolve()):(Ec()<=ft.DEBUG&&Ie("QueryEngine","Query:",kc(n),"scans",s.documentReadCount,"local documents and returns",a,"documents as results."),s.documentReadCount>this.ds*a?(Ec()<=ft.DEBUG&&Ie("QueryEngine","The SDK decides to create cache indexes for query:",kc(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,ai(n))):ve.resolve())}gs(e,n){if(n2(n))return ve.resolve(null);let s=ai(n);return this.indexManager.getIndexType(e,s).next((a=>a===0?null:(n.limit!==null&&a===1&&(n=tp(n,null,"F"),s=ai(n)),this.indexManager.getDocumentsMatchingTarget(e,s).next((c=>{const u=yt(...c);return this.fs.getDocuments(e,u).next((h=>this.indexManager.getMinOffset(e,s).next((m=>{const p=this.bs(n,h);return this.Ss(n,p,u,m.readTime)?this.gs(e,tp(n,null,"F")):this.Ds(e,p,n,m)}))))})))))}ps(e,n,s,a){return n2(n)||a.isEqual(Je.min())?ve.resolve(null):this.fs.getDocuments(e,s).next((c=>{const u=this.bs(n,c);return this.Ss(n,u,s,a)?ve.resolve(null):(Ec()<=ft.DEBUG&&Ie("QueryEngine","Re-using previous result from %s to execute query: %s",a.toString(),kc(n)),this.Ds(e,u,n,CU(a,Yd)).next((h=>h)))}))}bs(e,n){let s=new Rn(Gj(e));return n.forEach(((a,c)=>{$p(e,c)&&(s=s.add(c))})),s}Ss(e,n,s,a){if(e.limit===null)return!1;if(s.size!==n.size)return!0;const c=e.limitType==="F"?n.last():n.first();return!!c&&(c.hasPendingWrites||c.version.compareTo(a)>0)}ys(e,n,s){return Ec()<=ft.DEBUG&&Ie("QueryEngine","Using full collection scan to execute query:",kc(n)),this.fs.getDocumentsMatchingQuery(e,n,eo.min(),s)}Ds(e,n,s,a){return this.fs.getDocumentsMatchingQuery(e,s,a).next((c=>(n.forEach((u=>{c=c.insert(u.key,u)})),c)))}}/**
3615 * @license
3616 * Copyright 2020 Google LLC
3617 *
3618 * Licensed under the Apache License, Version 2.0 (the "License");
3619 * you may not use this file except in compliance with the License.
3620 * You may obtain a copy of the License at
3621 *
3622 *   http://www.apache.org/licenses/LICENSE-2.0
3623 *
3624 * Unless required by applicable law or agreed to in writing, software
3625 * distributed under the License is distributed on an "AS IS" BASIS,
3626 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3627 * See the License for the specific language governing permissions and
3628 * limitations under the License.
3629 */const d_="LocalStore",mF=3e8;class pF{constructor(e,n,s,a){this.persistence=e,this.Cs=n,this.serializer=a,this.vs=new Qt(gt),this.Fs=new gl((c=>e_(c)),t_),this.Ms=new Map,this.xs=e.getRemoteDocumentCache(),this.li=e.getTargetCache(),this.Pi=e.getBundleCache(),this.Os(s)}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 sF(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 gF(t,e,n,s){return new pF(t,e,n,s)}async function yA(t,e){const n=tt(t);return await n.persistence.runTransaction("Handle user change","readonly",(s=>{let a;
3629return n.mutationQueue.getAllMutationBatches(s).next((c=>(a=c,n.Os(e),n.mutationQueue.getAllMutationBatches(s)))).next((c=>{const u=[],h=[];let m=yt();for(const p of a){u.push(p.batchId);for(const b of p.mutations)m=m.add(b.key)}for(const p of c){h.push(p.batchId);for(const b of p.mutations)m=m.add(b.key)}return n.localDocuments.getDocuments(s,m).next((p=>({Ns:p,removedBatchIds:u,addedBatchIds:h})))}))}))}function yF(t,e){const n=tt(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",(s=>{const a=e.batch.keys(),c=n.xs.newChangeBuffer({trackRemovals:!0});return(function(h,m,p,b){const x=p.batch,w=x.keys();let T=ve.resolve();return w.forEach((N=>{T=T.next((()=>b.getEntry(m,N))).next((j=>{const A=p.docVersions.get(N);At(A!==null,48541),j.version.compareTo(A)<0&&(x.applyToRemoteDocument(j,p),j.isValidDocument()&&(j.setReadTime(p.commitVersion),b.addEntry(j)))}))})),T.next((()=>h.mutationQueue.removeMutationBatch(m,x)))})(n,s,e,c).next((()=>c.apply(s))).next((()=>n.mutationQueue.performConsistencyCheck(s))).next((()=>n.documentOverlayCache.removeOverlaysForBatchId(s,a,e.batch.batchId))).next((()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(s,(function(h){let m=yt();for(let p=0;p<h.mutationResults.length;++p)h.mutationResults[p].transformResults.length>0&&(m=m.add(h.batch.mutations[p].key));return m})(e)))).next((()=>n.localDocuments.getDocuments(s,a)))}))}function bA(t){const e=tt(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",(n=>e.li.getLastRemoteSnapshotVersion(n)))}function bF(t,e){const n=tt(t),s=e.snapshotVersion;let a=n.vs;return n.persistence.runTransaction("Apply remote event","readwrite-primary",(c=>{const u=n.xs.newChangeBuffer({trackRemovals:!0});a=n.vs;const h=[];
3629e.targetChanges.forEach(((b,x)=>{const w=a.get(x);if(!w)return;h.push(n.li.removeMatchingKeys(c,b.removedDocuments,x).next((()=>n.li.addMatchingKeys(c,b.addedDocuments,x))));let T=w.withSequenceNumber(c.currentSequenceNumber);e.targetMismatches.get(x)!==null?T=T.withResumeToken(Wn.EMPTY_BYTE_STRING,Je.min()).withLastLimboFreeSnapshotVersion(Je.min()):b.resumeToken.approximateByteSize()>0&&(T=T.withResumeToken(b.resumeToken,s)),a=a.insert(x,T),(function(j,A,F){return j.resumeToken.approximateByteSize()===0||A.snapshotVersion.toMicroseconds()-j.snapshotVersion.toMicroseconds()>=mF?!0:F.addedDocuments.size+F.modifiedDocuments.size+F.removedDocuments.size>0})(w,T,b)&&h.push(n.li.updateTargetData(c,T))}));let m=na(),p=yt();if(e.documentUpdates.forEach((b=>{e.resolvedLimboDocuments.has(b)&&h.push(n.persistence.referenceDelegate.updateLimboDocument(c,b))})),h.push(xF(c,u,e.documentUpdates).next((b=>{m=b.Bs,p=b.Ls}))),!s.isEqual(Je.min())){const b=n.li.getLastRemoteSnapshotVersion(c).next((x=>n.li.setTargetsMetadata(c,c.currentSequenceNumber,s)));h.push(b)}return ve.waitFor(h).next((()=>u.apply(c))).next((()=>n.localDocuments.getLocalViewOfDocuments(c,m,p))).next((()=>m))})).then((c=>(n.vs=a,c)))}function xF(t,e,n){let s=yt(),a=yt();return n.forEach((c=>s=s.add(c))),e.getEntries(t,s).next((c=>{let u=na();return n.forEach(((h,m)=>{const p=c.get(h);m.isFoundDocument()!==p.isFoundDocument()&&(a=a.add(h)),m.isNoDocument()&&m.version.isEqual(Je.min())?(e.removeEntry(h,m.readTime),u=u.insert(h,m)):!p.isValidDocument()||m.version.compareTo(p.version)>0||m.version.compareTo(p.version)===0&&p.hasPendingWrites?(e.addEntry(m),u=u.insert(h,m)):Ie(d_,"Ignoring outdated watch update for ",h,". Current version:",p.version," Watch version:",m.version)})),{Bs:u,Ls:a}}))}function vF(t,e){const n=tt(t);return n.persistence.runTransaction("Get next mutation batch","readonly",(s=>(e===void 0&&(e=Jv),n.mutationQueue.getNextMutationBatchAfterBatchId(s,e))))}function _F(t,e){const n=tt(t);return n.persistence.runTransaction("Allocate target","readwrite",(s=>{let a;return n.li.getTargetData(s,e).next((c=>c?(a=c,ve.resolve(a)):n.li.allocateTargetId(s).next((u=>(a=new Ha(e,u,"TargetPurposeListen",s.currentSequenceNumber),n.li.addTargetData(s,a).next((()=>a)))))))})).then((s=>{const a=n.vs.get(s.targetId);return(a===null||s.snapshotVersion.compareTo(a.snapshotVersion)>0)&&(n.vs=n.vs.insert(s.targetId,s),n.Fs.set(e,s.targetId)),s}))}async function Yx(t,e,n){const s=tt(t),a=s.vs.get(e),c=n?"readwrite":"readwrite-primary";try{n||await s.persistence.runTransaction("Release target",c,(u=>s.persistence.referenceDelegate.removeTarget(u,a)))}catch(u){if(!lu(u))throw u;Ie(d_,`Failed to update sequence numbers for target ${e}: ${u}`)}s.vs=s.vs.remove(e),s.Fs.delete(a.target)}function p2(t,e,n){const s=tt(t);let a=Je.min(),c=yt();return s.persistence.runTransaction("Execute query","readwrite",(u=>(function(m,p,b){const x=tt(m),w=x.Fs.get(b);return w!==void 0?ve.resolve(x.vs.get(w)):x.li.getTargetData(p,b)})(s,u,ai(e)).next((h=>{if(h)return a=h.lastLimboFreeSnapshotVersion,s.li.getMatchingKeysForTargetId(u,h.targetId).next((m=>{c=m}))})).next((()=>s.Cs.getDocumentsMatchingQuery(u,e,n?a:Je.min(),n?c:yt()))).next((h=>(wF(s,a9(e),h),{documents:h,ks:c})))))}function wF(t,e,n){let s=t.Ms.get(e)||Je.min();n.forEach(((a,c)=>{c.readTime.compareTo(s)>0&&(s=c.readTime)})),t.Ms.set(e,s)}class g2{constructor(){this.activeTargetIds=h9()}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 EF{constructor(){this.vo=new g2,this.Fo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,s){}addLocalQueryTarget(e,n=!0){return n&&this.vo.Qs(e),this.Fo[e]||"not-current"}updateQueryState(e,n,s){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 g2,Promise.resolve()}handleUserChange(e,n,s){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
3630 * @license
3631 * Copyright 2019 Google LLC
3632 *
3633 * Licensed under the Apache License, Version 2.0 (the "License");
3634 * you may not use this file except in compliance with the License.
3635 * You may obtain a copy of the License at
3636 *
3637 *   http://www.apache.org/licenses/LICENSE-2.0
3638 *
3639 * Unless required by applicable law or agreed to in writing, software
3640 * distributed under the License is distributed on an "AS IS" BASIS,
3641 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3642 * See the License for the specific language governing permissions and
3643 * limitations under the License.
3644 */class kF{Mo(e){}shutdown(){}}/**
3645 * @license
3646 * Copyright 2019 Google LLC
3647 *
3648 * Licensed under the Apache License, Version 2.0 (the "License");
3649 * you may not use this file except in compliance with the License.
3650 * You may obtain a copy of the License at
3651 *
3652 *   http://www.apache.org/licenses/LICENSE-2.0
3653 *
3654 * Unless required by applicable law or agreed to in writing, software
3655 * distributed under the License is distributed on an "AS IS" BASIS,
3656 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3657 * See the License for the specific language governing permissions and
3658 * limitations under the License.
3659 */const y2="ConnectivityMonitor";class b2{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(){Ie(y2,"Network connectivity changed: AVAILABLE");for(const e of this.Lo)e(0)}Bo(){Ie(y2,"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}}/**
3660 * @license
3661 * Copyright 2023 Google LLC
3662 *
3663 * Licensed under the Apache License, Version 2.0 (the "License");
3664 * you may not use this file except in compliance with the License.
3665 * You may obtain a copy of the License at
3666 *
3667 *   http://www.apache.org/licenses/LICENSE-2.0
3668 *
3669 * Unless required by applicable law or agreed to in writing, software
3670 * distributed under the License is distributed on an "AS IS" BASIS,
3671 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3672 * See the License for the specific language governing permissions and
3673 * limitations under the License.
3674 */let om=null;function Wx(){return om===null?om=(function(){return 268435456+Math.round(2147483648*Math.random())})():om++,"0x"+om.toString(16)}/**
3675 * @license
3676 * Copyright 2020 Google LLC
3677 *
3678 * Licensed under the Apache License, Version 2.0 (the "License");
3679 * you may not use this file except in compliance with the License.
3680 * You may obtain a copy of the License at
3681 *
3682 *   http://www.apache.org/licenses/LICENSE-2.0
3683 *
3684 * Unless required by applicable law or agreed to in writing, software
3685 * distributed under the License is distributed on an "AS IS" BASIS,
3686 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3687 * See the License for the specific language governing permissions and
3688 * limitations under the License.
3689 */const Ib="RestConnection",TF={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery",ExecutePipeline:"executePipeline"};class SF{get Ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const n=e.ssl?"https":"http",s=encodeURIComponent(this.databaseId.projectId),a=encodeURIComponent(this.databaseId.database);this.qo=n+"://"+e.host,this.Uo=`projects/${s}/databases/${a}`,this.$o=this.databaseId.database===Jm?`project_id=${s}`:`project_id=${s}&database_id=${a}`}Wo(e,n,s,a,c){const u=Wx(),h=this.Qo(e,n.toUriEncodedString());Ie(Ib,`Sending RPC '${e}' ${u}:`,h,s);const m={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.$o};this.Go(m,a,c);const{host:p}=new URL(h),b=hi(p);return this.zo(e,h,m,s,b).then((x=>(Ie(Ib,`Received RPC '${e}' ${u}: `,x),x)),(x=>{throw cl(Ib,`RPC '${e}' ${u} failed with error: `,x,"url: ",h,"request:",s),x}))}jo(e,n,s,a,c,u){return this.Wo(e,n,s,a,c)}Go(e,n,s){e["X-Goog-Api-Client"]=(function(){return"gl-js/ fire/"+au})(),e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),n&&n.headers.forEac
vendor: 4,585 bytes, lines 3689-3719
3689h(((a,c)=>e[c]=a)),s&&s.headers.forEach(((a,c)=>e[c]=a))}Qo(e,n){const s=TF[e];let a=`${this.qo}/v1/${n}:${s}`;return this.databaseInfo.apiKey&&(a=`${a}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),a}terminate(){}}/**
3690 * @license
3691 * Copyright 2017 Google LLC
3692 *
3693 * Licensed under the Apache License, Version 2.0 (the "License");
3694 * you may not use this file except in compliance with the License.
3695 * You may obtain a copy of the License at
3696 *
3697 *   http://www.apache.org/licenses/LICENSE-2.0
3698 *
3699 * Unless required by applicable law or agreed to in writing, software
3700 * distributed under the License is distributed on an "AS IS" BASIS,
3701 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3702 * See the License for the specific language governing permissions and
3703 * limitations under the License.
3704 */class NF{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)}}/**
3705 * @license
3706 * Copyright 2017 Google LLC
3707 *
3708 * Licensed under the Apache License, Version 2.0 (the "License");
3709 * you may not use this file except in compliance with the License.
3710 * You may obtain a copy of the License at
3711 *
3712 *   http://www.apache.org/licenses/LICENSE-2.0
3713 *
3714 * Unless required by applicable law or agreed to in writing, software
3715 * distributed under the License is distributed on an "AS IS" BASIS,
3716 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3717 * See the License for the specific language governing permissions and
3718 * limitations under the License.
3719 */const Jn="WebChannelConnection",gd=(t,e,n)=>{t.listen(e,(s=>{try{n(s)}catch(a){setTimeout((()=>{throw a}),0)}}))};class Oc extends SF{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(!Oc.c_){const e=kj();gd(e,Ej.STAT_EVENT,(n=>{n.stat===Lx.PROXY?Ie(Jn,"STAT_EVENT: detected buffering proxy"):n.stat===Lx.NOPROXY&&Ie(Jn,"STAT_EVENT: detected no buffering proxy")})),Oc.c_=!0}}zo(e,n,s,a,c){const u=Wx();return new Promise(((h,m)=>{const p=new _j;p.setWithCredentials(!0),p.listenOnce(wj.COMPLETE,(()=>{try{switch(p.getLastErrorCode()){case Am.NO_ERROR:const x=p.getResponseJson();Ie(Jn,`XHR for RPC '${e}' ${u} received:`,JSON.stringify(x)),h(x);break;case Am.TIMEOUT:Ie(Jn,`RPC '${e}' ${u} timed out`),m(new je(ye.DEADLINE_EXCEEDED,"Request time out"));break;case Am.HTTP_ERROR:const w=p.getStatus();if(Ie(Jn,`RPC '${e}' ${u} failed with status:`,w,"response text:",p.getResponseText()),w>0){let T=p.getResponseJson();Array.isArray(T)&&(T=T[0]);const N=T==null?void 0:T.error;if(N&&N.status&&N.message){const j=(function(F){const V=F.toLowerCase().replace(/_/g,"-");return Object.values(ye).indexOf(V)>=0?V:ye.UNKNOWN})(N.status);m(new je(j,N.message))}else m(new je(ye.UNKNOWN,"Server responded with status "+p.getStatus()))}else m(new je(ye.UNAVAILABLE,"Connection failed."));break;default:We(9055,{l_:e,streamId:u,h_:p.getLastErrorCode(),P_:p.getLastError()})}}finally{Ie(Jn,`RPC '${e}' ${u} completed.`)}}));const b=JSON.stringify(a);Ie(Jn,`RPC '${e}' ${u} sending request:`,a),p.send(n,"POST",b,s,15)}))}T_(e,n,s){const a=Wx(),c=[this.qo,"/","google.firestore.v1.Firestore","/",e,"/channel"],u=this.createWebChannelTransport(),h={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},m=this.longPollingOptions.timeoutSeconds;m!==void 0&&(h.longPollingTimeout=Math.round(1e3*m)),this.useFetchStreams&&(h.useFetchStreams=!0),this.Go(h.initMessageHeaders,n,s),h.encodeInitMessageHeaders=!0;const p=c.join("");Ie(Jn,`Creating RPC '${e}' stream ${a}: ${p}`,h);const b=u.createWebChannel(p,h);this.I_(b);let x=!1,w=!1;const T=new NF({Ho:N=>{w?Ie(Jn,`Not sending because RPC '${e}' stream ${a} is closed:`,N):(x||(Ie(Jn,`Opening RPC '${e}' stream ${a} transport.`),b.open(),x=!0),Ie(Jn,`RPC '${e}' stream ${a} sending:`,N),b.send(N))},Jo:()=>b.close()});return gd(b,Td.EventType.OPEN,(()=>{w||(Ie(Jn,`RPC '${e}' stream ${a} transport opened.`),T.i_())})),gd(b,Td.EventType.CLOSE,(()=>{w||(w=!0,Ie(Jn,`RPC '${e}' stream ${a} transport closed`),T.o_(),this.E_(b))}
3719)),gd(b,Td.EventType.ERROR,(N=>{w||(w=!0,cl(Jn,`RPC '${e}' stream ${a} transport errored. Name:`,N.name,"Message:",N.message),T.o_(new je(ye.UNAVAILABLE,"The operation could not be completed")))})),gd(b,Td.EventType.MESSAGE,(N=>{var j;if(!w){const A=N.data[0];At(!!A,16349);const F=A,V=(F==null?void 0:F.error)||((j=F[0])==null?void 0:j.error);if(V){Ie(Jn,`RPC '${e}' stream ${a} received error:`,V);const L=V.status;let Y=(function(I){const S=Tn[I];if(S!==void 0)return rA(S)})(L),$=V.message;L==="NOT_FOUND"&&$.includes("database")&&$.includes("does not exist")&&$.includes(this.databaseId.database)&&cl(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),Y===void 0&&(Y=ye.INTERNAL,$="Unknown error status: "+L+" with message "+V.message),w=!0,T.o_(new je(Y,$)),b.close()}else Ie(Jn,`RPC '${e}' stream ${a} received:`,A),T.__(A)}})),Oc.u_(),setTimeout((()=>{T.s_()}),0),T}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,s){super.Go(e,n,s),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return Tj()}}/**
3720 * @license
3721 * Copyright 2020 Google LLC
3722 *
3723 * Licensed under the Apache License, Version 2.0 (the "License");
3724 * you may not use this file except in compliance with the License.
3725 * You may obtain a copy of the License at
3726 *
3727 *   http://www.apache.org/licenses/LICENSE-2.0
3728 *
3729 * Unless required by applicable law or agreed to in writing, software
3730 * distributed under the License is distributed on an "AS IS" BASIS,
3731 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3732 * See the License for the specific language governing permissions and
3733 * limitations under the License.
3734 */function jF(t){return new Oc(t)}function Mb(){return typeof document<"u"?document:null}/**
3735 * @license
3736 * Copyright 2020 Google LLC
3737 *
3738 * Licensed under the Apache License, Version 2.0 (the "License");
3739 * you may not use this file except in compliance with the License.
3740 * You may obtain a copy of the License at
3741 *
3742 *   http://www.apache.org/licenses/LICENSE-2.0
3743 *
3744 * Unless required by applicable law or agreed to in writing, software
3745 * distributed under the License is distributed on an "AS IS" BASIS,
3746 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3747 * See the License for the specific language governing permissions and
3748 * limitations under the License.
3749 */function Yp(t){return new I9(t,!0)}/**
3750 * @license
3751 * Copyright 2017 Google LLC
3752 *
3753 * Licensed under the Apache License, Version 2.0 (the "License");
3754 * you may not use this file except in compliance with the License.
3755 * You may obtain a copy of the License at
3756 *
3757 *   http://www.apache.org/licenses/LICENSE-2.0
3758 *
3759 * Unless required by applicable law or agreed to in writing, software
3760 * distributed under the License is distributed on an "AS IS" BASIS,
3761 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3762 * See the License for the specific language governing permissions and
3763 * limitations under the License.
3764 */Oc.c_=!1;class xA{constructor(e,n,s=1e3,a=1.5,c=6e4){this.Ci=e,this.timerId=n,this.R_=s,this.A_=a,this.V_=c,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_()),s=Math.max(0,Date.now()-this.f_),a=Math.max(0,n-s);a>0&&Ie("ExponentialBackoff",`Backing off for ${a} ms (base delay: ${this.d_} ms, delay with jitter: ${n} ms, last attempt: ${s} ms ago)`),this.m_=this.Ci.enqueueAfterDelay(this.timerId,a,(()=>(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_}}/**
3765 * @license
3766 * Copyright 2017 Google LLC
3767 *
3768 * Licensed under the Apache License, Version 2.0 (the "License");
3769 * you may not use this file except in compliance with the License.
3770 * You may obtain a copy of the License at
3771 *
3772 *   http://www.apache.org/licenses/LICENSE-2.0
3773 *
3774 * Unless required by applicable law or agreed to in writing, softw
3774are
3775 * distributed under the License is distributed on an "AS IS" BASIS,
3776 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3777 * See the License for the specific language governing permissions and
3778 * limitations under the License.
3779 */const x2="PersistentStream";class vA{constructor(e,n,s,a,c,u,h,m){this.Ci=e,this.b_=s,this.S_=a,this.connection=c,this.authCredentialsProvider=u,this.appCheckCredentialsProvider=h,this.listener=m,this.state=0,this.D_=0,this.C_=null,this.v_=null,this.stream=null,this.F_=0,this.M_=new xA(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===ye.RESOURCE_EXHAUSTED?(ta(n.toString()),ta("Using maximum backoff delay to prevent overloading the backend."),this.M_.g_()):n&&n.code===ye.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((([s,a])=>{this.D_===n&&this.G_(s,a)}),(s=>{e((()=>{const a=new je(ye.UNKNOWN,"Fetching auth token failed: "+s.message);return this.z_(a)}))}))}G_(e,n){const s=this.Q_(this.D_);this.stream=this.j_(e,n),this.stream.Zo((()=>{s((()=>this.listener.Zo()))})),this.stream.Yo((()=>{s((()=>(this.state=2,this.v_=this.Ci.enqueueAfterDelay(this.S_,1e4,(()=>(this.O_()&&(this.state=3),Promise.resolve()))),this.listener.Yo())))})),this.stream.t_((a=>{s((()=>this.z_(a)))})),this.stream.onMessage((a=>{s((()=>++this.F_==1?this.H_(a):this.onNext(a)))}))}N_(){this.state=5,this.M_.p_((async()=>{this.state=0,this.start()}))}z_(e){return Ie(x2,`close with error: ${e}`),this.stream=null,this.close(4,e)}Q_(e){return n=>{this.Ci.enqueueAndForget((()=>this.D_===e?n():(Ie(x2,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve())))}}}class AF extends vA{constructor(e,n,s,a,c,u){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,s,a,u),this.serializer=c}j_(e,n){return this.connection.T_("Listen",e,n)}H_(e){return this.onNext(e)}onNext(e){this.M_.reset();const n=D9(this.serializer,e),s=(function(c){if(!("targetChange"in c))return Je.min();const u=c.targetChange;return u.targetIds&&u.targetIds.length?Je.min():u.readTime?oi(u.readTime):Je.min()})(e);return this.listener.J_(n,s)}Z_(e){const n={};n.database=Gx(this.serializer),n.addTarget=(function(c,u){let h;const m=u.target;if(h=Bx(m)?{documents:U9(c,m)}:{query:F9(c,m).ft},h.targetId=u.targetId,u.resumeToken.approximateByteSize()>0){h.resumeToken=oA(c,u.resumeToken);const p=$x(c,u.expectedCount);p!==null&&(h.expectedCount=p)}else if(u.snapshotVersion.compareTo(Je.min())>0){h.readTime=sp(c,u.snapshotVersion.toTimestamp());const p=$x(c,u.expectedCount);p!==null&&(h.expectedCount=p)}return h})(this.serializer,e);const s=z9(this.serializer,e);s&&(n.labels=s),this.K_(n)}X_(e){const n={};n.database=Gx(this.serializer),n.removeTarget=e,this.K_(n)}}class CF extends vA{constructor(e,n,s,a,c,u){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,s,a,u),this.serializer=c}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 At(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,At(!e.writeResults||e.writeResults.length===0,55816),this.listener.ta()}onNext(e){At(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.M_.reset();const n=L9(e.writeResults,e.commitTime),s=oi(e.commitTime);
3779return this.listener.na(s,n)}ra(){const e={};e.database=Gx(this.serializer),this.K_(e)}ea(e){const n={streamToken:this.lastStreamToken,writes:e.map((s=>O9(this.serializer,s)))};this.K_(n)}}/**
3780 * @license
3781 * Copyright 2017 Google LLC
3782 *
3783 * Licensed under the Apache License, Version 2.0 (the "License");
3784 * you may not use this file except in compliance with the License.
3785 * You may obtain a copy of the License at
3786 *
3787 *   http://www.apache.org/licenses/LICENSE-2.0
3788 *
3789 * Unless required by applicable law or agreed to in writing, software
3790 * distributed under the License is distributed on an "AS IS" BASIS,
3791 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3792 * See the License for the specific language governing permissions and
3793 * limitations under the License.
3794 */class RF{}class IF extends RF{constructor(e,n,s,a){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=s,this.serializer=a,this.ia=!1}sa(){if(this.ia)throw new je(ye.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,n,s,a){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([c,u])=>this.connection.Wo(e,qx(n,s),a,c,u))).catch((c=>{throw c.name==="FirebaseError"?(c.code===ye.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),c):new je(ye.UNKNOWN,c.toString())}))}jo(e,n,s,a,c){return this.sa(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then((([u,h])=>this.connection.jo(e,qx(n,s),a,u,h,c))).catch((u=>{throw u.name==="FirebaseError"?(u.code===ye.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),u):new je(ye.UNKNOWN,u.toString())}))}terminate(){this.ia=!0,this.connection.terminate()}}function MF(t,e,n,s){return new IF(t,e,n,s)}class PF{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}
3795This 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?(ta(n),this.aa=!1):Ie("OnlineStateTracker",n)}Pa(){this._a!==null&&(this._a.cancel(),this._a=null)}}/**
3796 * @license
3797 * Copyright 2017 Google LLC
3798 *
3799 * Licensed under the Apache License, Version 2.0 (the "License");
3800 * you may not use this file except in compliance with the License.
3801 * You may obtain a copy of the License at
3802 *
3803 *   http://www.apache.org/licenses/LICENSE-2.0
3804 *
3805 * Unless required by applicable law or agreed to in writing, software
3806 * distributed under the License is distributed on an "AS IS" BASIS,
3807 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3808 * See the License for the specific language governing permissions and
3809 * limitations under the License.
3810 */const ul="RemoteStore";class DF{constructor(e,n,s,a,c){this.localStore=e,this.datastore=n,this.asyncQueue=s,this.remoteSyncer={},this.Ta=[],this.Ia=new Map,this.Ea=new Set,this.Ra=[],this.Aa=c,this.Aa.Mo((u=>{s.enqueueAndForget((async()=>{yl(this)&&(Ie(ul,"Restarting streams for network reachability change."),await(async function(m){const p=tt(m);p.Ea.add(4),await _h(p),p.Va.set("Unknown"),p.Ea.delete(4),await Wp(p)})(this))}))})),this.Va=new PF(s,a)}}async function Wp(t){if(yl(t))for(const e of t.Ra)await e(!0)}async function _h(t){for(const e of t.Ra)await e(!1)}function _A(t,e){const n=tt(t);n.Ia.has(e.targetId)||(n.Ia.set(e.targetId,e),p_(n)?m_(n):cu(n).O_()&&f_(n,e))}function h_(t,e){const n=tt(t),s=cu(n);n.Ia.delete(e),s.O_()&&wA(n,e),n.Ia.size===0&&(s.O_()?s.L_():yl(n)&&n.Va.set("Unknown"))}function f_(t,e){if(t.da.$e(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(Je.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}cu(t).Z_(e)}function wA(t,e){t.da.$e(e),cu(t).X_(e)}function m_(t){t.da=new j9({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),At:e=>t.Ia.get(e)||null,ht:()=>t.datastore.serializer.databaseId}),cu(t).start(),t.Va.ua()}function p_(t){return yl(t)&&!cu(t).x_()&&t.Ia.size>0}function yl(t){return tt(t).Ea.size===0}function EA(t){t.da=void 0}async function OF(t){t.Va.set("Online")}
vendor: 9,264 bytes, lines 3810-3862
3810async function LF(t){t.Ia.forEach(((e,n)=>{f_(t,e)}))}async function UF(t,e){EA(t),p_(t)?(t.Va.ha(e),m_(t)):t.Va.set("Unknown")}async function FF(t,e,n){if(t.Va.set("Online"),e instanceof aA&&e.state===2&&e.cause)try{await(async function(a,c){const u=c.cause;for(const h of c.targetIds)a.Ia.has(h)&&(await a.remoteSyncer.rejectListen(h,u),a.Ia.delete(h),a.da.removeTarget(h))})(t,e)}catch(s){Ie(ul,"Failed to remove targets %s: %s ",e.targetIds.join(","),s),await ip(t,s)}else if(e instanceof Mm?t.da.Xe(e):e instanceof iA?t.da.st(e):t.da.tt(e),!n.isEqual(Je.min()))try{const s=await bA(t.localStore);n.compareTo(s)>=0&&await(function(c,u){const h=c.da.Tt(u);return h.targetChanges.forEach(((m,p)=>{if(m.resumeToken.approximateByteSize()>0){const b=c.Ia.get(p);b&&c.Ia.set(p,b.withResumeToken(m.resumeToken,u))}})),h.targetMismatches.forEach(((m,p)=>{const b=c.Ia.get(m);if(!b)return;c.Ia.set(m,b.withResumeToken(Wn.EMPTY_BYTE_STRING,b.snapshotVersion)),wA(c,m);const x=new Ha(b.target,m,p,b.sequenceNumber);f_(c,x)})),c.remoteSyncer.applyRemoteEvent(h)})(t,n)}catch(s){Ie(ul,"Failed to raise snapshot:",s),await ip(t,s)}}async function ip(t,e,n){if(!lu(e))throw e;t.Ea.add(1),await _h(t),t.Va.set("Offline"),n||(n=()=>bA(t.localStore)),t.asyncQueue.enqueueRetryable((async()=>{Ie(ul,"Retrying IndexedDB access"),await n(),t.Ea.delete(1),await Wp(t)}))}function kA(t,e){return e().catch((n=>ip(t,n,e)))}async function Xp(t){const e=tt(t),n=ro(e);let s=e.Ta.length>0?e.Ta[e.Ta.length-1].batchId:Jv;for(;VF(e);)try{const a=await vF(e.localStore,s);if(a===null){e.Ta.length===0&&n.L_();break}s=a.batchId,zF(e,a)}catch(a){await ip(e,a)}TA(e)&&SA(e)}function VF(t){return yl(t)&&t.Ta.length<10}function zF(t,e){t.Ta.push(e);const n=ro(t);n.O_()&&n.Y_&&n.ea(e.mutations)}function TA(t){return yl(t)&&!ro(t).x_()&&t.Ta.length>0}function SA(t){ro(t).start()}async function BF(t){ro(t).ra()}async function KF(t){const e=ro(t);for(const n of t.Ta)e.ea(n.mutations)}async function $F(t,e,n){const s=t.Ta.shift(),a=i_.from(s,e,n);await kA(t,(()=>t.remoteSyncer.applySuccessfulWrite(a))),await Xp(t)}async function qF(t,e){e&&ro(t).Y_&&await(async function(s,a){if((function(u){return T9(u)&&u!==ye.ABORTED})(a.code)){const c=s.Ta.shift();ro(s).B_(),await kA(s,(()=>s.remoteSyncer.rejectFailedWrite(c.batchId,a))),await Xp(s)}})(t,e),TA(t)&&SA(t)}async function v2(t,e){const n=tt(t);n.asyncQueue.verifyOperationInProgress(),Ie(ul,"RemoteStore received new credentials");const s=yl(n);n.Ea.add(3),await _h(n),s&&n.Va.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.Ea.delete(3),await Wp(n)}async function HF(t,e){const n=tt(t);e?(n.Ea.delete(2),await Wp(n)):e||(n.Ea.add(2),await _h(n),n.Va.set("Unknown"))}function cu(t){return t.ma||(t.ma=(function(n,s,a){const c=tt(n);return c.sa(),new AF(s,c.connection,c.authCredentials,c.appCheckCredentials,c.serializer,a)})(t.datastore,t.asyncQueue,{Zo:OF.bind(null,t),Yo:LF.bind(null,t),t_:UF.bind(null,t),J_:FF.bind(null,t)}),t.Ra.push((async e=>{e?(t.ma.B_(),p_(t)?m_(t):t.Va.set("Unknown")):(await t.ma.stop(),EA(t))}))),t.ma}function ro(t){return t.fa||(t.fa=(function(n,s,a){const c=tt(n);return c.sa(),new CF(s,c.connection,c.authCredentials,c.appCheckCredentials,c.serializer,a)})(t.datastore,t.asyncQueue,{Zo:()=>Promise.resolve(),Yo:BF.bind(null,t),t_:qF.bind(null,t),ta:KF.bind(null,t),na:$F.bind(null,t)}),t.Ra.push((async e=>{e?(t.fa.B_(),await Xp(t)):(await t.fa.stop(),t.Ta.length>0&&(Ie(ul,`Stopping write stream with ${t.Ta.length} pending writes`),t.Ta=[]))}))),t.fa}/**
3811 * @license
3812 * Copyright 2017 Google LLC
3813 *
3814 * Licensed under the Apache License, Version 2.0 (the "License");
3815 * you may not use this file except in compliance with the License.
3816 * You may obtain a copy of the License at
3817 *
3818 *   http://www.apache.org/licenses/LICENSE-2.0
3819 *
3820 * Unless required by applicable law or agreed to in writing, software
3821 * distributed under the License is distributed on an "AS IS" BASIS,
3822 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3823 * See the License for the specific language governing permissions and
3824 * limitations under the License.
3825 */class g_{constructor(e,n,s,a,c){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=s,this.op=a,this.removalCallback=c,this.deferred=new Yi,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch((u=>{}))}get promise(){return this.deferred.promise}static createAndSchedule(e,n,s,a,c){const u=Date.now()+s,h=new g_(e,n,u,a,c);return h.start(s),h}start(e){this.timerHandle=setTimeout((()=>this.handleDelayElapsed()),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new je(ye.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 y_(t,e){if(ta("AsyncQueue",`${e}: ${t}`),lu(t))return new je(ye.UNAVAILABLE,`${e}: ${t}`);throw t}/**
3826 * @license
3827 * Copyright 2017 Google LLC
3828 *
3829 * Licensed under the Apache License, Version 2.0 (the "License");
3830 * you may not use this file except in compliance with the License.
3831 * You may obtain a copy of the License at
3832 *
3833 *   http://www.apache.org/licenses/LICENSE-2.0
3834 *
3835 * Unless required by applicable law or agreed to in writing, software
3836 * distributed under the License is distributed on an "AS IS" BASIS,
3837 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3838 * See the License for the specific language governing permissions and
3839 * limitations under the License.
3840 */class Lc{static emptySet(e){return new Lc(e.comparator)}constructor(e){this.comparator=e?(n,s)=>e(n,s)||Ve.comparator(n.key,s.key):(n,s)=>Ve.comparator(n.key,s.key),this.keyedMap=Sd(),this.sortedSet=new Qt(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,s)=>(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 Lc)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),s=e.sortedSet.getIterator();for(;n.hasNext();){const a=n.getNext().key,c=s.getNext().key;if(!a.isEqual(c))return!1}return!0}toString(){const e=[];return this.forEach((n=>{e.push(n.toString())})),e.length===0?"DocumentSet ()":`DocumentSet (
3841  `+e.join(`  
3842`)+`
3843)`}copy(e,n){const s=new Lc;return s.comparator=this.comparator,s.keyedMap=e,s.sortedSet=n,s}}/**
3844 * @license
3845 * Copyright 2017 Google LLC
3846 *
3847 * Licensed under the Apache License, Version 2.0 (the "License");
3848 * you may not use this file except in compliance with the License.
3849 * You may obtain a copy of the License at
3850 *
3851 *   http://www.apache.org/licenses/LICENSE-2.0
3852 *
3853 * Unless required by applicable law or agreed to in writing, software
3854 * distributed under the License is distributed on an "AS IS" BASIS,
3855 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3856 * See the License for the specific language governing permissions and
3857 * limitations under the License.
3858 */class _2{constructor(){this.ga=new Qt(Ve.comparator)}track(e){const n=e.doc.key,s=this.ga.get(n);s?e.type!==0&&s.type===3?this.ga=this.ga.insert(n,e):e.type===3&&s.type!==1?this.ga=this.ga.insert(n,{type:s.type,doc:e.doc}):e.type===2&&s.type===2?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):e.type===2&&s.type===0?this.ga=this.ga.insert(n,{type:0,doc:e.doc}):e.type===1&&s.type===0?this.ga=this.ga.remove(n):e.type===1&&s.type===2?this.ga=this.ga.insert(n,{type:1,doc:s.doc}):e.type===0&&s.type===1?this.ga=this.ga.insert(n,{type:2,doc:e.doc}):We(63341,{Vt:e,pa:s}):this.ga=this.ga.insert(n,e)}ya(){const e=[];return this.ga.inorderTraversal(((n,s)=>{e.push(s)})),e}}class Xc{constructor(e,n,s,a,c,u,h,m,p){this.query=e,this.docs=n,this.oldDocs=s,this.docChanges=a,this.mutatedKeys=c,this.fromCache=u,this.syncStateChanged=h,this.excludesMetadataChanges=m,this.hasCachedResults=p}static fromInitialDocuments(e,n,s,a,c){const u=[];return n.forEach((h=>{u.push({type:0,doc:h})})),new Xc(e,n,Lc.emptySet(n),u,s,a,!0,!1,c)}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)&&Kp(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,s=e.docChanges;if(n.length!==s.length)return!1;for(let a=0;a<n.length;a++)if(n[a].type!==s[a].type||!n[a].doc.isEqual(s[a].doc))return!1;return!0}}/**
3859 * @license
3860 * Copyright 2017 Google LLC
3861 *
3862 * Licensed under the Apache License, Version 2.0 (the "License");
3863 * you may not use this file except in compliance with the License.
3864 * You may obtain a copy of the License at
3865 *
3866 *   http://www.apache.org/licenses/LICENSE-2.0
3867 *
3868 * Unless required by applicable law or agreed to in writing, software
3869 * distributed under the License is distributed on an "AS IS" BASIS,
3870 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3871 * See the License for the specific language governing permissions and
3872 * limitations under the License.
3873 */class GF{constructor(){this.wa=void 0,this.ba=[]}Sa(){return this.ba.some((e=>e.Da()))}}class YF{constructor(){this.queries=w2(),this.onlineState="Unknown",this.Ca=new Set}terminate(){(function(n,s){const a=tt(n),c=a.queries;a.queries=w2(),c.forEach(((u,h)=>{for(const m of h.ba)m.onError(s)}))})(this,new je(ye.ABORTED,"Firestore shutting down"))}}function w2(){return new gl((t=>Hj(t)),Kp)}async function b_(t,e){const n=tt(t);let s=3;const a=e.query;let c=n.queries.get(a);c?!c.Sa()&&e.Da()&&(s=2):(c=new GF,s=e.Da()?0:1);try{switch(s){case 0:c.wa=await n.onListen(a,!0);break;case 1:c.wa=await n.onListen(a,!1);break;case 2:await n.onFirstRemoteStoreListen(a)}}catch(u){const h=y_(u,`Initialization of query '${kc(e.query)}' failed`);return void e.onError(h)}n.queries.set(a,c),c.ba.push(e),e.va(n.onlineState),c.wa&&e.Fa(c.wa)&&v_(n)}async function x_(t,e){const n=tt(t),s=e.query;let a=3;const c=n.queries.get(s);if(c){const u=c.ba.indexOf(e);u>=0&&(c.ba.splice(u,1),c.ba.length===0?a=e.Da()?0:1:!c.Sa()&&e.Da()&&(a=2))}switch(a){case 0:return n.queries.delete(s),n.onUnlisten(s,!0);case 1:return n.queries.delete(s),n.onUnlisten(s,!1);case 2:return n.onLastRemoteStoreUnlisten(s);default:return}}function WF(t,e){const n=tt(t);let s=!1;for(const a of e){const c=a.query,u=n.queries.get(c);if(u){for(const h of u.ba)h.Fa(a)&&(s=!0);u.wa=a}}s&&v_(n)}function XF(t,e,n){const s=tt(t),a=s.queries.get(e);if(a)for(const c of a.ba)c.onError(n);s.queries.delete(e)}function v_(t){t.Ca.forEach((e=>{e.next()}))}var Xx,E2;(E2=Xx||(Xx={})).Ma="default",E2.Cache="cache";class __{constructor(e,n,s){this.query=e,this.xa=n,this.Oa=!1,this.Na=null,this.onlineState="Unknown",this.options=s||{}}Fa(e){if(!this.options.includeMetadataChanges){const s=[];for(const a of e.docChanges)a.type!==3&&s.push(a);e=new Xc(e.query,e.docs,e.oldDocs,s,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 s=n!=="Offline";return(!this.options.Ka||!s)&&(!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=Xc.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.Oa=!0,this.xa.next(e)}Da(){return this.options.source!==Xx.Cache}}/**
3874 * @license
3875 * Copyright 2017 Google LLC
3876 *
3877 * Licensed under the Apache License, Version 2.0 (the "License");
3878 * you may not use this file except in compliance with the License.
3879 * You may obtain a copy of the License at
3880 *
3881 *   http://www.apache.org/licenses/LICENSE-2.0
3882 *
3883 * Unless required by applicable law or agreed to in writing, software
3884 * distributed under the License is distributed on an "AS IS" BASIS,
3885 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3886 * See the License for the specific language governing permissions and
3887 * limitations under the License.
3888 */class NA{constructor(e){this.key=e}}class jA{constructor(e){this.key=e}}class QF{constructor(e,n){this.query=e,this.Za=n,this.Xa=null,this.hasCachedResults=!1,this.current=!1,this.Ya=yt(),this.mutatedKeys=yt(),this.eu=Gj(e),this.tu=new Lc(this.eu)}get nu(){return this.Za}ru(e,n){const s=n?n.iu:new _2,a=n?n.tu:this.tu;let c=n?n.mutatedKeys:this.mutatedKeys,u=a,h=!1;const m=this.query.limitType==="F"&&a.size===this.query.limit?a.last():null,p=this.query.limitType==="L"&&a.size===this.query.limit?a.first():null;if(e.inorderTraversal(((b,x)=>{const w=a.get(b),T=$p(this.query,x)?x:null,N=!!w&&this.mutatedKeys.has(w.key),j=!!T&&(T.hasLocalMutations||this.mutatedKeys.has(T.key)&&T.hasCommittedMutations);let A=!1;w&&T?w.data.isEqual(T.data)?N!==j&&(s.track({type:3,doc:T}),A=!0):this.su(w,T)||(s.track({type:2,doc:T}),A=!0,(m&&this.eu(T,m)>0||p&&this.eu(T,p)<0)&&(h=!0)):!w&&T?(s.track({type:0,doc:T}),A=!0):w&&!T&&(s.track({type:1,doc:w}),A=!0,(m||p)&&(h=!0)),A&&(T?(u=u.add(T),c=j?c.add(b):c.delete(b)):(u=u.delete(b),c=c.delete(b)))})),this.query.limit!==null)for(;
3888u.size>this.query.limit;){const b=this.query.limitType==="F"?u.last():u.first();u=u.delete(b.key),c=c.delete(b.key),s.track({type:1,doc:b})}return{tu:u,iu:s,Ss:h,mutatedKeys:c}}su(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,s,a){const c=this.tu;this.tu=e.tu,this.mutatedKeys=e.mutatedKeys;const u=e.iu.ya();u.sort(((b,x)=>(function(T,N){const j=A=>{switch(A){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return We(20277,{Vt:A})}};return j(T)-j(N)})(b.type,x.type)||this.eu(b.doc,x.doc))),this.ou(s),a=a??!1;const h=n&&!a?this._u():[],m=this.Ya.size===0&&this.current&&!a?1:0,p=m!==this.Xa;return this.Xa=m,u.length!==0||p?{snapshot:new Xc(this.query,e.tu,c,u,e.mutatedKeys,m===0,p,!1,!!s&&s.resumeToken.approximateByteSize()>0),au:h}:{au:h}}va(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({tu:this.tu,iu:new _2,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=yt(),this.tu.forEach((s=>{this.uu(s.key)&&(this.Ya=this.Ya.add(s.key))}));const n=[];return e.forEach((s=>{this.Ya.has(s)||n.push(new jA(s))})),this.Ya.forEach((s=>{e.has(s)||n.push(new NA(s))})),n}cu(e){this.Za=e.ks,this.Ya=yt();const n=this.ru(e.documents);return this.applyChanges(n,!0)}lu(){return Xc.fromInitialDocuments(this.query,this.tu,this.mutatedKeys,this.Xa===0,this.hasCachedResults)}}const w_="SyncEngine";class JF{constructor(e,n,s){this.query=e,this.targetId=n,this.view=s}}class ZF{constructor(e){this.key=e,this.hu=!1}}class eV{constructor(e,n,s,a,c,u){this.localStore=e,this.remoteStore=n,this.eventManager=s,this.sharedClientState=a,this.currentUser=c,this.maxConcurrentLimboResolutions=u,this.Pu={},this.Tu=new gl((h=>Hj(h)),Kp),this.Iu=new Map,this.Eu=new Set,this.Ru=new Qt(Ve.comparator),this.Au=new Map,this.Vu=new l_,this.du={},this.mu=new Map,this.fu=Wc.ar(),this.onlineState="Unknown",this.gu=void 0}get isPrimaryClient(){return this.gu===!0}}async function tV(t,e,n=!0){const s=PA(t);let a;const c=s.Tu.get(e);return c?(s.sharedClientState.addLocalQueryTarget(c.targetId),a=c.view.lu()):a=await AA(s,e,n,!0),a}async function nV(t,e){const n=PA(t);await AA(n,e,!0,!1)}async function AA(t,e,n,s){const a=await _F(t.localStore,ai(e)),c=a.targetId,u=t.sharedClientState.addLocalQueryTarget(c,n);let h;return s&&(h=await sV(t,e,c,u==="current",a.resumeToken)),t.isPrimaryClient&&n&&_A(t.remoteStore,a),h}async function sV(t,e,n,s,a){t.pu=(x,w,T)=>(async function(j,A,F,V){let L=A.view.ru(F);L.Ss&&(L=await p2(j.localStore,A.query,!1).then((({documents:I})=>A.view.ru(I,L))));const Y=V&&V.targetChanges.get(A.targetId),$=V&&V.targetMismatches.get(A.targetId)!=null,q=A.view.applyChanges(L,j.isPrimaryClient,Y,$);return T2(j,A.targetId,q.au),q.snapshot})(t,x,w,T);const c=await p2(t.localStore,e,!0),u=new QF(e,c.ks),h=u.ru(c.documents),m=vh.createSynthesizedTargetChangeForCurrentChange(n,s&&t.onlineState!=="Offline",a),p=u.applyChanges(h,t.isPrimaryClient,m);T2(t,n,p.au);const b=new JF(e,n,u);return t.Tu.set(e,b),t.Iu.has(n)?t.Iu.get(n).push(e):t.Iu.set(n,[e]),p.snapshot}async function rV(t,e,n){const s=tt(t),a=s.Tu.get(e),c=s.Iu.get(a.targetId);if(c.length>1)return s.Iu.set(a.targetId,c.filter((u=>!Kp(u,e)))),void s.Tu.delete(e);s.isPrimaryClient?(s.sharedClientState.removeLocalQueryTarget(a.targetId),s.sharedClientState.isActiveQueryTarget(a.targetId)||await Yx(s.localStore,a.targetId,!1).then((()=>{s.sharedClientState.clearQueryState(a.targetId),n&&h_(s.remoteStore,a.targetId),Qx(s,a.targetId)})).catch(ou)):(Qx(s,a.targetId),await Yx(s.localStore,a.targetId,!0))}async function iV(t,e){const n=tt(t),s=n.Tu.get(e),a=n.Iu.get(s.targetId);n.isPrimaryClient&&a.length===1&&(n.sharedClientState.removeLocalQueryTarget(s.targetId),h_(n.remoteStore,s.targetId))}async function aV(t,e,n){const s=fV(t);try{const a=await(function(u,h){const m=tt(u),p=Ut.now(),b=h.reduce(((T,N)=>T.add(N.key)),yt());let x,w;return m.persistence.runTransaction("Locally write mutations","readwrite",(T=>{let N=na(),j=yt();return m.xs.getEntries(T,b).next((A=>
3888{N=A,N.forEach(((F,V)=>{V.isValidDocument()||(j=j.add(F))}))})).next((()=>m.localDocuments.getOverlayedDocuments(T,N))).next((A=>{x=A;const F=[];for(const V of h){const L=v9(V,x.get(V.key).overlayedDocument);L!=null&&F.push(new co(V.key,L,Fj(L.value.mapValue),jr.exists(!0)))}return m.mutationQueue.addMutationBatch(T,p,F,h)})).next((A=>{w=A;const F=A.applyToLocalDocumentSet(x,j);return m.documentOverlayCache.saveOverlays(T,A.batchId,F)}))})).then((()=>({batchId:w.batchId,changes:Wj(x)})))})(s.localStore,e);s.sharedClientState.addPendingMutation(a.batchId),(function(u,h,m){let p=u.du[u.currentUser.toKey()];p||(p=new Qt(gt)),p=p.insert(h,m),u.du[u.currentUser.toKey()]=p})(s,a.batchId,n),await wh(s,a.changes),await Xp(s.remoteStore)}catch(a){const c=y_(a,"Failed to persist write");n.reject(c)}}async function CA(t,e){const n=tt(t);try{const s=await bF(n.localStore,e);e.targetChanges.forEach(((a,c)=>{const u=n.Au.get(c);u&&(At(a.addedDocuments.size+a.modifiedDocuments.size+a.removedDocuments.size<=1,22616),a.addedDocuments.size>0?u.hu=!0:a.modifiedDocuments.size>0?At(u.hu,14607):a.removedDocuments.size>0&&(At(u.hu,42227),u.hu=!1))})),await wh(n,s,e)}catch(s){await ou(s)}}function k2(t,e,n){const s=tt(t);if(s.isPrimaryClient&&n===0||!s.isPrimaryClient&&n===1){const a=[];s.Tu.forEach(((c,u)=>{const h=u.view.va(e);h.snapshot&&a.push(h.snapshot)})),(function(u,h){const m=tt(u);m.onlineState=h;let p=!1;m.queries.forEach(((b,x)=>{for(const w of x.ba)w.va(h)&&(p=!0)})),p&&v_(m)})(s.eventManager,e),a.length&&s.Pu.J_(a),s.onlineState=e,s.isPrimaryClient&&s.sharedClientState.setOnlineState(e)}}async function oV(t,e,n){const s=tt(t);s.sharedClientState.updateQueryState(e,"rejected",n);const a=s.Au.get(e),c=a&&a.key;if(c){let u=new Qt(Ve.comparator);u=u.insert(c,ts.newNoDocument(c,Je.min()));const h=yt().add(c),m=new Gp(Je.min(),new Map,new Qt(gt),u,h);await CA(s,m),s.Ru=s.Ru.remove(c),s.Au.delete(e),E_(s)}else await Yx(s.localStore,e,!1).then((()=>Qx(s,e,n))).catch(ou)}async function lV(t,e){const n=tt(t),s=e.batch.batchId;try{const a=await yF(n.localStore,e);IA(n,s,null),RA(n,s),n.sharedClientState.updateMutationState(s,"acknowledged"),await wh(n,a)}catch(a){await ou(a)}}async function cV(t,e,n){const s=tt(t);try{const a=await(function(u,h){const m=tt(u);return m.persistence.runTransaction("Reject batch","readwrite-primary",(p=>{let b;return m.mutationQueue.lookupMutationBatch(p,h).next((x=>(At(x!==null,37113),b=x.keys(),m.mutationQueue.removeMutationBatch(p,x)))).next((()=>m.mutationQueue.performConsistencyCheck(p))).next((()=>m.documentOverlayCache.removeOverlaysForBatchId(p,b,h))).next((()=>m.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(p,b))).next((()=>m.localDocuments.getDocuments(p,b)))}))})(s.localStore,e);IA(s,e,n),RA(s,e),s.sharedClientState.updateMutationState(e,"rejected",n),await wh(s,a)}catch(a){await ou(a)}}function RA(t,e){(t.mu.get(e)||[]).forEach((n=>{n.resolve()})),t.mu.delete(e)}function IA(t,e,n){const s=tt(t);let a=s.du[s.currentUser.toKey()];if(a){const c=a.get(e);c&&(n?c.reject(n):c.resolve(),a=a.remove(e)),s.du[s.currentUser.toKey()]=a}}
vendor: 4,310 bytes, line 3888
3888function Qx(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const s of t.Iu.get(e))t.Tu.delete(s),n&&t.Pu.yu(s,n);t.Iu.delete(e),t.isPrimaryClient&&t.Vu.Gr(e).forEach((s=>{t.Vu.containsKey(s)||MA(t,s)}))}function MA(t,e){t.Eu.delete(e.path.canonicalString());const n=t.Ru.get(e);n!==null&&(h_(t.remoteStore,n),t.Ru=t.Ru.remove(e),t.Au.delete(n),E_(t))}function T2(t,e,n){for(const s of n)s instanceof NA?(t.Vu.addReference(s.key,e),uV(t,s)):s instanceof jA?(Ie(w_,"Document no longer in limbo: "+s.key),t.Vu.removeReference(s.key,e),t.Vu.containsKey(s.key)||MA(t,s.key)):We(19791,{wu:s})}function uV(t,e){const n=e.key,s=n.path.canonicalString();t.Ru.get(n)||t.Eu.has(s)||(Ie(w_,"New document in limbo: "+n),t.Eu.add(s),E_(t))}function E_(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 Ve(Vt.fromString(e)),s=t.fu.next();t.Au.set(s,new ZF(n)),t.Ru=t.Ru.insert(n,s),_A(t.remoteStore,new Ha(ai(Bp(n.path)),s,"TargetPurposeLimboResolution",Up.ce))}}async function wh(t,e,n){const s=tt(t),a=[],c=[],u=[];s.Tu.isEmpty()||(s.Tu.forEach(((h,m)=>{u.push(s.pu(m,e,n).then((p=>{var b;if((p||n)&&s.isPrimaryClient){const x=p?!p.fromCache:(b=n==null?void 0:n.targetChanges.get(m.targetId))==null?void 0:b.current;s.sharedClientState.updateQueryState(m.targetId,x?"current":"not-current")}if(p){a.push(p);const x=u_.Es(m.targetId,p);c.push(x)}})))})),await Promise.all(u),s.Pu.J_(a),await(async function(m,p){const b=tt(m);try{await b.persistence.runTransaction("notifyLocalViewChanges","readwrite",(x=>ve.forEach(p,(w=>ve.forEach(w.Ts,(T=>b.persistence.referenceDelegate.addReference(x,w.targetId,T))).next((()=>ve.forEach(w.Is,(T=>b.persistence.referenceDelegate.removeReference(x,w.targetId,T)))))))))}catch(x){if(!lu(x))throw x;Ie(d_,"Failed to update sequence numbers: "+x)}for(const x of p){const w=x.targetId;if(!x.fromCache){const T=b.vs.get(w),N=T.snapshotVersion,j=T.withLastLimboFreeSnapshotVersion(N);b.vs=b.vs.insert(w,j)}}})(s.localStore,c))}async function dV(t,e){const n=tt(t);if(!n.currentUser.isEqual(e)){Ie(w_,"User change. New user:",e.toKey());const s=await yA(n.localStore,e);n.currentUser=e,(function(c,u){c.mu.forEach((h=>{h.forEach((m=>{m.reject(new je(ye.CANCELLED,u))}))})),c.mu.clear()})(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,s.removedBatchIds,s.addedBatchIds),await wh(n,s.Ns)}}function hV(t,e){const n=tt(t),s=n.Au.get(e);if(s&&s.hu)return yt().add(s.key);{let a=yt();const c=n.Iu.get(e);if(!c)return a;for(const u of c){const h=n.Tu.get(u);a=a.unionWith(h.view.nu)}return a}}function PA(t){const e=tt(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=CA.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=hV.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=oV.bind(null,e),e.Pu.J_=WF.bind(null,e.eventManager),e.Pu.yu=XF.bind(null,e.eventManager),e}function fV(t){const e=tt(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=lV.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=cV.bind(null,e),e}class ap{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Yp(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 gF(this.persistence,new fF,e.initialUser,this.serializer)}Cu(e){return new gA(c_.Vi,this.serializer)}Du(e){return new EF}async terminate(){var e,n;(e=this.gcScheduler)==null||e.stop(),(n=this.indexBackfillerScheduler)==null||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}ap.provider={build:()=>new ap};class mV extends ap{constructor(e){super(),this.cacheSizeBytes=e}Fu(e,n){At(this.persistence.referenceDelegate instanceof rp,46915);const s=this.persistence.referenceDelegate.garbageCollector;return new J9(s,e.asyncQueue,n)}Cu(e){const n=this.cacheSizeBytes!==void 0?xs.withCacheSize(this.cacheSizeBytes):xs.DEFAULT;return new gA((s=>rp.Vi(s,n)),this.serializer)}}class Jx{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedCl
3888ientState=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=s=>k2(this.syncEngine,s,1),this.remoteStore.remoteSyncer.handleCredentialChange=dV.bind(null,this.syncEngine),await HF(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return(function(){return new YF})()}createDatastore(e){const n=Yp(e.databaseInfo.databaseId),s=jF(e.databaseInfo);return MF(e.authCredentials,e.appCheckCredentials,s,n)}createRemoteStore(e){return(function(s,a,c,u,h){return new DF(s,a,c,u,h)})(this.localStore,this.datastore,e.asyncQueue,(n=>k2(this.syncEngine,n,0)),(function(){return b2.v()?new b2:new kF})())}createSyncEngine(e,n){return(function(a,c,u,h,m,p,b){const x=new eV(a,c,u,h,m,p);return b&&(x.gu=!0),x})(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await(async function(a){const c=tt(a);Ie(ul,"RemoteStore shutting down."),c.Ea.add(5),await _h(c),c.Aa.shutdown(),c.Va.set("Unknown")})(this.remoteStore),(e=this.datastore)==null||e.terminate(),(n=this.eventManager)==null||n.terminate()}}Jx.provider={build:()=>new Jx};/**
3889 * @license
3890 * Copyright 2020 Google LLC
3891 *
3892 * Licensed under the Apache License, Version 2.0 (the "License");
3893 * you may not use this file except in compliance with the License.
3894 * You may obtain a copy of the License at
3895 *
3896 *   http://www.apache.org/licenses/LICENSE-2.0
3897 *
3898 * Unless required by applicable law or agreed to in writing, software
3899 * distributed under the License is distributed on an "AS IS" BASIS,
3900 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3901 * See the License for the specific language governing permissions and
3902 * limitations under the License.
3903 *//**
3904 * @license
3905 * Copyright 2017 Google LLC
3906 *
3907 * Licensed under the Apache License, Version 2.0 (the "License");
3908 * you may not use this file except in compliance with the License.
3909 * You may obtain a copy of the License at
3910 *
3911 *   http://www.apache.org/licenses/LICENSE-2.0
3912 *
3913 * Unless required by applicable law or agreed to in writing, software
3914 * distributed under the License is distributed on an "AS IS" BASIS,
3915 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3916 * See the License for the specific language governing permissions and
3917 * limitations under the License.
3918 */class k_{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):ta("Uncaught Error in snapshot listener:",e.toString()))}Nu(){this.muted=!0}Ou(e,n){setTimeout((()=>{this.muted||e(n)}),0)}}/**
3919 * @license
3920 * Copyright 2017 Google LLC
3921 *
3922 * Licensed under the Apache License, Version 2.0 (the "License");
3923 * you may not use this file except in compliance with the License.
3924 * You may obtain a copy of the License at
3925 *
3926 *   http://www.apache.org/licenses/LICENSE-2.0
3927 *
3928 * Unless required by applicable law or agreed to in writing, software
3929 * distributed under the License is distributed on an "AS IS" BASIS,
3930 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3931 * See the License for the specific language governing permissions and
3932 * limitations under the License.
3933 */const io="FirestoreClient";class pV{constructor(e,n,s,a,c){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=s,this._databaseInfo=a,this.user=es.UNAUTHENTICATED,this.clientId=Qv.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=c,this.authCredentials.start(s,(async u=>{Ie(io,"Received user=",u.uid),await this.authCredentialListener(u),this.user=u})),this.appCheckCredentials.start(s,(u=>(Ie(io,"Received new app check token=",u),this.appCheckCredentialListener(u,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 Yi;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 s=y_(n,"Failed to shutdown persistence");e.reject(s)}})),e.promise}}async function Pb(t,e){t.asyncQueue.verifyOperationInProgress(),Ie(io,"Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let s=n.initialUser;t.setCredentialChangeListener((async a=>{s.isEqual(a)||(await yA(e.localStore,a),s=a)})),e.persistence.setDatabaseDeletedListener((()=>t.terminate())),t._offlineComponents=e}async function S2(t,e){t.asyncQueue.verifyOperationInProgress();const n=await gV(t);Ie(io,"Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener((s=>v2(e.remoteStore,s))),t.setAppCheckTokenChangeListener(((s,a)=>v2(e.remoteStore,a))),t._onlineComponents=e}async function gV(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){Ie(io,"Using user provided OfflineComponentProvider");try{await Pb(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!(function(a){return a.name==="FirebaseError"?a.code===ye.FAILED_PRECONDITION||a.code===ye.UNIMPLEMENT
3933ED:!(typeof DOMException<"u"&&a instanceof DOMException)||a.code===22||a.code===20||a.code===11})(n))throw n;cl("Error using user provided cache. Falling back to memory cache: "+n),await Pb(t,new ap)}}else Ie(io,"Using default OfflineComponentProvider"),await Pb(t,new mV(void 0));return t._offlineComponents}async function DA(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(Ie(io,"Using user provided OnlineComponentProvider"),await S2(t,t._uninitializedComponentsProvider._online)):(Ie(io,"Using default OnlineComponentProvider"),await S2(t,new Jx))),t._onlineComponents}function yV(t){return DA(t).then((e=>e.syncEngine))}async function op(t){const e=await DA(t),n=e.eventManager;return n.onListen=tV.bind(null,e.syncEngine),n.onUnlisten=rV.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=nV.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=iV.bind(null,e.syncEngine),n}function bV(t,e,n,s){const a=new k_(s),c=new __(e,a,n);return t.asyncQueue.enqueueAndForget((async()=>b_(await op(t),c))),()=>{a.Nu(),t.asyncQueue.enqueueAndForget((async()=>x_(await op(t),c)))}}function xV(t,e,n={}){const s=new Yi;return t.asyncQueue.enqueueAndForget((async()=>(function(c,u,h,m,p){const b=new k_({next:w=>{b.Nu(),u.enqueueAndForget((()=>x_(c,x)));const T=w.docs.has(h);!T&&w.fromCache?p.reject(new je(ye.UNAVAILABLE,"Failed to get document because the client is offline.")):T&&w.fromCache&&m&&m.source==="server"?p.reject(new je(ye.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.)')):p.resolve(w)},error:w=>p.reject(w)}),x=new __(Bp(h.path),b,{includeMetadataChanges:!0,Ka:!0});return b_(c,x)})(await op(t),t.asyncQueue,e,n,s))),s.promise}function vV(t,e,n={}){const s=new Yi;return t.asyncQueue.enqueueAndForget((async()=>(function(c,u,h,m,p){const b=new k_({next:w=>{b.Nu(),u.enqueueAndForget((()=>x_(c,x))),w.fromCache&&m.source==="server"?p.reject(new je(ye.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.)')):p.resolve(w)},error:w=>p.reject(w)}),x=new __(h,b,{includeMetadataChanges:!0,Ka:!0});return b_(c,x)})(await op(t),t.asyncQueue,e,n,s))),s.promise}function _V(t,e){const n=new Yi;return t.asyncQueue.enqueueAndForget((async()=>aV(await yV(t),e,n))),n.promise}/**
3934 * @license
3935 * Copyright 2023 Google LLC
3936 *
3937 * Licensed under the Apache License, Version 2.0 (the "License");
3938 * you may not use this file except in compliance with the License.
3939 * You may obtain a copy of the License at
3940 *
3941 *   http://www.apache.org/licenses/LICENSE-2.0
3942 *
3943 * Unless required by applicable law or agreed to in writing, software
3944 * distributed under the License is distributed on an "AS IS" BASIS,
3945 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3946 * See the License for the specific language governing permissions and
3947 * limitations under the License.
3948 */function OA(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
3949 * @license
3950 * Copyright 2020 Google LLC
3951 *
3952 * Licensed under the Apache License, Version 2.0 (the "License");
3953 * you may not use this file except in compliance with the License.
3954 * You may obtain a copy of the License at
3955 *
3956 *   http://www.apache.org/licenses/LICENSE-2.0
3957 *
3958 * Unless required by applicable law or agreed to in writing, software
3959 * distributed under the License is distributed on an "AS IS" BASIS,
3960 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3961 * See the License for the specific language governing permissions and
3962 * limitations under the License.
3963 */const wV="ComponentProvider",N2=new Map;function EV(t,e,n,s,a){return new VU(t,e,n,a.host,a.ssl,a.experimentalForceLongPolling,a.experimentalAutoDetectLongPolling,OA(a.experimentalLongPollingOptions),a.useFetchStreams,a.isUsingEmulator,s)}/**
3964 * @license
3965 * Copyright 2020 Google LLC
3966 *
3967 * Licensed under the Apache License, Version 2.0 (the "License");
3968 * you may not use this file except in compliance with the License.
3969 * You may obtain a copy of the License at
3970 *
3971 *   http://www.apache.org/licenses/LICENSE-2.0
3972 *
3973 * Unless required by applicable law or agreed to in writing, software
3974 * distributed under the License is distributed on an "AS IS" BASIS,
3975 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3976 * See the License for the specific language governing permissions and
3977 * limitations under the License.
3978 */const LA="firestore.googleapis.com",j2=!0;class A2{constructor(e){if(e.host===void 0){if(e.ssl!==void 0)throw new je(ye.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=LA,this.ssl=j2}else this.host=e.host,this.ssl=e.ssl??j2;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=pA;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<X9)throw new je(ye.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}jU("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=OA(e.experimentalLongPollingOptions??{}),(function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new je(ye.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new je(ye.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new je(ye.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}})(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&(function(s,a){return s.timeoutSeconds===a.timeoutSeconds})(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Qp{constructor(e,n,s,a){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=s,this._app=a,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new A2({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new je(ye.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 je(ye.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 A2(e),this._emulatorOptions=e.emulatorOptions||{},e.credentials!==void 0&&(this._authCredentials=(function(s){if(!s)return new bU;switch(s.type){case"firstParty":return new wU(s.sessionIndex||"0",s.iamToken||null,s.authTokenFactory||null);case"provider":return s.client;default:throw new je(ye.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 s=N2.get(n);s&&(Ie(wV,"Removing Datastore"),N2.delete(n),s.terminate())})(this),Promise.resolve()}}function kV(t,e,n,s={}){var p;t=Vs(t,Qp);const a=hi(e),c=t._getSettings(),u={...c,emulatorOptions:t._getEmulatorOptions()},h=`${e}:${n}`;a&&(Ap(`https://${h}`),Cp("Firestore",!0)),c.host!==LA&&c.host!==h&&cl("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");const m={...c,host:h,ssl:a,emulatorOptions:s};if(!Qi(m,u)&&(t._setSettings(m),s.mockUserToken)){let b,x;if(typeof s.mockUserToken=="string")b=s.mockUserToken,x=es.MOCK_USER;else{b=dN(s.mockUserToken,(p=t._app)==null?void 0:p.options.projectId);const w=s.mockUserToken.sub||s.mockUserToken.user_id;if(!w)throw new je(ye.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");x=new es(w)}t._authCredentials=new xU(new Nj(b,x))}}/**
3979 * @license
3980 * Copyright 2020 Google LLC
3981 *
3982 * Licensed under the Apache License, Version 2.0 (the "License");
3983 * you may not use this file except in compliance with the License.
3984 * You may obtain a copy of the License at
3985 *
3986 *   http://www.apache.org/licenses/LICENSE-2.0
3987 *
3988 * Unless required by applicable law or agreed to in writing, software
3989 * distributed under the License is distributed on an "AS IS" BASIS,
3990 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3991 * See the License for the specific language governing permissions and
3992 * limitations under the License.
3993 */class gi{constructor(e,n,s){this.converter=n,this._query=s,this.type="query",this.firestore=e}withConverter(e){return new gi(this.firestore,e,this._query)}}class tn{constructor(e,n,s){this.converter=n,this._key=s,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 Ja(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new tn(this.firestore,e,this._key)}toJSON(){return{type:tn._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,n,s){if(bh(n,tn._jsonSchema))return new tn(e,s||null,new Ve(Vt.fromString(n.referencePath)))}}tn._jsonSchemaVersion="firestore/documentReference/1.0",tn._jsonSchema={type:Nn("string",tn._jsonSchemaVersion),referencePath:Nn("string")};class Ja extends gi{constructor(e,n,s){super(e,n,Bp(s)),this._path=s,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 tn(this.firestore,null,new Ve(e))}withConverter(e){return new Ja(this.firestore,e,this._path)}}function lp(t,e,...n){if(t=st(t),jj("collection","path",e),t instanceof Qp){const s=Vt.fromString(e,...n);return Kk(s),new Ja(t,null,s)}{if(!(t instanceof tn||t instanceof Ja))throw new je(ye.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(Vt.fromString(e,...n));return Kk(s),new Ja(t.firestore,null,s)}}function si(t,e,...n){if(t=st(t),arguments.length===1&&(e=Qv.newId()),jj("doc","path",e),t instanceof Qp){const s=Vt.fromString(e,...n);return Bk(s),new tn(t,null,new Ve(s))}
3993{if(!(t instanceof tn||t instanceof Ja))throw new je(ye.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const s=t._path.child(Vt.fromString(e,...n));return Bk(s),new tn(t.firestore,t instanceof Ja?t.converter:null,new Ve(s))}}/**
3994 * @license
3995 * Copyright 2020 Google LLC
3996 *
3997 * Licensed under the Apache License, Version 2.0 (the "License");
3998 * you may not use this file except in compliance with the License.
3999 * You may obtain a copy of the License at
4000 *
4001 *   http://www.apache.org/licenses/LICENSE-2.0
4002 *
4003 * Unless required by applicable law or agreed to in writing, software
4004 * distributed under the License is distributed on an "AS IS" BASIS,
4005 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4006 * See the License for the specific language governing permissions and
4007 * limitations under the License.
4008 */const C2="AsyncQueue";class R2{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 xA(this,"async_queue_retry"),this._c=()=>{const s=Mb();s&&Ie(C2,"Visibility state changed to "+s.visibilityState),this.M_.w_()},this.ac=e;const n=Mb();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=Mb();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this._c)}}enqueue(e){if(this.uc(),this.ec)return new Promise((()=>{}));const n=new Yi;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(!lu(e))throw e;Ie(C2,"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((s=>{throw this.nc=s,this.rc=!1,ta("INTERNAL UNHANDLED ERROR: ",I2(s)),s})).then((s=>(this.rc=!1,s))))));return this.ac=n,n}enqueueAfterDelay(e,n,s){this.uc(),this.oc.indexOf(e)>-1&&(n=0);const a=g_.createAndSchedule(this,e,n,s,(c=>this.hc(c)));return this.tc.push(a),a}uc(){this.nc&&We(47125,{Pc:I2(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,s)=>n.targetTimeMs-s.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 I2(t){let e=t.message||"";return t.stack&&(e=t.stack.includes(t.message)?t.stack:t.message+`
4009`+t.stack),e}class ao extends Qp{constructor(e,n,s,a){super(e,n,s,a),this.type="firestore",this._queue=new R2,this._persistenceKey=(a==null?void 0:a.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new R2(e),this._firestoreClient=void 0,await e}}}function TV(t,e){const n=typeof t=="object"?t:ml(),s=typeof t=="string"?t:Jm,a=ur(n,"firestore").getImmediate({identifier:s});if(!a._initialized){const c=Rv("firestore");c&&kV(a,...c)}return a}function Jp(t){if(t._terminated)throw new je(ye.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||SV(t),t._firestoreClient}function SV(t){var s,a,c,u;const e=t._freezeSettings(),n=EV(t._databaseId,((s=t._app)==null?void 0:s.options.appId)||"",t._persistenceKey,(a=t._app)==null?void 0:a.options.apiKey,e);t._componentsProvider||(c=e.localCache)!=null&&c._offlineComponentProvider&&((u=e.localCache)!=null&&u._onlineComponentProvider)&&(t._componentsProvider={_offline:e.localCache._offlineComponentProvider,_online:e.localCache._onlineComponentProvider}),t._firestoreClient=new pV(t._authCredentials,t._appCheckCredentials,t._queue,n,t._componentsProvider&&(function(m){const p=m==null?void 0:m._online.build();return{_offline:m==null?void 0:m._offline.build(p),_online:p}})(t._componentsProvider))}/**
4010 * @license
4011 * Copyright 2020 Google LLC
4012 *
4013 * Licensed under the Apache License, Version 2.0 (the "License");
4014 * you may not use this file except in compliance with the License.
4015 * You may obtain a copy of the License at
4016 *
4017 *   http://www.apache.org/licenses/LICENSE-2.0
4018 *
4019 * Unless required by applicable law or agreed to in writing, software
4020 * distributed under the License is distributed on an "AS IS" BASIS,
4021 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4022 * See the License for the specific language governing permissions and
4023 * limitations under the License.
4024 */class sr{constructor(e){this._byteString=e}static fromBase64String(e){try{return new sr(Wn.fromBase64String(e))}catch(n){throw new je(ye.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new sr(Wn.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:sr._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(bh(e,sr._jsonSchema))return sr.fromBase64String(e.bytes)}}sr._jsonSchemaVersion="firestore/bytes/1.0",sr._jsonSchema={type:Nn("string",sr._jsonSchemaVersion),bytes:Nn("string")};/**
4025 * @license
4026 * Copyright 2020 Google LLC
4027 *
4028 * Licensed under the Apache License, Version 2.0 (the "License");
4029 * you may not use this file except in compliance with the License.
4030 * You may obtain a copy of the License at
4031 *
4032 *   http://www.apache.org/licenses/LICENSE-2.0
4033 *
4034 * Unless required by applicable law or agreed to in writing, software
4035 * distributed under the License is distributed on an "AS IS" BASIS,
4036 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4037 * See the License for the specific language governing permissions and
4038 * limitations under the License.
4039 */class T_{constructor(...e){for(let n=0;n<e.length;++n)if(e[n].length===0)throw new je(ye.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new Hn(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}/**
4040 * @license
4041 * Copyright 2020 Google LLC
4042 *
4043 * Licensed under the Apache License, Version 2.0 (the "License");
4044 * you may not use this file except in compliance with the License.
4045 * You may obtain a copy of the License at
4046 *
4047 *   http://www.apache.org/licenses/LICENSE-2.0
4048 *
4049 * Unless required by applicable law or agreed to in writing, software
4050 * distributed under the License is distributed on an "AS IS" BASIS,
4051 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4052 * See the License for the specific language governing permissions and
4053 * limitations under the License.
4054 */class Zp{constructor(e){this._methodName=e}}/**
4055 * @license
4056 * Copyright 2017 Google LLC
4057 *
4058 * Licensed under the Apache License, Version 2.0 (the "License");
4059 * you may not use this file except in compliance with the License.
4060 * You may obtain a copy of the License at
4061 *
4062 *   http://www.apache.org/licenses/LICENSE-2.0
4063 *
4064 * Unless required by applicable law or agreed to in writing, software
4065 * distributed under the License is distributed on an "AS IS" BASIS,
4066 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4067 * See the License for the specific language governing permissions and
4068 * limitations under the License.
4069 */class li{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new je(ye.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new je(ye.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 gt(this._lat,e._lat)||gt(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:li._jsonSchemaVersion}}static fromJSON(e){if(bh(e,li._jsonSchema))return new li(e.latitude,e.longitude)}}li._jsonSchemaVersion="firestore/geoPoint/1.0",li._jsonSchema={type:Nn("string",li._jsonSchemaVersion),latitude:Nn("number"),longitude:Nn("number")};/**
4070 * @license
4071 * Copyright 2024 Google LLC
4072 *
4073 * Licensed under the Apache License, Version 2.0 (the "License");
4074 * you may not use this file except in compliance with the License.
4075 * You may obtain a copy of the License at
4076 *
4077 *   http://www.apache.org/licenses/LICENSE-2.0
4078 *
4079 * Unless required by applicable law or agreed to in writing, software
4080 * distributed under the License is distributed on an "AS IS" BASIS,
4081 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4082 * See the License for the specific language governing permissions and
4083 * limitations under the License.
4084 */class Ar{constructor(e){this._values=(e||[]).map((n=>n))}toArray(){return this._values.map((e=>e))}isEqual(e){return(function(s,a){if(s.length!==a.length)return!1;for(let c=0;c<s.length;++c)if(s[c]!==a[c])return!1;return!0})(this._values,e._values)}toJSON(){return{type:Ar._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(bh(e,Ar._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every((n=>typeof n=="number")))return new Ar(e.vectorValues);throw new je(ye.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}Ar._jsonSchemaVersion="firestore/vectorValue/1.0",Ar._jsonSchema={type:Nn("string",Ar._jsonSchemaVersion),vectorValues:Nn("object")};/**
4085 * @license
4086 * Copyright 2017 Google LLC
4087 *
4088 * Licensed under the Apache License, Version 2.0 (the "License");
4089 * you may not use this file except in compliance with the License.
4090 * You may obtain a copy of the License at
4091 *
4092 *   http://www.apache.org/licenses/LICENSE-2.0
4093 *
4094 * Unless required by applicable law or agreed to in writing, software
4095 * distributed under the License is distributed on an "AS IS" BASIS,
4096 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4097 * See the License for the specific language governing permissions and
4098 * limitations under the License.
4099 */const NV=/^__.*__$/;class jV{constructor(e,n,s){this.data=e,this.fieldMask=n,this.fieldTransforms=s}toMutation(e,n){return this.fieldMask!==null?new co(e,this.data,this.fieldMask,n,this.fieldTransforms):new xh(e,this.data,n,this.fieldTransforms)}}class UA{constructor(e,n,s){this.data=e,this.fieldMask=n,this.fieldTransforms=s}toMutation(e,n){return new co(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function FA(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw We(40011,{dataSource:t})}}class S_{constructor(e,n,s,a,c,u){this.settings=e,this.databaseId=n,this.serializer=s,this.ignoreUndefinedProperties=a,c===void 0&&this.validatePath(),this.fieldTransforms=c||[],this.fieldMask=u||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}contextWith(e){return new S_({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}childContextForField(e){var a;const n=(a=this.path)==null?void 0:a.child(e),s=this.contextWith({path:n,arrayElement:!1});return s.validatePathSegment(e),s}childContextForFieldPath(e){var a;const n=(a=this.path)==null?void 0:a.child(e),s=this.contextWith({path:n,arrayElement:!1});return s.validatePath(),s}childContextForArray(e){return this.contextWith({path:void 0,arrayElement:!0})}createError(e){return cp(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(FA(this.dataSource)&&NV.test(e))throw this.createError('Document fields cannot begin and end with "__"')}}class AV{constructor(e,n,s){this.databaseId=e,this.ignoreUndefinedProperties=n,this.serializer=s||Yp(e)}createContext(e,n,s,a=!1){return new S_({dataSource:e,methodName:n,targetDoc:s,path:Hn.emptyPath(),arrayElement:!1,hasConverter:a},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function eg(t){const e=t._freezeSettings(),n=Yp(t._databaseId);return new AV(t._databaseId,!!e.ignoreUndefinedProperties,n)}function CV(t,e,n,s,a,c={}){const u=t.createContext(c.merge||c.mergeFields?2:0,e,n,a);j_("Data must be an object, but it was:",u,s);const h=zA(s,u);let m,p;
4099if(c.merge)m=new Ls(u.fieldMask),p=u.fieldTransforms;else if(c.mergeFields){const b=[];for(const x of c.mergeFields){const w=dl(e,x,n);if(!u.contains(w))throw new je(ye.INVALID_ARGUMENT,`Field '${w}' is specified in your field mask but missing from your input data.`);$A(b,w)||b.push(w)}m=new Ls(b),p=u.fieldTransforms.filter((x=>m.covers(x.field)))}else m=null,p=u.fieldTransforms;return new jV(new _s(h),m,p)}class tg extends Zp{_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 tg}}class N_ extends Zp{_toFieldTransform(e){return new g9(e.path,new Zd)}isEqual(e){return e instanceof N_}}function RV(t,e,n,s){const a=t.createContext(1,e,n);j_("Data must be an object, but it was:",a,s);const c=[],u=_s.empty();lo(s,((m,p)=>{const b=KA(e,m,n);p=st(p);const x=a.childContextForFieldPath(b);if(p instanceof tg)c.push(b);else{const w=Eh(p,x);w!=null&&(c.push(b),u.set(b,w))}}));const h=new Ls(c);return new UA(u,h,a.fieldTransforms)}function IV(t,e,n,s,a,c){const u=t.createContext(1,e,n),h=[dl(e,s,n)],m=[a];if(c.length%2!=0)throw new je(ye.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let w=0;w<c.length;w+=2)h.push(dl(e,c[w])),m.push(c[w+1]);const p=[],b=_s.empty();for(let w=h.length-1;w>=0;--w)if(!$A(p,h[w])){const T=h[w];let N=m[w];N=st(N);const j=u.childContextForFieldPath(T);if(N instanceof tg)p.push(T);else{const A=Eh(N,j);A!=null&&(p.push(T),b.set(T,A))}}const x=new Ls(p);return new UA(b,x,u.fieldTransforms)}function VA(t,e,n,s=!1){return Eh(n,t.createContext(s?4:3,e))}function Eh(t,e){if(BA(t=st(t)))return j_("Unsupported field value:",e,t),zA(t,e);if(t instanceof Zp)return(function(s,a){if(!FA(a.dataSource))throw a.createError(`${s._methodName}() can only be used with update() and set()`);if(!a.path)throw a.createError(`${s._methodName}() is not currently supported inside arrays`);const c=s._toFieldTransform(a);c&&a.fieldTransforms.push(c)})(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(s,a){const c=[];let u=0;for(const h of s){let m=Eh(h,a.childContextForArray(u));m==null&&(m={nullValue:"NULL_VALUE"}),c.push(m),u++}return{arrayValue:{values:c}}})(t,e)}return(function(s,a){if((s=st(s))===null)return{nullValue:"NULL_VALUE"};if(typeof s=="number")return f9(a.serializer,s);if(typeof s=="boolean")return{booleanValue:s};if(typeof s=="string")return{stringValue:s};if(s instanceof Date){const c=Ut.fromDate(s);return{timestampValue:sp(a.serializer,c)}}if(s instanceof Ut){const c=new Ut(s.seconds,1e3*Math.floor(s.nanoseconds/1e3));return{timestampValue:sp(a.serializer,c)}}if(s instanceof li)return{geoPointValue:{latitude:s.latitude,longitude:s.longitude}};if(s instanceof sr)return{bytesValue:oA(a.serializer,s._byteString)};if(s instanceof tn){const c=a.databaseId,u=s.firestore._databaseId;if(!u.isEqual(c))throw a.createError(`Document reference is for database ${u.projectId}/${u.database} but should be for database ${c.projectId}/${c.database}`);return{referenceValue:o_(s.firestore._databaseId||a.databaseId,s._key.path)}}if(s instanceof Ar)return(function(u,h){const m=u instanceof Ar?u.toArray():u;return{mapValue:{fields:{[Lj]:{stringValue:Uj},[Zm]:{arrayValue:{values:m.map((b=>{if(typeof b!="number")throw h.createError("VectorValues must only contain numeric values.");return s_(h.serializer,b)}))}}}}}})(s,a);if(mA(s))return s._toProto(a.serializer);throw a.createError(`Unsupported field value: ${Lp(s)}`)})(t,e)}function zA(t,e){const n={};return Rj(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):lo(t,((s,a)=>{const c=Eh(a,e.childContextForField(s));c!=null&&(n[s]=c)})),{mapValue:{fields:n}}}function BA(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof Ut||t instanceof li||t instanceof sr||t instanceof tn||t instanceof Zp||t instanceof Ar||mA(t))}function j_(t,e,n){if(!BA(n)||!Aj(n)){const s=Lp(n);throw s==="an object"?e.createError(t+" a custom object"):e.createError(t+" "+s)}}
vendor: 4,205 bytes, lines 4099-4133
4099function dl(t,e,n){if((e=st(e))instanceof T_)return e._internalPath;if(typeof e=="string")return KA(t,e);throw cp("Field path arguments must be of type string or ",t,!1,void 0,n)}const MV=new RegExp("[~\\*/\\[\\]]");function KA(t,e,n){if(e.search(MV)>=0)throw cp(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new T_(...e.split("."))._internalPath}catch{throw cp(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function cp(t,e,n,s,a){const c=s&&!s.isEmpty(),u=a!==void 0;let h=`Function ${e}() called with invalid data`;n&&(h+=" (via `toFirestore()`)"),h+=". ";let m="";return(c||u)&&(m+=" (found",c&&(m+=` in field ${s}`),u&&(m+=` in document ${a}`),m+=")"),new je(ye.INVALID_ARGUMENT,h+t+m)}function $A(t,e){return t.some((n=>n.isEqual(e)))}/**
4100 * @license
4101 * Copyright 2020 Google LLC
4102 *
4103 * Licensed under the Apache License, Version 2.0 (the "License");
4104 * you may not use this file except in compliance with the License.
4105 * You may obtain a copy of the License at
4106 *
4107 *   http://www.apache.org/licenses/LICENSE-2.0
4108 *
4109 * Unless required by applicable law or agreed to in writing, software
4110 * distributed under the License is distributed on an "AS IS" BASIS,
4111 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4112 * See the License for the specific language governing permissions and
4113 * limitations under the License.
4114 */class PV{convertValue(e,n="none"){switch(so(e)){case 0:return null;case 1:return e.booleanValue;case 2:return dn(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(no(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 We(62114,{value:e})}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const s={};return lo(e,((a,c)=>{s[a]=this.convertValue(c,n)})),s}convertVectorValue(e){var s,a,c;const n=(c=(a=(s=e.fields)==null?void 0:s[Zm].arrayValue)==null?void 0:a.values)==null?void 0:c.map((u=>dn(u.doubleValue)));return new Ar(n)}convertGeoPoint(e){return new li(dn(e.latitude),dn(e.longitude))}convertArray(e,n){return(e.values||[]).map((s=>this.convertValue(s,n)))}convertServerTimestamp(e,n){switch(n){case"previous":const s=zp(e);return s==null?null:this.convertValue(s,n);case"estimate":return this.convertTimestamp(Wd(e));default:return null}}convertTimestamp(e){const n=to(e);return new Ut(n.seconds,n.nanos)}convertDocumentKey(e,n){const s=Vt.fromString(e);At(fA(s),9688,{name:e});const a=new Xd(s.get(1),s.get(3)),c=new Ve(s.popFirst(5));return a.isEqual(n)||ta(`Document ${c} contains a document reference within a different database (${a.projectId}/${a.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),c}}/**
4115 * @license
4116 * Copyright 2024 Google LLC
4117 *
4118 * Licensed under the Apache License, Version 2.0 (the "License");
4119 * you may not use this file except in compliance with the License.
4120 * You may obtain a copy of the License at
4121 *
4122 *   http://www.apache.org/licenses/LICENSE-2.0
4123 *
4124 * Unless required by applicable law or agreed to in writing, software
4125 * distributed under the License is distributed on an "AS IS" BASIS,
4126 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4127 * See the License for the specific language governing permissions and
4128 * limitations under the License.
4129 */class A_ extends PV{constructor(e){super(),this.firestore=e}convertBytes(e){return new sr(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new tn(this.firestore,null,n)}}function Pm(){return new N_("serverTimestamp")}const M2="@firebase/firestore",P2="4.11.0";/**
4130 * @license
4131 * Copyright 2017 Google LLC
4132 *
4133 * Licensed under the Apache License, Version 2.0 (the "License");
4134 * you may not use this file except in compliance with the License.
4135 * You may obtain a copy of the License at
4136 *
4137 *   http://www.apache.org/licenses/LICENSE-2.0
4138 *
4139 * Unless required by applicable law or agreed to in writing, software
4140 * distributed under the License is distributed on an "AS IS" BASIS,
4141 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4142 * See the License for the specific language governing permissions and
4143 * limitations under the License.
4144 */function D2(t){return(function(n,s){if(typeof n!="object"||n===null)return!1;const a=n;for(const c of s)if(c in a&&typeof a[c]=="function")return!0;return!1})(t,["next","error","complete"])}/**
4145 * @license
4146 * Copyright 2020 Google LLC
4147 *
4148 * Licensed under the Apache License, Version 2.0 (the "License");
4149 * you may not use this file except in compliance with the License.
4150 * You may obtain a copy of the License at
4151 *
4152 *   http://www.apache.org/licenses/LICENSE-2.0
4153 *
4154 * Unless required by applicable law or agreed to in writing, software
4155 * distributed under the License is distributed on an "AS IS" BASIS,
4156 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4157 * See the License for the specific language governing permissions and
4158 * limitations under the License.
4159 */class C_{constructor(e,n,s,a,c){this._firestore=e,this._userDataWriter=n,this._key=s,this._document=a,this._converter=c}get id(){return this._key.path.lastSegment()}get ref(){return new tn(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new DV(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(dl("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class DV extends C_{data(){return super.data()}}/**
4160 * @license
4161 * Copyright 2020 Google LLC
4162 *
4163 * Licensed under the Apache License, Version 2.0 (the "License");
4164 * you may not use this file except in compliance with the License.
4165 * You may obtain a copy of the License at
4166 *
4167 *   http://www.apache.org/licenses/LICENSE-2.0
4168 *
4169 * Unless required by applicable law or agreed to in writing, software
4170 * distributed under the License is distributed on an "AS IS" BASIS,
4171 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4172 * See the License for the specific language governing permissions and
4173 * limitations under the License.
4174 */function qA(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new je(ye.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class R_{}class ng extends R_{}function Zo(t,e,...n){let s=[];e instanceof R_&&s.push(e),s=s.concat(n),(function(c){const u=c.filter((m=>m instanceof I_)).length,h=c.filter((m=>m instanceof sg)).length;if(u>1||u>0&&h>0)throw new je(ye.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(...)))`.")})(s);for(const a of s)t=a._apply(t);return t}class sg extends ng{constructor(e,n,s){super(),this._field=e,this._op=n,this._value=s,this.type="where"}static _create(e,n,s){return new sg(e,n,s)}_apply(e){const n=this._parse(e);return HA(e._query,n),new gi(e.firestore,e.converter,Kx(e._query,n))}_parse(e){const n=eg(e.firestore);return(function(c,u,h,m,p,b,x){let w;if(p.isKeyField()){if(b==="array-contains"||b==="array-contains-any")throw new je(ye.INVALID_ARGUMENT,`Invalid Query. You can't perform '${b}' queries on documentId().`);if(b==="in"||b==="not-in"){L2(x,b);const N=[];for(const j of x)N.push(O2(m,c,j));w={arrayValue:{values:N}}}else w=O2(m,c,x)}else b!=="in"&&b!=="not-in"&&b!=="array-contains-any"||L2(x,b),w=VA(h,u,x,b==="in"||b==="not-in");return Sn.create(p,b,w)})(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function yd(t,e,n){const s=e,a=dl("where",t);return sg._create(a,s,n)}class I_ extends R_{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new I_(e,n)}_parse(e){const n=this._queryConstraints.map((s=>s._parse(e))).filter((s=>s.getFilters().length>0));return n.length===1?n[0]:Cr.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:((function(a,c){let u=a;const h=c.getFlattenedFilters();for(const m of h)HA(u,m),u=Kx(u,m)})(e._query,n),new gi(e.firestore,e.converter,Kx(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}
4174class M_ extends ng{constructor(e,n){super(),this._field=e,this._direction=n,this.type="orderBy"}static _create(e,n){return new M_(e,n)}_apply(e){const n=(function(a,c,u){if(a.startAt!==null)throw new je(ye.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(a.endAt!==null)throw new je(ye.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new Jd(c,u)})(e._query,this._field,this._direction);return new gi(e.firestore,e.converter,r9(e._query,n))}}function nh(t,e="asc"){const n=e,s=dl("orderBy",t);return M_._create(s,n)}class P_ extends ng{constructor(e,n,s){super(),this.type=e,this._limit=n,this._limitType=s}static _create(e,n,s){return new P_(e,n,s)}_apply(e){return new gi(e.firestore,e.converter,tp(e._query,this._limit,this._limitType))}}function OV(t){return AU("limit",t),P_._create("limit",t,"F")}class D_ extends ng{constructor(e,n,s){super(),this.type=e,this._docOrFields=n,this._inclusive=s}static _create(e,n,s){return new D_(e,n,s)}_apply(e){const n=UV(e,this.type,this._docOrFields,this._inclusive);return new gi(e.firestore,e.converter,i9(e._query,n))}}function LV(...t){return D_._create("startAfter",t,!1)}function UV(t,e,n,s){if(n[0]=st(n[0]),n[0]instanceof C_)return(function(c,u,h,m,p){if(!m)throw new je(ye.NOT_FOUND,`Can't use a DocumentSnapshot that doesn't exist for ${h}().`);const b=[];for(const x of Dc(c))if(x.field.isKeyField())b.push(ep(u,m.key));else{const w=m.data.field(x.field);if(Vp(w))throw new je(ye.INVALID_ARGUMENT,'Invalid query. You are trying to start or end a query using a document for which the field "'+x.field+'" is an uncommitted server timestamp. (Since the value of this field is unknown, you cannot start/end a query with it.)');if(w===null){const T=x.field.canonicalString();throw new je(ye.INVALID_ARGUMENT,`Invalid query. You are trying to start or end a query using a document for which the field '${T}' (used as the orderBy) does not exist.`)}b.push(w)}return new Yc(b,p)})(t._query,t.firestore._databaseId,e,n[0]._document,s);{const a=eg(t.firestore);return(function(u,h,m,p,b,x){const w=u.explicitOrderBy;if(b.length>w.length)throw new je(ye.INVALID_ARGUMENT,`Too many arguments provided to ${p}(). The number of arguments must be less than or equal to the number of orderBy() clauses`);const T=[];for(let N=0;N<b.length;N++){const j=b[N];if(w[N].field.isKeyField()){if(typeof j!="string")throw new je(ye.INVALID_ARGUMENT,`Invalid query. Expected a string for document ID in ${p}(), but got a ${typeof j}`);if(!n_(u)&&j.indexOf("/")!==-1)throw new je(ye.INVALID_ARGUMENT,`Invalid query. When querying a collection and ordering by documentId(), the value passed to ${p}() must be a plain document ID, but '${j}' contains a slash.`);const A=u.path.child(Vt.fromString(j));if(!Ve.isDocumentKey(A))throw new je(ye.INVALID_ARGUMENT,`Invalid query. When querying a collection group and ordering by documentId(), the value passed to ${p}() must result in a valid document path, but '${A}' is not because it contains an odd number of segments.`);const F=new Ve(A);T.push(ep(h,F))}else{const A=VA(m,p,j);T.push(A)}}return new Yc(T,x)})(t._query,t.firestore._databaseId,a,e,n,s)}}function O2(t,e,n){if(typeof(n=st(n))=="string"){if(n==="")throw new je(ye.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!n_(e)&&n.indexOf("/")!==-1)throw new je(ye.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const s=e.path.child(Vt.fromString(n));if(!Ve.isDocumentKey(s))throw new je(ye.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${s}' is not because it has an odd number of segments (${s.length}).`);return ep(t,new Ve(s))}if(n instanceof tn)return ep(t,n._key);throw new je(ye.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Lp(n)}.`)}function L2(t,e){if(!Array.isArray(t)||t.length===0)throw new je(ye.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function HA(t,e){const n=(function(a,c){for(const u of a)for(const h of u.getFlattenedFilters())if(c.indexOf(h.op)>=0)return h.op;return null})(t.filters,(function(a){switch(a){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 je(ye.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new je(ye.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}function FV(t,e,n){let s;return s=t?t.toFirestore(e):e,s}class jd{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class el extends C_{constructor(e,n,s,a,c,u){super(e,n,s,a,u),this._firestore=e,this._firestoreImpl=e,this.metadata=c}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Dm(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 s=this._document.data.field(dl("DocumentSnapshot.get",e));if(s!==null)return this._userDataWriter.convertValue(s,n.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new je(ye.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=el._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)}}el._jsonSchemaVersion="firestore/documentSnapshot/1.0",el._jsonSchema={type:Nn("string",el._jsonSchemaVersion),bundleSource:Nn("string","DocumentSnapshot"),bundleName:Nn("string"),bundle:Nn("string")};class Dm extends el{data(e={}){return super.data(e)}}class tl{constructor(e,n,s,a){this._firestore=e,this._userDataWriter=n,this._snapshot=a,this.metadata=new jd(a.hasPendingWrites,a.fromCache),this.query=s}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((s=>{e.call(n,new Dm(this._firestore,this._userDataWriter,s.key,s,new jd(this._snapshot.mutatedKeys.has(s.key),this._snapshot.fromCache),this.query.converter))}))}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new je(ye.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(a,c){if(a._snapshot.oldDocs.isEmpty()){let u=0;return a._snapshot.docChanges.map((h=>{const m=new Dm(a._firestore,a._userDataWriter,h.doc.key,h.doc,new jd(a._snapshot.mutatedKeys.has(h.doc.key),a._snapshot.fromCache),a.query.converter);return h.doc,{type:"added",doc:m,oldIndex:-1,newIndex:u++}}))}{let u=a._snapshot.oldDocs;return a._snapshot.docChanges.filter((h=>c||h.type!==3)).map((h=>{const m=new Dm(a._firestore,a._userDataWriter,h.doc.key,h.doc,new jd(a._snapshot.mutatedKeys.has(h.doc.key),a._snapshot.fromCache),a.query.converter);let p=-1,b=-1;return h.type!==0&&(p=u.indexOf(h.doc.key),u=u.delete(h.doc.key)),h.type!==1&&(u=u.add(h.doc),b=u.indexOf(h.doc.key)),{type:VV(h.type),doc:m,oldIndex:p,newIndex:b}}))}})(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new je(ye.FAILED_PRECONDITION,"QuerySnapsh
4174ot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");const e={};e.type=tl._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Qv.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;const n=[],s=[],a=[];return this.docs.forEach((c=>{c._document!==null&&(n.push(c._document),s.push(this._userDataWriter.convertObjectMap(c._document.data.value.mapValue.fields,"previous")),a.push(c.ref.path))})),e.bundle=(this._firestore,this.query._query,e.bundleName,"NOT SUPPORTED"),e}}function VV(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return We(61501,{type:t})}}/**
4175 * @license
4176 * Copyright 2022 Google LLC
4177 *
4178 * Licensed under the Apache License, Version 2.0 (the "License");
4179 * you may not use this file except in compliance with the License.
4180 * You may obtain a copy of the License at
4181 *
4182 *   http://www.apache.org/licenses/LICENSE-2.0
4183 *
4184 * Unless required by applicable law or agreed to in writing, software
4185 * distributed under the License is distributed on an "AS IS" BASIS,
4186 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4187 * See the License for the specific language governing permissions and
4188 * limitations under the License.
4189 */tl._jsonSchemaVersion="firestore/querySnapshot/1.0",tl._jsonSchema={type:Nn("string",tl._jsonSchemaVersion),bundleSource:Nn("string","QuerySnapshot"),bundleName:Nn("string"),bundle:Nn("string")};/**
4190 * @license
4191 * Copyright 2020 Google LLC
4192 *
4193 * Licensed under the Apache License, Version 2.0 (the "License");
4194 * you may not use this file except in compliance with the License.
4195 * You may obtain a copy of the License at
4196 *
4197 *   http://www.apache.org/licenses/LICENSE-2.0
4198 *
4199 * Unless required by applicable law or agreed to in writing, software
4200 * distributed under the License is distributed on an "AS IS" BASIS,
4201 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4202 * See the License for the specific language governing permissions and
4203 * limitations under the License.
4204 */function rg(t){t=Vs(t,tn);const e=Vs(t.firestore,ao),n=Jp(e);return xV(n,t._key).then((s=>QA(e,t,s)))}function up(t){t=Vs(t,gi);const e=Vs(t.firestore,ao),n=Jp(e),s=new A_(e);return qA(t._query),vV(n,t._query).then((a=>new tl(e,s,t,a)))}function GA(t,e,n){t=Vs(t,tn);const s=Vs(t.firestore,ao),a=FV(t.converter,e),c=eg(s);return O_(s,[CV(c,"setDoc",t._key,a,t.converter!==null,n).toMutation(t._key,jr.none())])}function YA(t,e,n,...s){t=Vs(t,tn);const a=Vs(t.firestore,ao),c=eg(a);let u;return u=typeof(e=st(e))=="string"||e instanceof T_?IV(c,"updateDoc",t._key,e,n,s):RV(c,"updateDoc",t._key,e),O_(a,[u.toMutation(t._key,jr.exists(!0))])}function WA(t){return O_(Vs(t.firestore,ao),[new r_(t._key,jr.none())])}function XA(t,...e){var p,b,x;t=st(t);let n={includeMetadataChanges:!1,source:"default"},s=0;typeof e[s]!="object"||D2(e[s])||(n=e[s++]);const a={includeMetadataChanges:n.includeMetadataChanges,source:n.source};if(D2(e[s])){const w=e[s];e[s]=(p=w.next)==null?void 0:p.bind(w),e[s+1]=(b=w.error)==null?void 0:b.bind(w),e[s+2]=(x=w.complete)==null?void 0:x.bind(w)}let c,u,h;if(t instanceof tn)u=Vs(t.firestore,ao),h=Bp(t._key.path),c={next:w=>{e[s]&&e[s](QA(u,t,w))},error:e[s+1],complete:e[s+2]};else{const w=Vs(t,gi);u=Vs(w.firestore,ao),h=w._query;const T=new A_(u);c={next:N=>{e[s]&&e[s](new tl(u,T,w,N))},error:e[s+1],complete:e[s+2]},qA(t._query)}const m=Jp(u);return bV(m,h,a,c)}function O_(t,e){const n=Jp(t);return _V(n,e)}function QA(t,e,n){const s=n.docs.get(e._key),a=new A_(t);return new el(t,a,e._key,s,new jd(n.hasPendingWrites,n.fromCache),e.converter)}(function(e,n=!0){yU(Zi),Yn(new Un("firestore",((s,{instanceIdentifier:a,options:c})=>{const u=s.getProvider("app").getImmediate(),h=new ao(new vU(s.getProvider("auth-internal")),new EU(u,s.getProvider("app-check-internal")),zU(u,a),u);return c={useFetchStreams:n,...c},h._setSettings(c),h}),"PUBLIC").setMultipleInstances(!0)),mn(M2,P2,e),mn(M2,P2,"esm2020")})();/**
4205 * @license
4206 * Copyright 2017 Google LLC
4207 *
4208 * Licensed under the Apache License, Version 2.0 (the "License");
4209 * you may not use this file except in compliance with the License.
4210 * You may obtain a copy of the License at
4211 *
4212 *   http://www.apache.org/licenses/LICENSE-2.0
4213 *
4214 * Unless required by applicable law or agreed to in writing, software
4215 * distributed under the License is distributed on an "AS IS" BASIS,
4216 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4217 * See the License for the specific language governing permissions and
4218 * limitations under the License.
4219 */const zV="type.googleapis.com/google.protobuf.Int64Value",BV="type.googleapis.com/google.protobuf.UInt64Value";function JA(t,e){const n={};for(const s in t)t.hasOwnProperty(s)&&(n[s]=e(t[s]));return n}function dp(t){if(t==null)return null;if(t instanceof Number&&(t=t.valueOf()),typeof t=="number"&&isFinite(t)||t===!0||t===!1||Object.prototype.toString.call(t)==="[object String]")return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map(e=>dp(e));if(typeof t=="function"||typeof t=="object")return JA(t,e=>dp(e));throw new Error("Data cannot be encoded in JSON: "+t)}function Qc(t){if(t==null)return t;if(t["@type"])switch(t["@type"]){case zV:case BV:{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(e=>Qc(e)):typeof t=="function"||typeof t=="object"?JA(t,e=>Qc(e)):t}/**
4220 * @license
4221 * Copyright 2020 Google LLC
4222 *
4223 * Licensed under the Apache License, Version 2.0 (the "License");
4224 * you may not use this file except in compliance with the License.
4225 * You may obtain a copy of the License at
4226 *
4227 *   http://www.apache.org/licenses/LICENSE-2.0
4228 *
4229 * Unless required by applicable law or agreed to in writing, software
4230 * distributed under the License is distributed on an "AS IS" BASIS,
4231 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4232 * See the License for the specific language governing permissions and
4233 * limitations under the License.
4234 */const L_="functions";/**
4235 * @license
4236 * Copyright 2017 Google LLC
4237 *
4238 * Licensed under the Apache License, Version 2.0 (the "License");
4239 * you may not use this file except in compliance with the License.
4240 * You may obtain a copy of the License at
4241 *
4242 *   http://www.apache.org/licenses/LICENSE-2.0
4243 *
4244 * Unless required by applicable law or agreed to in writing, software
4245 * distributed under the License is distributed on an "AS IS" BASIS,
4246 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4247 * See the License for the specific language governing permissions and
4248 * limitations under the License.
4249 */const U2={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 ws extends ds{constructor(e,n,s){super(`${L_}/${e}`,n||""),this.details=s,Object.setPrototypeOf(this,ws.prototype)}}function KV(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function hp(t,e){let n=KV(t),s=n,a;try{const c=e&&e.error;if(c){const u=c.status;if(typeof u=="string"){if(!U2[u])return new ws("internal","internal");n=U2[u],s=u}const h=c.message;typeof h=="string"&&(s=h),a=c.details,a!==void 0&&(a=Qc(a))}}catch{}return n==="ok"?null:new ws(n,s,a)}/**
4250 * @license
4251 * Copyright 2017 Google LLC
4252 *
4253 * Licensed under the Apache License, Version 2.0 (the "License");
4254 * you may not use this file except in compliance with the License.
4255 * You may obtain a copy of the License at
4256 *
4257 *   http://www.apache.org/licenses/LICENSE-2.0
4258 *
4259 * Unless required by applicable law or agreed to in writing, software
4260 * distributed under the License is distributed on an "AS IS" BASIS,
4261 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4262 * See the License for the specific language governing permissions and
4263 * limitations under the License.
4264 */class $V{constructor(e,n,s,a){this.app=e,this.auth=null,this.messaging=null,this.appCheck=null,this.serverAppAppCheckToken=null,qn(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.auth=n.getImmediate({optional:!0}),this.messaging=s.getImmediate({optional:!0}),this.auth||n.get().then(c=>this.auth=c,()=>{}),this.messaging||s.get().then(c=>this.messaging=c,()=>{}),this.appCheck||a==null||a.get().then(c=>this.appCheck=c,()=>{})}async getAuthToken(){if(this.auth)try{const e=await this.auth.getToken();return e==null?void 0:e.accessToken}catch{return}}async getMessagingToken(){if(!(!this.messaging||!("Notification"in self)||Notification.permission!=="granted"))try{return await this.messaging.getToken()}catch{return}}async getAppCheckToken(e){if(this.serverAppAppCheckToken)return this.serverAppAppCheckToken;if(this.appCheck){const n=e?await this.appCheck.getLimitedUseToken():await this.appCheck.getToken();return n.error?null:n.token}return null}async getContext(e){const n=await this.getAuthToken(),s=await this.getMessagingToken(),a=await this.getAppCheckToken(e);return{authToken:n,messagingToken:s,appCheckToken:a}}}/**
4265 * @license
4266 * Copyright 2017 Google LLC
4267 *
4268 * Licensed under the Apache License, Version 2.0 (the "License");
4269 * you may not use this file except in compliance with the License.
4270 * You may obtain a copy of the License at
4271 *
4272 *   http://www.apache.org/licenses/LICENSE-2.0
4273 *
4274 * Unless required by applicable law or agreed to in writing, software
4275 * distributed under the License is distributed on an "AS IS" BASIS,
4276 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4277 * See the License for the specific language governing permissions and
4278 * limitations under the License.
4279 */const Zx="us-central1",qV=/^data: (.*?)(?:\n|$)/;function HV(t){let e=null;return{promise:new Promise((n,s)=>{e=setTimeout(()=>{s(new ws("deadline-exceeded","deadline-exceeded"))},t)}),cancel:()=>{e&&clearTimeout(e)}}}class GV{constructor(e,n,s,a,c=Zx,u=(...h)=>fetch(...h)){this.app=e,this.fetchImpl=u,this.emulatorOrigin=null,this.contextProvider=new $V(e,n,s,a),this.cancelAllRequests=new Promise(h=>{this.deleteService=()=>Promise.resolve(h())});try{const h=new URL(c);this.customDomain=h.origin+(h.pathname==="/"?"":h.pathname),this.region=Zx}catch{this.customDomain=null,this.region=c}}_delete(){return this.deleteService()}_url(e){const n=this.app.options.projectId;return this.emulatorOrigin!==null?`${this.emulatorOrigin}/${n}/${this.region}/${e}`:this.customDomain!==null?`${this.customDomain}/${e}`:`https://${this.region}-${n}.cloudfunctions.net/${e}`}}function YV(t,e,n){const s=hi(e);t.emulatorOrigin=`http${s?"s":""}://${e}:${n}`,s&&(Ap(t.emulatorOrigin+"/backends"),Cp("Functions",!0))}function WV(t,e,n){const s=a=>QV(t,e,a,{});return s.stream=(a,c)=>ZV(t,e,a,c),s}function ZA(t){return t.emulatorOrigin&&hi(t.emulatorOrigin)?"include":void 0}async function XV(t,e,n,s,a){n["Content-Type"]="application/json";
4279let c;try{c=await s(t,{method:"POST",body:JSON.stringify(e),headers:n,credentials:ZA(a)})}catch{return{status:0,json:null}}let u=null;try{u=await c.json()}catch{}return{status:c.status,json:u}}async function eC(t,e){const n={},s=await t.contextProvider.getContext(e.limitedUseAppCheckTokens);return s.authToken&&(n.Authorization="Bearer "+s.authToken),s.messagingToken&&(n["Firebase-Instance-ID-Token"]=s.messagingToken),s.appCheckToken!==null&&(n["X-Firebase-AppCheck"]=s.appCheckToken),n}function QV(t,e,n,s){const a=t._url(e);return JV(t,a,n,s)}async function JV(t,e,n,s){n=dp(n);const a={data:n},c=await eC(t,s),u=s.timeout||7e4,h=HV(u),m=await Promise.race([XV(e,a,c,t.fetchImpl,t),h.promise,t.cancelAllRequests]);if(h.cancel(),!m)throw new ws("cancelled","Firebase Functions instance was deleted.");const p=hp(m.status,m.json);if(p)throw p;if(!m.json)throw new ws("internal","Response is not valid JSON object.");let b=m.json.data;if(typeof b>"u"&&(b=m.json.result),typeof b>"u")throw new ws("internal","Response is missing data field.");return{data:Qc(b)}}function ZV(t,e,n,s){const a=t._url(e);return e8(t,a,n,s||{})}async function e8(t,e,n,s){var w;n=dp(n);const a={data:n},c=await eC(t,s);c["Content-Type"]="application/json",c.Accept="text/event-stream";let u;try{u=await t.fetchImpl(e,{method:"POST",body:JSON.stringify(a),headers:c,signal:s==null?void 0:s.signal,credentials:ZA(t)})}catch(T){if(T instanceof Error&&T.name==="AbortError"){const j=new ws("cancelled","Request was cancelled.");return{data:Promise.reject(j),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(j)}}}}}}const N=hp(0,null);return{data:Promise.reject(N),stream:{[Symbol.asyncIterator](){return{next(){return Promise.reject(N)}}}}}}let h,m;const p=new Promise((T,N)=>{h=T,m=N});(w=s==null?void 0:s.signal)==null||w.addEventListener("abort",()=>{const T=new ws("cancelled","Request was cancelled.");m(T)});const b=u.body.getReader(),x=t8(b,h,m,s==null?void 0:s.signal);return{stream:{[Symbol.asyncIterator](){const T=x.getReader();return{async next(){const{value:N,done:j}=await T.read();return{value:N,done:j}},async return(){return await T.cancel(),{done:!0,value:void 0}}}}},data:p}}function t8(t,e,n,s){const a=(u,h)=>{const m=u.match(qV);if(!m)return;const p=m[1];try{const b=JSON.parse(p);if("result"in b){e(Qc(b.result));return}if("message"in b){h.enqueue(Qc(b.message));return}if("error"in b){const x=hp(0,b);h.error(x),n(x);return}}catch(b){if(b instanceof ws){h.error(b),n(b);return}}},c=new TextDecoder;return new ReadableStream({start(u){let h="";return m();async function m(){if(s!=null&&s.aborted){const p=new ws("cancelled","Request was cancelled");return u.error(p),n(p),Promise.resolve()}try{const{value:p,done:b}=await t.read();if(b){h.trim()&&a(h.trim(),u),u.close();return}if(s!=null&&s.aborted){const w=new ws("cancelled","Request was cancelled");u.error(w),n(w),await t.cancel();return}h+=c.decode(p,{stream:!0});const x=h.split(`
4280`);h=x.pop()||"";for(const w of x)w.trim()&&a(w.trim(),u);return m()}catch(p){const b=p instanceof ws?p:hp(0,null);u.error(b),n(b)}}},cancel(){return t.cancel()}})}const F2="@firebase/functions",V2="0.13.1";/**
4281 * @license
4282 * Copyright 2019 Google LLC
4283 *
4284 * Licensed under the Apache License, Version 2.0 (the "License");
4285 * you may not use this file except in compliance with the License.
4286 * You may obtain a copy of the License at
4287 *
4288 *   http://www.apache.org/licenses/LICENSE-2.0
4289 *
4290 * Unless required by applicable law or agreed to in writing, software
4291 * distributed under the License is distributed on an "AS IS" BASIS,
4292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4293 * See the License for the specific language governing permissions and
4294 * limitations under the License.
4295 */const n8="auth-internal",s8="app-check-internal",r8="messaging-internal";function i8(t){const e=(n,{instanceIdentifier:s})=>{const a=n.getProvider("app").getImmediate(),c=n.getProvider(n8),u=n.getProvider(r8),h=n.getProvider(s8);return new GV(a,c,u,h,s)};Yn(new Un(L_,e,"PUBLIC").setMultipleInstances(!0)),mn(F2,V2,t),mn(F2,V2,"esm2020")}/**
4296 * @license
4297 * Copyright 2020 Google LLC
4298 *
4299 * Licensed under the Apache License, Version 2.0 (the "License");
4300 * you may not use this file except in compliance with the License.
4301 * You may obtain a copy of the License at
4302 *
4303 *   http://www.apache.org/licenses/LICENSE-2.0
4304 *
4305 * Unless required by applicable law or agreed to in writing, software
4306 * distributed under the License is distributed on an "AS IS" BASIS,
4307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4308 * See the License for the specific language governing permissions and
4309 * limitations under the License.
4310 */function a8(t=ml(),e=Zx){const s=ur(st(t),L_).getImmediate({identifier:e}),a=Rv("functions");return a&&o8(s,...a),s}function o8(t,e,n){YV(st(t),e,n)}function ct(t,e,n){return WV(st(t),e)}i8();/**
4311 * @license
4312 * Copyright 2017 Google LLC
4313 *
4314 * Licensed under the Apache License, Version 2.0 (the "License");
4315 * you may not use this file except in compliance with the License.
4316 * You may obtain a copy of the License at
4317 *
4318 *   http://www.apache.org/licenses/LICENSE-2.0
4319 *
4320 * Unless required by applicable law or agreed to in writing, software
4321 * distributed under the License is distributed on an "AS IS" BASIS,
4322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4323 * See the License for the specific language governing permissions and
4324 * limitations under the License.
4325 */const tC="firebasestorage.googleapis.com",nC="storageBucket",l8=120*1e3,c8=600*1e3,u8=1e3;/**
4326 * @license
4327 * Copyright 2017 Google LLC
4328 *
4329 * Licensed under the Apache License, Version 2.0 (the "License");
4330 * you may not use this file except in compliance with the License.
4331 * You may obtain a copy of the License at
4332 *
4333 *   http://www.apache.org/licenses/LICENSE-2.0
4334 *
4335 * Unless required by applicable law or agreed to in writing, software
4336 * distributed under the License is distributed on an "AS IS" BASIS,
4337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4338 * See the License for the specific language governing permissions and
4339 * limitations under the License.
4340 */class Jt extends ds{constructor(e,n,s=0){super(Db(e),`Firebase Storage: ${n} (${Db(e)})`),this.status_=s,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,Jt.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return Db(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage}
4341${this.customData.serverResponse}`:this.message=this._baseMessage}}var qt;(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"})(qt||(qt={}));function Db(t){return"storage/"+t}function U_(){const t="An unknown error occurred, please check the error payload for server response.";return new Jt(qt.UNKNOWN,t)}function d8(t){return new Jt(qt.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function h8(t){return new Jt(qt.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function f8(){const t="User is not authenticated, please authenticate using Firebase Authentication and try again.";return new Jt(qt.UNAUTHENTICATED,t)}function m8(){return new Jt(qt.UNAUTHORIZED_APP,"This app does not have permission to access Firebase Storage on this project.")}function p8(t){return new Jt(qt.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function sC(){return new Jt(qt.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function rC(){return new Jt(qt.CANCELED,"User canceled the upload/download.")}function g8(t){return new Jt(qt.INVALID_URL,"Invalid URL '"+t+"'.")}function y8(t){return new Jt(qt.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function b8(){return new Jt(qt.NO_DEFAULT_BUCKET,"No default bucket found. Did you set the '"+nC+"' property when initializing the app?")}function iC(){return new Jt(qt.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function x8(){return new Jt(qt.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function v8(){return new Jt(qt.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function _8(t){return new Jt(qt.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 ev(t){return new Jt(qt.INVALID_ARGUMENT,t)}function aC(){return new Jt(qt.APP_DELETED,"The Firebase app was deleted.")}function w8(t){return new Jt(qt.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 Od(t,e){return new Jt(qt.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function bd(t){throw new Jt(qt.INTERNAL_ERROR,"Internal error: "+t)}/**
4342 * @license
4343 * Copyright 2017 Google LLC
4344 *
4345 * Licensed under the Apache License, Version 2.0 (the "License");
4346 * you may not use this file except in compliance with the License.
4347 * You may obtain a copy of the License at
4348 *
4349 *   http://www.apache.org/licenses/LICENSE-2.0
4350 *
4351 * Unless required by applicable law or agreed to in writing, software
4352 * distributed under the License is distributed on an "AS IS" BASIS,
4353 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4354 * See the License for the specific language governing permissions and
4355 * limitations under the License.
4356 */class Us{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 s;try{s=Us.makeFromUrl(e,n)}catch{return new Us(e,"")}if(s.path==="")return s;throw y8(e)}static makeFromUrl(e,n){let s=null;const a="([A-Za-z0-9.\\-_]+)";function c(Y){Y.path.charAt(Y.path.length-1)==="/"&&(Y.path_=Y.path_.slice(0,-1))}const u="(/(.*))?$",h=new RegExp("^gs://"+a+u,"i"),m={bucket:1,path:3};function p(Y){Y.path_=decodeURIComponent(Y.path)}const b="v[A-Za-z0-9_]+",x=n.replace(/[.]/g,"\\."),w="(/([^?#]*).*)?$",T=new RegExp(`^https?://${x}/${b}/b/${a}/o${w}`,"i"),N={bucket:1,path:3},j=n===tC?"(?:storage.googleapis.com|storage.cloud.google.com)":n,A="([^?#]*)",F=new RegExp(`^https?://${j}/${a}/${A}`,"i"),L=[{regex:h,indices:m,postModify:c},{regex:T,indices:N,postModify:p},{regex:F,indices:{bucket:1,path:2},postModify:p}];for(let Y=0;Y<L.length;Y++){const $=L[Y],q=$.regex.exec(e);if(q){const I=q[$.indices.bucket];let S=q[$.indices.path];S||(S=""),s=new Us(I,S),$.postModify(s);break}}if(s==null)throw g8(e);return s}}class E8{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}/**
4357 * @license
4358 * Copyright 2017 Google LLC
4359 *
4360 * Licensed under the Apache License, Version 2.0 (the "License");
4361 * you may not use this file except in compliance with the License.
4362 * You may obtain a copy of the License at
4363 *
4364 *   http://www.apache.org/licenses/LICENSE-2.0
4365 *
4366 * Unless required by applicable law or agreed to in writing, software
4367 * distributed under the License is distributed on an "AS IS" BASIS,
4368 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4369 * See the License for the specific language governing permissions and
4370 * limitations under the License.
4371 */function k8(t,e,n){let s=1,a=null,c=null,u=!1,h=0;function m(){return h===2}let p=!1;function b(...A){p||(p=!0,e.apply(null,A))}function x(A){a=setTimeout(()=>{a=null,t(T,m())},A)}function w(){c&&clearTimeout(c)}function T(A,...F){if(p){w();return}if(A){w(),b.call(null,A,...F);return}if(m()||u){w(),b.call(null,A,...F);return}s<64&&(s*=2);let L;h===1?(h=2,L=0):L=(s+Math.random())*1e3,x(L)}let N=!1;function j(A){N||(N=!0,w(),!p&&(a!==null?(A||(h=2),clearTimeout(a),x(0)):A||(h=1)))}return x(0),c=setTimeout(()=>{u=!0,j(!0)},n),j}function T8(t){t(!1)}/**
4372 * @license
4373 * Copyright 2017 Google LLC
4374 *
4375 * Licensed under the Apache License, Version 2.0 (the "License");
4376 * you may not use this file except in compliance with the License.
4377 * You may obtain a copy of the License at
4378 *
4379 *   http://www.apache.org/licenses/LICENSE-2.0
4380 *
4381 * Unless required by applicable law or agreed to in writing, software
4382 * distributed under the License is distributed on an "AS IS" BASIS,
4383 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4384 * See the License for the specific language governing permissions and
4385 * limitations under the License.
4386 */function S8(t){return t!==void 0}function N8(t){return typeof t=="function"}function j8(t){return typeof t=="object"&&!Array.isArray(t)}function ig(t){return typeof t=="string"||t instanceof String}function z2(t){return F_()&&t instanceof Blob}function F_(){return typeof Blob<"u"}function B2(t,e,n,s){if(s<e)throw ev(`Invalid value for '${t}'. Expected ${e} or greater.`);if(s>n)throw ev(`Invalid value for '${t}'. Expected ${n} or less.`)}/**
4387 * @license
4388 * Copyright 2017 Google LLC
4389 *
4390 * Licensed under the Apache License, Version 2.0 (the "License");
4391 * you may not use this file except in compliance with the License.
4392 * You may obtain a copy of the License at
4393 *
4394 *   http://www.apache.org/licenses/LICENSE-2.0
4395 *
4396 * Unless required by applicable law or agreed to in writing, software
4397 * distributed under the License is distributed on an "AS IS" BASIS,
4398 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4399 * See the License for the specific language governing permissions and
4400 * limitations under the License.
4401 */function uu(t,e,n){let s=e;return n==null&&(s=`https://${e}`),`${n}://${s}/v0${t}`}function oC(t){const e=encodeURIComponent;let n="?";for(const s in t)if(t.hasOwnProperty(s)){const a=e(s)+"="+e(t[s]);n=n+a+"&"}return n=n.slice(0,-1),n}var nl;(function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"})(nl||(nl={}));/**
4402 * @license
4403 * Copyright 2022 Google LLC
4404 *
4405 * Licensed under the Apache License, Version 2.0 (the "License");
4406 * you may not use this file except in compliance with the License.
4407 * You may obtain a copy of the License at
4408 *
4409 *   http://www.apache.org/licenses/LICENSE-2.0
4410 *
4411 * Unless required by applicable law or agreed to in writing, software
4412 * distributed under the License is distributed on an "AS IS" BASIS,
4413 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4414 * See the License for the specific language governing permissions and
4415 * limitations under the License.
4416 */function lC(t,e){const n=t>=500&&t<600,a=[408,429].indexOf(t)!==-1,c=e.indexOf(t)!==-1;return n||a||c}/**
4417 * @license
4418 * Copyright 2017 Google LLC
4419 *
4420 * Licensed under the Apache License, Version 2.0 (the "License");
4421 * you may not use this file except in compliance with the License.
4422 * You may obtain a copy of the License at
4423 *
4424 *   http://www.apache.org/licenses/LICENSE-2.0
4425 *
4426 * Unless required by applicable law or agreed to in writing, software
4427 * distributed under the License is distributed on an "AS IS" BASIS,
4428 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4429 * See the License for the specific language governing permissions and
4430 * limitations under the License.
4431 */class A8{constructor(e,n,s,a,c,u,h,m,p,b,x,w=!0,T=!1){this.url_=e,this.method_=n,this.headers_=s,this.body_=a,this.successCodes_=c,this.additionalRetryCodes_=u,this.callback_=h,this.errorCallback_=m,this.timeout_=p,this.progressCallback_=b,this.connectionFactory_=x,this.retry=w,this.isUsingEmulator=T,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((N,j)=>{this.resolve_=N,this.reject_=j,this.start_()})}start_(){const e=(s,a)=>{if(a){s(!1,new lm(!1,null,!0));return}const c=this.connectionFactory_();this.pendingConnection_=c;const u=h=>{const m=h.loaded,p=h.lengthComputable?h.total:-1;this.progressCallback_!==null&&this.progressCallback_(m,p)};this.progressCallback_!==null&&c.addUploadProgressListener(u),c.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{this.progressCallback_!==null&&c.removeUploadProgressListener(u),this.pendingConnection_=null;const h=c.getErrorCode()===nl.NO_ERROR,m=c.getStatus();if(!h||lC(m,this.additionalRetryCodes_)&&this.retry){const b=c.getErrorCode()===nl.ABORT;s(!1,new lm(!1,null,b));return}const p=this.successCodes_.indexOf(m)!==-1;s(!0,new lm(p,c))})},n=(s,a)=>{const c=this.resolve_,u=this.reject_,h=a.connection;if(a.wasSuccessCode)try{const m=this.callback_(h,h.getResponse());S8(m)?c(m):c()}catch(m){u(m)}else if(h!==null){const m=U_();m.serverResponse=h.getErrorText(),this.errorCallback_?u(this.errorCallback_(h,m)):u(m)}else if(a.canceled){const m=this.appDelete_?aC():rC();u(m)}else{const m=sC();u(m)}};this.canceled_?n(!1,new lm(!1,null,!0)):this.backoffId_=k8(e,n,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,this.backoffId_!==null&&T8(this.backoffId_),this.pendingConnection_!==null&&this.pendingConnection_.abort()}}class lm{constructor(e,n,s){this.wasSuccessCode=e,this.connection=n,this.canceled=!!s}}function C8(t,e){e!==null&&e.length>0&&(t.Authorization="Firebase "+e)}function R8(t,e){t["X-Firebase-Storage-Version"]="webjs/"+(e??"AppManager")}function I8(t,e){e&&(t["X-Firebase-GMPID"]=e)}function M8(t,e){e!==null&&(t["X-Firebase-AppCheck"]=e)}
4431function P8(t,e,n,s,a,c,u=!0,h=!1){const m=oC(t.urlParams),p=t.url+m,b=Object.assign({},t.headers);return I8(b,e),C8(b,n),R8(b,c),M8(b,s),new A8(p,t.method,b,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,a,u,h)}/**
4432 * @license
4433 * Copyright 2017 Google LLC
4434 *
4435 * Licensed under the Apache License, Version 2.0 (the "License");
4436 * you may not use this file except in compliance with the License.
4437 * You may obtain a copy of the License at
4438 *
4439 *   http://www.apache.org/licenses/LICENSE-2.0
4440 *
4441 * Unless required by applicable law or agreed to in writing, software
4442 * distributed under the License is distributed on an "AS IS" BASIS,
4443 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4444 * See the License for the specific language governing permissions and
4445 * limitations under the License.
4446 */function D8(){return typeof BlobBuilder<"u"?BlobBuilder:typeof WebKitBlobBuilder<"u"?WebKitBlobBuilder:void 0}function O8(...t){const e=D8();if(e!==void 0){const n=new e;for(let s=0;s<t.length;s++)n.append(t[s]);return n.getBlob()}else{if(F_())return new Blob(t);throw new Jt(qt.UNSUPPORTED_ENVIRONMENT,"This browser doesn't seem to support creating Blobs")}}function L8(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}/**
4447 * @license
4448 * Copyright 2021 Google LLC
4449 *
4450 * Licensed under the Apache License, Version 2.0 (the "License");
4451 * you may not use this file except in compliance with the License.
4452 * You may obtain a copy of the License at
4453 *
4454 *   http://www.apache.org/licenses/LICENSE-2.0
4455 *
4456 * Unless required by applicable law or agreed to in writing, software
4457 * distributed under the License is distributed on an "AS IS" BASIS,
4458 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4459 * See the License for the specific language governing permissions and
4460 * limitations under the License.
4461 */function U8(t){if(typeof atob>"u")throw _8("base-64");return atob(t)}/**
4462 * @license
4463 * Copyright 2017 Google LLC
4464 *
4465 * Licensed under the Apache License, Version 2.0 (the "License");
4466 * you may not use this file except in compliance with the License.
4467 * You may obtain a copy of the License at
4468 *
4469 *   http://www.apache.org/licenses/LICENSE-2.0
4470 *
4471 * Unless required by applicable law or agreed to in writing, software
4472 * distributed under the License is distributed on an "AS IS" BASIS,
4473 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4474 * See the License for the specific language governing permissions and
4475 * limitations under the License.
4476 */const ri={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"};class Ob{constructor(e,n){this.data=e,this.contentType=n||null}}function F8(t,e){switch(t){case ri.RAW:return new Ob(cC(e));case ri.BASE64:case ri.BASE64URL:return new Ob(uC(t,e));case ri.DATA_URL:return new Ob(z8(e),B8(e))}throw U_()}function cC(t){const e=[];for(let n=0;n<t.length;n++){let s=t.charCodeAt(n);if(s<=127)e.push(s);else if(s<=2047)e.push(192|s>>6,128|s&63);else if((s&64512)===55296)if(!(n<t.length-1&&(t.charCodeAt(n+1)&64512)===56320))e.push(239,191,189);else{const c=s,u=t.charCodeAt(++n);s=65536|(c&1023)<<10|u&1023,e.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63)}else(s&64512)===56320?e.push(239,191,189):e.push(224|s>>12,128|s>>6&63,128|s&63)}return new Uint8Array(e)}function V8(t){let e;try{e=decodeURIComponent(t)}catch{throw Od(ri.DATA_URL,"Malformed data URL.")}return cC(e)}function uC(t,e){switch(t){case ri.BASE64:{const a=e.indexOf("-")!==-1,c=e.indexOf("_")!==-1;if(a||c)throw Od(t,"Invalid character '"+(a?"-":"_")+"' found: is it base64url encoded?");break}case ri.BASE64URL:{const a=e.indexOf("+")!==-1,c=e.indexOf("/")!==-1;if(a||c)throw Od(t,"Invalid character '"+(a?"+":"/")+"' found: is it base64 encoded?");e=e.replace(/-/g,"+").replace(/_/g,"/");break}}let n;try{n=U8(e)}catch(a){throw a.message.includes("polyfill")?a:Od(t,"Invalid character found")}const s=new Uint8Array(n.length);for(let a=0;a<n.length;a++)s[a]=n.charCodeAt(a);return s}class dC{constructor(e){this.base64=!1,this.contentType=null;const n=e.match(/^data:([^,]+)?,/);if(n===null)throw Od(ri.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");const s=n[1]||null;s!=null&&(this.base64=K8(s,";base64"),this.contentType=this.base64?s.substring(0,s.length-7):s),this.rest=e.substring(e.indexOf(",")+1)}}function z8(t){const e=new dC(t);return e.base64?uC(ri.BASE64,e.rest):V8(e.rest)}function B8(t){return new dC(t).contentType}function K8(t,e){return t.length>=e.length?t.substring(t.length-e.length)===e:!1}/**
4477 * @license
4478 * Copyright 2017 Google LLC
4479 *
4480 * Licensed under the Apache License, Version 2.0 (the "License");
4481 * you may not use this file except in compliance with the License.
4482 * You may obtain a copy of the License at
4483 *
4484 *   http://www.apache.org/licenses/LICENSE-2.0
4485 *
4486 * Unless required by applicable law or agreed to in writing, software
4487 * distributed under the License is distributed on an "AS IS" BASIS,
4488 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4489 * See the License for the specific language governing permissions and
4490 * limitations under the License.
4491 */class Vi{constructor(e,n){let s=0,a="";z2(e)?(this.data_=e,s=e.size,a=e.type):e instanceof ArrayBuffer?(n?this.data_=new Uint8Array(e):(this.data_=new Uint8Array(e.byteLength),this.data_.set(new Uint8Array(e))),s=this.data_.length):e instanceof Uint8Array&&(n?this.data_=e:(this.data_=new Uint8Array(e.length),this.data_.set(e)),s=e.length),this.size_=s,this.type_=a}size(){return this.size_}type(){return this.type_}slice(e,n){if(z2(this.data_)){const s=this.data_,a=L8(s,e,n);return a===null?null:new Vi(a)}else{const s=new Uint8Array(this.data_.buffer,e,n-e);return new Vi(s,!0)}}static getBlob(...e){if(F_()){const n=e.map(s=>s instanceof Vi?s.data_:s);return new Vi(O8.apply(null,n))}else{const n=e.map(u=>ig(u)?F8(ri.RAW,u).data:u.data_);let s=0;n.forEach(u=>{s+=u.byteLength});const a=new Uint8Array(s);let c=0;return n.forEach(u=>{for(let h=0;h<u.length;h++)a[c++]=u[h]}),new Vi(a,!0)}}uploadData(){return this.data_}}/**
4492 * @license
4493 * Copyright 2017 Google LLC
4494 *
4495 * Licensed under the Apache License, Version 2.0 (the "License");
4496 * you may not use this file except in compliance with the License.
4497 * You may obtain a copy of the License at
4498 *
4499 *   http://www.apache.org/licenses/LICENSE-2.0
4500 *
4501 * Unless required by applicable law or agreed to in writing, software
4502 * distributed under the License is distributed on an "AS IS" BASIS,
4503 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4504 * See the License for the specific language governing permissions and
4505 * limitations under the License.
4506 */function hC(t){let e;try{e=JSON.parse(t)}catch{return null}return j8(e)?e:null}/**
4507 * @license
4508 * Copyright 2017 Google LLC
4509 *
4510 * Licensed under the Apache License, Version 2.0 (the "License");
4511 * you may not use this file except in compliance with the License.
4512 * You may obtain a copy of the License at
4513 *
4514 *   http://www.apache.org/licenses/LICENSE-2.0
4515 *
4516 * Unless required by applicable law or agreed to in writing, software
4517 * distributed under the License is distributed on an "AS IS" BASIS,
4518 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4519 * See the License for the specific language governing permissions and
4520 * limitations under the License.
4521 */function $8(t){if(t.length===0)return null;const e=t.lastIndexOf("/");return e===-1?"":t.slice(0,e)}function q8(t,e){const n=e.split("/").filter(s=>s.length>0).join("/");return t.length===0?n:t+"/"+n}function fC(t){const e=t.lastIndexOf("/",t.length-2);return e===-1?t:t.slice(e+1)}/**
4522 * @license
4523 * Copyright 2017 Google LLC
4524 *
4525 * Licensed under the Apache License, Version 2.0 (the "License");
4526 * you may not use this file except in compliance with the License.
4527 * You may obtain a copy of the License at
4528 *
4529 *   http://www.apache.org/licenses/LICENSE-2.0
4530 *
4531 * Unless required by applicable law or agreed to in writing, software
4532 * distributed under the License is distributed on an "AS IS" BASIS,
4533 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4534 * See the License for the specific language governing permissions and
4535 * limitations under the License.
4536 */function H8(t,e){return e}class ls{constructor(e,n,s,a){this.server=e,this.local=n||e,this.writable=!!s,this.xform=a||H8}}let cm=null;function G8(t){return!ig(t)||t.length<2?t:fC(t)}function V_(){if(cm)return cm;const t=[];t.push(new ls("bucket")),t.push(new ls("generation")),t.push(new ls("metageneration")),t.push(new ls("name","fullPath",!0));function e(c,u){return G8(u)}const n=new ls("name");n.xform=e,t.push(n);function s(c,u){return u!==void 0?Number(u):u}const a=new ls("size");return a.xform=s,t.push(a),t.push(new ls("timeCreated")),t.push(new ls("updated")),t.push(new ls("md5Hash",null,!0)),t.push(new ls("cacheControl",null,!0)),t.push(new ls("contentDisposition",null,!0)),t.push(new ls("contentEncoding",null,!0)),t.push(new ls("contentLanguage",null,!0)),t.push(new ls("contentType",null,!0)),t.push(new ls("metadata","customMetadata",!0)),cm=t,cm}function Y8(t,e){function n(){const s=t.bucket,a=t.fullPath,c=new Us(s,a);return e._makeStorageReference(c)}Object.defineProperty(t,"ref",{get:n})}function W8(t,e,n){const s={};s.type="file";const a=n.length;for(let c=0;c<a;c++){const u=n[c];s[u.local]=u.xform(s,e[u.server])}return Y8(s,t),s}function mC(t,e,n){const s=hC(e);return s===null?null:W8(t,s,n)}function X8(t,e,n,s){const a=hC(e);if(a===null||!ig(a.downloadTokens))return null;const c=a.downloadTokens;if(c.length===0)return null;const u=encodeURIComponent;return c.split(",").map(p=>
4536{const b=t.bucket,x=t.fullPath,w="/b/"+u(b)+"/o/"+u(x),T=uu(w,n,s),N=oC({alt:"media",token:p});return T+N})[0]}function pC(t,e){const n={},s=e.length;for(let a=0;a<s;a++){const c=e[a];c.writable&&(n[c.server]=t[c.local])}return JSON.stringify(n)}class bl{constructor(e,n,s,a){this.url=e,this.method=n,this.handler=s,this.timeout=a,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}}/**
4537 * @license
4538 * Copyright 2017 Google LLC
4539 *
4540 * Licensed under the Apache License, Version 2.0 (the "License");
4541 * you may not use this file except in compliance with the License.
4542 * You may obtain a copy of the License at
4543 *
4544 *   http://www.apache.org/licenses/LICENSE-2.0
4545 *
4546 * Unless required by applicable law or agreed to in writing, software
4547 * distributed under the License is distributed on an "AS IS" BASIS,
4548 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4549 * See the License for the specific language governing permissions and
4550 * limitations under the License.
4551 */function Wi(t){if(!t)throw U_()}function z_(t,e){function n(s,a){const c=mC(t,a,e);return Wi(c!==null),c}return n}function Q8(t,e){function n(s,a){const c=mC(t,a,e);return Wi(c!==null),X8(c,a,t.host,t._protocol)}return n}function kh(t){function e(n,s){let a;return n.getStatus()===401?n.getErrorText().includes("Firebase App Check token is invalid")?a=m8():a=f8():n.getStatus()===402?a=h8(t.bucket):n.getStatus()===403?a=p8(t.path):a=s,a.status=n.getStatus(),a.serverResponse=s.serverResponse,a}return e}function B_(t){const e=kh(t);function n(s,a){let c=e(s,a);return s.getStatus()===404&&(c=d8(t.path)),c.serverResponse=a.serverResponse,c}return n}function J8(t,e,n){const s=e.fullServerUrl(),a=uu(s,t.host,t._protocol),c="GET",u=t.maxOperationRetryTime,h=new bl(a,c,z_(t,n),u);return h.errorHandler=B_(e),h}function Z8(t,e,n){const s=e.fullServerUrl(),a=uu(s,t.host,t._protocol),c="GET",u=t.maxOperationRetryTime,h=new bl(a,c,Q8(t,n),u);return h.errorHandler=B_(e),h}function ez(t,e){const n=e.fullServerUrl(),s=uu(n,t.host,t._protocol),a="DELETE",c=t.maxOperationRetryTime;function u(m,p){}const h=new bl(s,a,u,c);return h.successCodes=[200,204],h.errorHandler=B_(e),h}function tz(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function gC(t,e,n){const s=Object.assign({},n);return s.fullPath=t.path,s.size=e.size(),s.contentType||(s.contentType=tz(null,e)),s}function yC(t,e,n,s,a){const c=e.bucketOnlyServerUrl(),u={"X-Goog-Upload-Protocol":"multipart"};function h(){let L="";for(let Y=0;Y<2;Y++)L=L+Math.random().toString().slice(2);return L}const m=h();u["Content-Type"]="multipart/related; boundary="+m;const p=gC(e,s,a),b=pC(p,n),x="--"+m+`\r
4552Content-Type: application/json; charset=utf-8\r
4553\r
4554`+b+`\r
4555--`+m+`\r
4556Content-Type: `+p.contentType+`\r
4557\r
4558`,w=`\r
4559--`+m+"--",T=Vi.getBlob(x,s,w);if(T===null)throw iC();const N={name:p.fullPath},j=uu(c,t.host,t._protocol),A="POST",F=t.maxUploadRetryTime,V=new bl(j,A,z_(t,n),F);return V.urlParams=N,V.headers=u,V.body=T.uploadData(),V.errorHandler=kh(e),V}class fp{constructor(e,n,s,a){this.current=e,this.total=n,this.finalized=!!s,this.metadata=a||null}}function K_(t,e){let n=null;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch{Wi(!1)}return Wi(!!n&&(e||["active"]).indexOf(n)!==-1),n}function nz(t,e,n,s,a){const c=e.bucketOnlyServerUrl(),u=gC(e,s,a),h={name:u.fullPath},m=uu(c,t.host,t._protocol),p="POST",b={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":`${s.size()}`,"X-Goog-Upload-Header-Content-Type":u.contentType,"Content-Type":"application/json; charset=utf-8"},x=pC(u,n),w=t.maxUploadRetryTime;function T(j){K_(j);let A;try{A=j.getResponseHeader("X-Goog-Upload-URL")}catch{Wi(!1)}return Wi(ig(A)),A}const N=new bl(m,p,T,w);return N.urlParams=h,N.headers=b,N.body=x,N.errorHandler=kh(e),N}function sz(t,e,n,s){const a={"X-Goog-Upload-Command":"query"};function c(p){const b=K_(p,["active","final"]);let x=null;try{x=p.getResponseHeader("X-Goog-Upload-Size-Received")}catch{Wi(!1)}x||Wi(!1);const w=Number(x);return Wi(!isNaN(w)),new fp(w,s.size(),b==="final")}const u="POST",h=t.maxUploadRetryTime,m=new bl(n,u,c,h);return m.headers=a,m.errorHandler=kh(e),m}const K2=256*1024;function rz(t,e,n,s,a,c,u,h){const m=new fp(0,0);if(u?(m.current=u.current,m.total=u.total):(m.current=0,m.total=s.size()),s.size()!==m.total)throw x8();const p=m.total-m.current;let b=p;a>0&&(b=Math.min(b,a));const x=m.current,w=x+b;let T="";b===0?T="finalize":p===b?T="upload, finalize":T="upload";const N={"X-Goog-Upload-Command":T,"X-Goog-Upload-Offset":`${m.current}`},j=s.slice(x,w);if(j===null)throw iC();function A(Y,$){const q=K_(Y,["active","final"]),I=m.current+b,S=s.size();let C;return q==="final"?C=z_(e,c)(Y,$):C=null,new fp(I,S,q==="final",C)}const F="POST",V=e.maxUploadRetryTime,L=new bl(n,F,A,V);return L.headers=N,L.body=j.uploadData(),L.progressCallback=h||null,L.errorHandler=kh(t),L}const vs={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};
4559function Lb(t){switch(t){case"running":case"pausing":case"canceling":return vs.RUNNING;case"paused":return vs.PAUSED;case"success":return vs.SUCCESS;case"canceled":return vs.CANCELED;case"error":return vs.ERROR;default:return vs.ERROR}}/**
4560 * @license
4561 * Copyright 2017 Google LLC
4562 *
4563 * Licensed under the Apache License, Version 2.0 (the "License");
4564 * you may not use this file except in compliance with the License.
4565 * You may obtain a copy of the License at
4566 *
4567 *   http://www.apache.org/licenses/LICENSE-2.0
4568 *
4569 * Unless required by applicable law or agreed to in writing, software
4570 * distributed under the License is distributed on an "AS IS" BASIS,
4571 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4572 * See the License for the specific language governing permissions and
4573 * limitations under the License.
4574 */class iz{constructor(e,n,s){if(N8(e)||n!=null||s!=null)this.next=e,this.error=n??void 0,this.complete=s??void 0;else{const c=e;this.next=c.next,this.error=c.error,this.complete=c.complete}}}/**
4575 * @license
4576 * Copyright 2017 Google LLC
4577 *
4578 * Licensed under the Apache License, Version 2.0 (the "License");
4579 * you may not use this file except in compliance with the License.
4580 * You may obtain a copy of the License at
4581 *
4582 *   http://www.apache.org/licenses/LICENSE-2.0
4583 *
4584 * Unless required by applicable law or agreed to in writing, software
4585 * distributed under the License is distributed on an "AS IS" BASIS,
4586 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4587 * See the License for the specific language governing permissions and
4588 * limitations under the License.
4589 */function pc(t){return(...e)=>{Promise.resolve().then(()=>t(...e))}}class az{constructor(){this.sent_=!1,this.xhr_=new XMLHttpRequest,this.initXhr(),this.errorCode_=nl.NO_ERROR,this.sendPromise_=new Promise(e=>{this.xhr_.addEventListener("abort",()=>{this.errorCode_=nl.ABORT,e()}),this.xhr_.addEventListener("error",()=>{this.errorCode_=nl.NETWORK_ERROR,e()}),this.xhr_.addEventListener("load",()=>{e()})})}send(e,n,s,a,c){if(this.sent_)throw bd("cannot .send() more than once");if(hi(e)&&s&&(this.xhr_.withCredentials=!0),this.sent_=!0,this.xhr_.open(n,e,!0),c!==void 0)for(const u in c)c.hasOwnProperty(u)&&this.xhr_.setRequestHeader(u,c[u].toString());return a!==void 0?this.xhr_.send(a):this.xhr_.send(),this.sendPromise_}getErrorCode(){if(!this.sent_)throw bd("cannot .getErrorCode() before sending");return this.errorCode_}getStatus(){if(!this.sent_)throw bd("cannot .getStatus() before sending");try{return this.xhr_.status}catch{return-1}}getResponse(){if(!this.sent_)throw bd("cannot .getResponse() before sending");return this.xhr_.response}getErrorText(){if(!this.sent_)throw bd("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 oz extends az{initXhr(){this.xhr_.responseType="text"}}function qa(){return new oz}/**
4590 * @license
4591 * Copyright 2017 Google LLC
4592 *
4593 * Licensed under the Apache License, Version 2.0 (the "License");
4594 * you may not use this file except in compliance with the License.
4595 * You may obtain a copy of the License at
4596 *
4597 *   http://www.apache.org/licenses/LICENSE-2.0
4598 *
4599 * Unless required by applicable law or agreed to in writing, software
4600 * distributed under the License is distributed on an "AS IS" BASIS,
4601 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4602 * See the License for the specific language governing permissions and
4603 * limitations under the License.
4604 */class lz{isExponentialBackoffExpired(){return this.sleepTime>this.maxSleepTime}constructor(e,n,s=null){this._transferred=0,this._needToFetchStatus=!1,this._needToFetchMetadata=!1,this._observers=[],this._error=void 0,this._uploadUrl=void 0,this._request=void 0,this._chunkMultiplier=1,this._resolve=void 0,this._reject=void 0,this._ref=e,this._blob=n,this._metadata=s,this._mappings=V_(),this._resumable=this._shouldDoResumable(this._blob),this._state="running",this._errorHandler=a=>
vendor: 4,978 bytes, line 4604
4604{if(this._request=void 0,this._chunkMultiplier=1,a._codeEquals(qt.CANCELED))this._needToFetchStatus=!0,this.completeTransitions_();else{const c=this.isExponentialBackoffExpired();if(lC(a.status,[]))if(c)a=sC();else{this.sleepTime=Math.max(this.sleepTime*2,u8),this._needToFetchStatus=!0,this.completeTransitions_();return}this._error=a,this._transition("error")}},this._metadataErrorHandler=a=>{this._request=void 0,a._codeEquals(qt.CANCELED)?this.completeTransitions_():(this._error=a,this._transition("error"))},this.sleepTime=0,this.maxSleepTime=this._ref.storage.maxUploadRetryTime,this._promise=new Promise((a,c)=>{this._resolve=a,this._reject=c,this._start()}),this._promise.then(null,()=>{})}_makeProgressCallback(){const e=this._transferred;return n=>this._updateProgress(e+n)}_shouldDoResumable(e){return e.size()>256*1024}_start(){this._state==="running"&&this._request===void 0&&(this._resumable?this._uploadUrl===void 0?this._createResumable():this._needToFetchStatus?this._fetchStatus():this._needToFetchMetadata?this._fetchMetadata():this.pendingTimeout=setTimeout(()=>{this.pendingTimeout=void 0,this._continueUpload()},this.sleepTime):this._oneShotUpload())}_resolveToken(e){Promise.all([this._ref.storage._getAuthToken(),this._ref.storage._getAppCheckToken()]).then(([n,s])=>{switch(this._state){case"running":e(n,s);break;case"canceling":this._transition("canceled");break;case"pausing":this._transition("paused");break}})}_createResumable(){this._resolveToken((e,n)=>{const s=nz(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),a=this._ref.storage._makeRequest(s,qa,e,n);this._request=a,a.getPromise().then(c=>{this._request=void 0,this._uploadUrl=c,this._needToFetchStatus=!1,this.completeTransitions_()},this._errorHandler)})}_fetchStatus(){const e=this._uploadUrl;this._resolveToken((n,s)=>{const a=sz(this._ref.storage,this._ref._location,e,this._blob),c=this._ref.storage._makeRequest(a,qa,n,s);this._request=c,c.getPromise().then(u=>{u=u,this._request=void 0,this._updateProgress(u.current),this._needToFetchStatus=!1,u.finalized&&(this._needToFetchMetadata=!0),this.completeTransitions_()},this._errorHandler)})}_continueUpload(){const e=K2*this._chunkMultiplier,n=new fp(this._transferred,this._blob.size()),s=this._uploadUrl;this._resolveToken((a,c)=>{let u;try{u=rz(this._ref._location,this._ref.storage,s,this._blob,e,this._mappings,n,this._makeProgressCallback())}catch(m){this._error=m,this._transition("error");return}const h=this._ref.storage._makeRequest(u,qa,a,c,!1);this._request=h,h.getPromise().then(m=>{this._increaseMultiplier(),this._request=void 0,this._updateProgress(m.current),m.finalized?(this._metadata=m.metadata,this._transition("success")):this.completeTransitions_()},this._errorHandler)})}_increaseMultiplier(){K2*this._chunkMultiplier*2<32*1024*1024&&(this._chunkMultiplier*=2)}_fetchMetadata(){this._resolveToken((e,n)=>{const s=J8(this._ref.storage,this._ref._location,this._mappings),a=this._ref.storage._makeRequest(s,qa,e,n);this._request=a,a.getPromise().then(c=>{this._request=void 0,this._metadata=c,this._transition("success")},this._metadataErrorHandler)})}_oneShotUpload(){this._resolveToken((e,n)=>{const s=yC(this._ref.storage,this._ref._location,this._mappings,this._blob,this._metadata),a=this._ref.storage._makeRequest(s,qa,e,n);this._request=a,a.getPromise().then(c=>{this._request=void 0,this._metadata=c,this._updateProgress(this._blob.size()),this._transition("success")},this._errorHandler)})}_updateProgress(e){const n=this._transferred;this._transferred=e,this._transferred!==n&&this._notifyObservers()}_transition(e){if(this._state!==e)switch(e){case"canceling":case"pausing":this._state=e,this._request!==void 0?this._request.cancel():this.pendingTimeout&&(clearTimeout(this.pendingTimeout),this.pendingTimeout=void 0,this.completeTransitions_());break;case"running":const n=this._state==="paused";this._state=e,n&&(this._notifyObservers(),this._start());break;case"paused":this._state=e,this._notifyObservers();break;case"canceled":this._error=rC(),this._state=e,this._notifyObservers();break;case"error":this._state=e,this._notifyObservers();break;case"success":this._state=e,this._notifyObservers();break}}completeTransitions_(){switch(this._state){case"pausing":this._transition("paused");break;case"canceling":this._transition("canceled");break;case"running":this._start();break}}get snapshot(){const e=Lb(this._state);return{bytesTransferred:this._transferred,totalBytes:this._blob.size(),state:e,metadata:this._metadata,task:this,ref:this._ref}}on(e,n,s,a){const c=new iz(n||void 0,s||void 0,a||void 0);return this._addObserver(c),()=>{this._removeObserver(c)}}then(e,n){return this._promise.then(e,n)}catch(e){return this.then(null,e)}_addObserver(e){this._observers.push(e),this._notifyObserver(e)}_removeObserver(e){const n=this._observers.indexOf(e);n!==-1&&this._observers.splice(n,1)}_notifyObservers(){this._finishPromise(),this._observers.slice().forEac
4604h(n=>{this._notifyObserver(n)})}_finishPromise(){if(this._resolve!==void 0){let e=!0;switch(Lb(this._state)){case vs.SUCCESS:pc(this._resolve.bind(null,this.snapshot))();break;case vs.CANCELED:case vs.ERROR:const n=this._reject;pc(n.bind(null,this._error))();break;default:e=!1;break}e&&(this._resolve=void 0,this._reject=void 0)}}_notifyObserver(e){switch(Lb(this._state)){case vs.RUNNING:case vs.PAUSED:e.next&&pc(e.next.bind(e,this.snapshot))();break;case vs.SUCCESS:e.complete&&pc(e.complete.bind(e))();break;case vs.CANCELED:case vs.ERROR:e.error&&pc(e.error.bind(e,this._error))();break;default:e.error&&pc(e.error.bind(e,this._error))()}}resume(){const e=this._state==="paused"||this._state==="pausing";return e&&this._transition("running"),e}pause(){const e=this._state==="running";return e&&this._transition("pausing"),e}cancel(){const e=this._state==="running"||this._state==="pausing";return e&&this._transition("canceling"),e}}/**
4605 * @license
4606 * Copyright 2019 Google LLC
4607 *
4608 * Licensed under the Apache License, Version 2.0 (the "License");
4609 * you may not use this file except in compliance with the License.
4610 * You may obtain a copy of the License at
4611 *
4612 *   http://www.apache.org/licenses/LICENSE-2.0
4613 *
4614 * Unless required by applicable law or agreed to in writing, software
4615 * distributed under the License is distributed on an "AS IS" BASIS,
4616 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4617 * See the License for the specific language governing permissions and
4618 * limitations under the License.
4619 */class hl{constructor(e,n){this._service=e,n instanceof Us?this._location=n:this._location=Us.makeFromUrl(n,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,n){return new hl(e,n)}get root(){const e=new Us(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){return fC(this._location.path)}get storage(){return this._service}get parent(){const e=$8(this._location.path);if(e===null)return null;const n=new Us(this._location.bucket,e);return new hl(this._service,n)}_throwIfRoot(e){if(this._location.path==="")throw w8(e)}}function cz(t,e,n){t._throwIfRoot("uploadBytes");const s=yC(t.storage,t._location,V_(),new Vi(e,!0),n);return t.storage.makeRequestWithTokens(s,qa).then(a=>({metadata:a,ref:t}))}function uz(t,e,n){return t._throwIfRoot("uploadBytesResumable"),new lz(t,new Vi(e),n)}function dz(t){t._throwIfRoot("getDownloadURL");const e=Z8(t.storage,t._location,V_());return t.storage.makeRequestWithTokens(e,qa).then(n=>{if(n===null)throw v8();return n})}function hz(t){t._throwIfRoot("deleteObject");const e=ez(t.storage,t._location);return t.storage.makeRequestWithTokens(e,qa)}function fz(t,e){const n=q8(t._location.path,e),s=new Us(t._location.bucket,n);return new hl(t.storage,s)}/**
4620 * @license
4621 * Copyright 2017 Google LLC
4622 *
4623 * Licensed under the Apache License, Version 2.0 (the "License");
4624 * you may not use this file except in compliance with the License.
4625 * You may obtain a copy of the License at
4626 *
4627 *   http://www.apache.org/licenses/LICENSE-2.0
4628 *
4629 * Unless required by applicable law or agreed to in writing, software
4630 * distributed under the License is distributed on an "AS IS" BASIS,
4631 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4632 * See the License for the specific language governing permissions and
4633 * limitations under the License.
4634 */function mz(t){return/^[A-Za-z]+:\/\//.test(t)}function pz(t,e){return new hl(t,e)}function bC(t,e){if(t instanceof $_){const n=t;if(n._bucket==null)throw b8();const s=new hl(n,n._bucket);return e!=null?bC(s,e):s}else return e!==void 0?fz(t,e):t}function gz(t,e){if(e&&mz(e)){if(t instanceof $_)return pz(t,e);throw ev("To use ref(service, url), the first argument must be a Storage instance.")}else return bC(t,e)}function $2(t,e){const n=e==null?void 0:e[nC];return n==null?null:Us.makeFromBucketSpec(n,t)}function yz(t,e,n,s={}){t.host=`${e}:${n}`;const a=hi(e);a&&(Ap(`https://${t.host}/b`),Cp("Storage",!0)),t._isUsingEmulator=!0,t._protocol=a?"https":"http";const{mockUserToken:c}=s;c&&(t._overrideAuthToken=typeof c=="string"?c:dN(c,t.app.options.projectId))}class $_{constructor(e,n,s,a,c,u=!1){this.app=e,this._authProvider=n,this._appCheckProvider=s,this._url=a,this._firebaseVersion=c,this._isUsingEmulator=u,this._bucket=null,this._host=tC,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=l8,this._maxUploadRetryTime=c8,this._requests=new Set,a!=null?this._bucket=Us.makeFromBucketSpec(a,this._host):this._bucket=$2(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,this._url!=null?this._bucket=Us.makeFromBucketSpec(this._url,e):this._bucket=$2(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){B2("time",0,Number.POSITIVE_INFINITY,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){B2("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(qn(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;const e=this._appCheckProvider.getImmediate({optional:!0});
4634return 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 hl(this,e)}_makeRequest(e,n,s,a,c=!0){if(this._deleted)return new E8(aC());{const u=P8(e,this._appId,s,a,n,this._firebaseVersion,c,this._isUsingEmulator);return this._requests.add(u),u.getPromise().then(()=>this._requests.delete(u),()=>this._requests.delete(u)),u}}async makeRequestWithTokens(e,n){const[s,a]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,n,s,a).getPromise()}}const q2="@firebase/storage",H2="0.14.0";/**
4635 * @license
4636 * Copyright 2020 Google LLC
4637 *
4638 * Licensed under the Apache License, Version 2.0 (the "License");
4639 * you may not use this file except in compliance with the License.
4640 * You may obtain a copy of the License at
4641 *
4642 *   http://www.apache.org/licenses/LICENSE-2.0
4643 *
4644 * Unless required by applicable law or agreed to in writing, software
4645 * distributed under the License is distributed on an "AS IS" BASIS,
4646 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4647 * See the License for the specific language governing permissions and
4648 * limitations under the License.
4649 */const xC="storage";function bz(t,e,n){return t=st(t),cz(t,e,n)}function xz(t,e,n){return t=st(t),uz(t,e,n)}function vC(t){return t=st(t),dz(t)}function _C(t){return t=st(t),hz(t)}function mp(t,e){return t=st(t),gz(t,e)}function vz(t=ml(),e){t=st(t);const s=ur(t,xC).getImmediate({identifier:e}),a=Rv("storage");return a&&_z(s,...a),s}function _z(t,e,n,s={}){yz(t,e,n,s)}function wz(t,{instanceIdentifier:e}){const n=t.getProvider("app").getImmediate(),s=t.getProvider("auth-internal"),a=t.getProvider("app-check-internal");return new $_(n,s,a,e,Zi)}function Ez(){Yn(new Un(xC,wz,"PUBLIC").setMultipleInstances(!0)),mn(q2,H2,""),mn(q2,H2,"esm2020")}Ez();/**
4650 * @license
4651 * Copyright 2020 Google LLC
4652 *
4653 * Licensed under the Apache License, Version 2.0 (the "License");
4654 * you may not use this file except in compliance with the License.
4655 * You may obtain a copy of the License at
4656 *
4657 *   http://www.apache.org/licenses/LICENSE-2.0
4658 *
4659 * Unless required by applicable law or agreed to in writing, software
4660 * distributed under the License is distributed on an "AS IS" BASIS,
4661 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4662 * See the License for the specific language governing permissions and
4663 * limitations under the License.
4664 */const tv=new Map,wC={activated:!1,tokenObservers:[]},kz={initialized:!1,enabled:!1};function In(t){return tv.get(t)||{...wC}}function Tz(t,e){return tv.set(t,e),tv.get(t)}function ag(){return kz}/**
4665 * @license
4666 * Copyright 2020 Google LLC
4667 *
4668 * Licensed under the Apache License, Version 2.0 (the "License");
4669 * you may not use this file except in compliance with the License.
4670 * You may obtain a copy of the License at
4671 *
4672 *   http://www.apache.org/licenses/LICENSE-2.0
4673 *
4674 * Unless required by applicable law or agreed to in writing, software
4675 * distributed under the License is distributed on an "AS IS" BASIS,
4676 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4677 * See the License for the specific language governing permissions and
4678 * limitations under the License.
4679 */const EC="https://content-firebaseappcheck.googleapis.com/v1",Sz="exchangeRecaptchaV3Token",Nz="exchangeDebugToken",G2={RETRIAL_MIN_WAIT:30*1e3,RETRIAL_MAX_WAIT:960*1e3},jz=1440*60*1e3;/**
4680 * @license
4681 * Copyright 2020 Google LLC
4682 *
4683 * Licensed under the Apache License, Version 2.0 (the "License");
4684 * you may not use this file except in compliance with the License.
4685 * You may obtain a copy of the License at
4686 *
4687 *   http://www.apache.org/licenses/LICENSE-2.0
4688 *
4689 * Unless required by applicable law or agreed to in writing, software
4690 * distributed under the License is distributed on an "AS IS" BASIS,
4691 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4692 * See the License for the specific language governing permissions and
4693 * limitations under the License.
4694 */class Az{constructor(e,n,s,a,c){if(this.operation=e,this.retryPolicy=n,this.getWaitDuration=s,this.lowerBound=a,this.upperBound=c,this.pending=null,this.nextErrorWaitInterval=a,a>c)throw new Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{this.pending=new $d,this.pending.promise.catch(n=>{}),await Cz(this.getNextRun(e)),this.pending.resolve(),await this.pending.promise,this.pending=new $d,this.pending.promise.catch(n=>{}),await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(n){this.retryPolicy(n)?this.process(!1).catch(()=>{}):this.stop()}}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{const n=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),n}}}function Cz(t){return new Promise(e=>{setTimeout(e,t)})}/**
4695 * @license
4696 * Copyright 2020 Google LLC
4697 *
4698 * Licensed under the Apache License, Version 2.0 (the "License");
4699 * you may not use this file except in compliance with the License.
4700 * You may obtain a copy of the License at
4701 *
4702 *   http://www.apache.org/licenses/LICENSE-2.0
4703 *
4704 * Unless required by applicable law or agreed to in writing, software
4705 * distributed under the License is distributed on an "AS IS" BASIS,
4706 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4707 * See the License for the specific language governing permissions and
4708 * limitations under the License.
4709 */const Rz={"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"},Es=new fi("appCheck","AppCheck",Rz);/**
4710 * @license
4711 * Copyright 2020 Google LLC
4712 *
4713 * Licensed under the Apache License, Version 2.0 (the "License");
4714 * you may not use this file except in compliance with the License.
4715 * You may obtain a copy of the License at
4716 *
4717 *   http://www.apache.org/licenses/LICENSE-2.0
4718 *
4719 * Unless required by applicable law or agreed to in writing, software
4720 * distributed under the License is distributed on an "AS IS" BASIS,
4721 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4722 * See the License for the specific language governing permissions and
4723 * limitations under the License.
4724 */function Y2(t=!1){var e;return t?(e=self.grecaptcha)==null?void 0:e.enterprise:self.grecaptcha}function q_(t){if(!In(t).activated)throw Es.create("use-before-activation",{appName:t.name})}function kC(t){const e=Math.round(t/1e3),n=Math.floor(e/(3600*24)),s=Math.floor((e-n*3600*24)/3600),a=Math.floor((e-n*3600*24-s*3600)/60),c=e-n*3600*24-s*3600-a*60;let u="";return n&&(u+=um(n)+"d:"),s&&(u+=um(s)+"h:"),u+=um(a)+"m:"+um(c)+"s",u}function um(t){return t===0?"00":t>=10?t.toString():"0"+t}/**
4725 * @license
4726 * Copyright 2020 Google LLC
4727 *
4728 * Licensed under the Apache License, Version 2.0 (the "License");
4729 * you may not use this file except in compliance with the License.
4730 * You may obtain a copy of the License at
4731 *
4732 *   http://www.apache.org/licenses/LICENSE-2.0
4733 *
4734 * Unless required by applicable law or agreed to in writing, software
4735 * distributed under the License is distributed on an "AS IS" BASIS,
4736 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4737 * See the License for the specific language governing permissions and
4738 * limitations under the License.
4739 */async function H_({url:t,body:e},n){const s={"Content-Type":"application/json"},a=n.getImmediate({optional:!0});if(a){const x=await a.getHeartbeatsHeader();x&&(s["X-Firebase-Client"]=x)}const c={method:"POST",body:JSON.stringify(e),headers:s};let u;try{u=await fetch(t,c)}catch(x){throw Es.create("fetch-network-error",{originalErrorMessage:x==null?void 0:x.message})}if(u.status!==200)throw Es.create("fetch-status-error",{httpStatus:u.status});let h;try{h=await u.json()}catch(x){throw Es.create("fetch-parse-error",{originalErrorMessage:x==null?void 0:x.message})}const m=h.ttl.match(/^([\d.]+)(s)$/);if(!m||!m[2]||isNaN(Number(m[1])))throw Es.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${h.ttl}`});const p=Number(m[1])*1e3,b=Date.now();return{token:h.token,expireTimeMillis:b+p,issuedAtTimeMillis:b}}
4739function Iz(t,e){const{projectId:n,appId:s,apiKey:a}=t.options;return{url:`${EC}/projects/${n}/apps/${s}:${Sz}?key=${a}`,body:{recaptcha_v3_token:e}}}function TC(t,e){const{projectId:n,appId:s,apiKey:a}=t.options;return{url:`${EC}/projects/${n}/apps/${s}:${Nz}?key=${a}`,body:{debug_token:e}}}/**
4740 * @license
4741 * Copyright 2020 Google LLC
4742 *
4743 * Licensed under the Apache License, Version 2.0 (the "License");
4744 * you may not use this file except in compliance with the License.
4745 * You may obtain a copy of the License at
4746 *
4747 *   http://www.apache.org/licenses/LICENSE-2.0
4748 *
4749 * Unless required by applicable law or agreed to in writing, software
4750 * distributed under the License is distributed on an "AS IS" BASIS,
4751 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4752 * See the License for the specific language governing permissions and
4753 * limitations under the License.
4754 */const Mz="firebase-app-check-database",Pz=1,sh="firebase-app-check-store",SC="debug-token";let dm=null;function NC(){return dm||(dm=new Promise((t,e)=>{try{const n=indexedDB.open(Mz,Pz);n.onsuccess=s=>{t(s.target.result)},n.onerror=s=>{var a;e(Es.create("storage-open",{originalErrorMessage:(a=s.target.error)==null?void 0:a.message}))},n.onupgradeneeded=s=>{const a=s.target.result;switch(s.oldVersion){case 0:a.createObjectStore(sh,{keyPath:"compositeKey"})}}}catch(n){e(Es.create("storage-open",{originalErrorMessage:n==null?void 0:n.message}))}}),dm)}function Dz(t){return AC(CC(t))}function Oz(t,e){return jC(CC(t),e)}function Lz(t){return jC(SC,t)}function Uz(){return AC(SC)}async function jC(t,e){const s=(await NC()).transaction(sh,"readwrite"),c=s.objectStore(sh).put({compositeKey:t,value:e});return new Promise((u,h)=>{c.onsuccess=m=>{u()},s.onerror=m=>{var p;h(Es.create("storage-set",{originalErrorMessage:(p=m.target.error)==null?void 0:p.message}))}})}async function AC(t){const n=(await NC()).transaction(sh,"readonly"),a=n.objectStore(sh).get(t);return new Promise((c,u)=>{a.onsuccess=h=>{const m=h.target.result;c(m?m.value:void 0)},n.onerror=h=>{var m;u(Es.create("storage-get",{originalErrorMessage:(m=h.target.error)==null?void 0:m.message}))}})}function CC(t){return`${t.options.appId}-${t.name}`}/**
4755 * @license
4756 * Copyright 2020 Google LLC
4757 *
4758 * Licensed under the Apache License, Version 2.0 (the "License");
4759 * you may not use this file except in compliance with the License.
4760 * You may obtain a copy of the License at
4761 *
4762 *   http://www.apache.org/licenses/LICENSE-2.0
4763 *
4764 * Unless required by applicable law or agreed to in writing, software
4765 * distributed under the License is distributed on an "AS IS" BASIS,
4766 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4767 * See the License for the specific language governing permissions and
4768 * limitations under the License.
4769 */const Ga=new su("@firebase/app-check");/**
4770 * @license
4771 * Copyright 2020 Google LLC
4772 *
4773 * Licensed under the Apache License, Version 2.0 (the "License");
4774 * you may not use this file except in compliance with the License.
4775 * You may obtain a copy of the License at
4776 *
4777 *   http://www.apache.org/licenses/LICENSE-2.0
4778 *
4779 * Unless required by applicable law or agreed to in writing, software
4780 * distributed under the License is distributed on an "AS IS" BASIS,
4781 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4782 * See the License for the specific language governing permissions and
4783 * limitations under the License.
4784 */async function Fz(t){if(fh()){let e;try{e=await Dz(t)}catch(n){Ga.warn(`Failed to read token from IndexedDB. Error: ${n}`)}return e}}function Ub(t,e){return fh()?Oz(t,e).catch(n=>{Ga.warn(`Failed to write token to IndexedDB. Error: ${n}`)}):Promise.resolve()}async function Vz(){let t;try{t=await Uz()}catch{}if(t)return t;{const e=crypto.randomUUID();return Lz(e).catch(n=>Ga.warn(`Failed to persist debug token to IndexedDB. Error: ${n}`)),e}}/**
4785 * @license
4786 * Copyright 2020 Google LLC
4787 *
4788 * Licensed under the Apache License, Version 2.0 (the "License");
4789 * you may not use this file except in compliance with the License.
4790 * You may obtain a copy of the License at
4791 *
4792 *   http://www.apache.org/licenses/LICENSE-2.0
4793 *
4794 * Unless required by applicable law or agreed to in writing, softw
4794are
4795 * distributed under the License is distributed on an "AS IS" BASIS,
4796 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4797 * See the License for the specific language governing permissions and
4798 * limitations under the License.
4799 */function G_(){return ag().enabled}async function Y_(){const t=ag();if(t.enabled&&t.token)return t.token.promise;throw Error(`
4800            Can't get debug token in production mode.
4801        `)}function zz(){const t=oN(),e=ag();if(e.initialized=!0,typeof t.FIREBASE_APPCHECK_DEBUG_TOKEN!="string"&&t.FIREBASE_APPCHECK_DEBUG_TOKEN!==!0)return;e.enabled=!0;const n=new $d;e.token=n,typeof t.FIREBASE_APPCHECK_DEBUG_TOKEN=="string"?n.resolve(t.FIREBASE_APPCHECK_DEBUG_TOKEN):n.resolve(Vz())}/**
4802 * @license
4803 * Copyright 2020 Google LLC
4804 *
4805 * Licensed under the Apache License, Version 2.0 (the "License");
4806 * you may not use this file except in compliance with the License.
4807 * You may obtain a copy of the License at
4808 *
4809 *   http://www.apache.org/licenses/LICENSE-2.0
4810 *
4811 * Unless required by applicable law or agreed to in writing, software
4812 * distributed under the License is distributed on an "AS IS" BASIS,
4813 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4814 * See the License for the specific language governing permissions and
4815 * limitations under the License.
4816 */const Bz={error:"UNKNOWN_ERROR"};function Kz(t){return Cv.encodeString(JSON.stringify(t),!1)}async function nv(t,e=!1,n=!1){const s=t.app;q_(s);const a=In(s);let c=a.token,u;if(c&&!Nc(c)&&(a.token=void 0,c=void 0),!c){const p=await a.cachedTokenPromise;p&&(Nc(p)?c=p:await Ub(s,void 0))}if(!e&&c&&Nc(c))return{token:c.token};let h=!1;if(G_())try{a.exchangeTokenPromise||(a.exchangeTokenPromise=H_(TC(s,await Y_()),t.heartbeatServiceProvider).finally(()=>{a.exchangeTokenPromise=void 0}),h=!0);const p=await a.exchangeTokenPromise;return await Ub(s,p),a.token=p,{token:p.token}}catch(p){return p.code==="appCheck/throttled"||p.code==="appCheck/initial-throttle"?Ga.warn(p.message):n&&Ga.error(p),Fb(p)}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().finally(()=>{a.exchangeTokenPromise=void 0}),h=!0),c=await In(s).exchangeTokenPromise}catch(p){p.code==="appCheck/throttled"||p.code==="appCheck/initial-throttle"?Ga.warn(p.message):n&&Ga.error(p),u=p}let m;return c?u?Nc(c)?m={token:c.token,internalError:u}:m=Fb(u):(m={token:c.token},a.token=c,await Ub(s,c)):m=Fb(u),h&&MC(s,m),m}async function $z(t){const e=t.app;q_(e);const{provider:n}=In(e);if(G_()){const s=await Y_(),{token:a}=await H_(TC(e,s),t.heartbeatServiceProvider);return{token:a}}else{const{token:s}=await n.getToken();return{token:s}}}function RC(t,e,n,s){const{app:a}=t,c=In(a),u={next:n,error:s,type:e};if(c.tokenObservers=[...c.tokenObservers,u],c.token&&Nc(c.token)){const h=c.token;Promise.resolve().then(()=>{n({token:h.token}),W2(t)}).catch(()=>{})}c.cachedTokenPromise.then(()=>W2(t))}function IC(t,e){const n=In(t),s=n.tokenObservers.filter(a=>a.next!==e);s.length===0&&n.tokenRefresher&&n.tokenRefresher.isRunning()&&n.tokenRefresher.stop(),n.tokenObservers=s}function W2(t){const{app:e}=t,n=In(e);let s=n.tokenRefresher;s||(s=qz(t),n.tokenRefresher=s),!s.isRunning()&&n.isTokenAutoRefreshEnabled&&s.start()}function qz(t){const{app:e}=t;return new Az(async()=>{const n=In(e);let s;if(n.token?s=await nv(t,!0):s=await nv(t),s.error)throw s.error;if(s.internalError)throw s.internalError},()=>!0,()=>{const n=In(e);if(n.token){let s=n.token.issuedAtTimeMillis+(n.token.expireTimeMillis-n.token.issuedAtTimeMillis)*.5+3e5;const a=n.token.expireTimeMillis-300*1e3;return s=Math.min(s,a),Math.max(0,s-Date.now())}else return 0},G2.RETRIAL_MIN_WAIT,G2.RETRIAL_MAX_WAIT)}function MC(t,e){const n=In(t).tokenObservers;for(const s of n)try{s.type==="EXTERNAL"&&e.error!=null?s.error(e.error):s.next(e)}catch{}}function Nc(t){return t.expireTimeMillis-Date.now()>0}function Fb(t){return{token:Kz(Bz),error:t}}/**
4817 * @license
4818 * Copyright 2020 Google LLC
4819 *
4820 * Licensed under the Apache License, Version 2.0 (the "License");
4821 * you may not use this file except in compliance with the License.
4822 * You may obtain a copy of the License at
4823 *
4824 *   http://www.apache.org/licenses/LICENSE-2.0
4825 *
4826 * Unless required by applicable law or agreed to in writing, softw
4826are
4827 * distributed under the License is distributed on an "AS IS" BASIS,
4828 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4829 * See the License for the specific language governing permissions and
4830 * limitations under the License.
4831 */class Hz{constructor(e,n){this.app=e,this.heartbeatServiceProvider=n}_delete(){const{tokenObservers:e}=In(this.app);for(const n of e)IC(this.app,n.next);return Promise.resolve()}}function Gz(t,e){return new Hz(t,e)}function Yz(t){return{getToken:e=>nv(t,e),getLimitedUseToken:()=>$z(t),addTokenListener:e=>RC(t,"INTERNAL",e),removeTokenListener:e=>IC(t.app,e)}}const Wz="@firebase/app-check",Xz="0.11.0";/**
4832 * @license
4833 * Copyright 2020 Google LLC
4834 *
4835 * Licensed under the Apache License, Version 2.0 (the "License");
4836 * you may not use this file except in compliance with the License.
4837 * You may obtain a copy of the License at
4838 *
4839 *   http://www.apache.org/licenses/LICENSE-2.0
4840 *
4841 * Unless required by applicable law or agreed to in writing, software
4842 * distributed under the License is distributed on an "AS IS" BASIS,
4843 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4844 * See the License for the specific language governing permissions and
4845 * limitations under the License.
4846 */const Qz="https://www.google.com/recaptcha/api.js";function Jz(t,e){const n=new $d,s=In(t);s.reCAPTCHAState={initialized:n};const a=Zz(t),c=Y2(!1);return c?X2(t,e,c,a,n):n7(()=>{const u=Y2(!1);if(!u)throw new Error("no recaptcha");X2(t,e,u,a,n)}),n.promise}function X2(t,e,n,s,a){n.ready(()=>{t7(t,e,n,s),a.resolve(n)})}function Zz(t){const e=`fire_app_check_${t.name}`,n=document.createElement("div");return n.id=e,n.style.display="none",document.body.appendChild(n),e}async function e7(t){q_(t);const n=await In(t).reCAPTCHAState.initialized.promise;return new Promise((s,a)=>{const c=In(t).reCAPTCHAState;n.ready(()=>{s(n.execute(c.widgetId,{action:"fire_app_check"}))})})}function t7(t,e,n,s){const a=n.render(s,{sitekey:e,size:"invisible",callback:()=>{In(t).reCAPTCHAState.succeeded=!0},"error-callback":()=>{In(t).reCAPTCHAState.succeeded=!1}}),c=In(t);c.reCAPTCHAState={...c.reCAPTCHAState,widgetId:a}}function n7(t){const e=document.createElement("script");e.src=Qz,e.onload=t,document.head.appendChild(e)}/**
4847 * @license
4848 * Copyright 2021 Google LLC
4849 *
4850 * Licensed under the Apache License, Version 2.0 (the "License");
4851 * you may not use this file except in compliance with the License.
4852 * You may obtain a copy of the License at
4853 *
4854 *   http://www.apache.org/licenses/LICENSE-2.0
4855 *
4856 * Unless required by applicable law or agreed to in writing, software
4857 * distributed under the License is distributed on an "AS IS" BASIS,
4858 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4859 * See the License for the specific language governing permissions and
4860 * limitations under the License.
4861 */class W_{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(){var s,a,c;r7(this._throttleData);const e=await e7(this._app).catch(u=>{throw Es.create("recaptcha-error")});if(!((s=In(this._app).reCAPTCHAState)!=null&&s.succeeded))throw Es.create("recaptcha-error");let n;try{n=await H_(Iz(this._app,e),this._heartbeatServiceProvider)}catch(u){throw(a=u.code)!=null&&a.includes("fetch-status-error")?(this._throttleData=s7(Number((c=u.customData)==null?void 0:c.httpStatus),this._throttleData),Es.create("initial-throttle",{time:kC(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus})):u}return this._throttleData=null,n}initialize(e){this._app=e,this._heartbeatServiceProvider=ur(e,"heartbeat"),Jz(e,this._siteKey).catch(()=>{})}isEqual(e){return e instanceof W_?this._siteKey===e._siteKey:!1}}function s7(t,e){if(t===404||t===403)return{backoffCount:1,allowRequestsAfter:Date.now()+jz,httpStatus:t};{const n=e?e.backoffCount:0,s=qd(n,1e3,2);return{backoffCount:n+1,allowRequestsAfter:Date.now()+s,httpStatus:t}}}function r7(t){if(t&&Date.now()-t.allowRequestsAfter<=0)throw Es.create("throttled",{time:kC(t.allowRequestsAfter-Date.now()),httpStatus:t.httpStatus})}/**
4862 * @license
4863 * Copyright 2020 Google LLC
4864 *
4865 * Licensed under the Apache License, Version 2.0 (the "License");
4866 * you may not use this file except in compliance with the License.
4867 * You may obtain a copy of the License at
4868 *
4869 *   http://www.apache.org/licenses/LICENSE-2.0
4870 *
4871 * Unless required by applicable law or agreed to in writing, software
4872 * distributed under the License is distributed on an "AS IS" BASIS,
4873 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4874 * See the License for the specific language governing permissions and
4875 * limitations under the License.
4876 */function i7(t=ml(),e){t=st(t);const n=ur(t,"app-check");if(ag().initialized||zz(),G_()&&Y_().then(a=>console.log(`App Check debug token: ${a}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),n.isInitialized()){const a=n.getImmediate(),c=n.getOptions();if(c.isTokenAutoRefreshEnabled===e.isTokenAutoRefreshEnabled&&c.provider.isEqual(e.provider))return a;throw Es.create("already-initialized",{appName:t.name})}const s=n.initialize({options:e});return a7(t,e.provider,e.isTokenAutoRefreshEnabled),In(t).isTokenAutoRefreshEnabled&&RC(s,"INTERNAL",()=>{}),s}function a7(t,e,n=!1){const s=Tz(t,{...wC});s.activated=!0,s.provider=e,s.cachedTokenPromise=Fz(t).then(a=>(a&&Nc(a)&&(s.token=a,MC(t,{token:a.token})),a)),s.isTokenAutoRefreshEnabled=n&&t.automaticDataCollectionEnabled,!t.automaticDataCollectionEnabled&&n&&Ga.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."),s.provider.initialize(t)}const o7="app-check",Q2="app-check-internal";function l7(){Yn(new Un(o7,t=>{const e=t.getProvider("app").getImmediate(),n=t.getProvider("heartbeat");return Gz(e,n)},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((t,e,n)=>{t.getProvider(Q2).initialize()})),Yn(new Un(Q2,t=>{const e=t.getProvider("app-check").getImmediate();return Yz(e)},"PUBLIC").setInstantiationMode("EXPLICIT")),mn(Wz,Xz)}l7();const c7={apiKey:"AIzaSyBqZqOJH67WrPND_rYNG5Wln1CPUxoEfVU",authDomain:"fashio-ai-app.firebaseapp.com",projectId:"fashio-ai-app",storageBucket:"fashio-ai-app.firebasestorage.app",messagingSenderId:"459896296050",appId:"1:459896296050:web:ed46f14634a50fb66f28eb",measurementId:"G-RZF1HH50CF"},xl=gN(c7);if(typeof window<"u"){const t="6LcOEG4sAAAAAKWoJgQ2WDH66lpcIwzd_ODso8Ej";i7(xl,{provider:new W_(t),isTokenAutoRefreshEnabled:!0})}const xt=Y6(xl),u7=new Fi,sl=TV(xl),ut=a8(xl),pp=vz(xl);typeof window<"u"&&hU(xl);const sv=new Map,J2=new Map,gp=1440*60*1e3;let xd=null;function PC(){return xd||(xd=new Promise((t,e)=>{const n=indexedDB.open("fashio-studio-drafts",1);let s=!1;const a=()=>{s||(s=!0,clearTimeout(c),e(new Error("Draft storage unavailable")))},c=setTimeout(a,5e3);n.onupgradeneeded=()=>{n.result.objectStoreNames.contains("drafts")||n.result.createObjectStore("drafts")},n.onsuccess=()=>{if(s){n.result.close();return}s=!0,clearTimeout(c),n.result.onversionchange=()=>{n.result.close(),xd=null},t(n.result)},n.onerror=a,n.onblocked=a}).catch(t=>{throw xd=null,t})),xd}async function d7(t){let e=sv.get(t);if(!e)try{const s=await PC();e=await new Promise((a,c)=>{const u=s.transaction("drafts").objectStore("drafts").get(t);u.onsuccess=()=>a(u.result),u.onerror=()=>c(u.error)})}catch{}const n=e&&Date.now()<(e.expiresAt??e.updatedAt+gp)?e:{fields:{},updatedAt:Date.now(),expiresAt:Date.now()+gp};return sv.set(t,n),n}function rv(t){return t instanceof Blob||t instanceof Date?t:Array.isArray(t)?t.map(rv):t&&typeof t=="object"?Object.fromEntries(Object.entries(t).filter(([,e])=>!(typeof e=="string"&&e.startsWith("blob:"))).map(([e,n])=>[e,rv(n)])):t}function h7(t,e){sv.set(t,e);const n={fields:rv(e.fields),updatedAt:Date.now(),expiresAt:e.expiresAt??Date.now()+gp,originSource:e.originSource},s=(J2.get(t)??Promise.resolve()).catch(()=>{}).then(async()=>{const a=await PC();await new Promise((c,u)=>{const h=a.transaction("drafts","readwrite");h.objectStore("drafts").put(n,t),h.oncomplete=()=>c(),h.onerror=()=>u(h.error),h.onabort=()=>u(h.error)})});return J2.set(t,s),s}const DC="fashio.checkoutReturn";function Z2(t){const e=window.location.pathname;if(!(!e.startsWith("/")||e.startsWith("//")||/^(\/login|\/register|\/billing-return)$/.test(e)))try{sessionStorage.setItem(DC,JSON.stringify({uid:t,path:e,at:Date.now()}))}catch{}}function f7(t){try{const e=JSON.parse(sessionStorage.getItem(DC)||"null");
4876if((e==null?void 0:e.uid)===t&&Date.now()-e.at<gp&&typeof e.path=="string"&&/^\/(?!\/)[a-z0-9/_-]*$/.test(e.path)&&!["/login","/register","/billing-return"].includes(e.path))return e.path}catch{}return"/"}let Uc=null;function m7(t){return Uc=t,()=>{Uc===t&&(Uc=null)}}async function p7(){await(Uc==null?void 0:Uc())}const og=v.createContext(null);function g7({path:t,sourceUrl:e,children:n}){var m;const s=De(),a=`${((m=xt.currentUser)==null?void 0:m.uid)||"guest"}:${t}`,[c,u]=v.useState(null);v.useEffect(()=>{var b;let p=!0;return DS()===t?u({fields:{},updatedAt:Date.now(),expiresAt:(((b=Ep())==null?void 0:b.capturedAt)??Date.now())+1380*60*1e3}):d7(a).then(x=>{p&&u(e&&x.originSource!==e?{fields:{sourceRemoteUrl:e},originSource:e,updatedAt:Date.now(),expiresAt:Date.now()+1440*60*1e3}:x)}),()=>{p=!1}},[a,t,e]);const h=v.useMemo(()=>{if(!c)return null;let p;const b=()=>(clearTimeout(p),h7(a,c));return{fields:c.fields,flush:b,save:(x,w)=>{Object.is(c.fields[x],w)||(c.fields[x]=w,c.updatedAt=Date.now(),clearTimeout(p),p=setTimeout(()=>{b().catch(()=>{})},200))}}},[a,c]);return v.useEffect(()=>{if(!h)return;const p=m7(h.flush),b=()=>{h.flush().catch(()=>{})};return window.addEventListener("pagehide",b),()=>{p(),window.removeEventListener("pagehide",b),b()}},[h]),h?o.jsx(og.Provider,{value:h,children:n}):o.jsxs("div",{role:"status",className:"flex min-h-40 items-center justify-center gap-2 text-dim",children:[o.jsx(et,{size:18,className:"animate-spin"}),s("credits.opening")]})}function ze(t,e){const n=v.useContext(og),[s,a]=v.useState(()=>n&&t in n.fields?n.fields[t]:typeof e=="function"?e():e);return v.useLayoutEffect(()=>{n==null||n.save(t,s)},[n,t,s]),[s,a]}function y7(){const t=v.useContext(og);return(t==null?void 0:t.flush)??p7}function lg(t,e){const n=v.useRef(t);v.useEffect(()=>{if(!n.current)return;const s=URL.createObjectURL(n.current);return e(s),()=>URL.revokeObjectURL(s)},[])}function b7(){var u,h,m,p;const t=v.useContext(og),e=(t==null?void 0:t.fields)??{},n=e.sourceFile??((u=e["photos.files"])==null?void 0:u[0])??((h=e.uploadedFiles)==null?void 0:h[0]),s=e.sourceRemoteUrl??((m=e["photos.urls"])==null?void 0:m[0])??((p=e.hostedUrls)==null?void 0:p[0]),[a,c]=v.useState(null);return v.useEffect(()=>{if(!n){c(null);return}const b=URL.createObjectURL(n);return c(b),()=>URL.revokeObjectURL(b)},[n]),s||a}const x7=()=>{const{pathname:t}=rs();return v.useEffect(()=>{window.scrollTo({top:0,behavior:"instant"})},[t]),null},Ge="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o",OC={on_model:"https://v3b.fal.media/files/b/0aa22102/OD05DNSjTuNpszUcmjCx5_output.mp4",standalone:"https://v3b.fal.media/files/b/0aa2214b/5QikaRws8Y9qIYU1_ky_3_video.mp4"},yp={create:"nav.group.create",product:"nav.group.product",enhance:"nav.group.enhance",account:"nav.group.account"},Th=[{path:"/try-on",labelKey:"nav.tryOn.label",blurbKey:"nav.tryOn.blurb",group:"create",icon:"Shirt",toolId:"outfit_photo",keywords:["try on","tryon","virtual","outfit","model","fashion studio"],inputKey:"nav.tryOn.input",outputKey:"nav.tryOn.output",example:{after:`${Ge}/init%2FhTIXnzaE6Y-q9UtaE08Zd.jpg?alt=media&token=802c08bf-2929-46bf-b8e1-4aa99c901e18`},reel:[{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_before_1.png?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_after_1.png?alt=media`,tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_before_2.png?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_after_2.png?alt=media`,tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_before_3.png?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_after_3.png?alt=media`,tagKey:"nav.reel.after"}],reelMs:2600},{path:"/pro-studio",labelKey:"nav.proStudio.label",blurbKey:"nav.proStudio.blurb",group:"create",icon:"Sparkles",toolId:"pro_studio",keywords:["editorial","campaign","vogue","shot type","preset"],inputKey:"nav.proStudio.input",outputKey:"nav.proStudio.output",example:{after:`${Ge}/fal_outputs%2Fpro_land.jpg?alt=media&token=fdfc959c-a787-43a6-b8c5-ce0e0caa544b`},reel:[{url:`${Ge}/fal_outputs%2FWHITE%20SEAMLESS.jpg?alt=media`},{url:`${Ge}/fal_outputs%2FHARD%20FLASH.jpg?alt=media`},{url:`${Ge}/fal_outputs%2FMODERN%20E-COM.jpg?alt=media`},{url:`${Ge}/fal_outputs%2FOUTDOOR%20LIFESTYLE.jpg?alt=media`}],reelMs:3800},{path:"/catalogue",labelKey:"nav.catalogue.label",blurbKey:"nav.catalogue.blurb",group:"create",icon:"Camera",keywords:["catalog","template set","lookbook","shots"],inputKey:"nav.catalogue.input",outputKey:"nav.catalogue.output",legacy:!0,example:{before:`${Ge}/template_sets%2Friad_yellow_stripe%2Fhome.webp?alt=media&token=887ef5ba-6dba-478a-a8b4-8835abc0788a`,after:`${Ge}/template_sets%2Fgrey_studio_menswear_ecom%2Fhome.webp?alt=media&token=c6509280-0dac-49b5-8fe2-2b308662ca73`},reel:[{url:"/images/onboarding/catalog_flatlay.jpg",tagKey:"nav.reel.yourProduct"},{url:"/images/onboarding/catalog_pose_1.jpg",tagKey:"nav.reel.shot",tagN:1},{url:`${Ge}/fal_outputs%2Fonboard_catalog%2Fpose_s3.jpg?alt=media`,tagKey:"nav.reel.shot",tagN:2},{url:`${Ge}/fal_outputs%2Fonboard_catalog%2Fpose_s4.jpg?alt=media`,tagKey:"nav.reel.shot",tagN:3},{url:`${Ge}/fal_outputs%2Fonboard_catalog%2Fpose_s5.jpg?alt=media`,tagKey:"nav.reel.shot",tagN:4}],reelMs:2e3},{path:"/video",labelKey:"nav.video.label",blurbKey:"nav.video.blurb",group:"create",icon:"Video",toolId:"ai_videos",keywords:["motion","clip","reel","kling","animate"],inputKey:"nav.video.input",outputKey:"nav.video.output",example:{after:`${Ge}/fal_outputs%2Fphoto_video.mp4?alt=media&token=14a71088-5b73-4d4c-9491-6b5f732916eb`,isVideo:!0}},{path:"/packs",labelKey:"nav.packs.label",blurbKey:"nav.packs.blurb",group:"product",icon:"Images",toolId:"clothing_ecom_pack",keywords:["pack","ecommerce","bundle","listing","jewelry","jewellery","ring","necklace","earring","apparel","clothing"],inputKey:"nav.packs.input",outputKey:"nav.packs.output",example:{before:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_base.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`,after:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_white.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`},reel:[{url:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_onmodel.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`},{url:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_white.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`},{url:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_detail.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`},{url:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_pose.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`}],reelMs:4200,variants:[{labelKey:"nav.packs.variant.apparel",image:`${Ge}/fal_outputs%2Fpack_examples%2Fclo_white.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`},{labelKey:"nav.packs.variant.jewelry",image:`${Ge}/fal_outputs%2Fpack_examples%2Fjew_onmodel.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`}]},{path:"/jewelry-on-model",labelKey:"nav.jewelry.label",blurbKey:"nav.jewelry.blurb",group:"product",icon:"Diamond",toolId:"jewelry_on_model",keywords:["necklace","ring","earring","bracelet"],inputKey:"nav.jewelry.input",outputKey:"nav.jewelry.output",reel:[{url:`${Ge}/fal_outputs%2Fmin%2Fposes%2Fearring%2Fearring_sun_profile.png?alt=media`},{url:`${Ge}/fal_outputs%2Fmin%2Fposes%2Fnecklace%2Fnecklace_collar_pull.png?alt=media`},{url:`${Ge}/fal_outputs%2Fmin%2Fposes%2Fring%2Fring_stacked_knuckle.png?alt=media`},{url:`${Ge}/fal_outputs%2Fmin%2Fposes%2Fbracelet%2Fbracelet_statement_drape.png?alt=media`}],reelMs:3400,example:{before:`${Ge}/fal_outputs%2Fpack_examples%2Fjew_base.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`,after:`${Ge}/fal_outputs%2Fpack_examples%2Fjew_onmodel.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`}},{path:"/tools/model_to_flat_lay",labelKey:"nav.flatLay.label",blurbKey:"nav.flatLay.blurb",group:"product",icon:"PersonStanding",toolId:"model_to_flat_lay",keywords:["flatlay","flat lay","mannequin","ghost"],inputKey:"nav.flatLay.input",outputKey:"nav.flatLay.output",example:{before:"/images/mannequin-to-flat-lay/before.png",after:"/images/mannequin-to-flat-lay/after.png"},reel:[{url:"/images/mannequin-to-flat-lay/before.png",tagKey:"nav.reel.before"},{url:"/images/mannequin-to-flat-lay/after.png",tagKey:"nav.reel.after"},{url:"/images/mannequin-to-flat-lay/before-2.png",tagKey:"nav.reel.before"},{url:"/images/mannequin-to-flat-lay/after-2.png",tagKey:"nav.reel.after"}],reelMs:2400},{path:"/spin-360",labelKey:"nav.spin360.label",blurbKey:"nav.spin360.blurb",group:"product",icon:"RotateCw",keywords:["spin","360","packshot","turntable"],inputKey:"nav.spin360.input",outputKey:"nav.spin360.output",legacy:!0,example:{after:OC.on_model,isVideo:!0}},{path:"/image-to-3d",labelKey:"nav.imageTo3d.label",blurbKey:"nav.imageTo3d.blurb",group:"product",icon:"Box",keywords:["3d","mesh","glb"],inputKey:"nav.imageTo3d.input",outputKey:"nav.imageTo3d.output",legacy:!0},{path:"/tools/photo_edit",labelKey:"nav.photoEdit.label",blurbKey:"nav.photoEdit.blurb",group:"enhance",icon:"Wand2",toolId:"photo_edit",keywords:["edit","change","prompt","colour","color","sleeve","length","retouch"],inputKey:"nav.photoEdit.input",outputKey:"nav.photoEdit.output",reel:[{url:`${Ge}/fal_outputs%2FMODERN%20E-COM.jpg?alt=media`,tagKey:"nav.reel.before"},{url:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2F2bc42cb5-ea80-40fe-baf4-74b6d4fc18f6.jpeg?alt=media&token=7bcaf6af-fca1-4aaa-a01f-5118ae1e00a3",tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2FMODERN%20E-COM.jpg?alt=media`,tagKey:"nav.reel.before"},{url:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2Fc846328e-4e57-4fde-b072-75cf996ced86.jpeg?alt=media&token=fd25b096-7820-44a7-b44c-a550d15c1498",tagKey:"nav.reel.after"}],reelMs:2600},{path:"/tools/model_swap",labelKey:"nav.modelSwap.label",blurbKey:"nav.modelSwap.blurb",group:"enhance",icon:"RefreshCw",toolId:"model_swap",keywords:["model","swap","change model","face","identity","ethnicity"],inputKey:"nav.modelSwap.input",outputKey:"nav.modelSwap.output",reel:[{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_after_1.png?alt=media`,tagKey:"nav.reel.before"},{url:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2Fa5920352-9779-4d1f-8620-c4eac080913a.jpeg?alt=media&token=eb8f892b-029e-4f47-b7d0-c033addcd323",tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Ftryon_after_2.png?alt=media`,tagKey:"nav.reel.before"},{url:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2Fb0a0d145-20ea-4667-9b4e-80ad93d7817c.jpeg?alt=media&token=b238eb1a-29dc-40d7-adbb-e6f73637eaf1",tagKey:"nav.reel.after"}],reelMs:2600},{path:"/tools/amateur_to_pro",labelKey:"nav.amateurToPro.label",blurbKey:"nav.amateurToPro.blurb",group:"enhance",icon:"Wand2",toolId:"amateur_to_pro",keywords:["retouch","studio","fix","quality"],inputKey:"nav.amateurToPro.input",outputKey:"nav.amateurToPro.output",example:{after:`${Ge}/fal_outputs%2FpYs_32YDt2cDsffLXKNTh.jpg?alt=media&token=7c49da0e-0c7a-42bd-b327-902074dc5493`},reel:[{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_before_1.jpg?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_after_1.jpg?alt=media`,tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_before_2.jpg?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_after_2.jpg?alt=media`,tagKey:"nav.reel.after"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_before_3.jpg?alt=media`,tagKey:"nav.reel.before"},{url:`${Ge}/fal_outputs%2Fmin%2Fshowcase%2Famateur_wide_after_3.jpg?alt=media`,tagKey:"nav.reel.after"}],reelMs:2400},{path:"/tools/pose_angle_switch",labelKey:"nav.poseVariation.label",blurbKey:"nav.poseVariation.blurb",group:"enhance",icon:"RefreshCw",toolId:"pose_angle_switch",keywords:["pose","angle","variation"],inputKey:"nav.poseVariation.input",outputKey:"nav.poseVariation.output",reel:[{url:`${Ge}/fal_outputs%2Fangle2.jpg?alt=media&token=b3c0d7b6-6041-40cf-990b-784a6d4102e7`},{url:`${Ge}/fal_outputs%2Fangle.jpg?alt=media&token=b3c0d7b6-6041-40cf-990b-784a6d4102e7`}
4876],reelMs:4900,example:{after:`${Ge}/fal_outputs%2Fangle2.jpg?alt=media&token=b3c0d7b6-6041-40cf-990b-784a6d4102e7`}},{path:"/tools/photo_enhance",labelKey:"nav.enhance.label",blurbKey:"nav.enhance.blurb",group:"enhance",icon:"Maximize2",toolId:"photo_enhance",keywords:["upscale","resolution","sharpen"],inputKey:"nav.enhance.input",outputKey:"nav.enhance.output",example:{after:`${Ge}/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b`}},{path:"/tools/remove_background",labelKey:"nav.removeBackground.label",blurbKey:"nav.removeBackground.blurb",group:"enhance",icon:"Eraser",toolId:"remove_background",keywords:["cutout","transparent","background"],inputKey:"nav.removeBackground.input",outputKey:"nav.removeBackground.output",example:{after:`${Ge}/fal_outputs%2Fremove_bg.jpg?alt=media`}},{path:"/tools/photo_reframe",labelKey:"nav.reframe.label",blurbKey:"nav.reframe.blurb",group:"enhance",icon:"Crop",toolId:"photo_reframe",keywords:["aspect","ratio","outpaint","resize"],inputKey:"nav.reframe.input",outputKey:"nav.reframe.output",example:{before:"/images/photo-reframe/fashion-base-9-16.png",after:"/images/photo-reframe/fashion-reframe-16-9.png"}},{path:"/body-editor",labelKey:"nav.bodyEditor.label",blurbKey:"nav.bodyEditor.blurb",group:"enhance",icon:"PersonStanding",keywords:["body","shape","proportions"],inputKey:"nav.bodyEditor.input",outputKey:"nav.bodyEditor.output",legacy:!0,example:{after:"/images/dashboard/body-reshape.jpg"}},{path:"/ugc-creator",labelKey:"nav.ugc.label",blurbKey:"nav.ugc.blurb",group:"enhance",icon:"Clapperboard",keywords:["ugc","creator","tiktok","social"],inputKey:"nav.ugc.input",outputKey:"nav.ugc.output",legacy:!0},{path:"/lingerie-studio",labelKey:"nav.lingerie.label",blurbKey:"nav.lingerie.blurb",group:"enhance",icon:"Flower2",keywords:["lingerie","intimates","underwear"],inputKey:"nav.lingerie.input",outputKey:"nav.lingerie.output",legacy:!0,example:{after:`${Ge}/fal_outputs%2Flingerie_samples%2Fstyle_studio.jpg?alt=media`}},{path:"/products",labelKey:"nav.products.label",blurbKey:"nav.products.blurb",group:"account",icon:"Package",keywords:["products","library","garments","saved","wardrobe","catalog","uploads","photos","quick","reuse"],inputKey:"nav.products.input",outputKey:"nav.products.output"},{path:"/history",labelKey:"nav.history.label",blurbKey:"nav.history.blurb",group:"account",icon:"History",keywords:["gallery","creations","past","runs"],inputKey:"nav.history.input",outputKey:"nav.history.output"},{path:"/billing",labelKey:"nav.billing.label",blurbKey:"nav.billing.blurb",group:"account",icon:"CreditCard",keywords:["plan","credits","diamonds","subscription","invoice"],inputKey:"nav.billing.input",outputKey:"nav.billing.output"},{path:"/profile",labelKey:"nav.profile.label",blurbKey:"nav.profile.blurb",group:"account",icon:"User",keywords:["account","settings","email"],inputKey:"nav.profile.input",outputKey:"nav.profile.output"},{path:"/api-keys",labelKey:"nav.apiKeys.label",blurbKey:"nav.apiKeys.blurb",group:"account",icon:"KeyRound",keywords:["api","key","developer","integration","webhook"],inputKey:"nav.apiKeys.input",outputKey:"nav.apiKeys.output"}],Ad=t=>Th.filter(e=>e.group===t),iv=["create","product","enhance"],v7=["/pro-studio","/try-on","/catalogue","/packs","/tools/photo_edit","/tools/model_swap","/video","/jewelry-on-model","/tools/amateur_to_pro","/tools/pose_angle_switch","/tools/model_to_flat_lay","/spin-360","/lingerie-studio"],_7="fashio-theme",w7="light",Vb=new Set;function eT(){const t=document.documentElement.getAttribute("data-theme");return t==="light"||t==="dark"?t:w7}const Fc={get current(){return eT()},set(t){document.documentElement.setAttribute("data-theme",t);try{localStorage.setItem(_7,t)}catch{}for(const e of Vb)e(t)},toggle(){const t=eT()==="dark"?"light":"dark";return Fc.set(t),t},subscribe(t){return Vb.add(t),()=>Vb.delete(t)}},E7="M0,-1 L0.309,-0.225 L0.951,-0.309 L0.363,0.118 L0.588,0.809 L0,0.382 L-0.588,0.809 L-0.363,0.118 L-0.951,-0.309 L-0.309,-0.225 Z",Fa=({x:t,y:e,r:n,fill:s,rotate:a=0})=>o.jsx("path",{d:E7,fill:s,transform:`translate(${t} ${e}) rotate(${a}) scale(${n})`}),gc=({colors:t})=>o.jsx(o.Fragment,{children:t.map((e,n)=>o.jsx("rect",{x:"0",y:16/t.length*n,width:"24",height:16/t.length,fill:e},n))}),tT=({colors:t})=>o.jsx(o.Fragment,{children:t.map((e,n)=>o.jsx("rect",{x:24/t.length*n,y:"0",width:24/t.length,height:"16",fill:e},n))}),k7={en:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#012169"}),o.jsx("path",{d:"M0,0 L24,16 M24,0 L0,16",stroke:"#fff",strokeWidth:"3.2"}),o.jsx("path",{d:"M0,0 L24,16 M24,0 L0,16",stroke:"#C8102E",strokeWidth:"1.8"}),o.jsx("path",{d:"M12,0 V16 M0,8 H24",stroke:"#fff",strokeWidth:"5"}),o.jsx("path",{d:"M12,0 V16 M0,8 H24",stroke:"#C8102E",strokeWidth:"3"})]}),zh:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#DE2910"}
4876),o.jsx(Fa,{x:5,y:5,r:2.8,fill:"#FFDE00"}),o.jsx(Fa,{x:9.5,y:2,r:1.1,fill:"#FFDE00"}),o.jsx(Fa,{x:11.4,y:4,r:1.1,fill:"#FFDE00"}),o.jsx(Fa,{x:11.4,y:6.6,r:1.1,fill:"#FFDE00"}),o.jsx(Fa,{x:9.5,y:8.6,r:1.1,fill:"#FFDE00"})]}),hi:o.jsxs(o.Fragment,{children:[o.jsx(gc,{colors:["#FF9933","#FFFFFF","#138808"]}),o.jsx("circle",{cx:"12",cy:"8",r:"2.2",fill:"none",stroke:"#000080",strokeWidth:"0.55"}),o.jsx("path",{d:"M12.55,8.00 L14.15,8.00 M12.48,8.28 L13.86,9.07 M12.28,8.48 L13.07,9.86 M12.00,8.55 L12.00,10.15 M11.72,8.48 L10.93,9.86 M11.52,8.28 L10.14,9.07 M11.45,8.00 L9.85,8.00 M11.52,7.72 L10.14,6.92 M11.72,7.52 L10.92,6.14 M12.00,7.45 L12.00,5.85 M12.28,7.52 L13.07,6.14 M12.48,7.72 L13.86,6.92",stroke:"#000080",strokeWidth:"0.3"}),o.jsx("circle",{cx:"12",cy:"8",r:"0.45",fill:"#000080"})]}),es:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#AA151B"}),o.jsx("rect",{y:"4",width:"24",height:"8",fill:"#F1BF00"})]}),ar:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#165D31"}),o.jsx("rect",{x:"5",y:"5.5",width:"14",height:"1.6",rx:"0.5",fill:"#fff"}),o.jsx("rect",{x:"5",y:"9.4",width:"14",height:"0.9",rx:"0.45",fill:"#fff"})]}),fr:o.jsx(tT,{colors:["#002395","#FFFFFF","#ED2939"]}),pt:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#DA291C"}),o.jsx("rect",{width:"9.6",height:"16",fill:"#046A38"}),o.jsx("circle",{cx:"9.6",cy:"8",r:"3.1",fill:"#FFE900",stroke:"#046A38",strokeWidth:"0.5"}),o.jsx("circle",{cx:"9.6",cy:"8",r:"1.5",fill:"#DA291C"})]}),ru:o.jsx(gc,{colors:["#FFFFFF","#0039A6","#D52B1E"]}),id:o.jsx(gc,{colors:["#CE1126","#FFFFFF"]}),de:o.jsx(gc,{colors:["#000000","#DD0000","#FFCE00"]}),ja:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#fff"}),o.jsx("circle",{cx:"12",cy:"8",r:"4.4",fill:"#BC002D"})]}),tr:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#E30A17"}),o.jsx("circle",{cx:"9.6",cy:"8",r:"3.6",fill:"#fff"}),o.jsx("circle",{cx:"11.1",cy:"8",r:"2.9",fill:"#E30A17"}),o.jsx(Fa,{x:14.6,y:8,r:1.5,fill:"#fff"})]}),vi:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#DA251D"}),o.jsx(Fa,{x:12,y:8,r:4.2,fill:"#FFFF00"})]}),ko:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#fff"}),o.jsx("path",{d:"M8.6,8 A3.4,3.4 0 0,1 15.4,8 A1.7,1.7 0 0,1 12,8 A1.7,1.7 0 0,0 8.6,8 Z",fill:"#CD2E3A"}),o.jsx("path",{d:"M8.6,8 A3.4,3.4 0 0,0 15.4,8 A1.7,1.7 0 0,0 12,8 A1.7,1.7 0 0,1 8.6,8 Z",fill:"#0047A0"}),o.jsxs("g",{stroke:"#000",strokeWidth:"0.6",strokeLinecap:"butt",children:[o.jsx("g",{transform:"rotate(-56 4.6 4)",children:o.jsx("path",{d:"M3.1,3.1 H6.1 M3.1,4 H6.1 M3.1,4.9 H6.1"})}),o.jsx("g",{transform:"rotate(56 19.4 4)",children:o.jsx("path",{d:"M17.9,3.1 H20.9 M17.9,4 H20.9 M17.9,4.9 H20.9"})}),o.jsx("g",{transform:"rotate(56 4.6 12)",children:o.jsx("path",{d:"M3.1,11.1 H6.1 M3.1,12 H6.1 M3.1,12.9 H6.1"})}),o.jsx("g",{transform:"rotate(-56 19.4 12)",children:o.jsx("path",{d:"M17.9,11.1 H20.9 M17.9,12 H20.9 M17.9,12.9 H20.9"})})]})]}),it:o.jsx(tT,{colors:["#008C45","#F4F5F0","#CD212A"]}),th:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#A51931"}),o.jsx("rect",{y:"2.7",width:"24",height:"10.6",fill:"#F4F5F8"}),o.jsx("rect",{y:"5.3",width:"24",height:"5.4",fill:"#2D2A4A"})]}),pl:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#fff"}),o.jsx("rect",{y:"8",width:"24",height:"8",fill:"#DC143C"})]}),uk:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#0057B7"}),o.jsx("rect",{y:"8",width:"24",height:"8",fill:"#FFDD00"})]}),ms:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#CC0001"}),[1,3,5,7,9,11,13].map(t=>o.jsx("rect",{y:16/14*t,width:"24",height:16/14,fill:"#fff"},t)),o.jsx("rect",{width:"13",height:"8.6",fill:"#010066"}),o.jsx("circle",{cx:"5.6",cy:"4.3",r:"2.5",fill:"#FFCC00"}),o.jsx("circle",{cx:"6.7",cy:"4.3",r:"2.1",fill:"#010066"}),o.jsx(Fa,{x:9.6,y:4.3,r:1.5,fill:"#FFCC00"})]}),"zh-tw":o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#FE0000"}),o.jsx("rect",{width:"12",height:"8",fill:"#000095"}),o.jsx("path",{d:"M6.00,1.00 L6.43,2.41 L7.50,1.40 L7.17,2.83 L8.60,2.50 L7.59,3.57 L9.00,4.00 L7.59,4.43 L8.60,5.50 L7.17,5.17 L7.50,6.60 L6.43,5.59 L6.00,7.00 L5.57,5.59 L4.50,6.60 L4.83,5.17 L3.40,5.50 L4.41,4.43 L3.00,4.00 L4.41,3.57 L3.40,2.50 L4.83,2.83 L4.50,1.40 L5.57,2.41 Z",fill:"#fff"})]}),nl:o.jsx(gc,{colors:["#AE1C28","#FFFFFF","#21468B"]}),sv:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#006AA7"}),o.jsx("rect",{x:"7",y:"0",width:"3",height:"16",fill:"#FECC00"}),o.jsx("rect",{x:"0",y:"6.5",width:"24",height:"3",fill:"#FECC00"})]}),he:o.jsxs(o.Fragment,{children:[o.jsx("rect",{width:"24",height:"16",fill:"#fff"}),o.jsx("rect",{y:"1.8",width:"24",height:"1.8",fill:"#0038B8"}),o.jsx("rect",{y:"12.4",width:"24",height:"1.8",fill:"#0038B8"}),o.jsx("path",{d:"M12,4.6 L14.6,9.2 L9.4,9.2 Z M12,11.4 L9.4,6.8 L14.6,6.8 Z",fill:"none",stroke:"#0038B8",strokeWidth:"0.75"})]}),bg:o.jsx(gc,{colors:["#FFFFFF","#00966E","#D62612"]})},nT=({code:t,className:e=""})=>o.jsx("svg",{viewBox:"0 0 24 16",className:e,"aria-hidden":!0,focusable:"false",style:{overflow:"hidden"},children:k7[t]}),LC=({variant:t="nav",align:e})=>{const{locale:n,setLocale:s,t:a}=nu(),[c,u]=v.useState(!1),h=v.useRef(null),m=e??"right";v.useEffect(()=>{if(!c)return;const x=T=>{var N;(N=h.current)!=null&&N.contains(T.target)||u(!1)},w=T=>T.key==="Escape"&&u(!1);return document.addEventListener("mousedown",x),document.addEventListener("keydown",w),()=>{document.removeEventListener("mousedown",x),document.removeEventListener("keydown",w)}},[c]);const p=ZS(n),b=t==="auth"?"flex items-center gap-2 rounded-lg border border-line bg-surface px-3 py-2 text-sm text-dim transition-colors hover:border-line-strong hover:text-ink":"ml-1 flex items-center gap-1.5 rounded-lg p-2 text-dim transition-colors hover:bg-raised hover:text-ink";return o.jsxs("div",{ref:h,className:"relative",children:[o.jsxs("button",{type:"button",onClick:()=>u(x=>!x),"aria-expanded":c,"aria-haspopup":"listbox","aria-label":`${p.english} — change language`,title:p.native,className:b,children:[o.jsx(nT,{code:n,className:"h-3.5 w-5 shrink-0 rounded-[2px] ring-1 ring-black/10"}),t==="auth"?o.jsx("span",{children:p.native}):o.jsx("span",{className:"font-mono text-[11px] uppercase",children:n})]}),c&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>u(!1)}),o.jsx("div",{role:"listbox","aria-label":a("common.language"),className:`absolute ${m==="right"?"right-0":"left-0"} top-full z-50 mt-1 max-h-[60vh] w-56 overflow-y-auto rounded-panel border border-line bg-overlay p-1.5 shadow-lift`,children:QS.map(x=>{const w=x.code===n;return o.jsxs("button",{type:"button",role:"option","aria-selected":w,lang:x.code,dir:x.dir,onClick:()=>{s(x.code),u(!1)},className:`flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-start text-sm transition-colors ${w?"bg-raised font-semibold text-ink":"text-dim hover:bg-raised hover:text-ink"}`,children:[o.jsx(nT,{code:x.code,className:"h-3.5 w-5 shrink-0 rounded-[2px] ring-1 ring-black/10"}),o.jsx("span",{className:"min-w-0 flex-1 truncate",children:x.native}),w&&o.jsx(Cn,{size:14,className:"shrink-0 text-accent"})]},x.code)})})]})]})},T7={Box:Ev,Camera:kp,Clapperboard:r5,CreditCard:LS,Crop:US,Diamond:Bc,Eraser:g5,Flower2:_5,History:kx,ImagePlus:Jo,Images:Sv,KeyRound:Tp,LayoutGrid:VS,Maximize2:BS,Package:Tr,PersonStanding:W5,RefreshCw:qS,RotateCw:Sx,Shirt:jv,Sparkles:us,User:Bd,Video:WS,Wand2:ir},$i=({name:t,size:e=18,className:n})=>{const s=T7[t]??VS;return o.jsx(s,{size:e,className:n})},S7=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),N7=({label:t,children:e,active:n})=>{const[s,a]=v.useState(!1),c=v.useRef(null);return v.useEffect(()=>{if(!s)return;const u=m=>{var p;(p=c.current)!=null&&p.contains(m.target)||a(!1)},h=m=>m.key==="Escape"&&a(!1);return document.addEventListener("mousedown",u),document.addEventListener("keydown",h),()=>{document.removeEventListener("mousedown",u),document.removeEventListener("keydown",h)}},[s]),o.jsxs("div",{ref:c,className:"relative",onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),children:[o.jsxs("button",{onClick:()=>a(u=>!u),"aria-expanded":s,className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${n||s?"text-ink":"text-dim hover:text-ink"}`,children:[t,o.jsx(Um,{size:13,className:`opacity-60 transition-transform ${s?"rotate-180":""}`})]}),s&&o.jsx("div",{className:"absolute left-0 top-full z-50 w-[420px] overflow-hidden rounded-panel border border-line bg-overlay p-1.5 shadow-lift",onClick:()=>a(!1),children:e})]})},j7=({diamondBalance:t,isSubscriber:e,userName:n,userEmail:s,onTopUp:a,onLogout:c,onOpenPalette:u})=>
4876{const h=De(),m=rs(),p=Xn(),[b,x]=v.useState(Fc.current),[w,T]=v.useState(!1),[N,j]=v.useState(!1);v.useEffect(()=>Fc.subscribe(x),[]),v.useEffect(()=>{T(!1),j(!1)},[m.pathname]);const A=Y=>Ad(Y).some($=>m.pathname.startsWith($.path)),F=({path:Y})=>{const $=Th.find(I=>I.path===Y),q=m.pathname===$.path;return o.jsxs(zt,{to:$.path,className:`flex items-start gap-3 rounded-lg px-3 py-2.5 transition-colors ${q?"bg-raised":"hover:bg-raised"}`,children:[o.jsx("span",{className:q?"mt-0.5 text-accent":"mt-0.5 text-faint",children:o.jsx($i,{name:$.icon,size:17})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-ink",children:h($.labelKey)}),$.legacy&&o.jsx("span",{className:"rounded border border-line px-1 font-mono text-[9px] uppercase text-faint",children:"v1"})]}),o.jsx("span",{className:"mt-0.5 block truncate text-xs text-faint",children:h($.blurbKey)})]})]})},[V,L]=v.useState(!1);return v.useEffect(()=>{const Y=()=>L(window.scrollY>8);return Y(),window.addEventListener("scroll",Y,{passive:!0}),()=>window.removeEventListener("scroll",Y)},[]),o.jsxs("header",{className:`sticky top-0 z-40 border-b bg-surface/90 backdrop-blur transition-colors duration-200 ${V?"border-line-strong":"border-line"}`,children:[o.jsxs("div",{className:"flex h-14 items-center gap-1 px-4",children:[o.jsx("button",{onClick:()=>p("/"),className:"mr-2 flex shrink-0 items-center",children:o.jsx("img",{src:"/logo2.webp",alt:"Fashio.ai",width:480,height:104,className:"brand-mark h-6 
4876w-auto"})}),o.jsxs("nav",{className:"hidden items-center gap-0.5 md:flex",children:[o.jsxs(zt,{to:"/history",className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${m.pathname.startsWith("/history")?"text-ink":"text-dim hover:text-ink"}`,children:[o.jsx(kx,{size:15}),h("nav.history.label")]}),o.jsxs(zt,{to:"/products",className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${m.pathname.startsWith("/products")&&m.search!=="?tab=uploads"?"text-ink":"text-dim hover:text-ink"}`,children:[o.jsx(Tr,{size:15}),h("nav.products.label")]}),o.jsxs(zt,{to:"/products?tab=uploads",className:`flex items-center gap-1.5 rounded-lg px-3 py-2 text-sm font-medium transition-colors ${m.pathname.startsWith("/products")&&m.search==="?tab=uploads"?"text-ink":"text-dim hover:text-ink"}`,children:[o.jsx(Jo,{size:15}),h("nav.uploads.label")]})]}),o.jsx("div",{className:"mx-1 hidden h-5 w-px bg-line md:block"}),o.jsx("nav",{className:"hidden items-center md:flex",children:iv.map(Y=>o.jsx(N7,{label:h(yp[Y]),active:A(Y),children:o.jsx("div",{className:"grid grid-cols-1 gap-0.5",children:Ad(Y).map($=>o.jsx(F,{path:$.path},$.path))})},Y))}),o.jsx("div",{className:"flex-1"}),o.jsxs("button",{onClick:u,className:"group hidden items-center gap-2 rounded-lg border border-line bg-base px-3 py-1.5 text-dim transition-colors hover:border-line-strong hover:text-ink sm:flex",children:[o.jsx(zd,{size:14}),o.jsx("span",{className:"text-xs",children:h("nav.search")}),o.jsxs("kbd",{className:"ml-4 rounded border border-line px-1.5 py-0.5 font-mono text-[10px] text-faint",children:[S7?"⌘":"Ctrl","K"]})]}),e?o.jsxs("button",{onClick:a,title:h("nav.buyCredits"),className:"ml-1 flex items-center gap-1.5 rounded-lg border border-line bg-base px-2.5 py-1.5 transition-colors hover:border-line-strong",children:[o.jsx(rr,{size:13,className:"fill-accent text-accent"}),o.jsx("span",{className:"text-xs font-bold tabular-nums text-ink",children:t})]}):o.jsxs("button",{onClick:a,className:"ml-1 flex items-center gap-1.5 rounded-lg border border-accent/40 bg-accent-soft px-2.5 py-1.5 transition-colors hover:border-accent",children:[o.jsx(rr,{size:13,className:"fill-accent text-accent"}),o.jsx("span",{className:"text-xs font-bold text-accent",children:h("nav.goPro")})]}),o.jsx(LC,{variant:"nav"}),o.jsx("button",{onClick:()=>Fc.toggle(),"aria-label":h(b==="dark"?"theme.switchToLight":"theme.switchToDark"),title:h(b==="dark"?"theme.lightMode":"theme.darkMode"),className:"ml-1 rounded-lg p-2 text-dim transition-colors hover:bg-raised hover:text-ink",children:b==="dark"?o.jsx(GS,{size:16}):o.jsx(KS,{size:16})}),o.jsxs("div",{className:"relative ml-1 hidden md:block",children:[o.jsx("button",{onClick:()=>j(Y=>!Y),"aria-label":h("nav.account"),className:"flex h-8 w-8 items-center justify-center rounded-full border border-line bg-base text-dim transition-colors hover:text-ink",children:o.jsx(Bd,{size:15})}),N&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"fixed inset-0 z-40",onClick:()=>j(!1)}),o.jsxs("div",{className:"absolute right-0 top-full z-50 mt-1 w-60 overflow-hidden rounded-panel border border-line bg-overlay p-1.5 shadow-lift",children:[(n||s)&&o.jsxs("div",{className:"border-b border-line px-3 pb-2.5 pt-2",children:[n&&o.jsx("p",{className:"truncate text-sm font-semibold text-ink",children:n}),s&&o.jsx("p",{className:"truncate text-xs text-faint",children:s})]}),Ad("account").map(Y=>o.jsxs(zt,{to:Y.path,className:"flex items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-dim transition-colors hover:bg-raised hover:text-ink",children:[o.jsx($i,{name:Y.icon,size:15}),h(Y.labelKey)]},Y.path)),o.jsx("div",{className:"my-1 border-t border-line"}),o.jsxs("button",{onClick:c,className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-faint transition-colors hover:bg-bad/10 hover:text-bad",children:[o.jsx(Tx,{size:15})," ",h("nav.signOut")]})]})]})]}),o.jsx("button",{onClick:()=>T(Y=>!Y),"aria-label":h("nav.menu"),className:"ml-1 rounded-lg p-2 text-dim hover:bg-raised hover:text-ink md:hidden",children:w?o.jsx(Wt,{size:18}):o.jsx(z5,{size:18})})]}),w&&o.jsxs("div",{className:"max-h-[75vh] overflow-y-auto border-t border-line bg-surface px-3 py-3 md:hidden",children:[o.jsxs("button",{onClick:u,className:"mb-3 flex w-full items-center gap-2 rounded-lg border border-line bg-base px-3 py-2.5 text-sm text-dim",children:[o.jsx(zd,{size:15})," ",h("nav.searchTools")]}),iv.map(Y=>o.jsxs("div",{className:"mb-3",children:[o.jsx("p",{className:"px-2 pb-1 font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:h(yp[Y])}),Ad(Y).map($=>o.jsx(F,{path:$.path},$.path))]},Y)),o.jsxs("div",{className:"border-t border-line pt-2",children:[o.jsxs(zt,{to:"/history",className:"flex items-center gap-2.5 rounded-lg px-3 py-2.5 text-sm text-dim",children:[o.jsx(kx,{size:16})," ",h("nav.history.label")]}),o.jsxs(zt,{to:"/profile",className:"flex items-center gap-2.5 rounded-lg px-3 py-2.5 text-sm text-dim",children:[o.jsx(Bd,{size:16})," ",h("nav.profile.label")]}),o.jsxs("button",{onClick:c,className:"flex w-full items-center gap-2.5 rounded-lg px-3 py-2.5 text-sm text-faint",children:[o.jsx(Tx,{size:16})," ",h("nav.signOut")]})]})]})]})},A7=()=>{const t=De();return o.jsxs("a",{href:"mailto:[email protected]",title:t("profile.help"),className:"fixed bottom-6 right-6 z-40 hidden items-center gap-2 whitespace-nowrap rounded-full border border-line bg-surface px-4 py-2.5 text-sm font-medium text-dim shadow-sm transition-colors hover:border-line-strong hover:bg-raised hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong lg:flex",children:[o.jsx(Sp,{size:16}),t("profile.help")]})},av="fashio:open-palette";function UC(){window.dispatchEvent(new CustomEvent(av))}const C7=(t,e)=>{if(!e)return 1;const n=e.toLowerCase();let s=0;for(const a of t){const c=a.toLowerCase();c===n?s=Math.max(s,100):c.startsWith(n)?s=Math.max(s,80):c.includes(n)&&(s=Math.max(s,50))}return s},R7=({isSubscriber:t,onTopUp:e,onLogout:n,onReplayOnboarding:s})=>{const a=De(),c=Xn(),[u,h]=v.useState(!1),[m,p]=v.useState(""),[b,x]=v.useState(0),w=v.useRef(null),T=v.useRef(null);v.useEffect(()=>{const V=Y=>{(Y.metaKey||Y.ctrlKey)&&Y.key.toLowerCase()==="k"&&(Y.preventDefault(),h($=>!$))},L=()=>h(!0);return window.addEventListener("keydown",V),window.addEventListener(av,L),()=>{window.removeEventListener("keydown",V),window.removeEventListener(av,L)}},[]),v.useEffect(()=>{u&&(p(""),x(0),requestAnimationFrame(()=>{var V;return(V=w.current)==null?void 0:V.focus()}))},[u]);const N=()=>h(!1),j=v.useMemo(()=>{const V=L=>({id:L.path,label:a(L.labelKey),hint:a(yp[L.group]),icon:o.jsx($i,{name:L.icon,size:16}),keywords:[a(L.labelKey),a(L.blurbKey),L.toolId??"",...L.keywords??[]],run:()=>{c(L.path),N()}});return[{id:"/",label:a("nav.dashboard"),hint:a("palette.hint.go"),icon:o.jsx($i,{name:"LayoutGrid",size:16}),keywords:[a("nav.dashboard"),"home","dashboard","start"],run:()=>{c("/"),N()}},...Th.map(V),{id:"theme",label:a("palette.toggleTheme"),hint:a("palette.hint.action"),icon:Fc.current==="dark"?o.jsx(GS,{size:16}):o.jsx(KS,{size:16}),keywords:["theme","dark","light","mode","appearance"],run:()=>{Fc.toggle(),N()}},{id:"topup",label:a(t?"nav.buyCredits":"nav.goPro"),hint:a("palette.hint.action"),icon:o.jsx($i,{name:"CreditCard",size:16}),keywords:["credits","diamonds","top up","buy","upgrade"],run:()=>{e(),N()}},{id:"logout",label:a("nav.signOut"),hint:a("palette.hint.action"),icon:o.jsx($i,{name:"User",size:16}),keywords:["logout","sign out","exit"],run:()=>{n(),N()}}]},[c,t,e,n,s,a]),A=v.useMemo(()=>{const V=j.map(L=>({a:L,score:C7(L.keywords.concat(L.label),m)})).filter(L=>L.score>0);return V.sort((L,Y)=>Y.score-L.score),V.slice(0,12).map(L=>L.a)},[j,m]);if(v.useEffect(()=>{var L;const V=(L=T.current)==null?void 0:L.querySelector(`[data-index="${b}"]`);V==null||V.scrollIntoView({block:"nearest"})},[b]),!u)return null;const F=V=>{var L;V.key==="Escape"?(V.preventDefault(),N()):V.key==="ArrowDown"?(V.preventDefault(),x(Y=>A.length?(Y+1)%A.length:0)):V.key==="ArrowUp"?(V.preventDefault(),x(Y=>A.length?(Y-1+A.length)%A.length:0)):V.key==="Enter"&&(V.preventDefault(),(L=A[b])==null||L.run())};return o.jsx("div",{className:"fixed inset-0 z-[70] flex items-start justify-center bg-black/60 px-4 pt-[12vh] backdrop-blur-sm",onClick:N,children:o.jsxs("div",{role:"dialog","aria-label":a("palette.title"),className:"w-full max-w-xl overflow-hidden rounded-panel border border-line bg-overlay 
4876shadow-lift",onClick:V=>V.stopPropagation(),onKeyDown:F,children:[o.jsxs("div",{className:"flex items-center gap-3 border-b border-line px-4",children:[o.jsx(zd,{size:16,className:"shrink-0 text-faint"}),o.jsx("input",{ref:w,value:m,onChange:V=>{p(V.target.value),x(0)},placeholder:a("palette.placeholder"),className:"w-full bg-transparent py-4 text-sm text-ink outline-none placeholder:text-faint"}),o.jsx("kbd",{className:"shrink-0 rounded border border-line px-1.5 py-0.5 font-mono text-[10px] text-faint",children:"esc"})]}),o.jsx("div",{ref:T,className:"max-h-[52vh] overflow-y-auto p-2",children:A.length===0?o.jsx("p",{className:"px-3 py-8 text-center text-xs text-faint",children:a("palette.empty",{term:m})}):A.map((V,L)=>o.jsxs("button",{"data-index":L,onMouseEnter:()=>x(L),onClick:V.run,className:`flex w-full items-center gap-3 rounded-lg px-3 py-2.5 text-left transition-colors ${L===b?"bg-raised text-ink":"text-dim"}`,children:[o.jsx("span",{className:L===b?"text-accent":"text-faint",children:V.icon}),o.jsx("span",{className:"flex-1 truncate text-sm font-medium",children:V.label}),V.hint&&o.jsx("span",{className:"shrink-0 font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:V.hint}),L===b&&o.jsx(l5,{size:13,className:"shrink-0 text-faint"})]},V.id))}),o.jsxs("div",{className:"flex items-center gap-4 border-t border-line px-4 py-2 font-mono text-[10px] text-faint",children:[o.jsxs("span",{children:["↑↓ ",a("palette.footer.navigate")]}),o.jsxs("span",{children:["↵ ",a("palette.footer.select")]}),o.jsxs("span",{className:"ml-auto",children:["⌘K ",a("palette.footer.anywhere")]})]})]})})},I7=Th.filter(t=>t.group!=="account").map(t=>t.path),M7=({children:t,onLogout:e,diamondBalance:n,isSubscriber:s,onTopUp:a,onReplayOnboarding:c,userName:u,userEmail:h})=>{var b,x;const m=rs(),p=I7.some(w=>m.pathname===w||m.pathname.startsWith(w+"/"));return o.jsxs("div",{"data-app-layout":!0,className:"flex min-h-screen flex-col bg-base",style:{"--mobile-nav-height":"0px"},children:[o.jsx(x7,{}),o.jsx(j7,{diamondBalance:n,isSubscriber:s,userName:u,userEmail:h,onTopUp:a,onLogout:e,onOpenPalette:UC}),o.jsx("main",{className:"flex-1 overflow-x-hidden",children:o.jsx("div",{className:p?"h-full px-4 pt-4 pb-[calc(1rem+var(--mobile-nav-height,0px))] sm:px-6":"mx-auto max-w-6xl px-4 pt-8 pb-[calc(2rem+var(--mobile-nav-height,0px))] sm:px-6",children:p?o.jsx(fn.Fragment,{children:o.jsx(g7,{path:m.pathname,sourceUrl:(b=m.state)==null?void 0:b.sourceUrl,children:t})},`${m.pathname}:${((x=m.state)==null?void 0:x.sourceUrl)??""}`):t})}),o.jsx(R7,{isSubscriber:s,onTopUp:a,onLogout:e,onReplayOnboarding:c}),o.jsx(KM,{}),o.jsx(A7,{})]})},sT="fashio.billingCatalog.",P7=600*1e3,Ds=class Ds{static async getPurchaseEligibility(){try{const n=await ct(ut,"getWebSubscriptionPurchaseEligibility")({});return(n==null?void 0:n.data)||null}catch(e){return console.error("getPurchaseEligibility error:",e.code,e.message),null}}static readCachedCatalog(e){try{const n=sessionStorage.getItem(`${sT}${e}`);if(!n)return null;const{at:s,value:a}=JSON.parse(n);return!s||Date.now()-s>P7?null:a}catch{return null}}static writeCachedCatalog(e,n){try{sessionStorage.setItem(`${sT}${e}`,JSON.stringify({at:Date.now(),value:n}))}catch{}}static getCachedBillingCatalog(e="all"){return Ds.readCachedCatalog("all")??Ds.readCachedCatalog(e)}static async getBillingCatalog(e="all"){const n=Ds.getCachedBillingCatalog(e);return n||(Ds.catalogRequest||(Ds.catalogRequest=Ds.fetchBillingCatalog().finally(()=>{Ds.catalogRequest=null})),Ds.catalogRequest)}static async fetchBillingCatalog(){try{const n=await ct(ut,"getWebBillingCatalog")({kind:"all"}),s=(n==null?void 0:n.data)||null;return s&&Ds.writeCachedCatalog("all",s),s}catch(e){return console.error("getBillingCatalog error:",e.code,e.message),null}}static async createMembershipCheckoutIntent(e){try{const s=await ct(ut,"createWebMembershipCheckoutIntent")({plan:e.plan,email:e.email||null,provider:e.provider||null});return(s==null?void 0:s.data)||null}catch(n){return console.error("createMembershipCheckoutIntent error:",n.code,n.message),null}}static async createCreditsCheckoutIntent(e){try{const s=await ct(ut,"createWebCreditsCheckoutIntent")({amount:e.amount,email:e.email||null,provider:e.provider||null});return(s==null?void 0:s.data)||null}catch(n){return console.error("createCreditsCheckoutIntent error:",n.code,n.message),null}}static async createBillingManagementPortalLink(){try{const n=await ct(ut,"createWebBillingManagementPortalLink")({});return(n==null?void 0:n.data)||null}catch(e){return console.error("createBillingManagementPortalLink error:",e.code,e.message),null}}static openPopup(e,n="billing_checkout"){return window.open(e,n,"popup=yes,width=560,height=760,menubar=no,toolbar=no,location=no,status=no")}static openPendingPopup(e,n){const s=Ds.openPopup("about:blank",n);if(s)try{s.document.title=e,s.document.body.textContent=e}catch{}return s}};Ds.catalogRequest=null;let $t=Ds;const An=({children:t,variant:e="primary",size:n="md",isLoading:s=!1,fullWidth:a=!1,className:c="",disabled:u,...h})=>{const m=De(),p="inline-flex items-center justify-center rounded-xl font-medium transition-[background-color,opacity,transform] duration-200 active:scale-95 disabled:opacity-50 disabled:pointer-events-none focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong",b={sm:"px-3.5 py-2 text-sm",md:"px-5 py-3"},x={primary:"bg-ink text-base hover:opacity-90",secondary:"bg-raised text-ink hover:bg-overlay border border-line",outline:"border border-line-strong text-ink bg-surface hover:bg-raised",ghost:"text-dim hover:bg-raised hover:text-ink"};return o.jsx("button",{className:`${p} ${b[n]} ${x[e]} ${a?"w-full":""} ${c}`,disabled:u||s,...h,children:s?o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsxs("svg",{className:"animate-spin h-4 w-4",viewBox:"0 0 24 24",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4",fill:"none"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),m("common.processing")]}):t})};function D7(){const[t,e]=v.useState(null);return v.useEffect(()=>{PS(),e(Ep())},[]),t?o.jsx(FC,{photo:t.url}):null}function O7(){const t=b7();return t?o.jsx(FC,{photo:t}):null}function FC({photo:t}){const e=De();return o.jsxs("div",{className:"flex items-center gap-3 rounded-2xl border border-accent/20 bg-accent-soft p-3 text-start",children:[o.jsxs("div",{className:"relative shrink-0",children:[o.jsx("img",{src:t,alt:e("flow.ready"),className:"h-16 w-16 rounded-xl bg-surface object-cover"}),o.jsx("span",{className:"absolute -bottom-1 -end-1 rounded-full bg-accent p-1 text-white",children:o.jsx(Cn,{size:12})})]}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-semibold text-ink",children:[o.jsx(us,{size:14,className:"shrink-0 text-accent"}),e("flow.ready")]}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-dim",children:e("flow.continue")})]})]})}const rT=["https://v3b.fal.media/files/b/0a89555e/faQ-Qvg84jKpj4FhXTrc8.png","https://v3b.fal.media/files/b/0a8d06fd/hYYBNQHl2uPQVWN54B2KI_history_result-min.png","https://v3b.fal.media/files/b/0a895575/zhqWhTudWI1M0KB0RyxIw.jpg","https://v3b.fal.media/files/b/0a89557f/QAGXYFIYuFw8XZyhwDCxh.jpg"],X_=({children:t,title:e,subt
4876itle:n})=>{const s=De(),[a,c]=v.useState(0);return v.useEffect(()=>{const u=setInterval(()=>{c(h=>(h+1)%rT.length)},5e3);return()=>clearInterval(u)},[]),o.jsxs("div",{className:"min-h-screen lg:h-screen lg:overflow-hidden flex bg-surface",children:[o.jsxs("div",{className:"hidden lg:block w-1/2 relative overflow-hidden bg-ink",children:[rT.map((u,h)=>o.jsxs("div",{className:`absolute inset-0 transition-opacity duration-1000 ease-in-out ${h===a?"opacity-100":"opacity-0"}`,children:[o.jsx("img",{src:u,alt:s("auth.slideAlt",{index:h+1}),className:"w-full h-full object-cover object-top"}),o.jsx("div",{className:"absolute inset-0 bg-black/10"})]},u)),o.jsxs("div",{className:"absolute bottom-12 right-12 bg-black/30 backdrop-blur-md border border-white/20 text-white px-5 py-3 rounded-full text-xs font-medium tracking-wide flex items-center gap-3 animate-fade-in z-10",children:[o.jsx("div",{className:"w-2.5 h-2.5 bg-green-400 rounded-full animate-pulse shadow-[0_0_8px_rgba(74,222,128,0.5)]"}),s("auth.badge")]})]}),o.jsxs("div",{className:"relative w-full lg:w-1/2 lg:h-full lg:overflow-y-auto flex px-4 pb-6 pt-20 sm:px-6 bg-raised/50",children:[o.jsx("div",{className:"absolute end-6 top-6 z-20",children:o.jsx(LC,{variant:"auth"})}
4876),o.jsxs("div",{className:"w-full max-w-md space-y-5 m-auto",children:[o.jsxs("div",{className:"text-center",children:[o.jsx("img",{src:"/logo2.webp",alt:s("auth.logoAlt"),width:480,height:104,className:"brand-mark mx-auto mb-4 h-8 w-auto"}),o.jsx("h1",{className:"text-2xl font-bold tracking-tight text-ink",children:e}),o.jsx("p",{className:"mt-1.5 text-sm text-dim",children:n})]}),o.jsx(D7,{}),o.jsx("div",{className:"bg-surface p-6 rounded-2xl shadow-sm border border-line",children:t})]})]})]})},zb="@firebase/remote-config",iT="0.8.0";/**
4877 * @license
4878 * Copyright 2019 Google LLC
4879 *
4880 * Licensed under the Apache License, Version 2.0 (the "License");
4881 * you may not use this file except in compliance with the License.
4882 * You may obtain a copy of the License at
4883 *
4884 *   http://www.apache.org/licenses/LICENSE-2.0
4885 *
4886 * Unless required by applicable law or agreed to in writing, software
4887 * distributed under the License is distributed on an "AS IS" BASIS,
4888 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4889 * See the License for the specific language governing permissions and
4890 * limitations under the License.
4891 */class VC{constructor(){this.listeners=[]}addEventListener(e){this.listeners.push(e)}abort(){this.listeners.forEach(e=>e())}}/**
4892 * @license
4893 * Copyright 2020 Google LLC
4894 *
4895 * Licensed under the Apache License, Version 2.0 (the "License");
4896 * you may not use this file except in compliance with the License.
4897 * You may obtain a copy of the License at
4898 *
4899 *   http://www.apache.org/licenses/LICENSE-2.0
4900 *
4901 * Unless required by applicable law or agreed to in writing, software
4902 * distributed under the License is distributed on an "AS IS" BASIS,
4903 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4904 * See the License for the specific language governing permissions and
4905 * limitations under the License.
4906 */const zC="remote-config",aT=100;/**
4907 * @license
4908 * Copyright 2019 Google LLC
4909 *
4910 * Licensed under the Apache License, Version 2.0 (the "License");
4911 * you may not use this file except in compliance with the License.
4912 * You may obtain a copy of the License at
4913 *
4914 *   http://www.apache.org/licenses/LICENSE-2.0
4915 *
4916 * Unless required by applicable law or agreed to in writing, software
4917 * distributed under the License is distributed on an "AS IS" BASIS,
4918 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4919 * See the License for the specific language governing permissions and
4920 * limitations under the License.
4921 */const L7={"already-initialized":"Remote Config already initialized","registration-window":"Undefined window object. This SDK only supports usage in a browser environment.","registration-project-id":"Undefined project identifier. Check Firebase app initialization.","registration-api-key":"Undefined API key. Check Firebase app initialization.","registration-app-id":"Undefined app identifier. Check Firebase app initialization.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}.","fetch-client-network":"Fetch client failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-timeout":'The config fetch request timed out.  Configure timeout using "fetchTimeoutMillis" SDK setting.',"fetch-throttle":'The config fetch request timed out while in an exponential backoff state. Configure timeout using "fetchTimeoutMillis" SDK setting. Unix timestamp in milliseconds when fetch request throttling ends: {$throttleEndTimeMillis}.',"fetch-client-parse":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","indexed-db-unavailable":"Indexed DB is not supported by current browser","custom-signal-max-allowed-signals":"Setting more than {$maxSignals} custom signals is not supported.","stream-error":"The stream was not able to connect to the backend: {$originalErrorMessage}.","realtime-unavailable":"The Realtime service is unavailable: {$originalErrorMessage}","update-message-invalid":"The stream invalidation message was unparsable: {$originalErrorMessage}","update-not-fetched":"Unable to fetch the latest config: {$originalErrorMessage}","analytics-unavailable":"Connection to Firebase Analytics failed: {$originalErrorMessage}"},hn=new fi("remoteconfig","Remote Config",L7);function U7(t,e){return t instanceof ds&&t.code.indexOf(e)!==-1}/**
4922 * @license
4923 * Copyright 2019 Google LLC
4924 *
4925 * Licensed under the Apache License, Version 2.0 (the "License");
4926 * you may not use this file except in compliance with the License.
4927 * You may obtain a copy of the License at
4928 *
4929 *   http://www.apache.org/licenses/LICENSE-2.0
4930 *
4931 * Unless required by applicable law or agreed to in writing, software
4932 * distributed under the License is distributed on an "AS IS" BASIS,
4933 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4934 * See the License for the specific language governing permissions and
4935 * limitations under the License.
4936 */const F7=!1,V7="",oT=0,z7=["1","true","t","yes","y","on"];class Bb{constructor(e,n=V7){this._source=e,this._value=n}asString(){return this._value}asBoolean(){return this._source==="static"?F7:z7.indexOf(this._value.toLowerCase())>=0}asNumber(){if(this._source==="static")return oT;let e=Number(this._value);return isNaN(e)&&(e=oT),e}getSource(){return this._source}}class B7{constructor(e){this.storage=e._storage,this.logger=e._logger,this.analyticsProvider=e._analyticsProvider}async updateActiveExperiments(e){const n=await this.storage.getActiveExperiments()||new Set,s=this.createExperimentInfoMap(e);return this.addActiveExperiments(s),this.removeInactiveExperiments(n,s),this.storage.setActiveExperiments(new Set(s.keys()))}createExperimentInfoMap(e){const n=new Map;for(const s of e)n.set(s.experimentId,s);return n}addActiveExperiments(e){const n={};for(const[s,a]of e.entries())n[`firebase${s}`]=a.variantId;this.addExperimentToAnalytics(n)}removeInactiveExperiments(e,n){const s={};for(const a of e)n.has(a)||(s[`firebase${a}`]=null);this.addExperimentToAnalytics(s)}addExperimentToAnalytics(e){if(Object.keys(e).length!==0)try{const n=this.analyticsProvider.getImmediate({optional:!0});n?(n.setUserProperties(e),n.logEvent("set_firebase_experiment_state")):this.logger.warn("Analytics import failed. Verify if you have imported Firebase Analytics in your app code.")}catch(n){throw hn.create("analytics-unavailable",{originalErrorMessage:n==null?void 0:n.message})}}}/**
4937 * @license
4938 * Copyright 2020 Google LLC
4939 *
4940 * Licensed under the Apache License, Version 2.0 (the "License");
4941 * you may not use this file except in compliance with the License.
4942 * You may obtain a copy of the License at
4943 *
4944 *   http://www.apache.org/licenses/LICENSE-2.0
4945 *
4946 * Unless required by applicable law or agreed to in writing, software
4947 * distributed under the License is distributed on an "AS IS" BASIS,
4948 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4949 * See the License for the specific language governing permissions and
4950 * limitations under the License.
4951 */function K7(t=ml(),e={}){var a,c;t=st(t);const n=ur(t,zC);if(n.isInitialized()){const u=n.getOptions();if(Qi(u,e))return n.getImmediate();throw hn.create("already-initialized")}n.initialize({options:e});const s=n.getImmediate();return e.initialFetchResponse&&(s._initializePromise=Promise.all([s._storage.setLastSuccessfulFetchResponse(e.initialFetchResponse),s._storage.setActiveConfigEtag(((a=e.initialFetchResponse)==null?void 0:a.eTag)||""),s._storage.setActiveConfigTemplateVersion(e.initialFetchResponse.templateVersion||0),s._storageCache.setLastSuccessfulFetchTimestampMillis(Date.now()),s._storageCache.setLastFetchStatus("success"),s._storageCache.setActiveConfig(((c=e.initialFetchResponse)==null?void 0:c.config)||{})]).then(),s._isInitializationComplete=!0),s}async function $7(t){const e=st(t),[n,s]=await Promise.all([e._storage.getLastSuccessfulFetchResponse(),e._storage.getActiveConfigEtag()]);if(!n||!n.config||!n.eTag||!n.templateVersion||n.eTag===s)return!1;const a=new B7(e),c=n.experiments?a.updateActiveExperiments(n.experiments):Promise.resolve();return await Promise.all([e._storageCache.setActiveConfig(n.config),e._storage.setActiveConfigEtag(n.eTag),e._storage.setActiveConfigTemplateVersion(n.templateVersion),c]),!0}function q7(t){const e=st(t);return e._initializePromise||(e._initializePromise=e._storageCache.loadFromStorage().then(()=>{e._isInitializationComplete=!0})),e._initializePromise}async function H7(t){const e=st(t),n=new VC;setTimeout(async()=>{n.abort()},e.settings.fetchTimeoutMillis);const s=e._storageCache.getCustomSignals();s&&e._logger.debug(`Fetching config with custom signals: ${JSON.stringify(s)}`);try{await e._client.fetch({cacheMaxAgeMillis:e.settings.minimumFetchIntervalMillis,signal:n,customSignals:s}),await e._storageCache.setLastFetchStatus("success")}catch(a){const c=U7(a,"fetch-throttle")?"throttle":"failure";throw await e._storageCache.setLastFetchStatus(c),a}}function hm(t,e){return Q_(st(t),e).asBoolean()}function lT(t,e){return Q_(st(t),e).asNumber()}function Ko(t,e){return Q_(st(t),e).asString()}function Q_(t,e){const n=st(t);n._isInitializationComplete||n._logger.debug(`A value was requested for key "${e}" before SDK initialization completed. Await on ensureInitialized if the intent was to get a previously activated value.`);const s=n._storageCache.getActiveConfig();return s&&s[e]!==void 0?new Bb("remote",s[e]):n.defaultConfig&&n.defaultConfig[e]!==void 0?new Bb("default",String(n.defaultConfig[e])):(n._logger.debug(`Returning static value for key "${e}". Define a default or remote value if this is unintentional.`),new Bb("static"))}/**
4952 * @license
4953 * Copyright 2019 Google LLC
4954 *
4955 * Licensed under the Apache License, Version 2.0 (the "License");
4956 * you may not use this file except in compliance with the License.
4957 * You may obtain a copy of the License at
4958 *
4959 *   http://www.apache.org/licenses/LICENSE-2.0
4960 *
4961 * Unless required by applicable law or agreed to in writing, software
4962 * distributed under the License is distributed on an "AS IS" BASIS,
4963 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4964 * See the License for the specific language governing permissions and
4965 * limitations under the License.
4966 */class G7{constructor(e,n,s,a){this.client=e,this.storage=n,this.storageCache=s,this.logger=a}isCachedDataFresh(e,n){if(!n)return this.logger.debug("Config fetch cache check. Cache unpopulated."),!1;const s=Date.now()-n,a=s<=e;return this.logger.debug(`Config fetch cache check. Cache age millis: ${s}. Cache max age millis (minimumFetchIntervalMillis setting): ${e}. Is cache hit: ${a}.`),a}async fetch(e){const[n,s]=await Promise.all([this.storage.getLastSuccessfulFetchTimestampMillis(),this.storage.getLastSuccessfulFetchResponse()]);if(s&&this.isCachedDataFresh(e.cacheMaxAgeMillis,n))return s;e.eTag=s&&s.eTag;const a=await this.client.fetch(e),c=[this.storageCache.setLastSuccessfulFetchTimestampMillis(Date.now())];return a.status===200&&c.push(this.storage.setLastSuccessfulFetchResponse(a)),await Promise.all(c),a}}/**
4967 * @license
4968 * Copyright 2019 Google LLC
4969 *
4970 * Licensed under the Apache License, Version 2.0 (the "License");
4971 * you may not use this file except in compliance with the License.
4972 * You may obtain a copy of the License at
4973 *
4974 *   http://www.apache.org/licenses/LICENSE-2.0
4975 *
4976 * Unless required by applicable law or agreed to in writing, software
4977 * distributed under the License is distributed on an "AS IS" BASIS,
4978 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4979 * See the License for the specific language governing permissions and
4980 * limitations under the License.
4981 */function Y7(t=navigator){return t.languages&&t.languages[0]||t.language}/**
4982 * @license
4983 * Copyright 2019 Google LLC
4984 *
4985 * Licensed under the Apache License, Version 2.0 (the "License");
4986 * you may not use this file except in compliance with the License.
4987 * You may obtain a copy of the License at
4988 *
4989 *   http://www.apache.org/licenses/LICENSE-2.0
4990 *
4991 * Unless required by applicable law or agreed to in writing, software
4992 * distributed under the License is distributed on an "AS IS" BASIS,
4993 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4994 * See the License for the specific language governing permissions and
4995 * limitations under the License.
4996 */class W7{constructor(e,n,s,a,c,u){this.firebaseInstallations=e,this.sdkVersion=n,this.namespace=s,this.projectId=a,this.apiKey=c,this.appId=u}async fetch(e){const[n,s]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken()]),c=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfig.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}:fetch?key=${this.apiKey}`,u={"Content-Type":"application/json","Content-Encoding":"gzip","If-None-Match":e.eTag||"*"},h={sdk_version:this.sdkVersion,app_instance_id:n,app_instance_id_token:s,app_id:this.appId,language_code:Y7(),custom_signals:e.customSignals},m={method:"POST",headers:u,body:JSON.stringify(h)},p=fetch(c,m),b=new Promise((V,L)=>{e.signal.addEventListener(()=>{const Y=new Error("The operation was aborted.");Y.name="AbortError",L(Y)})});let x;try{await Promise.race([p,b]),x=await p}catch(V){let L="fetch-client-network";throw(V==null?void 0:V.name)==="AbortError"&&(L="fetch-timeout"),hn.create(L,{originalErrorMessage:V==null?void 0:V.message})}let w=x.status;const T=x.headers.get("ETag")||void 0;let N,j,A,F;if(x.status===200){let V;try{V=await x.json()}catch(L){throw hn.create("fetch-client-parse",{originalErrorMessage:L==null?void 0:L.message})}N=V.entries,j=V.state,A=V.templateVersion,F=V.experimentDescriptions}if(j==="INSTANCE_STATE_UNSPECIFIED"?w=500:j==="NO_CHANGE"?w=304:(j==="NO_TEMPLATE"||j==="EMPTY_CONFIG")&&(N={},F=[]),w!==304&&w!==200)throw hn.create("fetch-status",{httpStatus:w});return{status:w,eTag:T,config:N,templateVersion:A,experiments:F}}}/**
4997 * @license
4998 * Copyright 2019 Google LLC
4999 *
5000 * Licensed under the Apache License, Version 2.0 (the "License");
5001 * you may not use this file except in compliance with the License.
5002 * You may obtain a copy of the License at
5003 *
5004 *   http://www.apache.org/licenses/LICENSE-2.0
5005 *
5006 * Unless required by applicable law or agreed to in writing, software
5007 * distributed under the License is distributed on an "AS IS" BASIS,
5008 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5009 * See the License for the specific language governing permissions and
5010 * limitations under the License.
5011 */function X7(t,e){return new Promise((n,s)=>{const a=Math.max(e-Date.now(),0),c=setTimeout(n,a);t.addEventListener(()=>{clearTimeout(c),s(hn.create("fetch-throttle",{throttleEndTimeMillis:e}))})})}function Q7(t){if(!(t instanceof ds)||!t.customData)return!1;const e=Number(t.customData.httpStatus);return e===429||e===500||e===503||e===504}class J7{constructor(e,n){this.client=e,this.storage=n}async fetch(e){const n=await this.storage.getThrottleMetadata()||{backoffCount:0,throttleEndTimeMillis:Date.now()};return this.attemptFetch(e,n)}async attemptFetch(e,{throttleEndTimeMillis:n,backoffCount:s}){await X7(e.signal,n);try{const a=await this.client.fetch(e);return await this.storage.deleteThrottleMetadata(),a}catch(a){if(!Q7(a))throw a;const c={throttleEndTimeMillis:Date.now()+qd(s),backoffCount:s+1};return await this.storage.setThrottleMetadata(c),this.attemptFetch(e,c)}}}/**
5012 * @license
5013 * Copyright 2019 Google LLC
5014 *
5015 * Licensed under the Apache License, Version 2.0 (the "License");
5016 * you may not use this file except in compliance with the License.
5017 * You may obtain a copy of the License at
5018 *
5019 *   http://www.apache.org/licenses/LICENSE-2.0
5020 *
5021 * Unless required by applicable law or agreed to in writing, software
5022 * distributed under the License is distributed on an "AS IS" BASIS,
5023 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5024 * See the License for the specific language governing permissions and
5025 * limitations under the License.
5026 */const Z7=60*1e3,eB=720*60*1e3;class tB{get fetchTimeMillis(){return this._storageCache.getLastSuccessfulFetchTimestampMillis()||-1}get lastFetchStatus(){return this._storageCache.getLastFetchStatus()||"no-fetch-yet"}constructor(e,n,s,a,c,u,h){this.app=e,this._client=n,this._storageCache=s,this._storage=a,this._logger=c,this._realtimeHandler=u,this._analyticsProvider=h,this._isInitializationComplete=!1,this.settings={fetchTimeoutMillis:Z7,minimumFetchIntervalMillis:eB},this.defaultConfig={}}}/**
5027 * @license
5028 * Copyright 2019 Google LLC
5029 *
5030 * Licensed under the Apache License, Version 2.0 (the "License");
5031 * you may not use this file except in compliance with the License.
5032 * You may obtain a copy of the License at
5033 *
5034 *   http://www.apache.org/licenses/LICENSE-2.0
5035 *
5036 * Unless required by applicable law or agreed to in writing, software
5037 * distributed under the License is distributed on an "AS IS" BASIS,
5038 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5039 * See the License for the specific language governing permissions and
5040 * limitations under the License.
5041 */function Om(t,e){const n=t.target.error||void 0;return hn.create(e,{originalErrorMessage:n&&(n==null?void 0:n.message)})}const za="app_namespace_store",nB="firebase_remote_config",sB=1;function rB(){return new Promise((t,e)=>{try{const n=indexedDB.open(nB,sB);n.onerror=s=>{e(Om(s,"storage-open"))},n.onsuccess=s=>{t(s.target.result)},n.onupgradeneeded=s=>{const a=s.target.result;switch(s.oldVersion){case 0:a.createObjectStore(za,{keyPath:"compositeKey"})}}}catch(n){e(hn.create("storage-open",{originalErrorMessage:n==null?void 0:n.message}))}})}class BC{getLastFetchStatus(){return this.get("last_fetch_status")}setLastFetchStatus(e){return this.set("last_fetch_status",e)}getLastSuccessfulFetchTimestampMillis(){return this.get("last_successful_fetch_timestamp_millis")}setLastSuccessfulFetchTimestampMillis(e){return this.set("last_successful_fetch_timestamp_millis",e)}getLastSuccessfulFetchResponse(){return this.get("last_successful_fetch_response")}setLastSuccessfulFetchResponse(e){return this.set("last_successful_fetch_response",e)}getActiveConfig(){return this.get("active_config")}setActiveConfig(e){return this.set("active_config",e)}getActiveConfigEtag(){return this.get("active_config_etag")}setActiveConfigEtag(e){return this.set("active_config_etag",e)}getActiveExperiments(){return this.get("active_experiments")}setActiveExperiments(e){return this.set("active_experiments",e)}getThrottleMetadata(){return this.get("throttle_metadata")}setThrottleMetadata(e){return this.set("throttle_metadata",e)}deleteThrottleMetadata(){return this.delete("throttle_metadata")}getCustomSignals(){return this.get("custom_signals")}getRealtimeBackoffMetadata(){return this.get("realtime_backoff_metadata")}setRealtimeBackoffMetadata(e){return this.set("realtime_backoff_metadata",e)}getActiveConfigTemplateVersion(){return this.get("last_known_template_version")}setActiveConfigTemplateVersion(e){return this.set("last_known_template_version",e)}}class iB extends BC{constructor(e,n,s,a=rB()){super(),this.appId=e,this.appName=n,this.namespace=s,this.openDbPromise=a}async setCustomSignals(e){const s=(await this.openDbPromise).transaction([za],"readwrite"),a=await this.getWithTransaction("custom_signals",s),c=KC(e,a||{});return await this.setWithTransaction("custom_signals",c,s),c}async getWithTransaction(e,n){return new Promise((s,a)=>{const c=n.objectStore(za),u=this.createCompositeKey(e);try{const h=c.get(u);h.onerror=m=>{a(Om(m,"storage-get"))},h.onsuccess=m=>{const p=m.target.result;s(p?p.value:void 0)}}catch(h){a(hn.create("storage-get",{originalErrorMessage:h==null?void 0:h.message}))}})}async setWithTransaction(e,n,s){return new Promise((a,c)=>{const u=s.objectStore(za),h=this.createCompositeKey(e);try{const m=u.put({compositeKey:h,value:n});m.onerror=p=>{c(Om(p,"storage-set"))},m.onsuccess=()=>{a()}}catch(m){c(hn.create("storage-set",{originalErrorMessage:m==null?void 0:m.message}))}})}async get(e){const s=(await this.openDbPromise).transaction([za],"readonly");return this.getWithTransaction(e,s)}async set(e,n){const a=(await this.openDbPromise).transaction([za],"readwrite");return this.setWithTransaction(e,n,a)}async delete(e){const n=await this.openDbPromise;return new Promise((s,a)=>{const u=n.transaction([za],"readwrite").objectStore(za),h=this.createCompositeKey(e);try{const m=u.delete(h);m.onerror=p=>{a(Om(p,"storage-delete"))},m.onsuccess=()=>{s()}}catch(m){a(hn.create("storage-delete",{originalErrorMessage:m==null?void 0:m.message}))}})}createCompositeKey(e){return[this.appId,this.appName,this.namespace,e].join()}}class aB extends BC{constructor(){super(...arguments),this.storage={}}async get(e){return Promise.resolve(this.storage[e])}async set(e,n){return this.storage[e]=n,Promise.resolve(void 0)}async delete(e){return this.storage[e]=void 0,Promise.resolve()}async setCustomSignals(e){const n=this.storage.custom_signals||{};return this.storage.custom_signals=KC(e,n),Promise.resolve(this.storage.custom_signals)}}function KC(t,e){const n={...e,...t},s=Object.fromEntries(Object.entries(n).filter(([a,c])=>c!==null).map(([a,c])=>typeof c=="number"?[a,c.toString()]:[a,c]));if(Object.keys(s).length>
5041aT)throw hn.create("custom-signal-max-allowed-signals",{maxSignals:aT});return s}/**
5042 * @license
5043 * Copyright 2019 Google LLC
5044 *
5045 * Licensed under the Apache License, Version 2.0 (the "License");
5046 * you may not use this file except in compliance with the License.
5047 * You may obtain a copy of the License at
5048 *
5049 *   http://www.apache.org/licenses/LICENSE-2.0
5050 *
5051 * Unless required by applicable law or agreed to in writing, software
5052 * distributed under the License is distributed on an "AS IS" BASIS,
5053 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5054 * See the License for the specific language governing permissions and
5055 * limitations under the License.
5056 */class oB{constructor(e){this.storage=e}getLastFetchStatus(){return this.lastFetchStatus}getLastSuccessfulFetchTimestampMillis(){return this.lastSuccessfulFetchTimestampMillis}getActiveConfig(){return this.activeConfig}getCustomSignals(){return this.customSignals}async loadFromStorage(){const e=this.storage.getLastFetchStatus(),n=this.storage.getLastSuccessfulFetchTimestampMillis(),s=this.storage.getActiveConfig(),a=this.storage.getCustomSignals(),c=await e;c&&(this.lastFetchStatus=c);const u=await n;u&&(this.lastSuccessfulFetchTimestampMillis=u);const h=await s;h&&(this.activeConfig=h);const m=await a;m&&(this.customSignals=m)}setLastFetchStatus(e){return this.lastFetchStatus=e,this.storage.setLastFetchStatus(e)}setLastSuccessfulFetchTimestampMillis(e){return this.lastSuccessfulFetchTimestampMillis=e,this.storage.setLastSuccessfulFetchTimestampMillis(e)}setActiveConfig(e){return this.activeConfig=e,this.storage.setActiveConfig(e)}async setCustomSignals(e){this.customSignals=await this.storage.setCustomSignals(e)}}/**
5057 * @license
5058 * Copyright 2025 Google LLC
5059 *
5060 * Licensed under the Apache License, Version 2.0 (the "License");
5061 * you may not use this file except in compliance with the License.
5062 * You may obtain a copy of the License at
5063 *
5064 *   http://www.apache.org/licenses/LICENSE-2.0
5065 *
5066 * Unless required by applicable law or agreed to in writing, software
5067 * distributed under the License is distributed on an "AS IS" BASIS,
5068 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5069 * See the License for the specific language governing permissions and
5070 * limitations under the License.
5071 */class lB{constructor(e){this.allowedEvents_=e,this.listeners_={},Nx(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...n){if(Array.isArray(this.listeners_[e])){const s=[...this.listeners_[e]];for(let a=0;a<s.length;a++)s[a].callback.apply(s[a].context,n)}}on(e,n,s){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:n,context:s});const a=this.getInitialEvent(e);a&&n.apply(s,a)}off(e,n,s){this.validateEventType_(e);const a=this.listeners_[e]||[];for(let c=0;c<a.length;c++)if(a[c].callback===n&&(!s||s===a[c].context)){a.splice(c,1);return}}validateEventType_(e){Nx(this.allowedEvents_.find(n=>n===e),"Unknown event: "+e)}}/**
5072 * @license
5073 * Copyright 2025 Google LLC
5074 *
5075 * Licensed under the Apache License, Version 2.0 (the "License");
5076 * you may not use this file except in compliance with the License.
5077 * You may obtain a copy of the License at
5078 *
5079 *   http://www.apache.org/licenses/LICENSE-2.0
5080 *
5081 * Unless required by applicable law or agreed to in writing, software
5082 * distributed under the License is distributed on an "AS IS" BASIS,
5083 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5084 * See the License for the specific language governing permissions and
5085 * limitations under the License.
5086 */class J_ extends lB{static getInstance(){return new J_}constructor(){super(["visible"]);let e,n;typeof document<"u"&&typeof document.addEventListener<"u"&&(typeof document.hidden<"u"?(n="visibilitychange",e="hidden"):typeof document.mozHidden<"u"?(n="mozvisibilitychange",e="mozHidden"):typeof document.msHidden<"u"?(n="msvisibilitychange",e="msHidden"):typeof document.webkitHidden<"u"&&(n="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,n&&document.addEventListener(n,()=>{const s=!document[e];s!==this.visible_&&(this.visible_=s,this.trigger("visible",s))},!1)}getInitialEvent(e){return Nx(e==="visible","Unknown event type: "+e),[this.visible_]}}/**
5087 * @license
5088 * Copyright 2025 Google LLC
5089 *
5090 * Licensed under the Apache License, Version 2.0 (the "License");
5091 * you may not use this file except in compliance with the License.
5092 * You may obtain a copy of the License at
5093 *
5094 *   http://www.apache.org/licenses/LICENSE-2.0
5095 *
5096 * Unless required by applicable law or agreed to in writing, software
5097 * distributed under the License is distributed on an "AS IS" BASIS,
5098 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5099 * See the License for the specific language governing permissions and
5100 * limitations under the License.
5101 */const cB="X-Goog-Api-Key",uB="X-Goog-Firebase-Installations-Auth",Kb=8,cT=3,uT=-1,dT=0,hT="featureDisabled",fT="retryIntervalSeconds",mT="latestTemplateVersionNumber";class dB{constructor(e,n,s,a,c,u,h,m,p,b){this.firebaseInstallations=e,this.storage=n,this.sdkVersion=s,this.namespace=a,this.projectId=c,this.apiKey=u,this.appId=h,this.logger=m,this.storageCache=p,this.cachingClient=b,this.observers=new Set,this.isConnectionActive=!1,this.isRealtimeDisabled=!1,this.httpRetriesRemaining=Kb,this.isInBackground=!1,this.decoder=new TextDecoder("utf-8"),this.isClosingConnection=!1,this.propagateError=x=>this.observers.forEach(w=>{var T;return(T=w.error)==null?void 0:T.call(w,x)}),this.isStatusCodeRetryable=x=>!x||[408,429,502,503,504].includes(x),this.setRetriesRemaining(),J_.getInstance().on("visible",this.onVisibilityChange,this)}async setRetriesRemaining(){const e=await this.storage.getRealtimeBackoffMetadata(),n=(e==null?void 0:e.numFailedStreams)||0;this.httpRetriesRemaining=Math.max(Kb-n,1)}async updateBackoffMetadataWithLastFailedStreamConnectionTime(e){var a;const n=(((a=await this.storage.getRealtimeBackoffMetadata())==null?void 0:a.numFailedStreams)||0)+1,s=qd(n,6e4,2);await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:new Date(e.getTime()+s),numFailedStreams:n})}async updateBackoffMetadataWithRetryInterval(e){const n=Date.now(),s=e*1e3,a=new Date(n+s);await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:a,numFailedStreams:0}),await this.retryHttpConnectionWhenBackoffEnds()}async closeRealtimeHttpConnection(){if(!this.isClosingConnection){this.isClosingConnection=!0;try{this.reader&&await this.reader.cancel()}catch{this.logger.debug("Failed to cancel the reader, connection was lost.")}finally{this.reader=void 0}this.controller&&(await this.controller.abort(),this.controller=void 0),this.isClosingConnection=!1}}async resetRealtimeBackoff(){await this.storage.setRealtimeBackoffMetadata({backoffEndTimeMillis:new Date(-1),numFailedStreams:0})}resetRetryCount(){this.httpRetriesRemaining=Kb}async establishRealtimeConnection(e,n,s,a){const c=await this.storage.getActiveConfigEtag(),u=await this.storage.getActiveConfigTemplateVersion(),h={[cB]:this.apiKey,[uB]:s,"Content-Type":"application/json",Accept:"application/json","If-None-Match":c||"*","Content-Encoding":"gzip"},m={project:this.projectId,namespace:this.namespace,lastKnownVersionNumber:u,appId:this.appId,sdkVersion:this.sdkVersion,appInstanceId:n};return await fetch(e,{method:"POST",headers:h,body:JSON.stringify(m),signal:a})}getRealtimeUrl(){const n=`${window.FIREBASE_REMOTE_CONFIG_URL_BASE||"https://firebaseremoteconfigrealtime.googleapis.com"}/v1/projects/${this.projectId}/namespaces/${this.namespace}
5101:streamFetchInvalidations?key=${this.apiKey}`;return new URL(n)}async createRealtimeConnection(){const[e,n]=await Promise.all([this.firebaseInstallations.getId(),this.firebaseInstallations.getToken(!1)]);this.controller=new AbortController;const s=this.getRealtimeUrl();return await this.establishRealtimeConnection(s,e,n,this.controller.signal)}async retryHttpConnectionWhenBackoffEnds(){let e=await this.storage.getRealtimeBackoffMetadata();e||(e={backoffEndTimeMillis:new Date(uT),numFailedStreams:dT});const n=new Date(e.backoffEndTimeMillis).getTime(),s=Date.now(),a=Math.max(0,n-s);await this.makeRealtimeHttpConnection(a)}setIsHttpConnectionRunning(e){this.isConnectionActive=e}checkAndSetHttpConnectionFlagIfNotRunning(){const e=this.canEstablishStreamConnection();return e&&this.setIsHttpConnectionRunning(!0),e}fetchResponseIsUpToDate(e,n){return e.config!=null&&e.templateVersion?e.templateVersion>=n:this.storageCache.getLastFetchStatus()==="success"}parseAndValidateConfigUpdateMessage(e){const n=e.indexOf("{"),s=e.indexOf("}",n);return n<0||s<0||n>=s?"":e.substring(n,s+1)}isEventListenersEmpty(){return this.observers.size===0}getRandomInt(e){return Math.floor(Math.random()*e)}executeAllListenerCallbacks(e){this.observers.forEach(n=>n.next(e))}getChangedParams(e,n){const s=new Set,a=new Set(Object.keys(e||{})),c=new Set(Object.keys(n||{}));for(const u of a)(!c.has(u)||e[u]!==n[u])&&s.add(u);for(const u of c)a.has(u)||s.add(u);return s}async fetchLatestConfig(e,n){const s=e-1,a=cT-s,c=this.storageCache.getCustomSignals();c&&this.logger.debug(`Fetching config with custom signals: ${JSON.stringify(c)}`);const u=new VC;try{const h={cacheMaxAgeMillis:0,signal:u,customSignals:c,fetchType:"REALTIME",fetchAttempt:a},m=await this.cachingClient.fetch(h);let p=await this.storage.getActiveConfig();if(!this.fetchResponseIsUpToDate(m,n)){this.logger.debug("Fetched template version is the same as SDK's current version. Retrying fetch."),await this.autoFetch(s,n);return}if(m.config==null){this.logger.debug("The fetch succeeded, but the backend had no updates.");return}p==null&&(p={});const b=this.getChangedParams(m.config,p);if(b.size===0){this.logger.debug("Config was fetched, but no params changed.");return}const x={getUpdatedKeys(){return new Set(b)}};this.executeAllListenerCallbacks(x)}catch(h){const m=h instanceof Error?h.message:String(h),p=hn.create("update-not-fetched",{originalErrorMessage:`Failed to auto-fetch config update: ${m}`});this.propagateError(p)}}async autoFetch(e,n){if(e===0){const c=hn.create("update-not-fetched",{originalErrorMessage:"Unable to fetch the latest version of the template."});this.propagateError(c);return}const a=this.getRandomInt(4)*1e3;await new Promise(c=>setTimeout(c,a)),await this.fetchLatestConfig(e,n)}async handleNotifications(e){let n,s="";for(;;){const{done:a,value:c}=await e.read();if(a)break;if(n=this.decoder.decode(c,{stream:!0}),s+=n,n.includes("}")){if(s=this.parseAndValidateConfigUpdateMessage(s),s.length===0)continue;try{const u=JSON.parse(s);if(this.isEventListenersEmpty())break;if(hT in u&&u[hT]===!0){const h=hn.create("realtime-unavailable",{originalErrorMessage:"The server is temporarily unavailable. Try again in a few minutes."});this.propagateError(h);break}if(mT in u){const h=await this.storage.getActiveConfigTemplateVersion(),m=Number(u[mT]);h&&m>h&&await this.autoFetch(cT,m)}if(fT in u){const h=Number(u[fT]);await this.updateBackoffMetadataWithRetryInterval(h)}}catch(u){this.logger.debug("Unable to parse latest config update message.",u);const h=u instanceof Error?u.message:String(u);this.propagateError(hn.create("update-message-invalid",{originalErrorMessage:h}))}s=""}}}async listenForNotifications(e){try{await this.handleNotifications(e)}catch{this.isInBackground||this.logger.debug("Real-time connection was closed due to an exception.")}}async prepareAndBeginRealtimeHttpStream(){if(!this.checkAndSetHttpConnectionFlagIfNotRunning())return;let e=await this.storage.getRealtimeBackoffMetadata();e||(e={backoffEndTimeMillis:new Date(uT),numFailedStreams:dT});const n=e.backoffEndTimeMillis.getTime();
5101if(Date.now()<n){await this.retryHttpConnectionWhenBackoffEnds();return}let s,a;try{if(s=await this.createRealtimeConnection(),a=s.status,s.ok&&s.body){this.resetRetryCount(),await this.resetRealtimeBackoff();const c=s.body.getReader();this.reader=c,await this.listenForNotifications(c)}}catch(c){this.isInBackground?this.resetRetryCount():this.logger.debug("Exception connecting to real-time RC backend. Retrying the connection...:",c)}finally{await this.closeRealtimeHttpConnection(),this.setIsHttpConnectionRunning(!1);const c=!this.isInBackground&&(a===void 0||this.isStatusCodeRetryable(a));if(c&&await this.updateBackoffMetadataWithLastFailedStreamConnectionTime(new Date),c||s!=null&&s.ok)await this.retryHttpConnectionWhenBackoffEnds();else{const u=`Unable to connect to the server. HTTP status code: ${a}`,h=hn.create("stream-error",{originalErrorMessage:u});this.propagateError(h)}}}canEstablishStreamConnection(){const e=this.observers.size>0,n=!this.isRealtimeDisabled,s=!this.isConnectionActive,a=!this.isInBackground;return e&&n&&s&&a}async makeRealtimeHttpConnection(e){if(this.canEstablishStreamConnection()){if(this.httpRetriesRemaining>0)this.httpRetriesRemaining--,await new Promise(n=>setTimeout(n,e)),this.prepareAndBeginRealtimeHttpStream();else if(!this.isInBackground){const n=hn.create("stream-error",{originalErrorMessage:"Unable to connect to the server. Check your connection and try again."});this.propagateError(n)}}}async beginRealtime(){this.observers.size>0&&await this.makeRealtimeHttpConnection(0)}addObserver(e){this.observers.add(e),this.beginRealtime()}removeObserver(e){this.observers.has(e)&&this.observers.delete(e)}async onVisibilityChange(e){this.isInBackground=!e,e?e&&await this.beginRealtime():await this.closeRealtimeHttpConnection()}}/**
5102 * @license
5103 * Copyright 2020 Google LLC
5104 *
5105 * Licensed under the Apache License, Version 2.0 (the "License");
5106 * you may not use this file except in compliance with the License.
5107 * You may obtain a copy of the License at
5108 *
5109 *   http://www.apache.org/licenses/LICENSE-2.0
5110 *
5111 * Unless required by applicable law or agreed to in writing, software
5112 * distributed under the License is distributed on an "AS IS" BASIS,
5113 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5114 * See the License for the specific language governing permissions and
5115 * limitations under the License.
5116 */function hB(){Yn(new Un(zC,t,"PUBLIC").setMultipleInstances(!0)),mn(zb,iT),mn(zb,iT,"esm2020");function t(e,{options:n}){const s=e.getProvider("app").getImmediate(),a=e.getProvider("installations-internal").getImmediate(),c=e.getProvider("analytics-internal"),{projectId:u,apiKey:h,appId:m}=s.options;if(!u)throw hn.create("registration-project-id");if(!h)throw hn.create("registration-api-key");if(!m)throw hn.create("registration-app-id");const p=(n==null?void 0:n.templateId)||"firebase",b=fh()?new iB(m,s.name,p):new aB,x=new oB(b),w=new su(zb);w.logLevel=ft.ERROR;const T=new W7(a,Zi,p,u,h,m),N=new J7(T,b),j=new G7(N,b,x,w),A=new dB(a,b,Zi,p,u,h,m,w,x,j),F=new tB(s,j,x,b,w,A,c);return q7(F),F}}/**
5117 * @license
5118 * Copyright 2020 Google LLC
5119 *
5120 * Licensed under the Apache License, Version 2.0 (the "License");
5121 * you may not use this file except in compliance with the License.
5122 * You may obtain a copy of the License at
5123 *
5124 *   http://www.apache.org/licenses/LICENSE-2.0
5125 *
5126 * Unless required by applicable law or agreed to in writing, software
5127 * distributed under the License is distributed on an "AS IS" BASIS,
5128 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5129 * See the License for the specific language governing permissions and
5130 * limitations under the License.
5131 */async function fB(t){return t=st(t),await H7(t),$7(t)}hB();const Zn=K7(xl);Zn.defaultConfig={paywall_enabled:!0,free_trial_days:7,onboarding_enabled:!1};Zn.settings.minimumFetchIntervalMillis=6e4;class bp{static async initialize(){try{await fB(Zn),console.log("Remote Config initialized")}catch(e){console.error("Error initializing Remote Config:",e)}}static get isPaywallEnabled(){return hm(Zn,"paywall_enabled")}static get isOnboardingEnabled(){return hm(Zn,"onboarding_enabled")}static get freeTrialDays(){return lT(Zn,"free_trial_days")}static get instagramUrl(){return Ko(Zn,"instagram_url")}static get facebookUrl(){return Ko(Zn,"facebook_url")}static get tiktokUrl(){return Ko(Zn,"tiktok_url")}static get termsOfServiceUrl(){return Ko(Zn,"terms_of_service_url")}static get privacyPolicyUrl(){return Ko(Zn,"privacy_policy_url")}
5131static get isFirebaseAnalyticsEnabled(){return hm(Zn,"analytics_firebase_enabled")}static getString(e){return Ko(Zn,e)}static getBoolean(e){return hm(Zn,e)}static getNumber(e){return lT(Zn,e)}static getJson(e){try{const n=Ko(Zn,e);return n?JSON.parse(n):null}catch(n){return console.error(`Error parsing JSON for key ${e}:`,n),null}}}const mB=!1;function $C(t){const e={};for(const[n,s]of Object.entries(t))s==null||s===""||typeof s=="number"&&Number.isNaN(s)||(e[n]=s);return e}function du(){if(typeof window>"u")return!1;const t=window.location.hostname;return t!=="localhost"&&t!=="127.0.0.1"&&t!==""}function ar(t,e={},n={}){const{onDelivered:s,timeoutMs:a=2500}=n;let c=!1;const u=()=>{c||(c=!0,s==null||s())};if(!(typeof window>"u")){if(!du()){u();return}try{const h=$C(e);window.dataLayer=window.dataLayer||[],s?(window.setTimeout(u,a),window.dataLayer.push({event:t,...h,eventCallback:u,eventTimeout:a})):window.dataLayer.push({event:t,...h}),mB&&window.gtag}catch{u()}}}function pT(t){ar("sign_up",{method:t})}function gT(t){ar("login",{method:t})}function pB(){ar("onboarding_complete")}function gB(t){ar("paywall_open",t)}function yB(t){ar("tool_detail_open",t)}function bB(t){ar("plan_selected",{currency:"USD",...t})}function Jc(t){const e=t.value||(t.content_category==="credits"?vB[String(qC(t.content_id))]:void 0);ar("begin_checkout",{currency:"USD",...t,value:e}),_B({...t,value:e})}const rh="ga4_pending_checkout",ov="fashio:checkout-started",xB=3600*1e3,vB={40:9.99,120:29.99,1200:129.99};function qC(t){const e=parseInt(t.replace(/^credits_/,""),10);return Number.isFinite(e)?e:0}function _B(t){if(typeof window>"u")return;const e=t.value??0,n={id:`${t.content_id}_${Date.now()}`,at:Date.now(),provider:t.provider,content_id:t.content_id,content_name:t.content_name,content_category:t.content_category,value:e,currency:t.currency??"USD"};try{window.localStorage.setItem(rh,JSON.stringify(n)),window.dispatchEvent(new Event(ov))}catch{}}function cg(){try{const t=window.localStorage.getItem(rh);if(!t)return null;const e=JSON.parse(t);return Date.now()-e.at>xB?(window.localStorage.removeItem(rh),null):e}catch{return null}}function wB(t){return window.addEventListener(ov,t),()=>window.removeEventListener(ov,t)}function EB(t){const e=cg();if(!(!e||e.baseline))try{window.localStorage.setItem(rh,JSON.stringify({...e,baseline:t}))}catch{}}function HC(t={}){var s;const e=cg();if(!e)return(s=t.onDelivered)==null||s.call(t),null;try{window.localStorage.removeItem(rh)}catch{}return SB({dedupe_key:e.id,transaction_id:t.transactionId||e.id,value:e.value,currency:e.currency,item_id:e.content_id,item_name:e.content_name,item_category:e.content_category,quantity:1},t.onDelivered)?e:null}function GC(t,e){if(!(t!=null&&t.baseline)||t.baseline.uid!==e.uid)return!1;const{baseline:n}=t,s=qC(t.content_id);return t.content_category==="membership"?e.isPremium&&!n.isPremium:s>0&&e.credits-n.credits>=s}function kB(t){return GC(cg(),t)?HC():null}function Li(t){ar("checkout_failed",{...t,plan:t.plan??"none"})}const TB="ga4_purchase_sent:";function SB(t,e){if(typeof window>"u")return!1;const{dedupe_key:n,transaction_id:s,value:a,currency:c="USD",item_id:u,item_name:h,item_category:m,quantity:p}=t,b=TB+(n||s||`${u??"unknown"}:${a??0}:${c}`);try{if(window.localStorage.getItem(b))return e==null||e(),!1;window.localStorage.setItem(b,String(Date.now()))}catch{}return ar("purchase",{transaction_id:s,value:a,currency:c,items:[$C({item_id:u,item_name:h,item_category:m,price:a,quantity:p})]},{onDelivered:e}),!0}function NB(){const t={};return document.cookie.split(";").forEach(e=>{const[n,...s]=e.trim().split("=");n&&(t[n]=decodeURIComponent(s.join("=")))}),{deviceId:t._fl_uid||null,sessionId:t._fl_sid||null,firstVisited:t._fl_fv||null,offerFirstVisit:t._fl_ofv||null,campaignFirst:t._fl_cf||null,sourceFirst:t._fl_sf||null,sourceLast:t._fl_sl||null,campaignLast:t._fl_cl||null}}const vp=class vp{static userFromFirebaseUser(e){return e?{uid:e.uid,email:e.email||void 0,createdAt:new Date().toISOString(),hasConsentedToDataProcessing:!1,diamondBalance:0,permanentDiamonds:0,subscriptionDiamonds:[],header:{},profilePhotos:[],hasCompletedAiOnboarding:!1,isPremium:!1,closetCount:0,isActive:!0,fcmTokens:[]}:null}static async createUser(){try{console.log("Creating user document in Firestore...");const e=ct(ut,"createUser"),n=NB(),s=await e({marketing:n});console.log("Create user result:",s.data)}catch(e){console.error("Cloud Function Error:",e.code,e.message)}}static async getUserMe(){var n;const e=(n=xt.currentUser)==null?void 0:n.uid;if(!e)return null;if(!this.userRequests.has(e)){const s=this.fetchUserMe().then(a=>{var c;return a&&((c=xt.currentUser)==null?void 0:c.uid)===e&&window.dispatchEvent(new CustomEvent("fashio:u
5131ser-updated",{detail:{uid:e,user:a}})),a}).finally(()=>this.userRequests.delete(e));this.userRequests.set(e,s)}return this.userRequests.get(e)}static async fetchUserMe(){try{const s=(await ct(ut,"getUser")({})).data;return(s==null?void 0:s.status)==="Success"&&s.user?s.user:null}catch(e){return console.error("getUserMe error:",e.code,e.message),null}}static async ensureUserDocumentExists(e){try{const n=si(sl,this.USERS_COLLECTION,e);(await rg(n)).exists()||await this.createUser()}catch(n){console.error("Error ensuring user document exists:",n),await this.createUser()}}static async signInAnonymously(){try{const e=await kO(xt);return e.user&&(console.log("Signed in anonymously UID:",e.user.uid),await this.ensureUserDocumentExists(e.user.uid)),e}catch(e){return console.error("Error signing in anonymously:",e),null}}static async signInWithEmailAndPassword(e,n){try{const s=await IO(xt,e,n);return s.user&&await this.ensureUserDocumentExists(s.user.uid),s}catch(s){throw console.error("Error signing in with email/password:",s),s}}static async registerWithEmailAndPassword(e,n){try{const s=await RO(xt,e,n);return s.user&&await this.ensureUserDocumentExists(s.user.uid),s}catch(s){throw console.error("Error registering with email/password:",s),s}}static async signInWithGoogle(){try{const e=await s6(xt,u7);return e.user&&await this.ensureUserDocumentExists(e.user.uid),e}catch(e){throw console.error("Error signing in with Google:",e),e}}static async signOut(){try{await LO(xt)}catch(e){console.error("Error signing out:",e)}}static onAuthStateChanged(e){return xt.onAuthStateChanged(e)}};vp.USERS_COLLECTION="users",vp.userRequests=new Map;let sa=vp;const jB={female:"model.gender.female",male:"model.gender.male",caucasian:"model.race.caucasian",east_asian:"model.race.eastAsian",south_asian:"model.race.southAsian",african:"model.race.african",hispanic:"model.race.hispanic",middle_eastern:"model.race.middleEastern",pacific_islander:"model.race.pacificIslander",athletic:"model.body.athletic",slim:"model.body.slim",average:"model.body.average",curvy:"model.body.curvy",plus_size:"model.body.plusSize",pear_shaped:"model.body.pearShaped"};function ug(t){const e=(t||"").trim();return e?e.toLowerCase().split(/[_\s-]+/).filter(Boolean).map(n=>n.charAt(0).toUpperCase()+n.slice(1)).join(" "):""}function lv(t){const e=(t||"").trim().toLowerCase();if(!e)return"";const n=jB[e];return n?Wa(n):ug(e)}function YC(t){const e=(t||"").replace(/\bmodels?\b/gi,"").trim();return ug(e)}function Vc(t){if(!t)return"";const e=(t.name||"").trim();if(e)return e;
5131const n=[lv(t.gender),(t.ageRange||"").trim(),lv(t.race)].filter(Boolean);return n.length?n.join(" · "):YC(t.character)}function yT(t){return t?[lv(t.bodyType),YC(t.character)].filter(Boolean).join(" · "):""}function zi(t,e=""){return t&&(t[Cd.current]||t.en||Object.values(t).find(Boolean))||e}function hu(t){return t?zi(t.displayNames,t.name||""):""}class Ld{static async getTemplateSets(e={}){var n;try{const a=await ct(ut,"getTemplateSets")(e);return(n=a.data)!=null&&n.success&&Array.isArray(a.data.sets)?{sets:a.data.sets,nextCursor:a.data.nextCursor??null}:{sets:[],nextCursor:null}}catch(s){return console.error("Error listing template sets:",s),{sets:[],nextCursor:null}}}static async getTemplateSetById(e){var n;try{const a=await ct(ut,"getTemplateSetById")({id:e});return(n=a.data)!=null&&n.success?a.data.set:null}catch(s){return console.error("Error getting template set:",s),null}}static async getTagLabels(){var e;try{const s=await ct(ut,"getTemplateTagLabels")({});return((e=s.data)==null?void 0:e.groups)??s.data??{}}catch(n){return console.error("Error getting tag labels:",n),{}}}static async createCatalogJob(e){var u,h;const n=e.garmentUrls.filter(Boolean);if(!n.length)throw new Error("At least one garment photo is required.");const s={styleId:"catalog_shoot",templateSetId:e.templateSetId,ratio:e.ratio??"3:4",imageFields:{garment_photos:n,garment_photo:n[0]}};(u=e.shotIds)!=null&&u.length&&(s.shotIds=e.shotIds);const c=await ct(ut,"createCatalogJob")(s);if(!((h=c.data)!=null&&h.mediaItemId))throw new Error("createCatalogJob returned no mediaItemId.");return c.data}}class AB extends Error{constructor(e,n){super("Your request was blocked by our content policy. Please revise your prompt and try again."),this.name="ContentModerationError",this.decision=e,this.reason=n}}class ih{static async moderatePrompt(e,n){var u;const s=typeof e=="string"?e.trim():"";if(!s)return{decision:"allow"};const c=`${((u=xt.currentUser)==null?void 0:u.uid)??"anon"}:${(n==null?void 0:n.jobType)??"generation"}:${Date.now()}`;try{const h=await fetch("/api/moderate",{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({prompt:s,externalId:c})});if(!h.ok)return{decision:"deny",reason:"moderation_network_error"};const m=await h.json(),p=(m==null?void 0:m.decision)==="allow"||(m==null?void 0:m.decision)==="flag"||(m==null?void 0:m.decision)==="deny"?m.decision:"deny";return{...m,decision:p}}catch(h){return console.error("[moderation] request failed",h),{decision:"deny",reason:"moderation_network_error"}}}static async assertAllowed(e,n){const s=await this.moderatePrompt(e,n);if(s.decision!=="allow")throw new AB(s.decision,s.reason)}}class nn{static async getFashionModels(e){try{const n=ct(ut,"getFashionModels"),s={...e};Object.keys(s).forEach(u=>s[u]===void 0&&delete s[u]);const c=(await n(s)).data;return c.success&&Array.isArray(c.data)?{models:c.data,nextPageToken:c.nextPageToken,hasMore:c.hasMore||!!c.nextPageToken,total:Number(c.count)||c.data.length}:Array.isArray(c)?{models:c,hasMore:!1,total:c.length}:{models:[],hasMore:!1,total:0}}catch(n){return console.error("Error getting fashion models:",n),{models:[],hasMore:!1,total:0}}}static async getFashionModelById(e){try{const s=await ct(ut,"getFashionModelById")({id:e});return s.data?s.data:null}catch(n){return console.error("Error getting fashion model by ID:",n),null}}static async createFashionJob(e){await ih.assertAllowed(e.prompt,{jobType:"fashion"});try{return console.log("Creating fashion job...",e),(await ct(ut,"createFashionJob")(e)).data}catch(n){throw console.error("Error creating fashion job:",n),new Error("Failed to create fashion job: "+(n.message||n))}}static async createUserFashionModel(e){const n=[e.name,e.description].filter(s=>typeof s=="string"&&s.trim().length>0).join(`
5132`);n&&await ih.assertAllowed(n,{jobType:"user_fashion_model"});try{return(await ct(ut,"createUserFashionModel")(e)).data}catch(s){throw console.error("Error creating user fashion model:",s),s}}static async getFashionStylePresets(){try{const n=await ct(ut,"getFashionStylePresets")({});console.log("getFashionStylePresets response:",n);const s=n.data;return Array.isArray(s)?(console.log("Returning style presets as array:",s),s):s!=null&&s.presets&&Array.isArray(s.presets)?(console.log("Returning style presets from data.presets:",s.presets),s.presets):(console.warn("Unexpected response format for style presets:",s),[])}catch(e){return console.error("Error getting fashion style presets:",{message:e.message,code:e.code,details:e.details,fullError:e}),[]}}static async getFashionEnvironments(){try{const s=(await ct(ut,"getFashionEnvironments")({})).data;return Array.isArray(s)?s:s!=null&&s.environments&&Array.isArray(s.environments)?s.environments:[]}catch(e){return console.error("Error getting fashion environments:",e),[]}}static async getFashionPoses(e){try{const a=(await ct(ut,"getFashionPoses")(e||{})).data;return Array.isArray(a)?a:a!=null&&a.poses&&Array.isArray(a.poses)?a.poses:[]}catch(n){return console.error("Error getting fashion poses:",n),[]}}static async getFashionShotTypes(){try{const n=await ct(ut,"getFashionShotTypes")({});console.log("getFashionShotTypes response:",n);const s=n.data;return Array.isArray(s)?(console.log("Returning shot types as array:",s),s):s!=null&&s.shotTypes&&Array.isArray(s.shotTypes)?(console.log("Returning shot types from data.shotTypes:",s.shotTypes),s.shotTypes):(console.warn("Unexpected response format for shot types:",s),[])}catch(e){return console.error("Error getting fashion shot types:",{message:e.message,code:e.code,details:e.details,fullError:e}),[]}}}const CB="1:1",RB="9:16",Sh=["auto","1:1","3:4","9:16","16:9","4:3"],IB={virtual_model:{id:"virtual_model",label:"Virtual Try-On",inputShape:"model_garment",ratioMode:"global",ratioKey:"aspect_ratio",price:4,promptMode:"custom",requires:["fashion_model"],optional:["garment_photo","garment_photos","venue"]},outfit_photo:{id:"outfit_photo",label:"Outfit Try-On",inputShape:"model_garment",ratioMode:"global",ratioKey:"aspect_ratio",price:4,promptMode:"custom",requires:["fashion_model"],optional:["garment_photo","garment_photos","venue"]},pro_studio:{id:"pro_studio",label:"Pro Studio",inputShape:"model_garment",ratioMode:"global",ratioKey:"image_size",price:4,promptMode:"assembled",requires:["fashion_model"],optional:["garment_photos"]},jewelry_on_model:{id:"jewelry_on_model",label:"Jewelry On Model",inputShape:"model_garment",ratioMode:"global",ratioKey:"image_size",price:4,promptMode:"none",requires:["jewelry_image"],optional:[]},clothing_ecom_pack:{id:"clothing_ecom_pack",label:"Clothing E-com Pack",inputShape:"fanout_pack",ratioMode:"global",ratioKey:"image_size",price:12,promptMode:"none",requires:["user_photo"],optional:["fashion_model"]},jewelry_ecom_pack:{id:"jewelry_ecom_pack",label:"Jewelry E-com Pack",inputShape:"fanout_pack",ratioMode:"global",ratioKey:"image_size",price:12,promptMode:"none",requires:["user_photo"],optional:["fashion_model"]},ai_videos:{id:"ai_videos",label:"Photo To Video",inputShape:"video",ratioMode:"video",ratioKey:"aspect_ratio",price:15,promptMode:"motion",requires:["user_photo"],optional:["image_urls"]},model_to_flat_lay:{id:"model_to_flat_lay",label:"Mannequin To Flat Lay",inputShape:"single_image_edit",ratioMode:"global",ratioKey:"image_size",price:4,promptMode:"none",requires:["user_photo"],optional:[]},amateur_to_pro:{id:"amateur_to_pro",label:"Amateur To Professional",inputShape:"single_image_edit",ratioMode:"global",ratioKey:"image_size",price:4,promptMode:"none",requires:["user_photo"],optional:[]},pose_angle_switch:{id:"pose_angle_switch",label:"Pose Variation",inputShape:"single_image_edit",ratioMode:"global",ratioKey:"image_size",price:4,promptMode:"assembled",requires:["user_photo"],optional:[]},photo_enhance:{id:"photo_enhance",label:"Enhance / Upscale",inputShape:"deterministic",ratioMode:"preserve",ratioKey:null,price:3,promptMode:"none",requires:["user_photo"],optional:[]},remove_background:{id:"remove_background",label:"Remove Backgroun
5132d",inputShape:"deterministic",ratioMode:"preserve",ratioKey:null,price:2,promptMode:"none",requires:["user_photo"],optional:[]},photo_edit:{id:"photo_edit",label:"Photo Edit",inputShape:"single_image_edit",ratioMode:"input",ratioKey:"image_size",price:4,promptMode:"assembled",freeText:!0,requires:["user_photo"],optional:[]},model_swap:{id:"model_swap",label:"Change the Model",inputShape:"model_garment",ratioMode:"input",ratioKey:"image_size",price:4,promptMode:"assembled",freeText:!0,requires:["user_photo","fashion_model"],optional:[]},photo_reframe:{id:"photo_reframe",label:"Reframe",inputShape:"deterministic",ratioMode:"user_target",ratioKey:"image_size",price:2,promptMode:"none",requires:["user_photo"],optional:[]}};function cr(t){return t?IB[t]:void 0}function bT(t){return t.ratioMode!=="preserve"&&t.ratioMode!=="input"}function WC(t){return t.ratioMode==="video"?RB:CB}const fm={severity:"none",maxSeverity:"none",findings:[],hints:[],issues:[],advice:null};function MB(t){return!t||t.severity==="none"?!1:t.findings.length>0||!!t.advice}const PB=["user_photo","fashion_model","garment_photo","garment_photos","jewelry_image","venue","image_urls"];function DB(t){const e={};for(const n of PB){const s=t[n];if(typeof s=="string"&&s)e[n]=s;else if(Array.isArray(s)){const a=s.filter(c=>typeof c=="string"&&!!c);a.length&&(e[n]=a)}}return e}function $b(t){return typeof t=="string"&&t?t:void 0}function OB(t,e){for(const n of t.requires){const s=e[n];if(!(Array.isArray(s)?s.length>0:!!s))throw new Error(`${t.label}: missing required image "${n}".`)}}class uo{static async create(e){if(!xt.currentUser)throw new Error("User must be authenticated");const n=cr(e.toolId);if(!n)throw new Error(`"${e.toolId}" is not a V2 tool. Add it to functions/v2/registry.ts and src/constants/tool-registry.ts first.`);OB(n,e.images||{});const s=e.customPrompt||e.motionPrompt||"";s.trim()&&await ih.assertAllowed(s,{jobType:n.id});const u=(await ct(ut,"createGenerationV2")(e)).data;if(!(u!=null&&u.mediaItemId))throw new Error("createGenerationV2 returned no mediaItemId.");return u}static generate(e){var w;const{toolId:n,duration:s}=e,a=cr(n);if(!a)throw new Error(`"${n}" is not a V2 tool. Add it to the registry before calling it.`);const c=e.imageFields||{},u=(e.prompt||"").trim(),h=e.ratio||WC(a),m={toolId:n,images:DB(c)};(w=e.precheckHints)!=null&&w.length&&(m.precheckHints=e.precheckHints);const p=$b(c.pose),b=$b(c.shot_type),x=$b(c.style_preset);return p&&(m.pose=p),b&&(m.shotType=b),x&&(m.stylePreset=x),a.ratioMode!=="preserve"&&(m.ratio=h),a.inputShape==="video"&&s&&(m.duration=s),n==="ai_videos"?m.motionPrompt=u:n==="photo_reframe"?m.targetRatio=h:u&&(m.customPrompt=u),this.create(m)}static async precheck(e){var s;const n=e.imageUrls.filter(Boolean);if(!n.length)return fm;try{const u=(await ct(ut,"precheckGeneration")({tool:e.tool,imageUrls:n,locale:e.locale||((s=navigator.language)==null?void 0:s.slice(0,2))||"en"})).data;if(!u||u.severity==="none")return fm;const h=Array.isArray(u.findings)?u.findings.filter(m=>m&&typeof m.message=="string"&&m.message.trim()):[];return!h.length&&!u.advice?fm:{severity:"warn",maxSeverity:u.maxSeverity||(h.some(m=>m.severity==="strong")?"strong":"warn"),findings:h,hints:Array.isArray(u.hints)?u.hints.filter(m=>typeof m=="string"&&m.trim()):h.map(m=>m.modelHint).filter(Boolean),issues:Array.isArray(u.issues)?u.issues:h.map(m=>m.code),advice:u.advice??null}}catch(a){return console.warn("precheckGeneration failed (fail-open):",a),fm}}static async setReaction(e){try{return(await ct(ut,"setMediaReaction")({mediaId:e.mediaId,reaction:e.reaction,...e.reason?{reason:e.reason}:{}})).data||{}}catch(n){return console.warn("setMediaReaction failed:",n),{}}}}/**
5133 * @license
5134 * Copyright 2019 Google LLC
5135 *
5136 * Licensed under the Apache License, Version 2.0 (the "License");
5137 * you may not use this file except in compliance with the License.
5138 * You may obtain a copy of the License at
5139 *
5140 *   http://www.apache.org/licenses/LICENSE-2.0
5141 *
5142 * Unless required by applicable law or agreed to in writing, software
5143 * distributed under the License is distributed on an "AS IS" BASIS,
5144 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5145 * See the License for the specific language governing permissions and
5146 * limitations under the License.
5147 */const LB="/firebase-messaging-sw.js",UB="/firebase-cloud-messaging-push-scope",XC="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",FB="https://fcmregistrations.googleapis.com/v1",QC="google.c.a.c_id",VB="google.c.a.c_l",zB="google.c.a.ts",BB="google.c.a.e",xT=1e4;var vT;(function(t){t[t.DATA_MESSAGE=1]="DATA_MESSAGE",t[t.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(vT||(vT={}));/**
5148 * @license
5149 * Copyright 2018 Google LLC
5150 *
5151 * Licensed under the Apache License, Version 2.0 (the "License");
5151 you may not use this file except
5152 * in compliance with the License. You may obtain a copy of the License at
5153 *
5154 * http://www.apache.org/licenses/LICENSE-2.0
5155 *
5156 * Unless required by applicable law or agreed to in writing, software distributed under the License
5157 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
5158 * or implied. See the License for the specific language governing permissions and limitations under
5159 * the License.
5160 */var ah;(function(t){t.PUSH_RECEIVED="push-received",t.NOTIFICATION_CLICKED="notification-clicked"})(ah||(ah={}));/**
5161 * @license
5162 * Copyright 2017 Google LLC
5163 *
5164 * Licensed under the Apache License, Version 2.0 (the "License");
5165 * you may not use this file except in compliance with the License.
5166 * You may obtain a copy of the License at
5167 *
5168 *   http://www.apache.org/licenses/LICENSE-2.0
5169 *
5170 * Unless required by applicable law or agreed to in writing, software
5171 * distributed under the License is distributed on an "AS IS" BASIS,
5172 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5173 * See the License for the specific language governing permissions and
5174 * limitations under the License.
5175 */function Ui(t){const e=new Uint8Array(t);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function KB(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/\-/g,"+").replace(/_/g,"/"),s=atob(n),a=new Uint8Array(s.length);for(let c=0;c<s.length;++c)a[c]=s.charCodeAt(c);return a}/**
5176 * @license
5177 * Copyright 2019 Google LLC
5178 *
5179 * Licensed under the Apache License, Version 2.0 (the "License");
5180 * you may not use this file except in compliance with the License.
5181 * You may obtain a copy of the License at
5182 *
5183 *   http://www.apache.org/licenses/LICENSE-2.0
5184 *
5185 * Unless required by applicable law or agreed to in writing, software
5186 * distributed under the License is distributed on an "AS IS" BASIS,
5187 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5188 * See the License for the specific language governing permissions and
5189 * limitations under the License.
5190 */const qb="fcm_token_details_db",$B=5,_T="fcm_token_object_Store";async function qB(t){if("databases"in indexedDB&&!(await indexedDB.databases()).map(c=>c.name).includes(qb))return null;let e=null;return(await Rp(qb,$B,{upgrade:async(s,a,c,u)=>{if(a<2||!s.objectStoreNames.contains(_T))return;const h=u.objectStore(_T),m=await h.index("fcmSenderId").get(t);if(await h.clear(),!!m){if(a===2){const p=m;if(!p.auth||!p.p256dh||!p.endpoint)return;e={token:p.fcmToken,createTime:p.createTime??Date.now(),subscriptionOptions:{auth:p.auth,p256dh:p.p256dh,endpoint:p.endpoint,swScope:p.swScope,vapidKey:typeof p.vapidKey=="string"?p.vapidKey:Ui(p.vapidKey)}}}else if(a===3){const p=m;e={token:p.fcmToken,createTime:p.createTime,subscriptionOptions:{auth:Ui(p.auth),p256dh:Ui(p.p256dh),endpoint:p.endpoint,swScope:p.swScope,vapidKey:Ui(p.vapidKey)}}}else if(a===4){const p=m;e={token:p.fcmToken,createTime:p.createTime,subscriptionOptions:{auth:Ui(p.auth),p256dh:Ui(p.p256dh),endpoint:p.endpoint,swScope:p.swScope,vapidKey:Ui(p.vapidKey)}}}}}})).close(),await wb(qb),await wb("fcm_vapid_details_db"),await wb("undefined"),HB(e)?e:null}function HB(t){if(!t||!t.subscriptionOptions)return!1;const{subscriptionOptions:e}=t;return typeof t.createTime=="number"&&t.createTime>0&&typeof t.token=="string"&&t.token.length>0&&typeof e.auth=="string"&&e.auth.length>0&&typeof e.p256dh=="string"&&e.p256dh.length>0&&typeof e.endpoint=="string"&&e.endpoint.length>0&&typeof e.swScope=="string"&&e.swScope.length>0&&typeof e.vapidKey=="string"&&e.vapidKey.length>0}/**
5191 * @license
5192 * Copyright 2019 Google LLC
5193 *
5194 * Licensed under the Apache License, Version 2.0 (the "License");
5195 * you may not use this file except in compliance with the License.
5196 * You may obtain a copy of the License at
5197 *
5198 *   http://www.apache.org/licenses/LICENSE-2.0
5199 *
5200 * Unless required by applicable law or agreed to in writing, software
5201 * distributed under the License is distributed on an "AS IS" BASIS,
5202 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5203 * See the License for the specific language governing permissions and
5204 * limitations under the License.
5205 */const GB="firebase-messaging-database",YB=1,oh="firebase-messaging-store";let Hb=null;function JC(){return Hb||(Hb=Rp(GB,YB,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(oh)}}})),Hb}async function WB(t){const e=ZC(t),s=await(await JC()).transaction(oh).objectStore(oh).get(e);if(s)return s;{const a=await qB(t.appConfig.senderId);if(a)return await Z_(t,a),a}}async function Z_(t,e){const n=ZC(t),a=(await JC()).transaction(oh,"readwrite");return await a.objectStore(oh).put(e,n),await a.done,e}function ZC({appConfig:t}){return t.appId}/**
5206 * @license
5207 * Copyright 2017 Google LLC
5208 *
5209 * Licensed under the Apache License, Version 2.0 (the "License");
5210 * you may not use this file except in compliance with the License.
5211 * You may obtain a copy of the License at
5212 *
5213 *   http://www.apache.org/licenses/LICENSE-2.0
5214 *
5215 * Unless required by applicable law or agreed to in writing, software
5216 * distributed under the License is distributed on an "AS IS" BASIS,
5217 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5218 * See the License for the specific language governing permissions and
5219 * limitations under the License.
5220 */const XB={"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."},zs=new fi("messaging","Messaging",XB);/**
5221 * @license
5222 * Copyright 2019 Google LLC
5223 *
5224 * Licensed under the Apache License, Version 2.0 (the "License");
5225 * you may not use this file except in compliance with the License.
5226 * You may obtain a copy of the License at
5227 *
5228 *   http://www.apache.org/licenses/LICENSE-2.0
5229 *
5230 * Unless required by applicable law or agreed to in writing, software
5231 * distributed under the License is distributed on an "AS IS" BASIS,
5232 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5233 * See the License for the specific language governing permissions and
5234 * limitations under the License.
5235 */async function QB(t,e){const n=await t0(t),s=eR(e),a={method:"POST",headers:n,body:JSON.stringify(s)};let c;try{c=await(await fetch(e0(t.appConfig),a)).json()}catch(u){throw zs.create("token-subscribe-failed",{errorInfo:u==null?void 0:u.toString()})}if(c.error){const u=c.error.message;throw zs.create("token-subscribe-failed",{errorInfo:u})}if(!c.token)throw zs.create("token-subscribe-no-token");return c.token}async function JB(t,e){const n=await t0(t),s=eR(e.subscriptionOptions),a={method:"PATCH",headers:n,body:JSON.stringify(s)};let c;try{c=await(await fetch(`${e0(t.appConfig)}/${e.token}`,a)).json()}catch(u){throw zs.create("token-update-failed",{errorInfo:u==null?void 0:u.toString()})}if(c.error){const u=c.error.message;throw zs.create("token-update-failed",{errorInfo:u})}if(!c.token)throw zs.create("token-update-no-token");return c.token}async function ZB(t,e){const s={method:"DELETE",headers:await t0(t)};try{const c=await(await fetch(`${e0(t.appConfig)}/${e}`,s)).json();if(c.error){const u=c.error.message;throw zs.create("token-unsubscribe-failed",{errorInfo:u})}}catch(a){throw zs.create("token-unsubscribe-failed",{errorInfo:a==null?void 0:a.toString()})}}function e0({projectId:t}){return`${FB}/projects/${t}/registrations`}async function t0({appConfig:t,installations:e}){const n=await e.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function eR({p256dh:t,auth:e,endpoint:n,vapidKey:s}){const a={web:{endpoint:n,auth:e,p256dh:t}};return s!==XC&&(a.web.applicationPubKey=s),a}/**
5236 * @license
5237 * Copyright 2019 Google LLC
5238 *
5239 * Licensed under the Apache License, Version 2.0 (the "License");
5240 * you may not use this file except in compliance with the License.
5241 * You may obtain a copy of the License at
5242 *
5243 *   http://www.apache.org/licenses/LICENSE-2.0
5244 *
5245 * Unless required by applicable law or agreed to in writing, software
5246 * distributed under the License is distributed on an "AS IS" BASIS,
5247 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5248 * See the License for the specific language governing permissions and
5249 * limitations under the License.
5250 */const eK=10080*60*1e3;async function tK(t){const e=await sK(t.swRegistration,t.vapidKey),n={vapidKey:t.vapidKey,swScope:t.swRegistration.scope,endpoint:e.endpoint,auth:Ui(e.getKey("auth")),p256dh:Ui(e.getKey("p256dh"))},s=await WB(t.firebaseDependencies);if(s){if(rK(s.subscriptionOptions,n))return Date.now()>=s.createTime+eK?nK(t,{token:s.token,createTime:Date.now(),subscriptionOptions:n}):s.token;try{await ZB(t.firebaseDependencies,s.token)}catch(a){console.warn(a)}return wT(t.firebaseDependencies,n)}else return wT(t.firebaseDependencies,n)}async function nK(t,e){try{const n=await JB(t.firebaseDependencies,e),s={...e,token:n,createTime:Date.now()};return await Z_(t.firebaseDependencies,s),n}catch(n){throw n}}async function wT(t,e){const s={token:await QB(t,e),createTime:Date.now(),subscriptionOptions:e};return await Z_(t,s),s.token}async function sK(t,e){const n=await t.pushManager.getSubscription();return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:KB(e)})}function rK(t,e){const n=e.vapidKey===t.vapidKey,s=e.endpoint===t.endpoint,a=e.auth===t.auth,c=e.p256dh===t.p256dh;return n&&s&&a&&c}/**
5251 * @license
5252 * Copyright 2020 Google LLC
5253 *
5254 * Licensed under the Apache License, Version 2.0 (the "License");
5255 * you may not use this file except in compliance with the License.
5256 * You may obtain a copy of the License at
5257 *
5258 *   http://www.apache.org/licenses/LICENSE-2.0
5259 *
5260 * Unless required by applicable law or agreed to in writing, software
5261 * distributed under the License is distributed on an "AS IS" BASIS,
5262 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5263 * See the License for the specific language governing permissions and
5264 * limitations under the License.
5265 */function ET(t){const e={from:t.from,collapseKey:t.collapse_key,messageId:t.fcmMessageId};return iK(e,t),aK(e,t),oK(e,t),e}function iK(t,e){if(!e.notification)return;t.notification={};const n=e.notification.title;n&&(t.notification.title=n);const s=e.notification.body;s&&(t.notification.body=s);const a=e.notification.image;a&&(t.notification.image=a);const c=e.notification.icon;c&&(t.notification.icon=c)}function aK(t,e){e.data&&(t.data=e.data)}function oK(t,e){var a,c,u,h;if(!e.fcmOptions&&!((a=e.notification)!=null&&a.click_action))return;t.fcmOptions={};const n=((c=e.fcmOptions)==null?void 0:c.link)??((u=e.notification)==null?void 0:u.click_action);n&&(t.fcmOptions.link=n);const s=(h=e.fcmOptions)==null?void 0:h.analytics_label;s&&(t.fcmOptions.analyticsLabel=s)}/**
5266 * @license
5267 * Copyright 2019 Google LLC
5268 *
5269 * Licensed under the Apache License, Version 2.0 (the "License");
5270 * you may not use this file except in compliance with the License.
5271 * You may obtain a copy of the License at
5272 *
5273 *   http://www.apache.org/licenses/LICENSE-2.0
5274 *
5275 * Unless required by applicable law or agreed to in writing, software
5276 * distributed under the License is distributed on an "AS IS" BASIS,
5277 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5278 * See the License for the specific language governing permissions and
5279 * limitations under the License.
5280 */function lK(t){return typeof t=="object"&&!!t&&QC in t}/**
5281 * @license
5282 * Copyright 2019 Google LLC
5283 *
5284 * Licensed under the Apache License, Version 2.0 (the "License");
5285 * you may not use this file except in compliance with the License.
5286 * You may obtain a copy of the License at
5287 *
5288 *   http://www.apache.org/licenses/LICENSE-2.0
5289 *
5290 * Unless required by applicable law or agreed to in writing, software
5291 * distributed under the License is distributed on an "AS IS" BASIS,
5292 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5293 * See the License for the specific language governing permissions and
5294 * limitations under the License.
5295 */function cK(t){if(!t||!t.options)throw Gb("App Configuration Object");if(!t.name)throw Gb("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:n}=t;for(const s of e)if(!n[s])throw Gb(s);return{appName:t.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}function Gb(t){return zs.create("missing-app-config-values",{valueName:t})}/**
5296 * @license
5297 * Copyright 2020 Google LLC
5298 *
5299 * Licensed under the Apache License, Version 2.0 (the "License");
5300 * you may not use this file except in compliance with the License.
5301 * You may obtain a copy of the License at
5302 *
5303 *   http://www.apache.org/licenses/LICENSE-2.0
5304 *
5305 * Unless required by applicable law or agreed to in writing, software
5306 * distributed under the License is distributed on an "AS IS" BASIS,
5307 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5308 * See the License for the specific language governing permissions and
5309 * limitations under the License.
5310 */class uK{constructor(e,n,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const a=cK(e);this.firebaseDependencies={app:e,appConfig:a,installations:n,analyticsProvider:s}}_delete(){return Promise.resolve()}}/**
5311 * @license
5312 * Copyright 2020 Google LLC
5313 *
5314 * Licensed under the Apache License, Version 2.0 (the "License");
5315 * you may not use this file except in compliance with the License.
5316 * You may obtain a copy of the License at
5317 *
5318 *   http://www.apache.org/licenses/LICENSE-2.0
5319 *
5320 * Unless required by applicable law or agreed to in writing, software
5321 * distributed under the License is distributed on an "AS IS" BASIS,
5322 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5323 * See the License for the specific language governing permissions and
5324 * limitations under the License.
5325 */async function dK(t){try{t.swRegistration=await navigator.serviceWorker.register(LB,{scope:UB}),t.swRegistration.update().catch(()=>{}),await hK(t.swRegistration)}catch(e){throw zs.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}async function hK(t){return new Promise((e,n)=>{const s=setTimeout(()=>n(new Error(`Service worker not registered after ${xT} ms`)),xT),a=t.installing||t.waiting;t.active?(clearTimeout(s),e()):a?a.onstatechange=c=>{var u;((u=c.target)==null?void 0:u.state)==="activated"&&(a.onstatechange=null,clearTimeout(s),e())}:(clearTimeout(s),n(new Error("No incoming service worker found.")))})}/**
5326 * @license
5327 * Copyright 2020 Google LLC
5328 *
5329 * Licensed under the Apache License, Version 2.0 (the "License");
5330 * you may not use this file except in compliance with the License.
5331 * You may obtain a copy of the License at
5332 *
5333 *   http://www.apache.org/licenses/LICENSE-2.0
5334 *
5335 * Unless required by applicable law or agreed to in writing, software
5336 * distributed under the License is distributed on an "AS IS" BASIS,
5337 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5338 * See the License for the specific language governing permissions and
5339 * limitations under the License.
5340 */async function fK(t,e){if(!e&&!t.swRegistration&&await dK(t),!(!e&&t.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw zs.create("invalid-sw-registration");t.swRegistration=e}}/**
5341 * @license
5342 * Copyright 2020 Google LLC
5343 *
5344 * Licensed under the Apache License, Version 2.0 (the "License");
5345 * you may not use this file except in compliance with the License.
5346 * You may obtain a copy of the License at
5347 *
5348 *   http://www.apache.org/licenses/LICENSE-2.0
5349 *
5350 * Unless required by applicable law or agreed to in writing, software
5351 * distributed under the License is distributed on an "AS IS" BASIS,
5352 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5353 * See the License for the specific language governing permissions and
5354 * limitations under the License.
5355 */async function mK(t,e){e?t.vapidKey=e:t.vapidKey||(t.vapidKey=XC)}/**
5356 * @license
5357 * Copyright 2020 Google LLC
5358 *
5359 * Licensed under the Apache License, Version 2.0 (the "License");
5360 * you may not use this file except in compliance with the License.
5361 * You may obtain a copy of the License at
5362 *
5363 *   http://www.apache.org/licenses/LICENSE-2.0
5364 *
5365 * Unless required by applicable law or agreed to in writing, software
5366 * distributed under the License is distributed on an "AS IS" BASIS,
5367 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5368 * See the License for the specific language governing permissions and
5369 * limitations under the License.
5370 */async function pK(t,e){if(!navigator)throw zs.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw zs.create("permission-blocked");return await mK(t,e==null?void 0:e.vapidKey),await fK(t,e==null?void 0:e.serviceWorkerRegistration),tK(t)}/**
5371 * @license
5372 * Copyright 2019 Google LLC
5373 *
5374 * Licensed under the Apache License, Version 2.0 (the "License");
5375 * you may not use this file except in compliance with the License.
5376 * You may obtain a copy of the License at
5377 *
5378 *   http://www.apache.org/licenses/LICENSE-2.0
5379 *
5380 * Unless required by applicable law or agreed to in writing, software
5381 * distributed under the License is distributed on an "AS IS" BASIS,
5382 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5383 * See the License for the specific language governing permissions and
5384 * limitations under the License.
5385 */async function gK(t,e,n){const s=yK(e);(await t.firebaseDependencies.analyticsProvider.get()).logEvent(s,{message_id:n[QC],message_name:n[VB],message_time:n[zB],message_device_time:Math.floor(Date.now()/1e3)})}function yK(t){switch(t){case ah.NOTIFICATION_CLICKED:return"notification_open";case ah.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
5386 * @license
5387 * Copyright 2017 Google LLC
5388 *
5389 * Licensed under the Apache License, Version 2.0 (the "License");
5390 * you may not use this file except in compliance with the License.
5391 * You may obtain a copy of the License at
5392 *
5393 *   http://www.apache.org/licenses/LICENSE-2.0
5394 *
5395 * Unless required by applicable law or agreed to in writing, software
5396 * distributed under the License is distributed on an "AS IS" BASIS,
5397 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5398 * See the License for the specific language governing permissions and
5399 * limitations under the License.
5400 */async function bK(t,e){const n=e.data;if(!n.isFirebaseMessaging)return;t.onMessageHandler&&n.messageType===ah.PUSH_RECEIVED&&(typeof t.onMessageHandler=="function"?t.onMessageHandler(ET(n)):t.onMessageHandler.next(ET(n)));const s=n.data;lK(s)&&s[BB]==="1"&&await gK(t,n.messageType,s)}const kT="@firebase/messaging",TT="0.12.23";/**
5401 * @license
5402 * Copyright 2020 Google LLC
5403 *
5404 * Licensed under the Apache License, Version 2.0 (the "License");
5405 * you may not use this file except in compliance with the License.
5406 * You may obtain a copy of the License at
5407 *
5408 *   http://www.apache.org/licenses/LICENSE-2.0
5409 *
5410 * Unless required by applicable law or agreed to in writing, software
5411 * distributed under the License is distributed on an "AS IS" BASIS,
5412 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
5413 * See the License for the specific language governing permissions and
5414 * limitations under the License.
5415 */const xK=t=>{const e=new uK(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),t.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",n=>bK(e,n)),e},vK=t=>{const e=t.getProvider("messaging").getImmediate();return{getToken:s=>pK(e,s)}};function _K(){Yn(new Un("messaging",xK,"PUBLIC")),Yn(new Un("messaging-internal",vK,"PRIVATE")),mn(kT,TT),mn(kT,TT,"esm2020")}_K();const c0=class c0{static async getUserMediaItems(e=20,n){const s=xt.currentUser;if(!s)return[];try{let a=Zo(lp(sl,this.COLLECTION_NAME),yd("userId","==",s.uid),yd("isDeleted","==",!1),yd("status","==","completed"),nh("createdAt","desc"),OV(e));return n&&(a=Zo(a,LV(n))),(await up(a)).docs.map(u=>({...u.data(),id:u.id})).filter(u=>u.kind!=="pack_child")}catch(a){return console.error("Error getting user media:",a),[]}}static async getPackChildren(e){const n=xt.currentUser;if(!n)return[];try{const s=Zo(lp(sl,this.COLLECTION_NAME),yd("userId","==",n.uid),yd("parentMediaItemId","==",e)),c=(await up(s)).docs.map(u=>({...u.data(),id:u.id})).filter(u=>!u.isDeleted);return c.sort((u,h)=>{var b,x;const m=((b=u.createdAt)==null?void 0:b.seconds)??0,p=((x=h.createdAt)==null?void 0:x.seconds)??0;return m-p}),c}catch(s){return console.error("Error getting pack children:",s),[]}}static async getMediaById(e){try{const s=await ct(ut,"getMediaById")({mediaId:e});return s.data.success&&s.data.media?s.data.media:null}catch(n){return console.error("Error getting media by ID:",n),null}}static async deleteMediaItem(e){const n=xt.currentUser;if(!n)return!1;try{const s=si(sl,this.COLLECTION_NAME,e),a=await rg(s);return a.exists()&&a.data().userId===n.uid?(await YA(s,{isDeleted:!0,deletedAt:Ut.now()}),!0):!1}catch(s){return console.error("Error deleting media:",s),!1}}static async changeLikes(e,n){try{return(await ct(ut,"changeLikes")({mediaId:e,isLiked:n})).data.success===!0}catch(s){return console.error("Error changing likes:",s),!1}}static async getSimilarContent(e){try{const s=await ct(ut,"getSimilarContent")(e);return s.data.success?{medias:s.data.medias,hasMore:s.data.hasMore}:{medias:[],hasMore:!1}}catch(n){return console.error("Error getting similar content:",n),{medias:[],hasMore:!1}}}};c0.COLLECTION_NAME="medias";let Ln=c0;class Ks{static async uploadPhoto(e,n="uploads/photos"){const s=e.name.split(".").pop()||"jpg",a=`${Date.now()}-${Math.random().toString(36).slice(2)}.${s}`,c=`${n}/${a}`,u=mp(pp,c);await xz(u,e,{contentType:e.type||"image/jpeg"});const h=await vC(u);return{path:c,downloadUrl:h}}}const u0=class u0{static subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}static publish(e){for(const n of this.subscribers)n(e)}static showSuccess(e,n){this.publish({type:"success",message:e,durationMs:n})}static showError(e,n){this.publish({type:"error",message:e,durationMs:n})}static showInfo(e,n){this.publish({type:"info",message:e,durationMs:n})}static showWarning(e,n){this.publish({type:"warning",message:e,durationMs:n})}};u0.subscribers=new Set;let _t=u0;class Rr{static async getStylesByCategoryId(e,n){try{const s=ct(ut,"getStyles"),a={categoryId:e};
5415n&&(a.limit=n);const c=await s(a);if(c.data.success)return c.data.styles;throw new Error("Failed to get styles: "+JSON.stringify(c.data))}catch(s){return console.error("Error getting styles by category:",s),[]}}static async getStyleById(e){try{const s=await ct(ut,"getStyleById")({styleId:e});return s.data.success&&s.data.style?s.data.style:null}catch(n){return console.error("Error getting style by ID:",n),null}}static async getFeaturedStyles(e=5){try{const s=await ct(ut,"getStyles")({isFeatured:!0,limit:e});return s.data.success?s.data.styles:[]}catch(n){return console.error("Error getting featured styles:",n),[]}}}class Yb{static async createUgcJob(e){return await ih.assertAllowed(e.script,{jobType:"ugc_video"}),(await ct(ut,"createUgcJob")(e)).data}static async getEffectTypes(e){return(await ct(ut,"getUgcEffectTypes")({category:e})).data.effectTypes||[]}static async getEffectCategories(){return(await ct(ut,"getUgcEffectCategories")({})).data.categories||[]}}class wK{static async createImageTo3dJob(e){await ih.assertAllowed(e.prompt,{jobType:"image_to_3d"});try{return console.log("Creating image-to-3D job...",e),(await ct(ut,"createImageTo3dJob")(e)).data}catch(n){throw console.error("Error creating image-to-3D job:",n),new Error("Failed to create 3D model: "+(n.message||n))}}}const EK={"auth/user-not-found":"auth.error.invalidCredentials","auth/wrong-password":"auth.error.invalidCredentials","auth/invalid-credential":"auth.error.invalidCredentials","auth/popup-closed-by-user":"auth.error.popupClosed"},ST=({onLogin:t})=>{const e=De(),[n,s]=v.useState(!1),[a,c]=v.useState(null),[u,h]=v.useState(""),[m,p]=v.useState("");v.useEffect(()=>{const T=document.createElement("link");return T.rel="canonical",T.href="https://dash.fashio.ai/login",document.head.appendChild(T),()=>{document.head.removeChild(T)}},[]);const b=async T=>{T.preventDefault(),s(!0),c(null);try{await sa.signInWithEmailAndPassword(u,m),gT("email"),t()}catch(N){w(N)}finally{s(!1)}},x=async()=>{s(!0),c(null);try{await sa.signInWithGoogle(),gT("google"),t()}catch(T){w(T)}finally{s(!1)}},w=T=>{console.error("Authentication error:",T),c(EK[T==null?void 0:T.code]??"auth.error.generic")};return o.jsxs(X_,{title:e("auth.login.title"),subtitle:e("auth.login.subtitle"),children:[a&&o.jsxs("div",{className:"mb-6 p-4 bg-bad/10 border border-bad/25 rounded-xl text-red-600 text-sm flex items-start gap-3 animate-in fade-in slide-in-from-top-2",children:[o.jsx(dh,{size:18,className:"shrink-0 mt-0.5"}),o.jsx("span",{children:e(a)})]}),o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("button",{type:"button",onClick:x,disabled:n,className:"w-full flex items-center justify-center gap-3 bg-surface border border-line text-dim font-medium py-2.5 px-4 rounded-xl hover:bg-raised transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[o.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),o.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),o.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),o.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),e("auth.continueWithGoogle")]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-line"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"px-2 bg-surface text-dim",children:e("auth.orContinueWithEmail")})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative group",children:[o.jsx(Sp,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"email",name:"email",autoComplete:"username",autoCapitalize:"none",spellCheck:!1,"aria-label":e("auth.email"),placeholder:e("auth.email"),value:u,onChange:T=>h(T.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint",required:!0})]}),o.jsxs("div",{className:"relative group",children:[o.jsx(zS,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"password",name:"password",autoComplete:"current-password","aria-label":e("auth.password"),placeholder:e("auth.password"),value:m,onChange:T=>p(T.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint",required:!0})]})]}),o.jsx("div",{className:"flex items-center justify-end",children:o.jsx(zt,{to:"/reset-password",className:"text-sm font-medium text-dim hover:text-ink transition-colors",children:e("auth.forgotPassword")})}),o.jsx(An,{type:"submit",fullWidth:!0,isLoading:n,className:"py-3 text-base font-semibold shadow-lg shadow-black/5 hover:shadow-black/10",children:e("auth.signIn")}),o.jsx("div",{className:"text-center",children:o.jsxs("p",{className:"text-dim text-sm",children:[e("auth.noAccount"),o.jsx(zt,{to:"/register",className:"ms-2 font-bold text-ink hover:underline transition-all",children:e("auth.signUp")})]})})]})]})},kK=()=>{const[t,e]=v.useState(null),n=v.useRef(!1);return v.useEffect(()=>{if(n.current)return;n.current=!0;const s=new URLSearchParams(window.location.hash.replace(/^#/,"")),a=s.get("t"),c=s.get("next")||"/";if(window.history.replaceState(null,"",window.location.pathname),!a){window.location.replace("/login");return}AO(xt,a).then(()=>window.location.replace(c)).catch(()=>e("Bu bağlantının süresi dolmuş. Lütfen tekrar deneyin."))},[]),o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white",children:t?o.jsxs("div",{className:"text-center",children:[o.jsx("p",{className:"text-sm text-gray-700",children:t}),o.jsx("a",{href:"/login",className:"mt-3 inline-block text-sm underline text-gray-500",children:"Giriş sayfasına git"})]}):o.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"})})},TK="1133754225134597";function Oi(...t){du()&&typeof window<"u"&&typeof window.fbq=="function"&&window.fbq(...t)}function SK(){var t;du()&&((t=window.ttq)==null||t.page())}function yc(t,e){var n;du()&&((n=window.ttq)==null||n.track(t,e))}function NK(t){var e;du()&&((e=window.ttq)==null||e.identify(t))}async function NT(t){const e=t.trim().toLowerCase(),n=await crypto.subtle.digest("SHA-256",
5415new TextEncoder().encode(e));return Array.from(new Uint8Array(n)).map(s=>s.toString(16).padStart(2,"0")).join("")}function jK(t){return t.map(e=>({content_id:e.content_id,content_type:e.content_type??"product",content_name:e.content_name??e.content_id,content_category:e.content_category??"",price:e.price??0,quantity:e.quantity??1}))}function bc(t,e,n="USD",s={}){var a;return{contents:jK(t),content_type:((a=t[0])==null?void 0:a.content_type)??"product",value:e,currency:n,...s}}const ns={async identify(t){if(du())try{const e={},n={};if(t.email){const s=await NT(t.email);e.em=s,n.email=s}if(t.uid){const s=await NT(t.uid);e.external_id=s,n.external_id=s}Object.keys(e).length>0&&(Oi("init",TK,e),Oi("track","PageView")),Object.keys(n).length>0&&NK(n)}catch(e){console.warn("PixelService.identify failed",e)}},pageView(){Oi("track","PageView"),SK()},viewContent(t){const e=t.value??0,n=t.currency??"USD";Oi("track","ViewContent",{content_ids:[t.content_id],content_type:"product",content_name:t.content_name,content_category:t.content_category??"",value:e,currency:n}),yc("ViewContent",bc([{content_id:t.content_id,content_name:t.content_name,content_category:t.content_category,price:e}],e,n))},addToCart(t){const e=t.currency??"USD",n=t.num_items??1;Oi("track","AddToCart",{content_ids:[t.content_id],content_type:"product",content_name:t.content_name,content_category:t.content_category??"",value:t.value,currency:e}),yc("AddToCart",bc([{content_id:t.content_id,content_name:t.content_name,content_category:t.content_category,price:t.value/n,quantity:n}],t.value,e))},initiateCheckout(t){const e=t.currency??"USD",n=t.num_items??1;Oi("track","InitiateCheckout",{content_ids:[t.content_id],content_type:"product",content_name:t.content_name,content_category:t.content_category,value:t.value,currency:e,num_items:n}),yc("InitiateCheckout",bc([{content_id:t.content_id,content_name:t.content_name,content_category:t.content_category,price:t.value/n,quantity:n}],t.value,e))},purchase(t){const e=t.value??0,n=t.currency??"USD",s=t.num_items??1;Oi("track","Purchase",{content_ids:[t.content_id],content_type:"product",content_name:t.content_name,content_category:t.content_type,value:e,currency:n,transaction_id:t.transaction_id}),yc("CompletePayment",bc([{content_id:t.content_id,content_name:t.content_name,content_category:t.content_type,price:e/s,quantity:s}],e,n,{order_id:t.transaction_id??""}))},lead(t){Oi("track","Lead",{content_ids:[t.content_id],content_type:"product",content_name:t.content_name,content_category:t.content_category??""}),yc("SubmitForm",bc([{content_id:t.content_id,content_name:t.content_name,content_category:t.content_category}],0,"USD"))},completeRegistration(t){const e=(t==null?void 0:t.method)??"email";Oi("track","CompleteRegistration",{content_ids:["registration"],content_type:"product",content_name:"User Registration",content_category:e}),yc("CompleteRegistration",bc([{content_id:"registration",content_name:"User Registration",content_category:e}],0,"USD",{registration_method:e}))}},AK={"auth/popup-closed-by-user":"auth.error.popupClosed","auth/email-already-in-use":"auth.error.emailInUse","auth/weak-password":"auth.error.weakPassword","auth/invalid-email":"auth.error.invalidEmail"},CK=({onLogin:t})=>{const e=De(),[n,s]=v.useState(!1),[a,c]=v.useState(null),[u,h]=v.useState(""),[m,p]=v.useState(""),[b,x]=v.useState(""),w=async j=>{j.preventDefault(),s(!0),c(null);try{const A=await sa.registerWithEmailAndPassword(u,m);if(!A){c("auth.error.registrationFailed");return}b&&await PO(A.user,{displayName:b}),ns.identify({email:A.user.email??void 0,uid:A.user.uid}),ns.completeRegistration({method:"email"}),pT("email"),t()}catch(A){N(A)}finally{s(!1)}},T=async()=>{var j,A;s(!0),c(null);try{const F=await sa.signInWithGoogle();ns.identify({email:((j=F==null?void 0:F.user)==null?void 0:j.email)??void 0,uid:(A=F==null?void 0:F.user)==null?void 0:A.uid}),ns.completeRegistration({method:"google"}),pT("google"),t()}catch(F){N(F)}finally{s(!1)}},N=j=>{console.error("Authentication error:",j),c(AK[j==null?void 0:j.code]??"auth.error.generic")};return o.jsxs(X_,{title:e("auth.register.title"),subtitle:e("auth.register.subtitle"),children:[a&&o.jsxs("div",{className:"mb-6 p-4 bg-bad/10 border border-bad/25 rounded-xl text-red-600 text-sm flex items-start gap-3 animate-in fade-in slide-in-from-top-2",children:[o.jsx(dh,{size:18,className:"shrink-0 mt-0.5"}),o.jsx("span",{children:e(a)})]}),o.jsxs("form",{onSubmit:w,className:"space-y-4",children:[o.jsxs("button",{type:"button",onClick:T,disabled:n,className:"w-full flex items-center justify-center gap-3 bg-surface border border-line text-dim font-medium py-2.5 px-4 roun
5415ded-xl hover:bg-raised transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",children:[o.jsxs("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",children:[o.jsx("path",{d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z",fill:"#4285F4"}),o.jsx("path",{d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z",fill:"#34A853"}),o.jsx("path",{d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z",fill:"#FBBC05"}),o.jsx("path",{d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z",fill:"#EA4335"})]}),e("auth.continueWithGoogle")]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"absolute inset-0 flex items-center",children:o.jsx("div",{className:"w-full border-t border-line"})}),o.jsx("div",{className:"relative flex justify-center text-sm",children:o.jsx("span",{className:"px-2 bg-surface text-dim",children:e("auth.orSignUpWithEmail")})})]}),o.jsxs("div",{className:"space-y-3",children:[o.jsxs("div",{className:"relative group",children:[o.jsx(Bd,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"text",name:"name",autoComplete:"name","aria-label":e("auth.fullName"),placeholder:e("auth.fullName"),value:b,onChange:j=>x(j.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint"})]}),o.jsxs("div",{className:"relative group",children:[o.jsx(Sp,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"email",name:"email",autoComplete:"email",autoCapitalize:"none",spellCheck:!1,"aria-label":e("auth.email"),placeholder:e("auth.email"),value:u,onChange:j=>h(j.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint",required:!0})]}),o.jsxs("div",{className:"relative group",children:[o.jsx(zS,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"password",name:"password",autoComplete:"new-password","aria-label":e("auth.password"),placeholder:e("auth.password"),value:m,onChange:j=>p(j.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint",required:!0,minLength:6})]})]}),o.jsx(An,{type:"submit",fullWidth:!0,isLoading:n,className:"py-3 text-base font-semibold shadow-lg shadow-black/5 hover:shadow-black/10",children:e("auth.createAccount")}),o.jsx("div",{className:"text-center",children:o.jsxs("p",{className:"text-dim text-sm",children:[e("auth.haveAccount"),o.jsx(zt,{to:"/login",className:"ms-2 font-bold text-ink hover:underline transition-all",children:e("auth.logIn")})]})})]})]})},RK={"auth/user-not-found":"auth.error.invalidEmail","auth/invalid-email":"auth.error.invalidEmail"},IK=()=>{const{t,dir:e}=nu(),[n,s]=v.useState(!1),[a,c]=v.useState(null),[u,h]=v.useState(!1),[m,p]=v.useState(""),b=async w=>{w.preventDefault(),s(!0),c(null),h(!1);try{await CO(xt,m),h(!0)}catch(T){console.error("Authentication error:",T),c(RK[T==null?void 0:T.code]??"auth.error.generic")}finally{s(!1)}},x=e==="rtl"?ks:di;return o.jsxs(X_,{title:t("auth.reset.title"),subtitle:t("auth.reset.subtitle"),children:[a&&o.jsxs("div",{className:"mb-6 p-4 bg-bad/10 border border-bad/25 rounded-xl text-red-600 text-sm flex items-start gap-3 animate-in fade-in slide-in-from-top-2",children:[o.jsx(dh,{size:18,className:"shrink-0 mt-0.5"}),o.jsx("span",{children:t(a)})]}),u&&o.jsxs("div",{className:"mb-6 p-4 bg-ok/10 border border-green-100 rounded-xl text-ok text-sm flex items-start gap-3 animate-in fade-in slide-in-from-top-2",children:[o.jsx(kv,{size:18,className:"shrink-0 mt-0.5"}),o.jsx("span",{children:t("auth.resetSent")}
5415)]}),o.jsxs("form",{onSubmit:b,className:"space-y-4",children:[o.jsxs("div",{className:"relative group",children:[o.jsx(Sp,{className:"absolute start-4 top-1/2 -translate-y-1/2 text-faint group-focus-within:text-ink transition-colors",size:20}),o.jsx("input",{type:"email",placeholder:t("auth.email"),value:m,onChange:w=>p(w.target.value),className:"w-full ps-12 pe-4 py-3 bg-raised border border-line rounded-xl focus:outline-none focus:ring-2 focus:ring-black/5 focus:border-line-strong transition-all placeholder:text-faint",required:!0})]}),o.jsx(An,{type:"submit",fullWidth:!0,isLoading:n,className:"py-3 text-base font-semibold shadow-lg shadow-black/5 hover:shadow-black/10",children:t("auth.sendResetLink")}),o.jsx("div",{className:"text-center",children:o.jsxs(zt,{to:"/login",className:"inline-flex items-center text-sm text-dim hover:text-ink transition-colors",children:[o.jsx(x,{size:16,className:"me-2"}),t("auth.backToLogin")]})})]})]})},Wo=5,tR=t=>{if(t.imageUrls.length===0)return null;const e=t.coverIndex>=0&&t.coverIndex<t.imageUrls.length?t.coverIndex:0;return t.imageUrls[e]},jT=t=>t instanceof Ut?t.toDate():null,Wb=(t,e)=>({id:t,name:typeof e.name=="string"?e.name:"",imageUrls:Array.isArray(e.imageUrls)?e.imageUrls.filter(n=>typeof n=="string"):[],imagePaths:Array.isArray(e.imagePaths)?e.imagePaths.filter(n=>typeof n=="string"):[],coverIndex:typeof e.coverIndex=="number"?e.coverIndex:0,createdAt:jT(e.createdAt),updatedAt:jT(e.updatedAt)}),zc={severity:"none",sameProduct:null,issues:[],advice:null,suggestions:[],suggestedName:null},MK=t=>t.severity==="warn"||t.sameProduct===!1||t.suggestions.length>0;class un{static col(e){return lp(sl,"users",e,"products")}static watch(e,n,s){const a=Zo(un.col(e),nh("updatedAt","desc"));return XA(a,c=>n(c.docs.map(u=>Wb(u.id,u.data()))),c=>s==null?void 0:s(c))}static async list(e){return(await up(Zo(un.col(e),nh("updatedAt","desc")))).docs.map(s=>Wb(s.id,s.data()))}static async get(e,n){const s=await rg(si(un.col(e),n));return s.exists()?Wb(s.id,s.data()):null}static newId(e){return si(un.col(e)).id}static async uploadPhoto(e,n,s){var m;const a=((m=s.name.split(".").pop())==null?void 0:m.toLowerCase())||"jpg",c=`${Date.now()}-${Math.random().toString(36).slice(2)}.${a}`,u=`users/${e}/products/${n}/${c}`,h=mp(pp,u);return await bz(h,s,{contentType:s.type||"image/jpeg",customMetadata:{visibility:"public"}}),{url:await vC(h),path:u}}static async uploadPhotos(e,n,s){return Promise.all(s.slice(0,Wo).map(a=>un.uploadPhoto(e,n,a)))}static async commitNew(e,n,s,a,c=0){const u=a.slice(0,Wo),h=c>=0&&c<u.length?c:0,m={name:s.trim(),imageUrls:u.map(p=>p.url),imagePaths:u.map(p=>p.path),coverIndex:h};return await GA(si(un.col(e),n),{...m,createdAt:Pm(),updatedAt:Pm()}),{id:n,...m,createdAt:new Date,updatedAt:new Date}}static async commitUpdate(e,n,s,a,c,u=0){const h=a.slice(0,Wo),m=u>=0&&u<h.length?u:0,p={name:s.trim(),imageUrls:h.map(b=>b.url),imagePaths:h.map(b=>b.path),coverIndex:m};return await YA(si(un.col(e),n.id),{...p,updatedAt:Pm()}),await un.discardUploads(c),{...n,...p,updatedAt:new Date}}static async remove(e,n){await un.discardUploads(n.imagePaths),await WA(si(un.col(e),n.id))}static async discardUploads(e){await Promise.all(e.map(async n=>{try{await _C(mp(pp,n))}catch(s){console.warn("[products] could not delete",n,s)}}))}static async precheck(e){if(e.imageUrls.length===0)return zc;try{const s=await ct(ut,"precheckProduct")({imageUrls:e.imageUrls.slice(0,Wo),name:e.name??"",locale:e.locale??navigator.language??"en"});return{...zc,...s.data||{}}}catch(n){return console.warn("[products] precheck failed, continuing",n),zc}}}const PK=({frames:t,intervalMs:e=3200})=>{const n=De(),[s,a]=v.useState(0);v.useEffect(()=>{t.forEach(u=>{const h=new Image;h.src=u.url})},[t]),v.useEffect(()=>{if(t.length<2)return;const u=window.setInterval(()=>a(h=>(h+1)%t.length),e);return()=>window.clearInterval(u)},[t.length,e]);const c=t[s];return o.jsxs("div",{className:"relative h-full w-full overflow-hidden",children:[t.map((u,h)=>o.jsx("img",{src:u.url,alt:"",className:"absolute inset-0 h-full w-full object-cover object-top transition-opacity duration-700",style:{opacity:h===s?1:0}},u.url+h)),(c==null?void 0:c.tagKey)&&o.jsx("span",{className:"absolute bottom-2 left-2 rounded-md bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.06em] text-white backdrop-blur",children:n(c.tagKey,c.tagN?{n:c.tagN}:void 0)}),t.length>1&&o.jsx("div",{className:"absolute bottom-2 right-2 flex gap-1",children:t.map((u,h)=>o.jsx("span",{className:"h-1 w-1 rounded-full transition-colors",style:{backgroundColor:h===s?"rgba(255,255,255,0.95)":"rgba(255,255,255,0.35)"}},u.url+h))})]})}
5415,DK=[{id:"riad_yellow_stripe",name:"Riad Yellow Stripe",shots:6},{id:"camel_trench_studio",name:"Camel Trench Studio",shots:6},{id:"floral_mini_studio",name:"Floral Mini Studio",shots:6},{id:"drapery_dogs_set",name:"Drapery & Dogs",shots:6},{id:"black_shirt_chair",name:"Black Shirt Chair",shots:6},{id:"corset_dress_studio",name:"Corset Dress Studio",shots:6},{id:"gold_backdrop_shirting",name:"Gold Backdrop",shots:6},{id:"grey_studio_menswear_ecom",name:"Grey Studio Menswear",shots:6}],OK=()=>{const t=De(),[e,n]=v.useState([]),[s,a]=v.useState(!0);v.useEffect(()=>{let m=!0;return Ld.getTemplateSets({featuredOnly:!0,sort:"popular",limit:12}).then(p=>{if(m)return p.sets.length?n(p.sets):Ld.getTemplateSets({sort:"popular",limit:12}).then(b=>m&&n(b.sets))}).catch(()=>{}).finally(()=>m&&a(!1)),()=>{m=!1}},[]);const{locale:c}=nu(),u=e.length?e.map(m=>{var p,b;return{key:m.id,url:m.coverUrl,name:((p=m.displayNames)==null?void 0:p[c])||((b=m.displayNames)==null?void 0:b.en)||m.id,shots:m.shotCount}}):DK.map(m=>({key:m.id,url:`/images/catalogue/${m.id}.webp`,name:m.name,shots:m.shots})),h=u.reduce((m,p)=>m+(p.shots||0),0);return o.jsxs("section",{className:"overflow-hidden rounded-panel border border-line bg-surface",children:[o.jsxs("div",{className:"flex flex-col gap-4 p-5 sm:flex-row sm:items-end sm:justify-between sm:p-6",children:[o.jsxs("div",{className:"max-w-xl",children:[o.jsxs("p",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-accent",children:[o.jsx(kp,{size:12})," ",t("catalogueBand.eyebrow")]}),o.jsx("h2",{className:"mt-2 text-2xl font-bold tracking-tight text-ink",children:t("catalogueBand.title")}),o.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-dim",children:t("catalogueBand.body")})]}),o.jsxs(zt,{to:"/catalogue",className:"inline-flex shrink-0 items-center gap-2 self-start rounded-xl bg-ink px-5 py-3 text-sm font-bold text-base transition-opacity hover:opacity-90 sm:self-auto",children:[t("catalogueBand.browse"),o.jsx(ks,{size:15})]})]}),o.jsxs("div",{className:"relative",children:[o.jsx("div",{className:"flex gap-3 overflow-x-auto px-5 pb-5 sm:px-6 sm:pb-6",children:s?Array.from({length:6}).map((m,p)=>o.jsx("div",{className:"h-52 w-40 shrink-0 animate-pulse rounded-xl bg-raised"},p)):u.map(m=>o.jsxs(zt,{to:"/catalogue",className:"group relative h-52 w-40 shrink-0 overflow-hidden rounded-xl border border-line bg-base",children:[o.jsx("img",{src:m.url,alt:"",loading:"lazy",className:"h-full w-full object-cover transition-transform duration-500 group-hover:scale-105"}),o.jsxs("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/40 to-transparent px-2.5 pb-2.5 pt-8",children:[o.jsx("p",{className:"truncate text-xs font-bold text-white",children:m.name}),o.jsx("p",{className:"font-mono text-[9px] uppercase tracking-[0.08em] text-white/70",children:t("catalogueBand.shots",{count:m.shots})})]})]},m.key))}),o.jsx("div",{className:"pointer-events-none absolute inset-y-0 right-0 w-16 bg-gradient-to-l from-surface to-transparent"})]}),!s&&u.length>0&&o.jsx("div",{className:"border-t border-line px-5 py-3 sm:px-6",children:o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.12em] text-faint",children:t("catalogueBand.footer",{sets:u.length,shots:h})})})]})},AT=typeof navigator<"u"&&/Mac|iPhone|iPad/.test(navigator.platform),LK=v7.map(t=>Th.find(e=>e.path===t)).filter(t=>!!t),UK=({entry:t})=>{const e=De(),n=cr(t.toolId),s=t.example;return o.jsxs(zt,{to:t.path,className:"group flex flex-col overflow-hidden rounded-panel border border-line bg-surface transition-colors hover:border-line-strong",children:[o.jsxs("div",{className:"relative aspect-[4/3] overflow-hidden bg-base",children:[t.reel?o.jsx(PK,{frames:t.reel,intervalMs:t.reelMs}):t.variants?o.jsx("div",{className:"flex h-full divide-x divide-line",children:t.variants.map(a=>o.jsxs("div",{className:"relative h-full flex-1",children:[o.jsx("img",{src:a.image,alt:"",className:"h-full w-full object-cover"}),o.jsx("span",{className:"absolute bottom-2 left-1/2 -translate-x-1/2 whitespace-nowrap rounded-md bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.06em] text-white backdrop-blur",children:e(a.labelKey)})]},a.labelKey))}):s!=null&&s.isVideo?o.jsx("video",{src:s.after,muted:!0,loop:!0,playsInl
5415ine:!0,autoPlay:!0,className:"h-full w-full object-cover object-top"}):s!=null&&s.after?o.jsxs(o.Fragment,{children:[s.before&&o.jsx("img",{src:s.before,alt:"",className:"absolute inset-0 h-full w-full object-cover transition-opacity duration-300 group-hover:opacity-0"}),o.jsx("img",{src:s.after,alt:"",className:`h-full w-full object-cover ${s.before?"opacity-0 transition-opacity duration-300 group-hover:opacity-100":""}`}),s.before&&o.jsx("span",{className:"absolute bottom-2 left-2 rounded-md bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.06em] text-white backdrop-blur transition-opacity group-hover:opacity-0",children:e("home.card.hoverForResult")})]}):o.jsx("div",{className:"flex h-full items-center justify-center text-faint",children:o.jsx($i,{name:t.icon,size:28})}),(s==null?void 0:s.isVideo)&&o.jsxs("span",{className:"absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-md bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase text-white backdrop-blur",children:[o.jsx($S,{size:8})," ",e("home.card.video")]})]}),o.jsxs("div",{className:"flex flex-1 flex-col gap-2 p-3.5",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-accent",children:o.jsx($i,{name:t.icon,size:15})}),o.jsx("h3",{className:"flex-1 text-sm font-bold text-ink",children:e(t.labelKey)}),n&&o.jsxs("span",{className:"inline-flex items-center gap-0.5 font-mono text-[10px] font-bold text-dim",children:[o.jsx(Bc,{size:9}),n.price]})]}),o.jsxs("dl",{className:"space-y-1 font-mono text-[10px] uppercase tracking-[0.06em]",children:[o.jsxs("div",{className:"flex gap-2",children:[o.jsx("dt",{className:"w-7 shrink-0 text-faint",children:e("home.card.in")}),o.jsx("dd",{className:"text-dim",children:e(t.inputKey)})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx("dt",{className:"w-7 shrink-0 text-faint",children:e("home.card.out")}),o.jsx("dd",{className:"text-dim",children:e(t.outputKey)})]})]})]})]})},FK=t=>t.type==="video"||typeof t.generationType=="string"&&t.generationType.toLowerCase().includes("video"),VK=({item:t})=>{const e=FK(t),n=t.mediaUrl??t.url,s=t.thumbnailUrl;return o.jsxs(zt,{to:"/history",className:"group relative aspect-[3/4] overflow-hidden rounded-lg border border-line bg-surface",children:[e&&!s?o.jsx("video",{src:n,muted:!0,loop:!0,playsInline:!0,preload:"metadata",onMouseEnter:a=>void a.currentTarget.play(),onMouseLeave:a=>a.currentTarget.pause(),className:"h-full w-full object-cover object-top"}):o.jsx("img",{src:s??n,alt:"",loading:"lazy",className:`h-full w-full object-cover transition-transform duration-300 group-hover:scale-105 ${e?"object-top":""}`}),e&&o.jsx("span",{className:"absolute right-1.5 top-1.5 rounded bg-black/70 p-1 text-white backdrop-blur",children:o.jsx($S,{size:9})}),o.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/80 to-transparent px-2 pb-1.5 pt-6 font-mono text-[9px] uppercase tracking-[0.06em] text-white",children:t.styleId})]})},zK=()=>{const t=De(),[e,n]=v.useState([]),[s,a]=v.useState(!1);return v.useEffect(()=>{var u;const c=(u=xt.currentUser)==null?void 0:u.uid;if(!c){a(!0);return}return un.watch(c,h=>{n(h),a(!0)},()=>a(!0))},[]),s?e.length===0?o.jsxs("section",{className:"flex flex-wrap items-center gap-4 roun
5415ded-panel border border-line bg-surface p-5",children:[o.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Tr,{size:20,className:"text-accent"})}),o.jsxs("div",{className:"min-w-[16rem] flex-1",children:[o.jsx("h2",{className:"text-sm font-bold text-ink",children:t("home.products.emptyTitle")}),o.jsx("p",{className:"mt-1 text-sm leading-relaxed text-dim",children:t("home.products.emptyBody")})]}),o.jsxs(zt,{to:"/products",className:"inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(Kc,{size:14})," ",t("home.products.add")]})]}):o.jsxs("section",{children:[o.jsxs("div",{className:"mb-3 flex items-baseline justify-between",children:[o.jsx("h2",{className:"text-sm font-bold uppercase tracking-[0.08em] text-ink",children:t("nav.products.label")}),o.jsxs(zt,{to:"/products",className:"inline-flex items-center gap-1 text-xs font-semibold text-dim hover:text-ink",children:[t("home.products.manage")," ",o.jsx(ks,{size:12})]})]}),o.jsxs("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-8",children:[e.slice(0,7).map(c=>{const u=tR(c);return o.jsxs(zt,{to:"/products",className:"group relative aspect-square overflow-hidden rounded-lg border border-line bg-surface",children:[u?o.jsx("img",{src:u,alt:"",className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full items-center justify-center text-faint",children:o.jsx(Tr,{size:16})}),o.jsx("span",{className:"absolute inset-x-0 bottom-0 truncate bg-gradient-to-t from-black/80 to-transparent px-2 pb-1.5 pt-6 text-[10px] font-semibold text-white",children:c.name||t("home.products.untitled")})]},c.id)}),o.jsxs(zt,{to:"/products",className:"flex aspect-square flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-line text-faint transition-colors hover:border-accent hover:text-accent",children:[o.jsx(Kc,{size:16}),o.jsx("span",{className:"text-[10px] font-semibold",children:t("home.products.addShort")})]})]})]}):null},BK=[{headKey:"home.value.speed.head",bodyKey:"home.value.speed.body"},{headKey:"home.value.cost.head",bodyKey:"home.value.cost.body"},{headKey:"home.value.coverage.head",bodyKey:"home.value.coverage.body"}],KK=({onUpgrade:t})=>{const e=De();return o.jsxs("section",{className:"rounded-panel border border-line bg-surface p-5 sm:p-6",children:[o.jsx("div",{className:"grid gap-6 sm:grid-cols-3",children:BK.map(n=>o.jsxs("div",{children:[o.jsx("h3",{className:"text-sm font-bold text-ink",children:e(n.headKey)}),o.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-dim",children:e(n.bodyKey)})]},n.headKey))}),t&&o.jsxs("div",{className:"mt-6 flex flex-col gap-3 border-t border-line pt-5 sm:flex-row sm:items-center sm:justify-between",children:[o.jsx("p",{className:"text-sm text-dim",children:e("home.value.proLine")}),o.jsxs("button",{onClick:t,className:"inline-flex shrink-0 items-center gap-1.5 rounded-xl bg-ink px-5 py-3 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(us,{size:14})," ",e("home.value.seePlans")]})]})]})},$K=({user:t,onUpgrade:e})=>{const n=De(),s=Xn(),[a,c]=v.useState([]),[u,h]=v.useState(!0);v.useEffect(()=>{Ln.getUserMediaItems(12).then(c).catch(()=>c([])).finally(()=>h(!1))},[]);const m=(t.name||n("home.defaultName")).split(" ")[0];return o.jsxs("div",{className:"space-y-10",children:[o.jsxs("section",{className:"flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[11px] uppercase tracking-[0.14em] text-accent",children:n("home.eyebrow")}),o.jsx("h1",{className:"mt-1.5 text-3xl font-bold tracking-tight text-ink",children:n("home.greeting",{name:m})}),o.jsx("p",{className:"mt-1.5 max-w-xl text-sm leading-relaxed text-dim",children:n("home.intro")})]}),o.jsxs("button",{onClick:UC,className:"flex shrink-0 items-center gap-2.5 rounded-xl border border-line bg-surface px-4 py-2.5 text-dim transition-colors hover:border-line-strong hover:text-ink",children:[o.jsx(zd,{size:15}),o.jsx("span",{className:"text-sm",children:n("home.jumpToTool")}),o.jsxs("kbd",{className:"rounded border border-line px-1.5 py-0.5 font-mono text-[10px] text-faint",children:[AT?"⌘":"Ctrl","K"]})]})]}),o.jsxs("section",{className:"flex flex-wrap items-center gap-x-8 gap-y-3 rounded-panel border border-line bg-surface px-5 py-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:n("home.credits")}),o.jsxs("p",{className:"mt-0.5 flex items-center gap-1.5 text-xl font-bold text-ink",children:[o.jsx(Bc,{size:16,className:"text-accent"}),t.diamond_balance]})]}),o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:n("home.plan")}),o.jsx("p",{className:"mt-0.5 text-xl font-bold text-ink",children:t.is_premium?n("home.plan.pro"):n("home.plan.free")})]}),o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:n("home.recentRuns")}),o.jsx("p",{className:"mt-0.5 text-xl font-bold text-ink",children:u?"—":a.length>=12?"12+":a.length})]}),o.jsx("div",{className:"flex-1"}),!t.is_premium&&e&&o.jsxs("button",{onClick:e,className:"inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(us,{size:14})," ",n("home.upgrade")]})]}),o.jsx(OK,{}),o.jsxs("section",{children:[o.jsxs("div",{className:"mb-3 flex items-baseline justify-between",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-bold uppercase tracking-[0.08em] text-ink",children:n("home.startHere")}),o.jsx("p",{className:"mt-1 text-sm text-dim",children:n("home.startHereBlurb")})]}),o.jsx("span",{className:"shrink-0 font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:n("home.inputOutput")})]}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-3",children:LK.map(p=>o.jsx(UK,{entry:p},p.path))})]}),!t.is_premium&&o.jsx(KK,{onUpgrade:e}),o.jsx(zK,{}),o.jsxs("section",{children:[o.jsxs("div",{className:"mb-3 flex items-baseline justify-between",children:[o.jsx("h2",{className:"text-sm font-bold uppercase tracking-[0.08em] text-ink",children:n("home.latestOutput")}),o.jsxs(zt,{to:"/history",className:"inline-flex items-center gap-1 text-xs font-semibold text-dim hover:text-ink",children:[n("home.allHistory")," ",o.jsx(ks,{size:12})]})]}),u?o.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-6",children:Array.from({length:6}).map((p,b)=>o.jsx("div",{className:"aspect-[3/4] animate-pulse rounded-lg bg-raised"},b))}):a.length===0?o.jsxs("div",{className:"rounded-panel border border-dashed border-line px-6 py-10 text-center",children:[o.jsx("p",{className:"text-sm text-dim",children:n("home.empty")}),o.jsx("button",{onClick:()=>s("/try-on"),className:"mt-3 rounded-xl bg-ink px-4 py-2 text-xs font-bold text-base transition-opacity hover:opacity-90",children:n("home.runFirst")})]}):o.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-6",children:a.slice(0,6).map(p=>o.jsx(VK,{item:p}
5415,p.id))})]}),iv.map(p=>o.jsxs("section",{children:[o.jsx("h2",{className:"mb-3 text-sm font-bold uppercase tracking-[0.08em] text-ink",children:n(yp[p])}),o.jsx("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 lg:grid-cols-3",children:Ad(p).map(b=>{var w,T,N,j,A;const x=cr(b.toolId);return o.jsxs(zt,{to:b.path,className:"group flex items-start gap-3 rounded-panel border border-line bg-surface p-3.5 transition-colors hover:border-line-strong",children:[b.reel||(w=b.example)!=null&&w.after||b.variants?o.jsx("span",{className:"relative h-12 w-12 shrink-0 overflow-hidden rounded-lg bg-base",children:(T=b.example)!=null&&T.isVideo?o.jsx("video",{src:b.example.after,muted:!0,loop:!0,playsInline:!0,autoPlay:!0,className:"h-full w-full object-cover object-top"}):o.jsx("img",{src:((j=(N=b.reel)==null?void 0:N[0])==null?void 0:j.url)??((A=b.example)==null?void 0:A.after)??b.variants[0].image,alt:"",loading:"lazy",className:"h-full w-full object-cover object-top"})}):o.jsx("span",{className:"mt-0.5 text-faint transition-colors group-hover:text-accent",children:o.jsx($i,{name:b.icon,size:17})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsxs("span",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-ink",children:n(b.labelKey)}),b.legacy&&o.jsx("span",{className:"rounded border border-line px-1 font-mono text-[9px] uppercase text-faint",children:"v1"}),x&&o.jsxs("span",{className:"ml-auto inline-flex items-center gap-0.5 font-mono text-[10px] font-bold text-faint",children:[o.jsx(Bc,{size:9}),x.price]})]}),o.jsx("span",{className:"mt-0.5 block text-xs text-faint",children:n(b.blurbKey)})]})]},b.path)})})]},p)),o.jsxs("section",{className:"rounded-panel border border-line bg-surface px-5 py-4",children:[o.jsx("h2",{className:"mb-3 text-sm font-bold uppercase tracking-[0.08em] text-ink",children:n("home.shortcuts")}),o.jsxs("div",{className:"flex flex-wrap gap-x-8 gap-y-2 font-mono text-[11px] text-faint",children:[o.jsxs("span",{children:[o.jsxs("kbd",{className:"rounded border border-line px-1.5 py-0.5 text-ink",children:[AT?"⌘":"Ctrl","K"]})," ",n("home.shortcut.palette")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"rounded border border-line px-1.5 py-0.5 text-ink",children:"↑ ↓"})," ",n("home.shortcut.navigate")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"rounded border border-line px-1.5 py-0.5 text-ink",children:"↵"})," ",n("home.shortcut.open")]}),o.jsxs("span",{children:[o.jsx("kbd",{className:"rounded border border-line px-1.5 py-0.5 text-ink",children:"esc"})," ",n("home.shortcut.close")]})]})]})]})},qK=[{value:"",labelKey:"model.filter.all"},{value:"female",labelKey:"model.gender.female"},{value:"male",labelKey:"model.gender.male"}],HK=[{value:"",labelKey:"model.filter.all"},{value:"caucasian",labelKey:"model.race.caucasian"},{value:"east_asian",labelKey:"model.race.eastAsian"},{value:"south_asian",labelKey:"model.race.southAsian"},{value:"african",labelKey:"model.race.african"},{value:"hispanic",labelKey:"model.race.hispanic"}],GK=[{value:"",labelKey:"model.filter.all"},{value:"athletic",labelKey:"model.body.athletic"},{value:"slim",labelKey:"model.body.slim"},{value:"average",labelKey:"model.body.average"},{value:"curvy",labelKey:"model.body.curvy"},{value:"plus_size",labelKey:"model.body.plusSize"}],YK=[{value:"",labelKey:"model.filter.all"},{value:"0-3",label:"0-3"},{value:"4-12",label:"4-12"},{value:"13-19",label:"13-19"},{value:"20-30",label:"20-30"},{value:"30-45",label:"30-45"},{value:"55+",label:"55+"}];function WK(t){return t.image_urls&&t.image_urls.length>0?t.image_urls[0]:t.imageUrls&&t.imageUrls.length>0?t.imageUrls[0]:t.imageUrl?t.imageUrl:null}const vl=({isOpen:t,selectedModel:e,onSelect:n,onClose:s})=>{const a=De(),[c,u]=v.useState([]),[h,m]=v.useState(""),[p,b]=v.useState(""),[x,w]=v.useState(""),[T,N]=v.useState(""),[j,A]=v.useState(),[F,V]=v.useState(!1),[L,Y]=v.useState(!1),[$,q]=v.useState(!1),I=v.useRef(!1),S=v.useCallback(async(D,z)=>{if(D){if(I.current)return;I.current=!0,Y(!0),u([]),A(void 0)}else q(!0);try{const P=await nn.getFashionModels({gender:h||void 0,race:p||void 0,bodyType:x||void 0,ageRange:T||void 0,pageSize:20,pageToken:D?void 0:z});u(D?P.models:ie=>[...ie,...P.models]),A(P.nextPageToken),V(P.hasMore)}catch(P){console.error("Failed to load models",P)}finally{I.current=!1,Y(!1),q(!1)}},[h,p,x,T]);if(v.useEffect(()=>{t&&S(!0)},[t,h,p,x,T]),!t)return null;const C="w-full appearance-none bg-raised border border-line rounded-xl px-3 py-2 pr-8 text-sm font-medium text-ink focus:outline-none focus:border-brand-black focus:ring-1 focus:ring-brand-black transition-colors",R=(D,z,P,ie)=>o.jsxs("div",{className:"flex-1 flex flex-col gap-1",children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:D}),o.jsxs("div",{className:"relative",children:[o.jsx("select",{value:z,onChange:_e=>P(_e.target.value),className:C,children:ie.map(_e=>o.jsx("option",{value:_e.value,children:_e.labelKey?a(_e.labelKey):_e.label},_e.value||"__all"))}),o.jsx(Um,{size:14,className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-faint pointer-events-none"})]})]});return o.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-center justify-center z-50 p-4",children:o.jsxs("div",{className:"bg-surface rounded-3xl shadow-2xl w-full max-w-3xl max-h-[90vh] flex flex-col",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-line flex-shrink-0",children:[o.jsx("h3",{className:"text-xl font-bold tracking-tight",children:a("picker.models.title")}),o.jsx("button",{onClick:s,className:"p-2 bg-raised rounded-full hover:bg-line transition-colors",children:o.jsx(Wt,{size:20})})]}),o.jsx("div",{className:"px-6 py-4 border-b border-line flex-shrink-0",children:o.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[R(a("model.gender"),h,m,qK),R(a("model.ethnicity"),p,b,HK),R(a("model.bodyType"),x,w,GK),R(a("model.ageRange"),T,N,YK)]})}),o.jsx("div",{className:"overflow-y-auto flex-1 min-h-0 px-6 py-4",children:L?o.jsx("div",{className:"flex items-center justify-center h-52",children:o.jsx(et,{size:28,className:"animate-spin text-faint"})}):c.length===0?o.jsx("div",{className:"flex items-center justify-center h-52 text-faint text-sm",children:a("picker.models.empty")}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 gap-4",children:c.map(D=>{const z=WK(D),P=(e==null?void 0:e.id)===D.id;return o.jsxs("button",{onClick:()=>{n(D),s()},className:`relative rounded-2xl overflow-hidden border-2 transition-all h-44 ${P?"border-brand-black shadow-lg":"border-line hover:border-line-strong"}`,children:[z?o.jsx("img",{src:z,alt:Vc(D),className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-raised flex items-center justify-center",children:o.jsx("span",{className:"text-faint text-xs text-center px-2",children:Vc(D)})}),P&&o.jsx("div",{className:"absolute top-2 right-2 bg-brand-black rounded-full w-5 h-5 flex items-center justify-center",children:o.jsx("svg",{width:"10",height:"8",viewBox:"0 0 10 8",fill:"none",children:o.jsx("path",{d:"M1 4L3.5 6.5L9 1",stroke:"white",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round"})})}),o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/60 to-transparent px-2 py-2",children:[o.jsx("p",{className:"text-white text-xs font-medium truncate",children:Vc(D)}),yT(D)&&o.jsx("p",{className:"text-white/70 text-[10px] truncate",children:yT(D)})]})]},D.id)})}),F&&o.jsx("div",{className:"flex justify-center mt-4",children:o.jsxs("button",{onClick:()=>S(!1,j),disabled:$,className:"flex items-center gap-2 px-6 py-2.5 rounded-xl border border-line text-sm font-medium text-dim hover:bg-raised disabled:opacity-50 transition-all",children:[$?o.jsx(et,{size:15,className:"animate-spin"}):o.jsx(Um,{size:15}),a("picker.loadMore")]})})]})})]})})};function XK(t){return t.image_url||t.imageUrl||null}function QK(t){return hu(t)||t.id}const nR=({isOpen:t,selectedPose:e,onSelect:n,onClose:s})=>{const a=De(),[c,u]=v.useState([]),[h,m]=v.useState(!1),[p,b]=v.useState(null),x=v.useRef(!1);return v.useEffect(()=>{if(!t||x.current)return;(async()=>{x.current=!0,m(!0),b(null);try{const T=await nn.getFashionPoses();u(T.filter(N=>N.isActive!==!1))}catch{b("picker.poses.failed")}finally{m(!1),x.current=!1}})()},[t]),t?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s}),o.jsxs("div",{className:"relative bg-surface rounded-3xl shadow-2xl w-full max-w-2xl max-h-[80vh] flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b border-line",children:[o.jsx("h2",{className:"text-lg font-bold text-ink",children:a("picker.poses.title")}),o.jsx("button",{onClick:s,className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(Wt,{size:18})})]}),o.jsxs("div",{className:"flex-1 overflow-y-auto p-6",children:[h&&o.jsx("div",{className:"flex items-center justify-center py-16",children:o.jsx(et,{size:24,className:"animate-spin text-faint"})}),p&&!h&&o.jsxs("div",{className:"text-center py-12",children:[o.jsx("p",{className:"text-red-500 text-sm mb-3",children:a(p)}),o.jsx("button",{onClick:()=>{x.current=!1,u([])},className:"text-sm font-medium text-dim underline",children:a("picker.retry")})]}),!h&&!p&&o.jsx("div",{className:"grid grid-cols-3 gap-3",children:c.map(w=>{const T=XK(w),N=QK(w),j=(e==null?void 0:e.id)===w.id;return o.jsxs("button",{onClick:()=>{n(w),s()},className:`relative rounded-2xl overflow-hidden aspect-[3/4] border-2 transition-all ${j?"border-ink ring-2 ring-black/10":"border-transparent hover:border-line"}`,children:[T?o.jsx("img",{src:T,alt:N,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-raised flex items-center justify-center text-xs text-faint",children:a("picker.noImage")}),o.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent px-2 py-3",children:o.jsx("p",{className:"text-white text-xs font-semibold truncate",children:N})}),j&&o.jsx("div",{className:"absolute top-2 right-2 w-5 h-5 rounded-full bg-accent flex items-center justify-center",children:o.jsx(Cn,{size:11,className:"text-white"})})]},w.id)})})]})]})]}):null},JK=[{value:"",labelKey:"model.filter.all"},{value:"studio",labelKey:"env.filter.studio"},{value:"outdoor",labelKey:"env.filter.outdoor"},{value:"indoor",labelKey:"env.filter.indoor"},{value:"nature",labelKey:"env.filter.nature"},{value:"landmark",labelKey:"env.filter.landmark"},{value:"street",labelKey:"env.filter.street"},{value:"rooftop",labelKey:"env.filter.rooftop"}];function ZK(t){return t.image_url||t.imageUrl||null}function e$(t){return hu(t)||t.id}const t$=({isOpen:t,selectedEnv:e,onSelect:n,onClose:s})=>{const a=De(),[c,u]=v.useState([]),[h,m]=v.useState(""),[p,b]=v.useState(!1),[x,w]=v.useState(null),T=v.useRef(!1);v.useEffect(()=>{if(!t||T.current||c.length>0)return;(async()=>{T.current=!0,b(!0),w(null);try{const A=await nn.getFashionEnvironments();u(A.filter(F=>F.isActive!==!1))}catch{w("picker.environments.failed")}finally{b(!1),T.current=!1}})()},[t,c.length]);const N=h?c.filter(j=>j.type===h):c;return t?o.jsxs("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center p-2 sm:p-4",children:[o.jsx("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:s}),o.jsxs("div",{className:"relative bg-surface rounded-t-3xl sm:rounded-3xl shadow-2xl w-full max-w-2xl h-[85dvh] sm:max-h-[85vh] sm:h-auto flex flex-col overflow-hidden",children:[o.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-6 py-4 border-b border-line shrink-0 bg-surface",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold text-ink",children:a("picker.environments.title")}),o.jsx("p",{className:"text-xs text-dim mt-0.5",children:a("picker.environments.count",{count:N.length})})]}),o.jsx("button",{onClick:s,className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(Wt,{size:18})})]}),o.jsx("div",{className:"px-4 sm:px-6 py-3 flex gap-2 overflow-x-auto scrollbar-hide border-b border-line shrink-0 bg-surface",children:JK.map(j=>o.jsx("button",{onClick:()=>
5415m(j.value),className:`flex-shrink-0 px-4 py-1.5 rounded-full text-xs font-semibold transition-colors ${h===j.value?"bg-ink text-base":"bg-raised text-dim hover:bg-line"}`,children:a(j.labelKey)},j.value))}),o.jsxs("div",{className:"flex-1 min-h-0 overflow-y-auto p-4 sm:p-6",children:[p&&o.jsx("div",{className:"flex items-center justify-center py-16",children:o.jsx(et,{size:24,className:"animate-spin text-faint"})}),x&&!p&&o.jsxs("div",{className:"text-center py-12",children:[o.jsx("p",{className:"text-red-500 text-sm mb-3",children:a(x)}),o.jsx("button",{onClick:()=>{T.current=!1,u([])},className:"text-sm font-medium text-dim underline",children:a("picker.retry")})]}),!p&&!x&&o.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3",children:N.map(j=>{const A=ZK(j),F=e$(j),V=(e==null?void 0:e.id)===j.id;return o.jsxs("button",{onClick:()=>{n(j),s()},className:`relative rounded-2xl overflow-hidden aspect-[4/3] border-2 transition-all ${V?"border-ink ring-2 ring-black/10":"border-transparent hover:border-line"}`,children:[A?o.jsx("img",{src:A,alt:F,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-raised flex items-center justify-center text-xs text-faint",children:a("picker.noImage")}),o.jsx("div",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/70 to-transparent px-2 py-3",children:o.jsx("p",{className:"text-white text-xs font-semibold truncate",children:F})}),V&&o.jsx("div",{className:"absolute top-2 right-2 w-5 h-5 rounded-full bg-accent flex items-center justify-center",children:o.jsx(Cn,{size:11,className:"text-white"})})]},j.id)})})]})]})]}):null},xc=[];let CT="";const n0=({isOpen:t,onClose:e,children:n,title:s,maxWidth:a="max-w-md",fullScreen:c=!1,footer:u})=>{const h=De(),m=v.useId(),p=v.useRef(null),b=v.useRef(null);v.useLayoutEffect(()=>{var w;t&&((w=b.current)==null||w.scrollTo(0,0))},[t,s]);const x=v.useRef(e);return x.current=e,v.useEffect(()=>{var N;if(!t)return;const w=document.activeElement;xc.length||(CT=document.body.style.overflow,document.body.style.overflow="hidden"),xc.push(m),(N=p.current)==null||N.focus();const T=j=>{var L,Y,$;if(xc.at(-1)!==m||(j.key==="Escape"&&(j.preventDefault(),j.stopImmediatePropagation(),x.current()),j.key!=="Tab"))return;const A=[...((L=p.current)==null?void 0:L.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), textarea:not([disabled]), select:not([disabled]), [tabindex="0"]'))??[]].filter(q=>q.getClientRects().length>0),F=A[0],V=A.at(-1);if(!F){j.preventDefault(),(Y=p.current)==null||Y.focus();return}j.shiftKey&&(document.activeElement===F||document.activeElement===p.current)?(j.preventDefault(),V==null||V.focus()):!j.shiftKey&&(document.activeElement===V||!(($=p.current)!=null&&$.contains(document.activeElement)))&&(j.preventDefault(),F.focus())};return document.addEventListener("keydown",T,!0),()=>{document.removeEventListener("keydown",T,!0);const j=xc.indexOf(m);j>=0&&xc.splice(j,1),xc.length||(document.body.style.overflow=CT),w!=null&&w.isConnected&&w.focus()}},[t,m]),t?C3.createPortal(o.jsxs("div",{className:`fixed inset-0 z-50 flex justify-center ${c?"":"items-center p-3 sm:p-4"}`,children:[o.jsx("div",{"aria-hidden":"true",className:"absolute inset-0 bg-black/60 backdrop-blur-sm",onClick:e}),o.jsxs("div",{ref:p,tabIndex:-1,role:"dialog","aria-modal":"true","aria-labelledby":`${m}-title`,className:c?"relative flex h-[100dvh] w-full flex-col overflow-hidden bg-base outline-none":`relative flex max-h-[90dvh] w-full flex-col overflow-hidden rounded-3xl border border-line bg-surface shadow-2xl outline-none ${a}`,children:[o.jsxs("header",{className:"z-10 flex shrink-0 items-center justify-between gap-3 border-b border-line bg-surface px-4 py-2 [padding-top:max(0.5rem,env(safe-area-inset-top))] sm:px-6",children:[o.jsx("h2",{id:`${m}-title`,className:"text-base font-bold tracking-tight text-ink",children:s}),o.jsx("button",{type:"button",onClick:e,"aria-label":h("common.close"),className:"flex h-11 w-11 shrink-0 items-center justify-center rounded-full bg-raised text-dim hover:text-ink focus-visible:ring-2 focus-visible:ring-accent",children:o.jsx(Wt,{size:20})})]}),o.jsx("div",{ref:b,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain ${c?"px-4 py-5 sm:px-8 sm:py-8":"p-4 sm:p-6"} ${u?"":"[padding-bottom:max(1.5rem,env(safe-area-inset-bottom))]"}`,children:n}),u&&o.jsx("footer",{className:"shrink-0 border-t border-line bg-surface px-4 pt-3 [padding-bottom:max(0.75rem,env(safe-area-inset-bottom))] sm:px-6",children:u})]})]}),document.body):null},s0=({value:t,onChange:e,trialDays:n=0,savingsAmount:s,className:a=""})=>{const c=De(),u=t==="year";return o.jsx("div",{className:`flex justify-center ${a}`,children:o.jsxs("div",{className:"relative mt-3 inline-flex items-center rounded-full bg-raised p-1 ring-1 ring-line",children:[o.jsx("button",{type:"button",onClick:()=>e("month"),"aria-pressed":!u,className:`rounded-full px-6 py-2 text-sm font-bold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong ${u?"text-dim":"bg-overlay text-ink shadow"}`,children:c("pro.period.monthly")}),o.jsxs("button",{type:"button",onClick:()=>e("year"),"aria-pressed":u,className:`relative flex items-center gap-2 rounded-full px-6 py-2 text-sm font-bold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong ${u?"bg-overlay text-ink shadow":"text-dim"}`,children:[c("pro.period.yearly"),s&&o.jsx("span",{className:"rounded bg-line/60 px-1.5 py-0.5 text-[10px] font-extrabold text-dim",children:c("pro.saveAmount",{amount:s})}),n>0&&o.jsx("span",{className:"pointer-events-none absolute -right-3 -top-2.5 z-10 whitespace-nowrap rounded-full border border-ok/30 bg-
5415ok/15 px-2 py-0.5 text-[10px] font-extrabold text-ok shadow-sm",children:c("pro.trialDays",{days:String(n)})})]})]})})};function dg(t){const[e,n]=v.useState(()=>typeof window<"u"&&window.matchMedia(t).matches);return v.useEffect(()=>{const s=window.matchMedia(t),a=()=>n(s.matches);return a(),s.addEventListener("change",a),()=>s.removeEventListener("change",a)},[t]),e}const n$=()=>dg("(min-width: 1280px)"),Os=[{key:"starter",planIds:{month:"starter",year:"starter_yearly"},nameKey:"pro.tier.starter.name",taglineKey:"pro.tier.starter.tagline"},{key:"plus",planIds:{month:"monthly",year:"yearly"},nameKey:"pro.tier.plus.name",taglineKey:"pro.tier.plus.tagline",recommended:!0},{key:"pro",planIds:{month:"pro",year:"pro_yearly"},nameKey:"pro.tier.pro.name",taglineKey:"pro.tier.pro.tagline"}],sR=["pro.benefit.tools","pro.benefit.models","pro.benefit.tryon","pro.benefit.exports","pro.benefit.queue","pro.benefit.api","pro.benefit.mcp","pro.benefit.shopify","pro.benefit.new"];function s$(t){var x,w,T;const e=De(),n=dg("(max-width: 767px)"),s=Os.find(N=>N.key===t.selectedTier)??Os[1],a=(x=t.catalog)==null?void 0:x.membership.find(N=>N.id===s.planIds[t.period]),c=(w=t.catalog)==null?void 0:w.credits.find(N=>Number(N.id)===t.selectedCredits),u=t.credits?c:a,h=t.period==="year"?e("pro.yearly.period"):e("pro.monthly.period"),m=u==null?void 0:u.basePriceDisplay,p=!t.credits&&(a==null?void 0:a.trialDays),b=t.credits?e("pro.buyPack",{pack:e("pro.packCredits",{count:t.selectedCredits})}):p?e("pro.trialDays",{days:p}):e("pro.startPlan",{plan:e(s.nameKey)});return o.jsx(n0,{isOpen:t.isOpen,onClose:t.onClose,fullScreen:n,maxWidth:"max-w-md",title:t.credits?e("pro.payg.title"):e("nav.goPro"),footer:o.jsxs("div",{className:"mx-auto max-w-md",children:[t.fallbackUrl?o.jsx("a",{href:t.fallbackUrl,target:"_blank",rel:"noopener noreferrer",className:"flex min-h-12 items-center justify-center rounded-2xl bg-accent px-4 font-semibold text-white",children:e("pro.openingCheckout")}):o.jsx("button",{type:"button",disabled:t.busy||t.blocked||!m||t.failed,onClick:()=>t.credits?t.onPurchaseCredits():t.onMembership(s.planIds[t.period]),className:"flex min-h-12 w-full items-center justify-center gap-2 rounded-2xl bg-accent px-3 py-3 text-sm font-bold text-white shadow-lg shadow-accent/20 transition-transform active:scale-[0.98] disabled:opacity-50",children:t.busy?o.jsxs(o.Fragment,{children:[o.jsx(et,{size:18,className:"animate-spin"}),e("pro.openingCheckout")]}):o.jsxs(o.Fragment,{children:[b,m&&!p&&` · ${m}${t.credits?"":h}`,o.jsx(ks,{size:16})]})}),o.jsx("p",{className:"mt-2 text-center text-[11px] leading-relaxed text-dim",children:t.credits?`${e("flow.once")} · ${e("credits.neverExpires")}`:o.jsxs(o.Fragment,{children:[p&&m&&o.jsxs(o.Fragment,{children:[e("flow.afterTrial",{days:p,price:m,period:h})," "]}),e("flow.renew")]})}),t.credits&&o.jsx("button",{type:"button",onClick:t.onClose,className:"min-h-11 w-full text-xs font-medium text-dim",children:e("flow.back")})]}),children:o.jsxs("div",{className:"mx-auto max-w-md space-y-4",children:[o.jsx(O7,{}),o.jsxs("div",{children:[o.jsx("h3",{className:"text-2xl font-bold tracking-tight text-ink",children:t.credits?e("pro.payg.title"):e("nav.goPro")}),o.jsx("p",{className:"mt-1 text-sm leading-relaxed text-dim",children:t.credits?e("pro.payg.blurb"):e("pro.benefit.tools")})]}),!t.credits&&o.jsx(s0,{value:t.period,onChange:t.onPeriod}),t.failed&&o.jsxs("div",{role:"alert",className:"rounded-xl border border-line bg-raised p-3 text-sm text-dim",children:[o.jsx("p",{children:e("pro.error.catalogUnavailable")}),o.jsx("button",{type:"button",onClick:t.onRetry,className:"min-h-11 font-semibold text-ink",children:e("common.tryAgain")})]}),!t.catalog&&!t.failed&&o.jsx("div",{role:"status",className:"space-y-2","aria-label":e("credits.opening"),children:[1,2,3].map(N=>o.jsx("div",{className:"h-20 animate-pulse rounded-2xl bg-raised"},N))}),o.jsxs("fieldset",{className:"space-y-2",disabled:t.busy,children:[o.jsx("legend",{className:"sr-only",children:t.credits?e("credits.choosePack"):e("pro.tab.membership")}),t.credits?(T=t.catalog)==null?void 0:T.credits.map(N=>{const j=Number(N.id)===t.selectedCredits;return o.jsxs("label",{className:`flex min-h-20 cursor-pointer items-center gap-3 rounded-2xl border p-4 focus-within:ring-2 focus-within:ring-accent ${j?"border-accent bg-accent-soft":"border-line bg-surface"}`,children:[o.jsx("input",{type:"radio",name:"credit-pack",className:"sr-only",checked:j,onChange:()=>t.onCredits(Number(N.id))}),o.jsx("span",{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border ${j?"border-accent bg-accent text-white":"border-line-strong"}`,children:j&&o.jsx(Cn,{size:13})}),o.jsxs("span",{className:"flex-1",children:[o.jsx("span",{className:"block text-sm font-bold text-ink",children:e("pro.packCredits",{count:N.credits})}),o.jsx("span",{className:"text-xs text-dim",children:e("flow.once")})]}),o.jsx("span",{className:"text-lg font-bold tabular-nums text-ink",children:N.basePriceDisplay})]},N.id)}):Os.map(N=>{var F;const j=(F=t.catalog)==null?void 0:F.membership.find(V=>V.id===N.planIds[t.period]);if(!j)return null;const A=N.key===t.selectedTier;return o.jsxs("label",{className:`flex min-h-20 cursor-pointer items-center gap-3 rounded-2xl border p-4 focus-within:ring-2 focus-within:ring-accent ${A?"border-accent bg-accent-soft":"border-line bg-surface"}`,children:[o.jsx("input",{type:"radio",name:"membership-plan",className:"sr-only",checked:A,onChange:()=>t.onTier(N.key)}),o.jsx("span",{className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border ${A?"border-accent bg-accent text-white":"border-line-strong"}`,children:A&&o.jsx(Cn,{size:13})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block text-sm font-bold text-ink",children:e(N.nameKey)}),o.jsx("span",{className:"mt-1 block text-xs text-dim",children:e("pro.creditsPerMonth",{count:j.credits})})]}),o.jsxs("span",{className:"shrink-0 text-end",children:[o.jsx("span",{className:"block text-lg font-bold tabular-nums text-ink",children:j.basePriceDisplay}),o.jsx("span",{className:"block text-[11px] text-dim",children:h})]})]},N.key)})]}),o.jsx("div",{className:"grid gap-2 rounded-2xl bg-raised p-4 text-xs text-dim",children:[t.credits?"pro.payg.blurb":"pro.benefit.tools","pro.benefit.exports"].map(N=>o.jsxs("p",{className:"flex items-start gap-2",children:[o.jsx(Cn,{size:14,className:"shrink-0 text-accent"}),e(N)]},N))}),t.credits?o.jsxs("button",{type:"button",onClick:t.onPlans,className:"min-h-11 w-full text-sm font-semibold text-ink",children:[e("pro.tab.membership")," →"]}):o.jsxs("button",{type:"button",onClick:t.onShowCredits,className:"min-h-11 w-full text-sm font-medium text-dim",children:[e("pro.payg.title")," →"]}),o.jsxs("p",{className:"flex items-center justify-center gap-1.5 text-[11px] text-faint",children:[o.jsx(HS,{size:13}),e("credits.secureCheckout")]})]})})}const r$=.5,r0=t=>{if(!t)return null;const e=t.match(/[\d.,]+/);if(!e)return null;const n=e[0],s=parseFloat(n.replace(/,/g,""));if(!isFinite(s)||s<=0)return null;const a=s/(1-r$),u=/[.,]\d{2}\b/.test(n)?a.toFixed(2):String(Math.round(a));return t.replace(n,u)},rR=({t,name:e,tagline:n,price:s,period:a,credits:c,benefitKeys:u,cta:h,badge:m,yearlyNote:p,trialNote:b,recommended:x=!1,preselected:w=!1,loading:T,disabled:N,onSelect:j})=>o.jsxs("div",{className:`relative flex flex-col rounded-2xl border p-5 ${x?"border-accent bg-accent/[0.04] shadow-lg":w?"border-accent bg-surface":"border-line bg-surface"}`,children:[x&&o.jsxs("span",{className:"absolute -top-2.5 left-1/2 inline-flex -translate-x-1/2 items-center gap-1.5 whitespace-nowrap rounded-full bg-ink px-2.5 py-1 font-mono text-[9px] font-bold uppercase tracking-[0.12em] text-base",children:[o.jsx(us,{size:10}),t("pro.mostPopular")]}),o.jsxs("div",{className:"mt-1.5 flex items-start justify-between gap-2",children:[o.jsxs("div",{children:[o.jsx("span",{className:"text-base font-bold text-ink",children:e}),o.jsx("p",{className:"mt-0.5 text-xs text-faint",children:n})]}),m&&o.jsx("span",{className:"shrink-0 rounded-md border border-ok/40 bg-ok/10 px-2 py-0.5 font-mono text-[9px] uppercase tracking-[0.1em] text-ok",children:m})]}),c!==null&&o.jsxs("div",{className:"mt-4 inline-flex w-fit items-center gap-1.5 rounded-full border border-accent/40 bg-accent-soft px-2.5 py-1",children:[o.jsx(rr,{size:12,className:"fill-accent text-accent"}),o.jsx("span",{className:"text-[11px] font-bold text-accent",children:t("pro.creditsPerMonth",{count:c}
5415)})]}),o.jsx("div",{className:"mt-4",children:o.jsx(i$,{value:s,period:a})}),p&&o.jsx("p",{className:"mt-1.5 text-[11px] text-faint",children:p}),b&&o.jsxs("p",{className:"mt-2 inline-flex w-fit items-center gap-1.5 rounded-md border border-ok/40 bg-ok/10 px-2 py-1 font-mono text-[9px] uppercase tracking-[0.1em] text-ok",children:[o.jsx(us,{size:10}),b]}),o.jsx("button",{type:"button",onClick:j,disabled:N,className:`mt-5 flex w-full items-center justify-center gap-2 rounded-xl px-5 py-3 text-sm font-bold transition-opacity disabled:cursor-not-allowed disabled:opacity-50 ${x?"bg-ink text-base hover:opacity-90":"border border-line-strong bg-surface text-ink hover:bg-raised"}`,children:T?o.jsxs(o.Fragment,{children:[o.jsx(et,{size:16,className:"animate-spin"})," ",t("credits.opening")]}):o.jsxs(o.Fragment,{children:[h,o.jsx(ks,{size:16})]})}),o.jsx("ul",{className:"mt-5 grow space-y-2",children:u.map(A=>o.jsxs("li",{className:"flex items-start gap-2 text-xs text-dim",children:[o.jsx(Cn,{size:12,strokeWidth:3,className:"mt-0.5 flex-shrink-0 text-ok"}),t(A)]},A))})]}),i$=({value:t,period:e})=>{const n=r0(t);return o.jsxs("div",{className:"flex items-end gap-2",children:[t?o.jsx("span",{className:"text-[38px] font-extrabold leading-none tracking-[-0.02em] tabular-nums text-ink",children:t}):o.jsx("span",{className:"inline-block h-9 w-24 animate-pulse rounded-lg bg-line"}),o.jsxs("div",{className:"flex flex-col pb-0.5",children:[n&&o.jsx("span",{className:"text-xs font-semibold tabular-nums text-faint line-through decoration-1",children:n}),o.jsx("span",{className:"text-xs text-dim",children:e})]})]})},RT=[{type:"image",url:"https://assets.vogue.com/photos/58bc69c2f9d6c10e11220887/master/w_1024,c_limit/15-juan-carlos-obando-fw17.jpg"},{type:"video",url:"https://v3b.fal.media/files/b/0a8d0706/tKtPNFXr4ZxaaqtBThTny_output.mp4"},{type:"image",url:"https://assets.vogue.com/photos/55c6518e08298d8be223cdc6/master/w_1024,c_limit/00040fullscreen.jpg"},{type:"image",url:"https://assets.vogue.com/photos/67911091e20cb96ed0a02738/master/w_1024,c_limit/00001-paul-smith-fall-2025-menswear-credit-brand.jpg"},{type:"image",url:"https://assets.vogue.com/photos/60d5f4e74b12a701e3d2f083/master/w_1024,c_limit/00001-Paul-Smith-Menswear-Spring-2022.jpg"},{type:"image",url:"https://v3b.fal.media/files/b/0a8955b6/8DboEz7maKFmar45EUTWB.jpg"}];function i0(t){var n,s;const e=String(t.subscription_status||((n=t.subscription_snapshot)==null?void 0:n.status)||"");return!!t.is_premium||!!((s=t.subscription_snapshot)!=null&&s.isActive)||["active","will_expire","billing_issue"].includes(e)}const a$=t=>!!t.uid;function cv(t){if(!t)return null;const e=parseFloat(t.replace(/[^0-9.,]/g,"").replace(",","."));return Number.isFinite(e)&&e>0?e:null}function xp(t,e){const n=cv(t),s=cv(e);if(n==null||s==null)return null;const a=n*12,c=a-s;return c<=0?null:{fullPrice:`$${a.toFixed(2)}`,savings:`$${c.toFixed(0)}`}}function iR(t,e,n){const s=cv(t);if(s==null||!e||e<=0||n<=0)return null;const a=s/(e*n);if(!Number.isFinite(a)||a<=0)return null;const c=a<.01?a.toFixed(3):a.toFixed(2),u=t.match(/[\d.,]+/);return u?t.replace(u[0],c):`${c}`}const o$="generate_gate",l$=[{q:"pro.faq.cancel.q",a:"pro.faq.cancel.a"},{q:"pro.faq.credits.q",a:"pro.faq.credits.a"},{q:"pro.faq.tools.q",a:"pro.faq.tools.a"},{q:"pro.faq.timing.q",a:"pro.faq.timing.a"}],Ts=({isOpen:t,onClose:e,user:n,initialFocus:s="membership",initialPlan:a=null,trigger:c=o$})=>{var lt;const u=De(),h=dg("(max-width: 767px)"),m=y7(),p=v.useRef(!1),b=v.useRef(!1),[x,w]=v.useState(!1),[T,N]=v.useState("plus"),j=`fashio.exitOffer:${n.uid}`,A=v.useRef(!1),F=(te=40)=>{A.current=!0;try{sessionStorage.setItem(j,"1")}catch{}q(te),S(!0),w(!0),ar("paywall_exit_offer",{trigger:c,content_id:`credits_${te}`})},V=()=>{p.current&&(b.current=!0),ar("paywall_dismissed",{trigger:c,view_kind:x?"exit_offer":L});let te=A.current;try{te||(te=sessionStorage.getItem(j)==="1")}catch{}!p.current&&!J&&["generate_gate","nav_upgrade","marketing_checkout"].includes(c)&&!i0(n)&&!x&&!te&&L==="membership"?F():(w(!1),e())};v.useEffect(()=>{if(!t){w(!1);return}const te=Os.find(ke=>Object.values(ke.planIds).includes(a));N((te==null?void 0:te.key)??"plus")},[t,a]);const[L,Y]=v.useState(s==="credits"?"credits":"membership"),[$,q]=v.useState(40),[I,S]=v.useState(!1),[C,R]=v.useState(!1),[D,z]=v.useState(null),[P,ie]=v.useState(!1),[_e,W]=v.useState(!1),[J,fe]=v.useState(null),[ce,ae]=v.useState(null),[O,B]=v.useState(()=>$t.getCachedBillingCatalog("all")),[re,pe]=v.useState(!1),[de,me]=v.useState(0),[we,Se]=v.useState(-1),[Re,Ce]=v.useState("month");v.useEffect(()=>{const te=ke=>{ke.persisted&&(p.current=!1,z(null),ie(!1),fe(null))};return window.addEventListener("pageshow",te),()=>window.removeEventListener("pageshow",te)},[]);const $e=v.useMemo(()=>{const te={};for(const ke of(O==null?void 0:O.membership)||[])te[ke.id]=ke;return te},[O]),Ue=v.useCallback((te,ke)=>$e[te.planIds[ke]]||null,[$e]),Qe=v.useMemo(()=>{var te;return(te=O==null?void 0:O.credits)!=null&&te.length?O.credits:[40,120,1200].map(ke=>({id:ke,title:u("pro.packTitle",{count:ke}),basePriceDisplay:null}))},[O,u]),Ke=v.useMemo(()=>{var te;return((te=O==null?void 0:O.credits)==null?void 0:te.find(ke=>String(ke.id)===String($)))||null},[O,$]);v.useEffect(()=>{t&&(Y(s==="credits"?"credits":"membership"),fe(null))},[t,s]),v.useEffect(()=>{if(!t||!a)return;const te=Os.find(ke=>ke.planIds.year===a);Ce(te?"year":"month")},[t,a]),v.useEffect(()=>{if(!t)return;const te=s==="credits",ke={content_id:te?"credits_modal":"subscription_modal",content_name:te?"Credits Modal":"Subscription Modal",content_category:te?"credits":"membership"};ns.viewContent(ke),gB({...ke,trigger:c})},[t,s,c]),v.useEffect(()=>{if(!t)return;let te=!0;R(!0),pe(!1);
5415const ke=$t.getBillingCatalog("all").then(he=>{te&&(B(he),pe(he==null))}),nt=$t.getPurchaseEligibility().then(he=>{te&&ae(he)});return Promise.all([ke,nt]).finally(()=>{te&&R(!1)}),()=>{te=!1}},[t,de]),v.useEffect(()=>{t||S(!1)},[t]),v.useEffect(()=>{if(!t||I)return;const te=O==null?void 0:O.credits;if(!(te!=null&&te.length))return;const ke=te[Math.min(1,te.length-1)];q(Number(ke.id))},[t,O,I]);const Ne=ce&&ce.canStartCheckout===!1,H=(ce==null?void 0:ce.manageAt)||((ce==null?void 0:ce.provider)==="creem"?"Creem":u("billing.providerOther")),oe=!Ne,se=a$(n),Ee=oe&&se;v.useEffect(()=>{se?oe||Y("credits"):Y("membership")},[se,oe]);const Me=async te=>{if(!n.uid||p.current)return;p.current=!0,b.current=!1,z(te),fe(null);const ke=$e[te]||null,nt=ke!=null&&ke.basePriceDisplay?parseFloat(ke.basePriceDisplay.replace(/[^0-9.]/g,"")):0,he=(ke==null?void 0:ke.canonicalProductId)||te,Fe=(ke==null?void 0:ke.title)||te;ns.addToCart({content_id:he,content_name:Fe,content_category:"membership",value:isNaN(nt)?0:nt}),bB({plan:te,content_id:he,content_name:Fe,value:isNaN(nt)?0:nt});const Oe=h?null:$t.openPendingPopup(u("pro.openingCheckout"),`membership_checkout_${te}`);try{if(h)try{await m()}catch{_t.showError(u("flow.saveFailed"));return}if(b.current){Oe==null||Oe.close();return}Z2(n.uid);const Xe=await $t.createMembershipCheckoutIntent({plan:te,email:n.email});if(b.current){Oe==null||Oe.close();return}if(!Xe){Oe==null||Oe.close(),Li({reason:"intent_failed",content_id:he,content_category:"membership",plan:te}),_t.showError(u("pro.error.membershipFailed"));return}if(Xe.canStartCheckout===!1){Oe==null||Oe.close(),ae(Xe),Li({reason:"eligibility_blocked",content_id:he,content_category:"membership",plan:te}),_t.showError(Xe.reason==="pending_web_membership_checkout"?u("pro.error.blockedPending"):u("pro.error.blockedExisting",{provider:Xe.manageAt||u("billing.providerOther")}));return}if(fe(Xe.checkoutUrl),!h&&(!Oe||Oe.closed)){Li({reason:"popup_blocked",content_id:he,content_category:"membership",plan:te}),_t.showError(u("pro.error.popupBlocked"));return}
5415const rn=$e[te]||null,jt=rn!=null&&rn.basePriceDisplay?parseFloat(rn.basePriceDisplay.replace(/[^0-9.]/g,"")):0;ns.initiateCheckout({content_id:he,content_name:Fe,content_category:"membership",value:isNaN(jt)?0:jt}),Jc({provider:Xe.provider,content_id:he,content_name:Fe,content_category:"membership",value:isNaN(jt)?0:jt}),h?window.location.assign(Xe.checkoutUrl):Oe&&(Oe.location.href=Xe.checkoutUrl),_t.showSuccess(u("pro.checkoutOpened",{provider:Xe.provider==="creem"?"Creem":"Gumroad"}))}catch(Xe){Oe==null||Oe.close(),console.error(Xe),Li({reason:"exception",content_id:he,content_category:"membership",plan:te}),_t.showError(u("pro.error.membershipFailed"))}finally{p.current=!1,z(null)}},ot=async()=>{if(!n.uid||p.current)return;p.current=!0,b.current=!1,ie(!0),fe(null);const te=`credits_${$}`,ke=(Ke==null?void 0:Ke.title)??u("pro.packTitle",{count:$}),nt=Ke!=null&&Ke.basePriceDisplay?parseFloat(Ke.basePriceDisplay.replace(/[^0-9.]/g,"")):0;ns.addToCart({content_id:te,content_name:ke,content_category:"credits",value:isNaN(nt)?0:nt,num_items:$});const he=h?null:$t.openPendingPopup(u("pro.openingCheckout"),`credits_checkout_${$}`);try{if(h)try{await m()}catch{_t.showError(u("flow.saveFailed"));return}if(b.current){he==null||he.close();return}Z2(n.uid);const Fe=await $t.createCreditsCheckoutIntent({amount:$,email:n.email});if(b.current){he==null||he.close();return}if(!Fe||Fe.canStartCheckout===!1){he==null||he.close(),Li({reason:Fe?"eligibility_blocked":"intent_failed",content_id:te,content_category:"credits"}),_t.showError(u("billing.creditsCheckoutFailed"));return}if(fe(Fe.checkoutUrl),!h&&(!he||he.closed)){Li({reason:"popup_blocked",content_id:te,content_category:"credits"}),_t.showError(u("pro.error.popupBlocked"));return}const Oe=Ke,Xe=Oe!=null&&Oe.basePriceDisplay?parseFloat(Oe.basePriceDisplay.replace(/[^0-9.]/g,"")):0;ns.initiateCheckout({content_id:te,content_name:(Oe==null?void 0:Oe.title)??ke,content_category:"credits",value:isNaN(Xe)?0:Xe,num_items:$}),Jc({provider:Fe.provider,content_id:te,content_name:(Oe==null?void 0:Oe.title)??ke,content_category:"credits",value:isNaN(Xe)?0:Xe}),h?window.location.assign(Fe.checkoutUrl):he&&(he.location.href=Fe.checkoutUrl),_t.showSuccess(u("pro.creditsCheckoutOpened"))}catch(Fe){he==null||he.close(),console.error(Fe),Li({reason:"exception",content_id:te,content_category:"credits"}),_t.showError(u("billing.creditsCheckoutFailed"))}finally{p.current=!1,ie(!1)}},sn=async()=>{W(!0);try{const te=await $t.createBillingManagementPortalLink();if(!te||!te.canManage||!te.portalUrl){_t.showError(te!=null&&te.manageAt?u("pro.portalUnavailableAt",{provider:te.manageAt}):u("pro.portalUnavailable"));return}$t.openPopup(te.portalUrl,"billing_portal")||window.open(te.portalUrl,"_blank","noopener,noreferrer")}catch(te){console.error(te),_t.showError(u("pro.portalFailed"))}finally{W(!1)}},pn=v.useMemo(()=>{const te=Os.map(ke=>{var nt;return((nt=Ue(ke,"year"))==null?void 0:nt.trialDays)??0});return te.length>0&&te.every(ke=>ke>0)?Math.min(...te):0},[Ue]),wt=v.useMemo(()=>{var ke,nt,he;const te=Os.find(Fe=>Fe.recommended)??Os[0];return te?((he=xp(((ke=Ue(te,"month"))==null?void 0:ke.basePriceDisplay)||null,((nt=Ue(te,"year"))==null?void 0:nt.basePriceDisplay)||null))==null?void 0:he.savings)??null:null},[Ue]),is=v.useMemo(()=>Os.map(te=>{const ke=Ue(te,Re),nt=Ue(te,"month"),he=Ue(te,"year");return{tier:te,plan:ke,planId:te.planIds[Re],perCredit:iR((ke==null?void 0:ke.basePriceDisplay)||null,typeof(ke==null?void 0:ke.credits)=="number"?ke.credits:null,Re==="year"?12:1),savings:Re==="year"?xp((nt==null?void 0:nt.basePriceDisplay)||null,(he==null?void 0:he.basePriceDisplay)||null):null}}).filter(te=>te.plan),[Re,Ue]),He=Ne||D!==null||!O||re;return x||h&&(oe||L==="credits")?o.jsx(s$,{isOpen:t,onClose:V,onPlans:()=>{w(!1),Y("membership")},onShowCredits:()=>F(),credits:x||L==="credits",catalog:O,period:Re,onPeriod:Ce,selectedTier:T,onTier:te=>{N(te),ar("paywall_option_selected",{tier:te,billing_period:Re})},selectedCredits:$,onCredits:te=>{q(te),S(!0)},onMembership:Me,onPurchaseCredits:ot,busy:D!==null||P,blocked:!(x||L==="credits")&&!!Ne,failed:re,onRetry:()=>me(te=>te+1),fallbackUrl:J}):o.jsxs(n0,{isOpen:t,onClose:V,title:u(oe?"nav.goPro":"credits.title"),maxWidth:"max-w-4xl",fullScreen:oe&&L==="membership",children:[o.jsx("style",{children:`
5416        @keyframes billing-marquee {
5417          from { transform: translateX(0); }
5418          to { transform: translateX(-50%); }
5419        }
5420        @media (prefers-reduced-motion: reduce) {
5421          .billing-marquee { animation: none !important; }
5422        }
5423      `}),o.jsxs("div",{className:"mx-auto w-full max-w-6xl space-y-6",children:[re&&o.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-2xl border border-line-strong bg-raised p-4",children:[o.jsx("p",{className:"text-sm text-dim",children:u("pro.error.catalogUnavailable")}),o.jsxs("button",{type:"button",onClick:()=>me(te=>te+1),disabled:C,className:"inline-flex items-center gap-2 rounded-xl border border-line-strong bg-surface px-4 py-2 text-sm font-semibold text-ink transition-colors hover:bg-overlay disabled:cursor-not-allowed disabled:opacity-50",children:[C&&o.jsx(et,{size:14,className:"animate-spin"}),u("common.tryAgain")]})]}),Ee&&o.jsx("div",{className:"mx-auto grid w-full max-w-md grid-cols-2 gap-1 rounded-2xl border border-line bg-raised p-1",children:[{id:"membership",labelKey:"pro.tab.membership",Icon:h5},{id:"credits",labelKey:"nav.credits",Icon:rr}].map(({id:te,labelKey:ke,Icon:nt})=>{const he=L===te;return o.jsxs("button",{type:"button",onClick:()=>Y(te),"aria-pressed":he,className:`flex items-center justify-center gap-2 rounded-xl py-2.5 text-sm font-semibold transition-colors ${he?"bg-ink text-base":"text-dim hover:bg-overlay hover:text-ink"}`,children:[o.jsx(nt,{size:15}),u(ke)]},te)})}),oe&&L==="membership"&&o.jsxs("div",{className:"space-y-5",children:[se&&o.jsxs("section",{className:"flex flex-wrap items-center justify-between gap-4 roun
5423ded-2xl border border-accent/25 bg-accent-soft p-4",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsxs("h3",{className:"flex items-center gap-2 text-sm font-bold text-ink",children:[o.jsx(rr,{size:17,className:"text-accent"}),u("pro.payg.title")]}),o.jsx("p",{className:"mt-1 text-xs leading-relaxed text-dim",children:u("pro.payg.blurb")})]}),o.jsx("div",{className:"flex flex-wrap gap-2",children:(lt=O==null?void 0:O.credits)==null?void 0:lt.map(te=>o.jsxs("button",{type:"button",disabled:!te.basePriceDisplay||D!==null||!!J,onClick:()=>F(Number(te.id)),className:"min-h-12 rounded-xl border border-line bg-surface px-4 py-2 text-start transition-colors hover:border-accent focus-visible:ring-2 focus-visible:ring-accent disabled:opacity-50",children:[o.jsx("span",{className:"block text-xs text-dim",children:u("pro.packCredits",{count:te.credits})}),o.jsx("span",{className:"block text-sm font-bold text-ink",children:te.basePriceDisplay})]},te.id))})]}),o.jsx(s0,{value:Re,onChange:Ce,trialDays:pn,savingsAmount:wt}),o.jsx("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-3",children:is.map(({tier:te,plan:ke,planId:nt,perCredit:he,savings:Fe})=>o.jsx(rR,{t:u,name:u(te.nameKey),tagline:u(te.taglineKey),price:ke.basePriceDisplay||null,period:u(Re==="year"?"pro.yearly.period":"pro.monthly.period"),credits:typeof ke.credits=="number"?ke.credits:null,benefitKeys:sR,cta:u("pro.startPlan",{plan:u(te.nameKey)}),badge:he?u("pro.perCredit",{price:he}):void 0,yearlyNote:Fe?u("pro.yearlyNote",Fe):void 0,trialNote:ke.trialDays?u("pro.trialDays",{days:ke.trialDays}):void 0,recommended:te.recommended,loading:D===nt,disabled:He,preselected:a===nt,onSelect:()=>Me(nt)},te.key))}),o.jsx(IT,{t:u}),J&&o.jsx(PT,{url:J,onUsed:()=>fe(null)})]}),se&&L==="credits"&&o.jsxs("div",{className:"space-y-5",children:[Ne&&o.jsx(MT,{t:u,compact:!0,providerLabel:H,isOpeningPortal:_e,onManage:sn}),o.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-lg font-bold tracking-tight text-ink",children:u("pro.payg.title")}),o.jsx("p",{className:"mt-0.5 text-sm text-dim",children:u("pro.payg.blurb")})]}),o.jsxs("div",{className:"rounded-xl border border-line bg-raised px-3 py-2 text-right",children:[o.jsx("div",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-faint",children:u("credits.balance")}),o.jsxs("div",{className:"flex items-center justify-end gap-1.5 text-lg font-bold tabular-nums text-ink",children:[o.jsx(rr,{size:14,className:"fill-accent text-accent"}),n.diamond_balance]})]})]}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:Qe.map((te,ke)=>{const nt=String(te.id)===String($),he=ke===Qe.length-1,Fe=r0(te.basePriceDisplay);return o.jsxs("button",{type:"button",onClick:()=>{S(!0),q(Number(te.id))},"aria-pressed":nt,className:`relative flex flex-col rounded-2xl border p-4 text-left transition-colors ${nt?"border-accent bg-accent-soft":"border-line bg-surface hover:border-line-strong"}`,children:[o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-dim",children:[o.jsx(rr,{size:11,className:"fill-accent text-accent"}),u("pro.packCredits",{count:te.id})]}),he&&o.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.1em] text-faint",children:u("credits.bestValue")})]}),o.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[o.jsx("span",{className:"text-2xl font-extrabold tracking-tight tabular-nums text-ink",children:te.basePriceDisplay||"—"}),Fe&&o.jsx("span",{className:"pb-1 text-xs font-semibold tabular-nums text-faint line-through decoration-1",children:Fe})]}),o.jsx("span",{className:"mt-1 text-[11px] text-faint",children:u("credits.neverExpires")}),o.jsx("span",{className:`mt-3 inline-flex h-5 w-5 items-center justify-center rounded-full border transition-colors ${nt?"border-accent bg-accent text-base":"border-line-strong bg-surface text-transparent"}`,children:o.jsx(Cn,{size:12,strokeWidth:3})})]},te.id)})}),o.jsx(An,{fullWidth:!0,onClick:ot,disabled:P||!(Ke!=null&&Ke.basePriceDisplay)||re,className:"py-4 text-base",children:P?o.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.jsx(et,{size:16,className:"animate-spin"})," ",u("pro.openingCheckout")]}):o.jsxs("span",{className:"inline-flex items-center gap-2",children:[u("pro.buyPack",{pack:(Ke==null?void 0:Ke.title)||u("pro.packTitle",{count:$})}),o.jsx(ks,{size:16})]})}),o.jsx(IT,{t:u,topUp:!0}),J&&o.jsx(PT,{url:J,onUsed:()=>fe(null)})]}),!oe&&!se&&o.jsx(MT,{t:u,providerLabel:H,isOpeningPortal:_e,onManage:sn}),o.jsxs("div",{className:"overflow-hidden rounded-2xl border border-line bg-base",children:[o.jsxs("div",{className:"flex items-center gap-2 px-4 pt-3 font-mono text-[10px] uppercase tracking-[0.14em] text-faint",children:[o.jsx(us,{size:11})," ",u("pro.madeWith")]}),o.jsx("div",{className:"overflow-hidden p-3",style:{maskImage:"linear-gradient(to right, transparent, black 6%, black 94%, transparent)",WebkitMaskImage:"linear-gradient(to right, transparent, black 6%, black 94%, transparent)"},children:o.jsx("div",{className:"billing-marquee flex w-[200%] gap-2",style:{animation:"billing-marquee 28s linear infinite"},children:[...RT,...RT].map((te,ke)=>o.jsx("div",{className:"relative h-24 min-w-[80px] overflow-hidden rounded-lg border border-line sm:h-28 sm:min-w-[96px]",children:te.type==="video"?o.jsx("video",{src:te.url,className:"h-full w-full object-cover object-top",autoPlay:!0,loop:!0,muted:!0,playsInl
5423ine:!0}):o.jsx("img",{src:te.url,alt:"",className:"h-full w-full object-cover object-top"})},`${te.url}-${ke}`))})})]}),o.jsx("div",{className:"overflow-hidden rounded-2xl border border-line bg-surface",children:l$.map((te,ke)=>{const nt=we===ke;return o.jsxs("div",{className:ke>0?"border-t border-line":void 0,children:[o.jsxs("button",{type:"button",onClick:()=>Se(nt?-1:ke),"aria-expanded":nt,className:"flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left transition-colors hover:bg-raised",children:[o.jsx("span",{className:"text-sm font-semibold text-ink",children:u(te.q)}),o.jsx(Um,{size:15,className:`flex-shrink-0 text-faint transition-transform ${nt?"rotate-180":""}`})]}),nt&&o.jsx("p",{className:"px-4 pb-4 text-sm leading-relaxed text-dim",children:u(te.a)})]},te.q)})})]})]})},IT=({t,topUp:e=!1})=>o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-5 gap-y-2 font-mono text-[10px] uppercase tracking-[0.12em] text-faint",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(hh,{size:11})," ",t("credits.secureCheckout")]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(XS,{size:11})," ",t(e?"credits.instantTopUp":"pro.instantAccess")]}),!e&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(Cn,{size:11})," ",t("pro.cancelAnyTime")]})]}),MT=({t,providerLabel:e,isOpeningPortal:n,onManage:s,compact:a=!1})=>{const c=o.jsx(An,{variant:"outline",onClick:s,disabled:n,className:"border-line-strong bg-surface",children:n?o.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.jsx(et,{size:16,className:"animate-spin"})," ",t("credits.opening")]}):o.jsxs("span",{className:"inline-flex items-center gap-2",children:[t("pro.manageBilling")," ",o.jsx(Fm,{size:14})]})});return a?o.jsxs("div",{className:"flex flex-col items-start justify-between gap-3 rounded-2xl border border-line bg-surface p-4 sm:flex-row sm:items-center",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-bold text-ink",children:t("pro.alreadyPro")}),o.jsx("p",{className:"text-xs text-dim",children:t("pro.alreadyProCompact",{provider:e})})]}),c]}):o.jsxs("div",{className:"rounded-2xl border border-line bg-surface p-8 text-center",children:[o.jsx("div",{className:"mx-auto mb-3 flex h-11 w-11 items-center justify-center rounded-full border border-accent/40 bg-accent-soft text-accent",children:o.jsx(hh,{size:18})}),o.jsx("h3",{className:"text-lg font-bold tracking-tight text-ink",children:t("pro.alreadyPro")}),o.jsx("p",{className:"mx-auto mt-1 max-w-sm text-sm text-dim",children:t("pro.alreadyProFull",{provider:e})}),o.jsx("div",{className:"mt-4 flex justify-center",children:c})]})},PT=({url:t,onUsed:e})=>{const n=De();return o.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",onClick:e,className:"flex items-center justify-center gap-2 rounded-xl border border-line-strong bg-raised px-4 py-3 text-sm font-medium text-ink transition-colors hover:bg-overlay",children:[o.jsx(Fm,{size:14}),n("pro.popupBlockedLink")]})},dr=({isOpen:t,onClose:e,user:n})=>{const s=De(),a=dg("(max-width: 767px)"),[c,u]=v.useState(null),[h,m]=v.useState(()=>$t.getCachedBillingCatalog("credits")),[p,b]=v.useState(!1),[x,w]=v.useState(0),[T,N]=v.useState(null),j=v.useRef(!1);fn.useEffect(()=>{if(!t)return;let V=!0;return b(!1),N(null),$t.getBillingCatalog("credits").then(L=>{V&&(m(L),b(!L))}),()=>{V=!1}},[t,x]);const A=[{amount:40,price:"",bonusKey:null},{amount:120,price:"",bonusKey:"credits.popular",recommended:!0},{amount:1200,price:"",bonusKey:"credits.bestValue"}].map(V=>{var L,Y;return{...V,price:((Y=(L=h==null?void 0:h.credits)==null?void 0:L.find($=>String($.id)===String(V.amount)))==null?void 0:Y.basePriceDisplay)||V.price}}),F=async V=>{if(j.current)return;if(!(n!=null&&n.uid)){_t.showError(s("credits.error.signIn"));return}const L=A.find($=>$.amount===V);if(!(L!=null&&L.price)||p)return;j.current=!0,u(V),N(null);const Y=$t.openPendingPopup(s("pro.openingCheckout"),`credit_pack_${V}`);try{const $=await $t.createCreditsCheckoutIntent({amount:V,email:n.email});if(!$||$.canStartCheckout===!1||!$.checkoutUrl){Y==null||Y.close(),Li({reason:"intent_failed",content_id:`credits_${V}`,content_category:"credits"}),_t.showError(s("credits.error.checkout"));return}const q=Number(L.price.replace(/[^0-9.]/g,""));if(!Y||Y.closed){N({url:$.checkoutUrl,provider:$.provider,amount:V,value:q}),Li({reason:"popup_blocked",content_id:`credits_${V}`,content_category:"credits"}),_t.showError(s("pro.error.popupBlocked"));return}Y.location.href=$.checkoutUrl,Jc({provider:$.provider,content_id:`credits_${V}`,content_name:`${V} credits`,content_category:"credits",value:q}),_t.showSuccess(s("credits.checkoutOpened")),e()}catch($){Y==null||Y.close(),console.error($),_t.showError(s("credits.error.checkout"))}finally{j.current=!1,u(null)}};return a?o.jsx(Ts,{isOpen:t,onClose:e,user:n,initialFocus:"credits",trigger:"nav_upgrade"}):o.jsx(n0,{isOpen:t,onClose:e,title:s("credits.title"),maxWidth:"max-w-2xl",children:o.jsxs("div",{className:"space-y-5",children:[p&&o.jsxs("div",{role:"alert",className:"rounded-xl border border-line bg-raised p-4 text-sm text-dim",children:[o.jsx("p",{children:s("pro.error.catalogUnavailable")}),o.jsx("button",{type:"button",onClick:()=>w(V=>V+1),className:"mt-2 min-h-11 font-semibold text-ink",children:s("common.tryAgain")})]}),T&&o.jsxs("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",className:"flex min-h-11 items-center justify-center gap-2 rounded-xl border border-line p-3 font-semibold text-ink",onClick:()=>{Jc({provider:T.provider,content_id:`credits_${T.amount}`,content_name:`${T.amount} credits`,content_category:"credits",value:T.value})},children:[s("credits.buy")," ",o.jsx(Fm,{size:14})]}),o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-faint",children:s("credits.choosePack")}),o.jsxs("div",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-faint",children:[s("credits.balance"),o.jsxs("span",{className:"inline-flex items-center gap-1 text-sm font-bold tabular-nums text-ink",children:[o.jsx(rr,{size:12,className:"fill-accent text-accent"}),(n==null?void 0:n.diamond_balance)??0]})]})]}),o.jsx("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-3",children:A.map(V=>{const L=r0(V.price),Y=!!V.recommended;return o.jsxs("div",{className:`relative flex flex-col rounded-2xl border p-4 ${Y?"border-accent bg-accent-soft":"border-line bg-surface"}`,children:[Y&&o.jsx("span",{className:"absolute inset-x-0 top-0 h-[3px] rounded-t-2xl bg-accent"}),o.jsxs("div",{className:"flex items-center justify-between gap-2",children:[o.jsxs("span",{className:"flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.14em] text-dim",children:[o.jsx(rr,{size:11,className:"fill-accent text-accent"}),s("nav.credits")]}),V.bonusKey&&o.jsx("span",{className:"font-mono text-[9px] uppercase tracking-[0.1em] text-accent",children:s(V.bonusKey)})]}),o.jsx("p",{className:"mt-2 text-3xl font-extrabold leading-none tracking-[-0.02em] tabular-nums text-ink",children:V.amount}),o.jsxs("div",{className:"mt-3 flex items-end gap-2",children:[o.jsx("span",{className:"text-lg font-bold tabular-nums text-ink",children:V.price||"—"}),L&&o.jsx("span",{className:"pb-0.5 text-xs font-semibold tabular-nums text-faint line-through decoration-1",children:L})]}),o.jsx("p",{className:"mt-1 text-[11px] text-faint",children:s("credits.neverExpires")}),o.jsx(An,{variant:Y?"primary":"outline",fullWidth:!0,className:"mt-4 py-2.5 text-sm",onClick:()=>F(V.amount),disabled:c!==null||!V.price||p||T!==null,children:c===V.amount?o.jsxs("span",{className:"inline-flex items-center gap-2",children:[o.jsx(et,{size:14,className:"animate-spin"})," ",s("credits.opening")]}):o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[s("credits.buy")," ",o.jsx(Fm,{size:12})]})})]},V.amount)})}),o.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-5 gap-y-2 font-mono text-[10px] uppercase tracking-[0.12em] text-faint",children:[o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(hh,{size:11})," ",s("credits.secureCheckout")]}),o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(XS,{size:11})," ",s("credits.instantTopUp")]})]})]})})},DT={proceed:!0,hints:[]},c$={proceed:!1,hints:[]},d0=class d0{static subscribe(e){return this.subscribers.add(e),()=>this.subscribers.delete(e)}static publish(e){for(const n of this.subscribers)n(e)}static async run(e){const n=await uo.precheck(e);if(!MB(n)||!this.subscribers.size)return DT;const s=n.findings.length?n.findings:[{code:"other",severity:n.maxSeverity==="strong"?"strong":"warn",imageIndex:null,message:n.advice||"",fix:"",modelHint:""}];return new Promise(a=>{this.publish({findings:s,maxSeverity:n.maxSeverity,resolve:c=>{this.publish(null),a(c?{proceed:!0,hints:n.hints}:c$)}})})}};d0.subscribers=new Set;let ra=d0;const mm={uid:"",name:"",email:"",diamond_balance:0,is_premium:!1,plan:"free"},hr=()=>{const t=v.useRef(0),[e,n]=v.useState(mm),[s,a]=v.useState(!1),[c,u]=v.useState(!1),h=v.useCallback(async()=>{const p=xt.currentUser;if(!p)return n(mm),mm;const b={...mm,uid:p.uid,email:p.email||"",name:p.displayName||"Designer"};try{const x=await sa.getUserMe();if(!x)return n(b),b;const w={...b,diamond_balance:x.diamondBalance??0,is_premium:x.isPremium??!1,plan:x.activeSubscriptionId?"pro_monthly":"free",active_subscription_id:x.activeSubscriptionId??null,subscription_status:x.subscriptionStatus??null,subscription_snapshot:x.subscription_snapshot||x.subscriptionSnapshot||null,avatar_url:x.avatarUrl,name:x.displayName||p.displayName||b.n
5423ame,email:x.email||p.email||b.email};return n(w),w}catch(x){return console.error("Failed to refresh billing gate user:",x),n(b),b}},[]);v.useEffect(()=>{const p=b=>{var T;const{uid:x,user:w}=b.detail||{};!w||x!==((T=xt.currentUser)==null?void 0:T.uid)||(n(N=>({...N,uid:x,name:w.displayName||N.name,email:w.email||N.email,diamond_balance:w.diamondBalance??0,is_premium:w.isPremium??!1,active_subscription_id:w.activeSubscriptionId,subscription_status:w.subscriptionStatus,subscription_snapshot:w.subscription_snapshot||w.subscriptionSnapshot||null})),t.current>0&&Number(w.diamondBalance)>=t.current&&(a(!1),u(!1)))};return window.addEventListener("fashio:user-updated",p),()=>window.removeEventListener("fashio:user-updated",p)},[]),v.useEffect(()=>{const p=zv(xt,()=>{h()});return()=>p()},[h]),v.useEffect(()=>{const p=()=>{h()},b=()=>{document.visibilityState==="visible"&&h()};return window.addEventListener("focus",p),document.addEventListener("visibilitychange",b),()=>{window.removeEventListener("focus",p),document.removeEventListener("visibilitychange",b)}},[h]);const m=v.useCallback(async p=>{const b=Math.max(0,Number(p)||0);if(t.current=b,b<=0)return!0;const x=e.uid?e:await h();return Number(x.diamond_balance||0)>=b?!0:i0(x)?(u(!0),!1):(a(!0),!1)},[h,e]);return{user:e,isSubscriptionModalOpen:s,isDiamondModalOpen:c,setIsSubscriptionModalOpen:a,setIsDiamondModalOpen:u,refreshUser:h,ensureCanGenerate:m}},Nt=({label:t,hint:e,children:n,className:s=""})=>o.jsxs("div",{className:`space-y-2 ${s}`,children:[o.jsxs("div",{className:"flex items-baseline justify-between gap-3",children:[o.jsx("label",{className:"text-[11px] font-semibold uppercase tracking-[0.08em] text-faint",children:t}),e&&o.jsx("span",{className:"text-[11px] text-faint",children:e})]}),n]});function u$({value:t,options:e,onChange:n,className:s=""}){return o.jsx("div",{className:`flex gap-0.5 rounded-xl border border-line bg-base p-0.5 ${s}`,children:e.map(a=>o.jsxs("button",{type:"button",onClick:()=>n(a.value),className:`flex flex-1 items-center justify-center gap-1.5 rounded-[10px] py-2 text-xs font-semibold transition-colors ${t===a.value?"bg-ink text-base":"text-dim hover:text-ink"}`,children:[a.icon,a.label]},a.value))})}const d$={auto:"w-5 h-5 border-dashed","1:1":"w-4 h-4","3:4":"w-3.5 h-[18px]","4:5":"w-3.5 h-[17px]","9:16":"w-3 h-[19px]","16:9":"w-[19px] h-3","4:3":"w-[18px] h-3.5"},_l=({value:t,options:e,onChange:n})=>o.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(s=>{const a=t===s;return o.jsxs("button",{type:"button",onClick:()=>n(s),className:`flex items-center gap-2 rounded-lg border px-2.5 py-1.5 text-[11px] font-semibold transition-colors ${a?"border-accent bg-accent-soft text-ink":"border-line bg-base text-dim hover:border-line-strong hover:text-ink"}`,children:[o.jsx("span",{className:`shrink-0 rounded-[3px] border ${a?"border-accent":"border-faint"} ${d$[s]??"w-4 h-4"}`}),s]},s)})}),h$="w-full rounded-xl border border-line bg-base px-3 py-2.5 text-sm text-ink placeholder:text-faint outline-none transition-colors focus:border-line-strong",a0=({className:t="",rows:e=3,...n})=>o.jsx("textarea",{...n,rows:e,className:`${h$} resize-none ${t}`}),Za=({label:t,value:e,imageUrl:n,placeholder:s,onClick:a,onClear:c})=>{const u=De();return o.jsxs("button",{type:"button",onClick:a,className:"group flex w-full items-center gap-3 rounded-xl border border-line bg-base p-2 text-left transition-colors hover:border-line-strong",children:[o.jsx("span",{className:"flex h-11 w-11 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-raised",children:n?o.jsx("img",{src:n,alt:"",className:"h-full w-full object-cover"}):o.jsx("span",{className:"text-[10px] font-bold text-faint",children:"—"})}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block text-[10px] font-semibold uppercase tracking-[0.08em] text-faint",children:t}),o.jsx("span",{className:`block truncate text-sm font-medium ${e?"text-ink":"text-faint"}`,children:e||s||u("studio.choose")})]}),e&&c&&o.jsx("span",{role:"button",tabIndex:-1,"aria-label":u("studio.clearField",{label:t}),onClick:h=>{h.stopPropagation(),c()},className:"rounded-md p-1.5 text-faint hover:bg-raised hover:text-ink",children:o.jsx(Wt,{size:13})})]})},ho=({previews:t,onFiles:e,onRemove:n,max:s=1,accept:a="image/*",hint:c,onPickLibrary:u})=>{const h=De(),[m,p]=fn.useState(!1),b=fn.useRef(null),x=t.length>
5423=s,w=T=>{const N=Array.from(T??[]);N.length&&e(N.slice(0,s-t.length))};return o.jsxs("div",{className:"space-y-2",children:[t.length>0&&o.jsx("div",{className:"grid grid-cols-4 gap-2",children:t.map((T,N)=>o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-lg border border-line bg-base",children:[o.jsx("img",{src:T,alt:"",className:"h-full w-full object-cover"}),n&&o.jsx("button",{type:"button","aria-label":h("studio.removePhoto"),onClick:()=>n(N),className:"absolute right-1 top-1 rounded-md bg-base/80 p-1 text-dim opacity-0 transition-opacity hover:text-ink group-hover:opacity-100",children:o.jsx(Wt,{size:12})})]},`${T}-${N}`))}),!x&&o.jsxs("div",{onDragOver:T=>{T.preventDefault(),p(!0)},onDragLeave:()=>p(!1),onDrop:T=>{T.preventDefault(),p(!1),w(T.dataTransfer.files)},className:`rounded-xl border border-dashed p-3 transition-colors ${m?"border-accent bg-accent-soft":"border-line bg-base"}`,children:[o.jsxs("div",{className:u?"grid grid-cols-2 gap-2":"",children:[o.jsxs("button",{type:"button",onClick:()=>{var T;return(T=b.current)==null?void 0:T.click()},className:"flex flex-col items-center justify-center gap-1.5 rounded-lg border border-line bg-surface px-3 py-4 text-center transition-colors hover:border-line-strong",children:[o.jsx(fl,{size:16,className:"text-faint"}),o.jsx("span",{className:"text-xs font-bold text-ink",children:h("studio.uploadPhotos")}),o.jsx("span",{className:"text-[11px] leading-tight text-faint",children:h("studio.fromThisComputer")})]}),u&&o.jsxs("button",{type:"button",onClick:u,className:"flex flex-col items-center justify-center gap-1.5 rounded-lg border border-accent/40 bg-accent-soft px-3 py-4 text-center transition-colors hover:border-accent",children:[o.jsx(Tr,{size:16,className:"text-accent"}),o.jsx("span",{className:"text-xs font-bold text-ink",children:h("studio.myProducts")}),o.jsx("span",{className:"text-[11px] leading-tight text-accent",children:h("studio.betterResults")})]})]}),o.jsxs("p",{className:"mt-2.5 text-center text-[11px] text-faint",children:[h(m?"studio.dropToAdd":s>1?"studio.orDropPhotos":"studio.orDropPhoto")," · ",c??h("studio.fileHint"),s>1?` · ${h("studio.upTo",{max:s})}`:""]}),o.jsx("input",{ref:b,type:"file",accept:a,multiple:s>1,className:"hidden",onChange:T=>{w(T.target.files),T.target.value=""}})]})]})},f$={idle:{dot:"bg-faint",text:"text-faint",labelKey:"studio.status.idle"},processing:{dot:"bg-accent animate-pulse",text:"text-ink",labelKey:"studio.status.processing"},completed:{dot:"bg-ok",text:"text-dim",labelKey:"studio.status.completed"},failed:{dot:"bg-bad",text:"text-bad",labelKey:"studio.status.failed"}},OT=({status:t,note:e})=>{const n=De(),s=f$[t];return o.jsxs("span",{className:"inline-flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.08em]",children:[o.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${s.dot}`}),o.jsx("span",{className:s.text,children:e||n(s.labelKey)})]})},wl=({onClick:t,busy:e=!1,disabled:n=!1,cost:s,label:a,busyLabel:c})=>{const u=De();return o.jsxs("button",{type:"button",onClick:t,disabled:e||n,className:"flex w-full items-center justify-center gap-2 rounded-xl bg-ink py-3 text-sm font-bold text-base transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",children:[e&&o.jsx(et,{size:15,className:"animate-spin"}),e?c??u("studio.generating"):a??u("studio.generate"),!e&&typeof s=="number"&&s>0&&o.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-base/10 px-1.5 py-0.5 text-[11px] font-bold",children:[o.jsx(Bc,{size:11}),s]})]})},El=({children:t})=>o.jsx("p",{className:"rounded-lg border border-bad/30 bg-bad/10 px-3 py-2 text-xs text-bad",children:t}),m$=({mediaId:t,className:e=""})=>{const n=De(),[s,a]=v.useState(null),c=h=>{const m=s===h?"none":h;a(m==="none"?null:h),uo.setReaction({mediaId:t,reaction:m})},u="inline-flex items-center justify-center rounded-lg border p-2 backdrop-blur transition-colors";return o.jsxs("div",{className:`flex items-center gap-1.5 ${e}`,children:[o.jsx("button",{type:"button","aria-label":n("result.like"),"aria-pressed":s==="like",onClick:()=>c("like"),className:`${u} ${s==="like"?"border-ok/50 bg-ok/15 text-ok":"border-line bg-surface/90 text-dim hover:text-ink"}`,children:o.jsx(_M,{size:15})}),o.jsx("button",{type:"button","aria-label":n("result.dislike"),"aria-pressed":s==="dislike",onClick:()=>c("dislike"),className:`${u} ${s==="dislike"?"border-bad/50 bg-bad/15 text-bad":"border-line bg-surface/90 text-dim hover:text-ink"}`,children:o.jsx(xM,{size:15})})]})};async function fo(t,e){const s=await(await fetch(t)).blob(),a=URL.createObjectURL(s),c=document.createElement("a");c.href=a,c.download=e||"download",document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(a)}const Xb="fashio-guide-autoshown",Qb="fashio-guide-seen",LT=t=>{try{return localStorage.getItem(t)==="1"}catch{return!0}},UT=t=>{try{localStorage.setItem(t,"1")}catch{}},pm={seen:()=>LT(Qb),markSeen:()=>UT(Qb),claimAutoShow:()=>LT(Xb)?!1:(UT(Xb),!0),reset:()=>{try{localStorage.removeItem(Xb),localStorage.removeItem(Qb)}catch{}}},p$="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/guidance%2F",kn=t=>`${p$}${t}`,cn={outfit_out:kn("outfit_out.jpg?alt=media&token=dc402cee-8b58-4f9c-850b-80a9b703382b"),outfit_in_shirt:kn("outfit_in_shirt.jpg?alt=media&token=04b2756e-bfb3-4c99-afa5-17ea234c8e00"),outfit_in_pants:kn("outfit_in_pants.jpg?alt=media&token=a19b8490-0047-4d16-b28e-2f6f9778ab7d"),outfit_in_shoes:kn("outfit_in_shoes.jpg?alt=media&token=a1ab4ef3-d8b9-408d-8c2f-c6e502c67c38"),outfit_in_collar:kn("outfit_in_collar.jpg?alt=media&token=fedf2a5f-4d00-42f6-b094-bfab81a4d4c5"),single_out:kn("single_out.jpg?alt=media&token=a6842780-6761-4521-920e-9a01969d3020"),single_in:kn("single_in.jpg?alt=media&token=94cfa9bd-b78e-446a-8b28-4df4581e3702"),single_in_cu:kn("single_in_cu.jpg?alt=media&token=28ac5bca-62ce-47b9-9ea1-770f66537aa1"),dark_in:kn("dark_in.jpg?alt=media&token=0fbfbe87-89d0-46dc-b1e5-5ad81f5ef839"),dark_out:kn("dark_out.jpg?alt=media&token=eaa6750c-4d50-4af5-a720-6121b2b5d8eb"),dark_fix_in:kn("dark_fix_in.jpg?alt=media&token=033956fb-3209-49b9-955e-c87ee253f3e2"),dark_fix_out:kn("dark_fix_out.jpg?alt=media&token=53be1c28-df33-4526-a886-4e21b4131afc"),crop_in:kn("crop_in.jpg?alt=media&token=d16026fe-b49b-4e76-a942-fae34c67a1de"),crop_out:kn("crop_out.jpg?alt=media&token=eea51c21-a043-4fb2-b8ee-e6a8db37
54237817"),crop_fix_in:kn("crop_fix_in.jpg?alt=media&token=e0518eb8-3f99-4b35-b790-695443cd776b"),crop_fix_out:kn("crop_fix_out.jpg?alt=media&token=83daec0a-fbac-4fe8-ab60-8b46c80c27b2"),back_in:kn("back_in.jpg?alt=media&token=5fc04d25-e57b-415c-afc2-eb9b4fd703a2"),back_out:kn("back_out.jpg?alt=media&token=7e870456-ceb8-476e-8f9a-7afd63dc6156"),back_fix_in_back:kn("back_fix_in_back.jpg?alt=media&token=7943fd0a-3ad7-4100-b33f-671542564c66"),back_fix_out:kn("back_fix_out.jpg?alt=media&token=9efa44e6-d7e7-4e30-a481-07b3e6b2cd0c")},gm=[{kind:"hero",img:cn.outfit_out,titleKey:"guide.hero.title",descKey:"guide.hero.desc"},{kind:"good",titleKey:"guide.outfit.title",descKey:"guide.outfit.desc",result:cn.outfit_out,inputs:[{img:cn.outfit_in_shirt,labelKey:"guide.in.shirt"},{img:cn.outfit_in_pants,labelKey:"guide.in.pants"},{img:cn.outfit_in_shoes,labelKey:"guide.in.shoes"},{img:cn.outfit_in_collar,labelKey:"guide.in.collar",closeUp:!0}]},{kind:"good",titleKey:"guide.single.title",descKey:"guide.single.desc",result:cn.single_out,inputs:[{img:cn.single_in,labelKey:"guide.in.item"},{img:cn.single_in_cu,labelKey:"guide.in.logo",closeUp:!0}]},{kind:"compare",titleKey:"guide.dark.title",bad:{input:cn.dark_in,output:cn.dark_out,textKey:"guide.dark.bad"},good:{input:cn.dark_fix_in,output:cn.dark_fix_out,textKey:"guide.dark.good"}},{kind:"compare",titleKey:"guide.crop.title",bad:{input:cn.crop_in,output:cn.crop_out,textKey:"guide.crop.bad"},good:{input:cn.crop_fix_in,output:cn.crop_fix_out,textKey:"guide.crop.good"}},{kind:"compare",titleKey:"guide.back.title",bad:{input:cn.back_in,output:cn.back_out,textKey:"guide.back.bad"},good:{input:cn.back_fix_in_back,output:cn.back_fix_out,textKey:"guide.back.good"}},{kind:"checklist",dos:["guide.do1","guide.do2","guide.do3","guide.do4","guide.do5","guide.do6"],donts:["guide.dont1","guide.dont2","guide.dont3","guide.dont4"]}],vc=({tone:t="neutral",children:e})=>o.jsx("span",{className:`inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 font-mono text-[9px] font-bold uppercase tracking-[0.08em] ${t==="ok"?"bg-ok/15 text-ok":t==="bad"?"bg-bad/15 text-bad":"bg-raised text-faint"}`,children:e}),vd=({src:t,caption:e,badge:n,ratio:s="aspect-[3/4]",fixed:a})=>o.jsxs("figure",{className:`flex min-w-0 flex-1 flex-col ${a?"":"sm:min-h-0"}`,children:[o.jsxs("div",{className:`relative ${s} overflow-hidden rounded-xl border border-line bg-base ${a?"":"sm:aspect-auto sm:min-h-0 sm:flex-1"}`,children:[o.jsx("img",{src:t,alt:"",loading:"lazy",className:"h-full w-full object-contain"}),n&&o.jsx("span",{className:"absolute left-1.5 top-1.5",children:n})]}),e&&o.jsx("figcaption",{className:"mt-1 shrink-0 truncate text-center text-[10px] text-dim",children:e})]}),g$=({slide:t})=>{const e=De();if(t.kind==="hero")return o.jsxs("div",{className:"flex flex-col gap-5 sm:h-full sm:min-h-0 sm:flex-row sm:items-center sm:gap-7",children:[o.jsx("div",{className:"mx-auto flex w-full max-w-[220px] sm:mx-0 sm:h-full sm:min-h-0 sm:max-w-none sm:flex-1",children:o.jsx(vd,{src:t.img})}),o.jsxs("div",{className:"sm:flex-1",children:[o.jsx("h2",{className:"text-2xl font-bold tracking-tight text-ink",children:e(t.titleKey)}),o.jsx("p",{className:"mt-2 text-sm leading-relaxed text-dim",children:e(t.descKey)})]})]});if(t.kind==="good")return o.jsxs("div",{className:"flex flex-col gap-4 sm:h-full sm:min-h-0",children:[o.jsxs("div",{className:"shrink-0",children:[o.jsx("h2",{className:"text-lg font-bold tracking-tight text-ink",children:e(t.titleKey)}),o.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-dim",children:e(t.descKey)})]}),o.jsxs("div",{className:"grid gap-4 sm:min-h-0 sm:flex-1 sm:grid-cols-2",children:[o.jsxs("div",{className:"flex flex-col gap-1.5 sm:min-h-0",children:[o.jsx("div",{className:"shrink-0",children:o.jsx(vc,{children:e("guide.tag.youUpload")})}),o.jsx("div",{className:`grid grid-cols-2 gap-2 sm:min-h-0 sm:flex-1 ${t.inputs.length>2?"sm:grid-rows-2":"sm:grid-rows-1"}`,children:t.inputs.map(n=>o.jsx("div",{className:"flex min-w-0 sm:min-h-0",children:o.jsx(vd,{src:n.img,caption:e(n.labelKey),ratio:"aspect-square",badge:n.closeUp?o.jsx(vc,{children:e("guide.tag.closeUp")}):void 0})},n.img))})]}),o.jsxs("div",{className:"flex flex-col gap-1.5 sm:min-h-0",children:[o.jsx("div",{className:"shrink-0",children:o.jsx(vc,{tone:"ok",children:e("guide.tag.result")})}),o.jsx("div",{className:"flex sm:min-h-0 sm:flex-1",children:o.jsx(vd,{src:t.result})})]})]})]});if(t.kind==="compare"){const n=({tone:s,label:a,pair:c})=>o.jsxs("div",{className:`flex flex-col rounded-panel border p-2.5 ${s==="ok"?"border-ok/30":"border-bad/30"}`,children:[o.jsx("div",{className:"shrink-0",children:o.jsx(vc,{tone:s,children:a})}),o.jsxs("div",{className:"mt-2 flex items-center gap-2",children:[o.jsx("div",{className:"flex min-w-0 flex-1",children:o.jsx(vd,{src:c.input,caption:e("guide.caption.input"),ratio:"aspect-square",fixed:!0})}),o.jsx(ks,{size:14,className:"shrink-0 text-faint"}),o.jsx("div",{className:"flex min-w-0 flex-1",children:o.jsx(vd,{src:c.output,caption:e("guide.caption.output"),ratio:"aspect-square",fixed:!0})})]}),o.jsx("p",{className:"mt-2 shrink-0 text-[12px] leading-snug text-dim",children:e(c.textKey)})]});return o.jsxs("div",{className:"flex flex-col gap-3 sm:h-full sm:justify-center",children:[o.jsx("h2",{className:"shrink-0 text-lg font-bold tracking-tight text-ink",children:e(t.titleKey)}),o.jsxs("div",{className:"grid items-start gap-3 sm:grid-cols-2",children:[o.jsx(n,{tone:"bad",label:e("guide.tag.mistake"),pair:t.bad}),o.jsx(n,{tone:"ok",label:e("guide.tag.doThis"),pair:t.good})]})]})}return o.jsxs("div",{className:"flex flex-col gap-5 sm:h-full sm:justify-center",children:[o.jsx("h2",{className:"text-xl font-bold tracking-tight text-ink",children:e("guide.checklist.title")}),o.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[o.jsxs("div",{className:"space-y-2",children:[o.jsx(vc,{tone:"ok",children:e("guide.tag.do")}),o.jsx("ul",{className:"space-y-2",children:t.dos.map(n=>o.jsxs("li",{className:"flex gap-2 text-sm text-dim",children:[o.jsx(Cn,{size:14,className:"mt-0.5 shrink-0 text-ok"}),e(n)]},n))})]}),o.jsxs("div",{className:"space-y-2",children:[o.jsx(vc,{tone:"bad",children:e("guide.tag.avoid")}),o.jsx("ul",{className:"space-y-2",children:t.donts.map(n=>o.jsxs("li",{className:"flex gap-2 text-sm text-dim",children:[o.jsx(Wt,{size:14,className:"mt-0.5 shrink-0 text-bad"}),e(n)]},n))})]})]})]})},y$=({open:t,onClose:e})=>{const n=De(),[s,a]=v.useState(0),c=s===gm.length-1;return v.useEffect(()=>{t&&a(0)},[t]),v.useEffect(()=>{if(!t)return;const u=h=>{h.key==="Escape"&&e(),h.key==="ArrowRight"&&a(m=>Math.min(m+1,gm.length-1)),h.key==="ArrowLeft"&&a(m=>Math.max(m-1,0))};return window.addEventListener("keydown",u),()=>window.removeEventListener("keydown",u)},[t,e]),t?o.jsx("div",{className:"fixed inset-0 z-[80] flex items-end justify-center bg-black/75 p-0 backdrop-blur-sm sm:items-center sm:p-4",onClick:e,children:o.jsxs("div",{className:"flex h-[92vh] w-full max-w-3xl flex-col overflow-hidden rounded-t-panel border border-line bg-surface shadow-lift sm:h-[min(90vh,760px)] sm:max-w-4xl sm:rounded-panel",onClick:u=>u.stopPropagation(),children:[o.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-5 py-3",children:[o.jsx("p",{className:"font-mono text-[10px] font-bold uppercase tracking-[0.12em] text-accent",children:n("guide.kicker")}),o.jsx("button",{onClick:e,"aria-label":n("guide.closeAria"),className:"rounded-lg p-1.5 text-faint transition-colors hover:bg-overlay hover:text-ink",children:o.jsx(Wt,{size:16})})]}),o.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4 sm:overflow-hidden",children:o.jsx(g$,{slide:gm[s]})}),o.jsxs("div",{className:"flex shrink-0 items-center gap-3 border-t border-line px-5 py-3",children:[o.jsx("button",{onClick:()=>a(u=>Math.max(u-1,0)),disabled:s===0,"aria-label":n("guide.previous"),className:"rounded-lg p-2 text-dim transition-colors hover:bg-overlay hover:text-ink disabled:opacity-30",children:o.jsx(di,{size:16})}),o.jsx("div",{className:"flex flex-1 justify-center gap-1.5",children:gm.map((u,h)=>o.jsx("button",{onClick:()=>a(h),"aria-label":n("guide.slideAria",{n:h+1}),className:`h-1.5 rounded-full transition-all ${h===s?"w-5 bg-accent":"w-1.5 bg-line-strong"}`},h))}),o.jsxs("button",{onClick:()=>c?e():a(u=>u+1),className:"inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[n(c?"guide.done":"onboarding.next"),!c&&o.jsx(ks,{size:14})]})]})]})}):null},b$=()=>{const t=De(),[e,n]=v.useState(!1),[s,a]=v.useState(()=>pm.seen());v.useEffect(()=>{pm.claimAutoShow()&&(n(!0),a(!0),pm.markSeen())},[]);const c=()=>{n(!0),a(!0),pm.markSeen()};return o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:c,"aria-label":t("guide.kicker"),className:"relative rounded-xl p-2 text-dim transition-colors hover:bg-raised hover:text-ink",children:[o.jsx(Nv,{size:17,className:s?"":"text-accent"}),!s&&o.jsx("span",{className:"absolute right-1 top-1 h-2 w-2 rounded-full bg-accent"})]}),o.jsx(y$,{open:e,onClose:()=>n(!1)})]})},kl=({title:t,subtitle:e,status:n,children:s,action:a,canvas:c,runStrip:u,onBack:h})=>{const m=Xn(),p=De(),b=n$(),[x,w]=v.useState(!1),T=v.useRef(n);v.useEffect(()=>{b?w(!1):n!=="idle"&&n!==T.current&&w(!0),T.current=n},[n,b]),v.useEffect(()=>{if(!x)return;const A=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=A}},[x]),v.useEffect(()=>{if(!x)return;const A=F=>{F.key==="Escape"&&w(!1)};return window.addEventListener("keydown",A),()=>window.removeEventListener("keydown",A)},[x]);const N=!b&&x,j=o.jsx("div",{className:"relative flex min-h-[320px] flex-1 items-center justify-center overflow-hidden rounded-panel border border-line bg-surface",children:c});return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex h-full flex-col xl:h-[calc(100vh-5.5rem)]",children:[o.jsxs("header",{className:"mb-4 flex shrink-0 items-center gap-3",children:[o.jsx("button",{onClick:h??(()=>
5423m(-1)),"aria-label":p("studio.back"),className:"rounded-xl p-2 text-dim transition-colors hover:bg-raised hover:text-ink",children:o.jsx(di,{size:18})}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("h1",{className:"truncate text-xl font-bold tracking-tight text-ink",children:t}),e&&o.jsx("p",{className:"truncate text-xs text-faint",children:e})]}),o.jsx(b$,{}),o.jsx(OT,{status:n})]}),o.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 gap-4 overflow-y-auto pb-[calc(8rem+var(--mobile-nav-height,0px))] xl:grid-cols-12 xl:overflow-hidden xl:pb-0",children:[o.jsxs("div",{className:"flex min-h-0 flex-col overflow-hidden rounded-panel border border-line bg-surface xl:col-span-5",children:[o.jsx("div",{className:"flex-1 space-y-4 overflow-y-auto p-4",children:s}),a&&b&&o.jsx("div",{className:"shrink-0 border-t border-line bg-surface p-4",children:a})]}),!N&&o.jsxs("div",{className:"flex min-h-0 flex-col gap-3 xl:col-span-7",children:[j,u&&o.jsx("div",{className:"shrink-0 space-y-3",children:u})]})]})]}),a&&!b&&!N&&o.jsxs("div",{className:"fixed inset-x-0 bottom-[var(--mobile-nav-height,0px)] z-30 border-t border-line bg-surface/95 px-4 pt-3 backdrop-blur pb-3 md:[padding-bottom:calc(0.75rem+env(safe-area-inset-bottom))]",children:[n!=="idle"&&o.jsxs("button",{type:"button",onClick:()=>w(!0),className:"mb-2 flex w-full items-center justify-center gap-1.5 text-[11px] font-semibold uppercase tracking-[0.08em] text-accent",children:[o.jsx(BS,{size:12}),p(n==="processing"?"studio.viewProgress":"studio.viewResult")]}),a]}),N&&o.jsxs("div",{role:"dialog","aria-modal":"false","aria-label":p("studio.resultOf",{title:t}),className:"fixed inset-x-0 top-0 bottom-[var(--mobile-nav-height,0px)] z-[45] flex flex-col bg-base",children:[o.jsxs("header",{className:"flex shrink-0 items-center gap-3 border-b border-line px-4 py-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"truncate text-sm font-bold text-ink",children:t}),o.jsx("p",{className:"truncate text-[11px] text-faint",children:p(n==="processing"?"studio.working":"studio.result")})]}),o.jsx(OT,{status:n}),o.jsx("button",{type:"button",onClick:()=>w(!1),"aria-label":p("studio.closeResult"),className:"rounded-xl p-2 text-dim transition-colors hover:bg-raised hover:text-ink",children:o.jsx(Wt,{size:18})})]}),o.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-3 overflow-y-auto p-4",children:[j,u&&o.jsx("div",{className:"shrink-0 space-y-3",children:u})]}),a&&o.jsx("div",{className:"shrink-0 border-t border-line bg-surface px-4 pt-3 pb-3 md:[padding-bottom:calc(0.75rem+env(safe-area-inset-bottom))]",children:a})]})]})},Nh=({message:t,children:e})=>{const n=De();return o.jsxs("div",{className:"flex flex-col items-center gap-3 px-6 text-center",children:[e??o.jsx(N5,{size:26,className:"text-faint"}),o.jsx("p",{className:"max-w-xs text-xs text-faint",children:t??n("studio.canvasEmptyDefault")})]})},Tl=({label:t})=>{const e=De();return o.jsxs("div",{className:"flex flex-col items-center gap-3",children:[o.jsx(et,{size:26,className:"animate-spin text-accent"}),o.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.08em] text-dim",children:t??e("studio.generating")})]})},Sl=({message:t})=>{const e=De();return o.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-2 px-6 text-center",children:[o.jsx("p",{className:"text-sm font-semibold text-bad",children:e("studio.generationFailed")}),o.jsx("p",{className:"text-xs text-faint",children:t})]})},jh=({url:t,mediaId:e,isVideo:n=!1,fileName:s})=>{const a=De();return o.jsxs(o.Fragment,{children:[n?o.jsx("video",{src:t,controls:!0,autoPlay:!0,loop:!0,playsInline:!0,className:"h-full w-full object-contain"}):o.jsx("img",{src:t,alt:a("studio.result"),className:"h-full w-full object-contain"}),o.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-1.5",children:[e&&o.jsx(m$,{mediaId:e}),o.jsx("button",{type:"button","aria-label":a("studio.downloadResult"),onClick:()=>void fo(t,s??`fashio.${n?"mp4":"jpg"}`),className:"rounded-lg border border-line bg-surface/90 p-2 text-dim backdrop-blur transition-colors hover:text-ink",children:o.jsx(aa,{size:15})})]})]})};function Ah(t){const[e,n]=ze("photos.files",[]),[s,a]=v.useState([]),[c,u]=ze("photos.urls",[]),[h,m]=v.useState(!1);v.useEffect(()=>{const j=e.map(A=>URL.createObjectURL(A));return a(j),()=>j.forEach(A=>URL.revokeObjectURL(A))},[e]);const p=c.length+e.length,b=v.useCallback(j=>{const A=t-c.length-e.length,F=j.slice(0,Math.max(0,A));F.length&&n(V=>[...V,...F])},[t,c.length,e.length]),x=v.useCallback(j=>{const A=t-c.length-e.length,F=j.filter(V=>!c.includes(V)).slice(0,Math.max(0,A));F.length&&u(V=>[...V,...F])},[t,c,e.length]),w=v.useCallback(j=>{if(j<c.length){u(F=>F.filter((V,L)=>L!==j));return}const A=j-c.length;n(F=>F.filter((V,L)=>L!==A))},[c.length]),T=v.useCallback(()=>{n([]),u([])},[]),N=v.useCallback(async j=>{const A=await Promise.all(e.map(j));return[...c,...A]},[e,c]);return{previews:[...c,...s],files:e,libraryUrls:c,count:p,remaining:Math.max(0,t-p),addFiles:b,addLibrary:x,removeAt:w,clear:T,resolve:N,pickerOpen:h,openPicker:()=>m(!0),closePicker:()=>m(!1)}}const x$=t=>t instanceof Ut?t.toDate():null,FT=(t,e)=>({id:t,url:typeof e.url=="string"?e.url:"",path:typeof e.path=="string"?e.path:"",createdAt:x$(e.createdAt)});class qi{static col(e){return lp(sl,"users",e,"uploads")}static watch(e,n,s){const a=Zo(qi.col(e),nh("createdAt","desc"));return XA(a,c=>n(c.docs.map(u=>FT(u.id,u.data()))),c=>s==null?void 0:s(c))}static async list(e){return(await up(Zo(qi.col(e),nh("createdAt","desc")))).docs.map(s=>FT(s.id,s.data()))}static async addFiles(e,n){return Promise.all(n.map(async s=>{const{path:a,downloadUrl:c}=await Ks.uploadPhoto(s,`users/${e}/uploads/library`),u=si(qi.col(e));return await GA(u,{url:c,path:a,createdAt:Pm()}),{id:u.id,url:c,path:a,createdAt:new Date}}))}static async remove(e,n){await WA(si(qi.col(e),n.id));try{await _C(mp(pp,n.path))}catch(s){console.warn("[uploads] could not delete storage object",n.path,s)}}}let Jb="products";const fu=({open:t,onClose:e,remaining:n,onPick:s})=>{const a=De(),[c,u]=v.useState(Jb),[h,m]=v.useState([]),[p,b]=v.useState([]),[x,w]=v.useState(!0),[T,N]=v.useState([]),j=$=>{Jb=$,u($)};v.useEffect(()=>{var I;if(!t)return;u(Jb),N([]);const $=(I=xt.currentUser)==null?void 0:I.uid;if(!$){w(!1);return}w(!0);let q=!0;return Promise.all([un.list($),qi.list($)]).then(([S,C])=>{q&&(m(S),b(C))}).catch(S=>console.warn("[library picker] load failed",S)).finally(()=>{q&&w(!1)}),()=>{q=!1}},[t]),v.useEffect(()=>{if(!t)return;const $=q=>q.key==="Escape"&&e();return window.addEventListener("keydown",$),()=>window.removeEventListener("keydown",$)},[t,e]);const A=T.length>=n,F=$=>{N(q=>q.includes($)?q.filter(I=>I!==$):q.length>=n?q:[...q,$])},V=$=>{N(q=>{if($.imageUrls.every(C=>q.includes(C)))return q.filter(C=>!$.imageUrls.includes(C));const S=[...q];for(const C of $.imageUrls){if(S.length>=n)break;S.includes(C)||S.push(C)}return S})},L=v.useMemo(()=>!x&&h.length===0,[x,h]),Y=v.useMemo(()=>!x&&p.length===0,[x,p]);return t?o.jsx("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/70 p-0 backdrop-blur-sm sm:items-center sm:p-4",onClick:e,children:o.jsxs("div",{className:"flex max-h-[88vh] w-full max-w-2xl flex-col overflow-hidden rounded-t-panel border border-line bg-surface shadow-lift sm:rounded-panel",onClick:$=>$.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-4",children:[o.jsxs("div",{children:[o.jsx("h3",{className:"text-[15px] font-bold text-ink",children:a("products.library")}),o.jsx("p",{className:"mt-0.5 text-xs text-dim",children:a("productPicker.subtitle")})]}),o.jsx("button",{onClick:e,className:"rounded-lg p-1.5 text-faint transition-colors hover:bg-overlay hover:text-ink",children:o.jsx(Wt,{size:16})})]}),o.jsx("div",{className:"grid grid-cols-2 gap-1 border-b border-line bg-raised p-1",children:[{id:"products",labelKey:"nav.products.label",Icon:Tr},{id:"uploads",labelKey:"nav.uploads.label",Icon:Jo}].map(({id:$,labelKey:q,Icon:I})=>{const S=c===$;return o.jsxs("button",{type:"button",onClick:()=>j($),"aria-pressed":S,className:`flex items-center justify-center gap-2 rounded-xl py-2 text-sm font-semibold transition-colors ${S?"bg-ink text-base":"text-dim hover:bg-overlay hover:text-ink"}`,children:[o.jsx(I,{size:14}),a(q)]},$)})}),o.jsx("div",{className:"flex-1 overflow-y-auto px-5 py-4",children:x?o.jsx("div",{className:"flex justify-center py-14 text-faint",children:o.jsx(et,{size:18,className:"animate-spin"})}):c==="products"?L?o.jsxs("div",{className:"py-12 text-center",children:[o.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Tr,{size:19,className:"text-accent"})}),o.jsx("p",{className:"text-sm font-semibold text-ink",children:a("productPicker.empty")}),o.jsx("p",{className:"mx-auto mt-1.5 max-w-xs text-xs leading-relaxed text-dim",children:a("productPicker.emptyBlurb")}),o.jsxs(zt,{to:"/products",onClick:e,className:"mt-4 inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2 text-xs font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(Tr,{size:12})," ",a("productPicker.add")]})]}):o.jsx("div",{className:"space-y-5",children:h.map($=>{const q=$.imageUrls.length>0&&$.imageUrls.every(I=>T.includes(I));return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{className:"flex items-center justify-between gap-3",children:[o.jsx("p",{className:"truncate text-sm font-semibold text-ink",children:$.name||a("productPicker.untitled")}),$.imageUrls.length>1&&o.jsx("button",{onClick:()=>V($),className:"shrink-0 font-mono text-[10px] uppercase tracking-[0.06em] text-faint transition-colors hover:text-ink",children:q?a("productPicker.clear"):a("productPicker.allCount",{count:$.imageUrls.length})})]}),o.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-6",children:$.imageUrls.map(I=>{const S=T.includes(I),C=!S&&A;return o.jsxs("button",{onClick:()=>F(I),disabled:C,className:`relative aspect-square overflow-hidden rounded-lg border-2 transition-colors ${S?"border-accent":"border-transparent"} ${C?"cursor-not-allowed opacity-40":""}`,children:[o.jsx("img",{src:I,alt:"",className:"h-full w-full object-cover"}),S&&o.jsx("span",{className:"absolute right-1 top-1 rounded-full bg-accent p-0.5 text-white",children:o.jsx(Cn,{size:10})})]},I)})})]},$.id)})}):Y?o.jsxs("div",{className:"py-12 text-center",children:[o.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Jo,{size:19,className:"text-accent"})}),o.jsx("p",{className:"text-sm font-semibold text-ink",children:a("uploads.empty")}),o.jsx("p",{className:"mx-auto mt-1.5 max-w-xs text-xs leading-relaxed text-dim",children:a("uploadsPicker.emptyBlurb")}),o.jsxs(zt,{to:"/products",onClick:e,className:"mt-4 inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2 text-xs font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(Jo,{size:12})," ",a("studio.uploadPhotos")]})]}):o.jsx("div",{className:"grid grid-cols-4 gap-2 sm:grid-cols-6",children:p.map($=>{const q=T.includes($.url),I=!q&&A;return o.jsxs("button",{onClick:()=>F($.url),disabled:I,className:`relative aspect-square overflow-hidden rounded-lg border-2 transition-colors ${q?"border-accent":"border-transparent"} ${I?"cursor-not-allowed opacity-40":""}`,children:[o.jsx("img",{src:$.url,alt:"",className:"h-full w-full object-cover"}),q&&o.jsx("span",{className:"absolute right-1 top-1 rounded-full bg-accent p-0.5 text-white",children:o.jsx(Cn,{size:10})})]},$.id)})})}),!(c==="products"?L:Y)&&o.jsxs("div",{className:"flex items-center gap-3 border-t border-line px-5 py-4",children:[o.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.06em] text-faint",children:a("productPicker.selected",{picked:T.length,total:n}
5423)}),o.jsx("div",{className:"flex-1"}),o.jsx(zt,{to:"/products",onClick:e,className:"text-xs font-semibold text-dim transition-colors hover:text-ink",children:a("productPicker.manage")}),o.jsx("button",{onClick:()=>{s(T),e()},disabled:T.length===0,className:"rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90 disabled:opacity-40",children:a("productPicker.use",{count:T.length})})]})]})}):null},v$=t=>new Promise(e=>setTimeout(e,t)),Zb=5,VT="outfit_photo";function _$(t){var e,n;return(e=t.image_urls)!=null&&e.length?t.image_urls[0]:(n=t.imageUrls)!=null&&n.length?t.imageUrls[0]:t.imageUrl??null}function w$(t){return Vc(t)}function E$(t){return t.image_url||t.imageUrl||null}function k$(t){return hu(t)||ug(t.id)}function T$(t){return t.image_url||t.imageUrl||null}function S$(t){return hu(t)||ug(t.id)}function N$(t){return t?t.mediaUrl??t.url??null:null}const j$=()=>{var Re;const t=Ah(Zb),[e,n]=ze("selectedModel",null),[s,a]=ze("selectedPose",null),[c,u]=ze("selectedEnv",null),[h,m]=ze("prompt",""),[p,b]=ze("ratio","3:4"),[x,w]=v.useState(!1),[T,N]=v.useState("idle"),[j,A]=v.useState(null),F=De(),[V,L]=v.useState(null),[Y,$]=v.useState(null),[q,I]=v.useState(!1),[S,C]=v.useState(!1),[R,D]=v.useState(!1),[z,P]=v.useState(((Re=cr("outfit_photo"))==null?void 0:Re.price)??0),{user:ie,isSubscriptionModalOpen:_e,isDiamondModalOpen:W,setIsSubscriptionModalOpen:J,setIsDiamondModalOpen:fe,ensureCanGenerate:ce}=hr(),ae=v.useRef(!1);v.useEffect(()=>{ae.current||(ae.current=!0,nn.getFashionModels({pageSize:1}).then(Ce=>{Ce.models.length&&n($e=>$e??Ce.models[0])}).catch(Ce=>console.error("TryOnBuilder model load error:",Ce)).finally(()=>{ae.current=!1}))},[]);const O=v.useRef(void 0);v.useEffect(()=>{let Ce=!0;return(async()=>{const $e=O.current===void 0;$e&&(O.current=ia("try-on"));const Ue=O.current;!Ue||!Ce||($e&&t.addLibrary([Ue.url]),Ue.model&&nn.getFashionModelById(Ue.model).then(Qe=>{Ce&&Qe&&n(Qe)}).catch(Qe=>console.error("TryOnBuilder handoff model error:",Qe)),Ue.venue&&nn.getFashionEnvironments().then(Qe=>{const Ke=Qe.find(Ne=>Ne.id===Ue.venue);Ce&&Ke&&u(Ke)}).catch(Qe=>console.error("TryOnBuilder handoff venue error:",Qe)),Ue.pose&&nn.getFashionPoses().then(Qe=>{const Ke=Qe.find(Ne=>Ne.id===Ue.pose);Ce&&Ke&&a(Ke)}).catch(Qe=>console.error("TryOnBuilder handoff pose error:",Qe)))})(),()=>{Ce=!1}},[]),v.useEffect(()=>{let Ce=!0;return Rr.getStyleById("outfit_photo").then($e=>{const Ue=Number($e==null?void 0:$e.price);Ce&&Ue>0&&P(Ue)}).catch(()=>{}),()=>{Ce=!1}},[]);const B=()=>{A(null),N("idle")},re=Ce=>{t.addFiles(Ce),B()},pe=Ce=>{t.addLibrary(Ce),B()},de=async Ce=>{for(let $e=0;$e<90;$e++){await v$(3e3);const Ue=await Ln.getMediaById(Ce);if(Ue){if(Ue.status==="completed"){A(Ue),N("completed");return}if(Ue.status==="failed"){A(Ue),N("failed"),$(Ue.errorMessage||null),L(Ue.errorMessage?null:"studio.error.generic");return}}}N("failed"),L("tryon.error.timeout")},me=async()=>{if(t.count===0){L("tryon.error.uploadGarment");return}if(!e){L("studio.error.selectModel");return}if(await ce(z)){L(null),$(null),w(!0),N("processing"),A(null);try{const Ce=await t.resolve(Ke=>Ks.uploadPhoto(Ke,`users/${ie.uid}/uploads/tryon/batch`).then(Ne=>Ne.downloadUrl)),$e={garment_photos:Ce},Ue=await ra.run({tool:VT,imageUrls:Ce});if(!Ue.proceed){N("idle");return}e&&($e.fashion_model=e.id),s&&($e.pose=s.id),c&&($e.venue=c.id);const Qe=await uo.generate({toolId:VT,prompt:h.trim(),imageFields:$e,ratio:p,precheckHints:Ue.hints});await de(Qe.mediaItemId)}catch(Ce){console.error("TryOnBuilder generate error:",Ce),N("failed"),$((Ce==null?void 0:Ce.message)||null),L(Ce!=null&&Ce.message?null:"studio.error.startFailed")}finally{w(!1)}}},we=N$(j),Se=T==="processing"?o.jsx(Tl,{}):T==="failed"?o.jsx(Sl,{message:Y??F(V??"studio.error.generic")}):we?o.jsx(jh,{url:we,mediaId:j==null?void 0:j.id,fileName:"try-on.jpg"}):o.jsx(Nh,{message:F("tryon.canvasEmpty"),children:o.jsx(jv,{size:26,className:"text-faint"})});return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:F("tryon.title"),subtitle:F("tryon.subtitle"),status:T,canvas:Se,action:o.jsx(wl,{onClick:()=>void me(),busy:x,disabled:!e||t.count===0,cost:z}),children:[o.jsx(Nt,{label:F("tryon.pieces"),hint:`${t.count}/${Zb}`,children:o.jsx(ho,{previews:t.previews,onFiles:re,onRemove:t.removeAt,onPickLibrary:t.openPicker,max:Zb,hint:F("tryon.piecesHint")})}),o.jsx(Nt,{label:F("studio.scene"),children:o.jsxs("div",{className:"space-y-2",children:[o.jsx(Za,{label:F("studio.model"),value:w$(e),imageUrl:e?_$(e):null,placeholder:F("studio.chooseModel"),onClick:()=>I(!0)}),o.jsx(Za,{label:F("studio.pose"),value:s?k$(s):null,imageUrl:s?E$(s):null,placeholder:F("tryon.defaultPose"),onClick:()=>C(!0),onClear:()=>a(null)}),o.jsx(Za,{label:F("tryon.venue"),value:c?S$(c):null,imageUrl:c?T$(c):null,placeholder:F("tryon.studioBackgroun
5423d"),onClick:()=>D(!0),onClear:()=>u(null)})]})}),o.jsx(Nt,{label:F("studio.prompt"),hint:F("common.optional"),children:o.jsx(a0,{value:h,onChange:Ce=>m(Ce.target.value),placeholder:F("tryon.extraDirection")})}),o.jsx(Nt,{label:F("studio.ratio"),children:o.jsx(_l,{value:p,options:Sh,onChange:b})}),(Y||V)&&o.jsx(El,{children:Y??F(V)})]}),o.jsx(vl,{isOpen:q,onClose:()=>I(!1),onSelect:Ce=>{n(Ce),I(!1)},selectedModel:e}),o.jsx(nR,{isOpen:S,onClose:()=>C(!1),onSelect:Ce=>{a(Ce),C(!1)},selectedPose:s}),o.jsx(t$,{isOpen:R,onClose:()=>D(!1),onSelect:Ce=>{u(Ce),D(!1)},selectedEnv:c}),o.jsx(fu,{open:t.pickerOpen,onClose:t.closePicker,remaining:t.remaining,onPick:pe}),o.jsx(Ts,{isOpen:_e,onClose:()=>J(!1),user:ie}),o.jsx(dr,{isOpen:W,onClose:()=>fe(!1),user:ie})]})},ex=10;function A$(t){return t.image_urls&&t.image_urls.length>0?t.image_urls[0]:t.imageUrls&&t.imageUrls.length>0?t.imageUrls[0]:t.imageUrl?t.imageUrl:null}const C$=t=>new Promise(e=>setTimeout(e,t)),R$=t=>t?t.mediaUrl??t.url??null:null,zT=hu,I$=()=>{var pe;const[t,e]=v.useState([]),[n,s]=v.useState([]),[a,c]=ze("selectedStylePreset",null),[u,h]=ze("selectedShotType",null),[m,p]=ze("selectedModel",null),b=Ah(ex),x=v.useRef(void 0);v.useEffect(()=>{let de=!0;const me=x.current===void 0;me&&(x.current=ia("pro-studio"));const we=x.current;return we&&(me&&b.addLibrary([we.url]),we.model&&nn.getFashionModelById(we.model).then(Se=>{de&&Se&&p(Se)}).catch(Se=>console.error("ProStudio handoff model error:",Se))),()=>{de=!1}},[]);const[w,T]=v.useState(!1),[N,j]=ze("selectedRatio","1:1"),[A,F]=v.useState("idle"),[V,L]=v.useState(null),[Y,$]=v.useState(!1),q=De(),[I,S]=v.useState(null),[C,R]=v.useState(null),[D,z]=v.useState(((pe=cr("pro_studio"))==null?void 0:pe.price)??0),{user:P,isSubscriptionModalOpen:ie,isDiamondModalOpen:_e,setIsSubscriptionModalOpen:W,setIsDiamondModalOpen:J,ensureCanGenerate:fe}=hr(),ce=v.useRef(!1);v.useEffect(()=>{(async()=>{if(!ce.current){ce.current=!0;try{const me=await nn.getFashionStylePresets();e(me),me.length>0&&c(Re=>Re??me[0]);const we=await nn.getFashionShotTypes();s(we),we.length>0&&h(Re=>Re??we[0]);const Se=await nn.getFashionModels({});Se.models.length>0&&p(Re=>Re??Se.models[0])}catch(me){console.error("ProStudio catalog load failed:",me)}finally{ce.current=!1}}})()},[]),v.useEffect(()=>{let de=!0;return Rr.getStyleById("pro_studio").then(me=>{const we=Number(me==null?void 0:me.price);de&&we>0&&z(we)}).catch(()=>{}),()=>{de=!1}},[]);const ae=async de=>{for(let me=0;me<40;me+=1){await C$(2e3);const we=await Ln.getMediaById(de);if(!we)continue;const Se=we.status||"processing";if(Se==="completed"){L(we),F("completed");return}if(Se==="failed"){L(we),F("failed"),R(we.errorMessage||null),S(we.errorMessage?null:"studio.error.processingFailed");return}}F("failed"),S("studio.error.timeoutGallery")},O=async()=>{if(!w){if(S(null),R(null),b.count===0){S("studio.error.uploadGarment");return}if(!a||!u||!m){S("pro.studio.error.incomplete");return}if(await fe(D)){T(!0),F("processing"),L(null);try{const de=xt.currentUser;if(!de)throw new Error(q("studio.error.loginFirst"));const me=await b.resolve(Re=>Ks.uploadPhoto(Re,`users/${de.uid}/uploads/tools/pro_studio`).then(Ce=>Ce.downloadUrl));if(me.length===0)throw new Error(q("studio.error.uploadFailed"));const we=await ra.run({tool:"pro_studio",imageUrls:me});if(!we.proceed){F("idle");return}const Se=await uo.generate({toolId:"pro_studio",imageFields:{garment_photos:me,fashion_model:m.id,style_preset:a.id,shot_type:u.id},ratio:N,precheckHints:we.hints});await ae(Se.mediaItemId)}catch(de){F("failed"),R((de==null?void 0:de.message)||null),S(de!=null&&de.message?null:"studio.error.imageFailed")}finally{T(!1)}}}},B=R$(V),re=A==="processing"?o.jsx(Tl,{}):A==="failed"?o.jsx(Sl,{message:C??q(I??"studio.error.generic")}):B?o.jsx(jh,{url:B,mediaId:V==null?void 0:V.id,fileName:"pro-studio.jpg"}):o.jsx(Nh,{message:q("pro.studio.canvasEmpty"),children:o.jsx(us,{size:26,className:"text-faint"})});return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:q("pro.studio.title"),subtitle:q("pro.studio.subtitle"),status:A,canvas:re,action:o.jsx(wl,{onClick:()=>void O(),busy:w,disabled:!b.count||!m||!u||!a,cost:D}),children:[o.jsx(Nt,{label:q("pro.studio.garmentPhotos"),hint:`${b.count}/${ex}`,children:o.jsx(ho,{previews:b.previews,onFiles:b.addFiles,onRemove:b.removeAt,onPickLibrary:b.openPicker,max:ex,hint:q("pro.studio.garmentHint")})}),o.jsx(Nt,{label:q("studio.model"),children:o.jsx(Za,{label:q("pro.studio.fashionModel"),value:Vc(m),imageUrl:m?A$(m):null,placeholder:q("studio.chooseModel"),onClick:()=>$(!0)})}),o.jsx(Nt,{label:q("pro.studio.shotType"),children:o.jsx("div",{className:"grid grid-cols-3 gap-1.5",children:n.map(de=>{const me=(u==null?void 0:u.id)===de.id;return o.jsx("button",{type:"button",onClick:()=>h(de),"aria-pressed":me,className:`rounded-lg border px-2 py-2 text-[11px] font-semibold transition-colors ${me?"border-accent bg-accent-soft text-ink":"border-line bg-base text-dim hover:border-line-strong hover:text-ink"}`,children:zT(de)||de.id},de.id)})})}),o.jsx(Nt,{label:q("pro.studio.stylePreset"),children:o.jsx("div",{className:"grid grid-cols-3 gap-2",children:t.map(de=>{const me=(a==null?void 0:a.id)===de.id,we=de.image_url||de.imageUrl;return o.jsxs("button",{type:"button",onClick:()=>c(de),"aria-pressed":me,className:`group overflow-hidden rounded-lg border text-left transition-colors ${me?"border-accent":"border-line hover:border-line-strong"}`,children:[o.jsxs("span",{className:"relative block aspect-[3/4] overflow-hidden bg-base",children:[we?o.jsx("img",{src:we,alt:"",loading:"lazy",className:"h-full w-full object-cover"}):o.jsx("span",{className:"flex h-full items-center justify-center text-faint",children:o.jsx(Tv,{size:16})}),me&&o.jsx("span",{className:"absolute right-1 top-1 rounded-full bg-accent p-0.5 text-white",children:o.jsx(Cn,{size:10})})]}),o.jsx("span",{className:`block truncate px-1.5 py-1.5 text-[11px] font-semibold ${me?"bg-accent-soft text-ink":"bg-base text-dim"}`,children:zT(de)||de.id})]},de.id)})})}),o.jsx(Nt,{label:q("studio.ratio"),children:o.jsx(_l,{value:N,options:Sh,onChange:j})}),(C||I)&&o.jsx(El,{children:C??q(I)})]}),o.jsx(vl,{isOpen:Y,onClose:()=>$(!1),onSelect:de=>{p(de),$(!1)},selectedModel:m}),o.jsx(fu,{open:b.pickerOpen,onClose:b.closePicker,remaining:b.remaining,onPick:b.addLibrary}),o.jsx(Ts,{isOpen:ie,onClose:()=>W(!1),user:P}),o.jsx(dr,{isOpen:_e,onClose:()=>J(!1),user:P})]})},M$=t=>new Promise(e=>setTimeout(e,t)),P$=["9:16","1:1","16:9"],D$=t=>{if(!t)return[];const e=t.configuration.uiSections.find(s=>s.type==="prompt");return e?e.config.readyPrompts??[]:[]},O$=t=>t?t.mediaUrl??t.url??null:null,L$=()=>{var de;const t=De(),n=(de=rs().state)==null?void 0:de.sourceUrl,[s,a]=v.useState(null),[c,u]=ze("sourceFile",null),[h,m]=v.useState(n??null),[p,b]=ze("sourceRemoteUrl",n??null);lg(c,m),v.useEffect(()=>{!c&&p&&m(p)},[]);const[x,w]=ze("prompt",""),[T,N]=ze("ratio","9:16"),j=5,[A,F]=v.useState(!1),[V,L]=v.useState("idle"),[Y,$]=v.useState(null),[q,I]=v.useState(null),[S,C]=v.useState(null),R=v.useMemo(()=>{var me;return Number(s==null?void 0:s.price)||((me=cr("ai_videos"))==null?void 0:me.price)||0},[s]),D=v.useMemo(()=>D$(s),[s]);v.useEffect(()=>{const me=ia("video");me&&(b(me.url),m(me.url),me.prompt&&w(me.prompt))},[]);const z=!!(c||p),{user:P,isSubscriptionModalOpen:ie,isDiamondModalOpen:_e,setIsSubscriptionModalOpen:W,setIsDiamondModalOpen:J,ensureCanGenerate:fe}=hr();v.useEffect(()=>{let me=!0;return Rr.getStyleById("ai_videos").then(we=>{me&&a(we)}).catch(()=>{}),()=>{me=!1}},[]),v.useEffect(()=>()=>{h&&!p&&URL.revokeObjectURL(h)},[h,p]);const ce=me=>{const we=me[0];
5423we&&(h&&!p&&URL.revokeObjectURL(h),b(null),u(we),m(URL.createObjectURL(we)),$(null),L("idle"))},ae=()=>{h&&!p&&URL.revokeObjectURL(h),u(null),m(null),b(null),$(null),L("idle")},O=async me=>{for(let we=0;we<120;we+=1){await M$(5e3);const Se=await Ln.getMediaById(me);if(Se){if(Se.status==="completed"){$(Se),L("completed");return}if(Se.status==="failed"){$(Se),L("failed"),C(Se.errorMessage||null),I(Se.errorMessage?null:"video.error.failed");return}}}L("failed"),I("video.error.timeout")},B=async()=>{if(!z){I("video.error.noImage");return}if(await fe(R)){I(null),C(null),F(!0),L("processing"),$(null);try{let me;p?me=p:me=(await Ks.uploadPhoto(c,`users/${P.uid}/uploads/tools/ai_videos`)).downloadUrl;const we=await ra.run({tool:"ai_videos",imageUrls:[me]});if(!we.proceed){L("idle");return}const Se=await uo.generate({toolId:"ai_videos",prompt:x.trim()||t("video.defaultPrompt"),imageFields:{user_photo:me},duration:j,ratio:T,precheckHints:we.hints});await O(Se.mediaItemId)}catch(me){console.error("Video generation failed:",me),L("failed"),C((me==null?void 0:me.message)||null),I(me!=null&&me.message?null:"studio.error.startFailed")}finally{F(!1)}}},re=O$(Y),pe=V==="processing"?o.jsx(Tl,{label:t("video.rendering",{seconds:j})}):V==="failed"?o.jsx(Sl,{message:S??t(q||"studio.error.generic")}):re?o.jsx(jh,{url:re,mediaId:Y==null?void 0:Y.id,isVideo:!0,fileName:"fashio-video.mp4"}):h?o.jsx("img",{src:h,alt:t("video.sourcePhoto"),className:"h-full w-full object-contain opacity-60"}):o.jsx(Nh,{message:t("video.canvasEmpty"),children:o.jsx(WS,{size:26,className:"text-faint"})});return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:t("nav.video.label"),subtitle:t("video.subtitle"),status:V,canvas:pe,action:o.jsx(wl,{onClick:()=>void B(),busy:A,disabled:!z,cost:R,label:t("video.generate"),busyLabel:t("video.generating")}),children:[o.jsx(Nt,{label:t("video.sourcePhoto"),hint:t("video.clipLength",{seconds:j}),children:o.jsx(ho,{previews:h?[h]:[],onFiles:ce,onRemove:ae,max:1,hint:t("video.sourceHint")})}),o.jsx(Nt,{label:t("video.motionPrompt"),hint:t("video.motionHint"),children:o.jsx(a0,{value:x,onChange:me=>w(me.target.value),placeholder:t("video.motionPlaceholder")})}),D.length>0&&o.jsx(Nt,{label:t("video.readyMotions"),children:o.jsx("div",{className:"flex flex-wrap gap-1.5",children:D.slice(0,8).map((me,we)=>{const Se=zi(me);return o.jsxs("button",{type:"button",onClick:()=>w(Se),className:"rounded-lg border border-line bg-base px-2.5 py-1.5 text-left text-[11px] font-medium text-dim transition-colors hover:border-line-strong hover:text-ink",children:[Se.slice(0,42),Se.length>42?"…":""]},we)})})}),o.jsx(Nt,{label:t("video.ratio"),children:o.jsx(_l,{value:T,options:P$,onChange:N})}),(S||q)&&o.jsx(El,{children:S??t(q)})]}),o.jsx(Ts,{isOpen:ie,onClose:()=>W(!1),user:P}),o.jsx(dr,{isOpen:_e,onClose:()=>J(!1),user:P})]})},U$=[{id:"model_to_flat_lay",nameKey:"nav.flatLay.label",descKey:"tools.flatLay.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fmanken_to_pro.jpg?alt=media&token=a016c243-03c7-40a1-a444-012a6d8dcbec",tagKey:"tools.tag.productTool"},{id:"amateur_to_pro",nameKey:"nav.amateurToPro.label",descKey:"tools.amateurToPro.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2FpYs_32YDt2cDsffLXKNTh.jpg?alt=media&token=7c49da0e-0c7a-42bd-b327-902074dc5493",tagKey:"tools.tag.enhance"},{id:"pose_angle_switch",nameKey:"nav.poseVariation.label",descKey:"tools.poseVariation.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fangle2.jpg?alt=media&token=b3c0d7b6-6041-40cf-990b-784a6d4102e7",tagKey:"tools.tag.pose"},{id:"remove_background",nameKey:"nav.removeBackground.label",descKey:"tools.removeBackground.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fremove_bg.jpg?alt=media",tagKey:"tools.tag.imageTool"},{id:"photo_enhance",nameKey:"tools.upscaler.name",descKey:"tools.upscaler.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b",tagKey:"tools.tag.enhance"},{id:"body_editor",nameKey:"nav.bodyEditor.label",descKey:"tools.bodyEditor.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b",tagKey:"tools.tag.bodyTool",path:"/body-editor"},{id:"jewelry_on_model",nameKey:"nav.jewelry.label",descKey:"tools.jewelry.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b",tagKey:"tools.tag.jewelry",path:"/jewelry-on-model"},{id:"image_to_3d",nameKey:"nav.imageTo3d.label",descKey:"tools.imageTo3d.desc",image:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b",tagKey:"tools.tag.threeD",path:"/image-to-3d"}],F$=()=>{const t=De(),e=Xn();return o.jsxs("div",{children:[o.jsxs("div",{className:"mb-10",children:[o.jsx("h1",{className:"text-3xl font-bold tracking-tight mb-2",children:t("tools.title")}),o.jsx("p",{className:"text-dim",children:t("tools.subtitle")})]}),o.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:U$.map(n=>o.jsxs("button",{onClick:()=>e(n.path||`/tools/${n.id}`),className:"group relative h-56 sm:h-72 md:h-80 rounded-3xl overflow-hidden cursor-pointer shadow-sm hover:shadow-xl transition-all duration-300",children:[o.jsxs("div",{className:"absolute inset-0",children:[o.jsx("img",{src:n.image,alt:t(n.nameKey),className:"w-full h-full object-cover transition-transform duration-700 group-hover:scale-110"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/90 via-black/40 to-transparent"})]}),o.jsxs("div",{className:"absolute inset-0 p-6 flex flex-col justify-end",children:[o.jsx("div",{className:"mb-auto",children:o.jsx("span",{className:"inline-block px-3 py-1 bg-black/50 backdrop-blur-md rounded-full text-white text-[10px] font-bold tracking-wider mb-2 border border-white/10",children:t(n.tagKey)})}),o.jsx("h3",{className:"text-2xl font-bold text-white mb-2 group-hover:translate-x-1 transition-transform",children:t(n.nameKey)}),o.jsx("p",{className:"text-faint text-sm mb-6 line-clamp-2",children:t(n.descKey)}),o.jsxs("button",{className:"flex items-center gap-2 text-white font-medium text-sm group/btn",children:[o.jsx("span",{className:"w-8 h-8 rounded-full bg-ink text-base flex items-center justify-center transition-transform group-hover/btn:scale-110",children:o.jsx(ks,{size:14})}),t("tools.open")]})]})]},n.id))})]})},V$={shopify:"Shopify",ikas:"ikas"},z$=()=>{const t=De(),[e,n]=v.useState(null),[s,a]=v.useState(!1);if(v.useEffect(()=>{let h=!1;return ct(ut,"getMyIntegrations")().then(m=>{h||n(m.data)}).catch(()=>{h||a(!0)}),()=>{h=!0}},[]),s)return null;const c=[],u=({icon:h,title:m,detail:p,state:b})=>o.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",children:[o.jsx(h,{size:18,className:"flex-shrink-0 text-faint"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"text-sm font-medium text-ink",children:m}),o.jsx("p",{className:"truncate font-mono text-[11px] text-faint",children:p})]}),b&&o.jsx("span",{className:"flex-shrink-0 rounded-full border border-ok/25 bg-ok/10 px-2 py-0.5 text-[10px] font-bold text-ok",children:b})]});
5423return e&&(e.stores.forEach(h=>c.push(o.jsx(u,{icon:gM,title:V$[h.platform]??h.platform,detail:h.storeId,state:t("profile.integrations.connected")},`${h.platform}:${h.storeId}`))),e.ikasPrivateApp.connected&&c.push(o.jsx(u,{icon:eM,title:t("profile.integrations.ikasPrivate"),detail:e.ikasPrivateApp.storeName??"—",state:t("profile.integrations.connected")},"ikas-private")),c.push(o.jsx(u,{icon:Tp,title:t("profile.apiKeys"),detail:e.apiKeys.active>0?t("profile.integrations.apiKeysActive",{n:String(e.apiKeys.active)}):t("profile.integrations.apiKeysNone")},"api-keys"))),o.jsxs("section",{className:"mb-8",children:[o.jsxs("div",{className:"mb-3 flex items-baseline justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("h2",{className:"text-sm font-semibold text-ink",children:t("profile.integrations")}),o.jsx("p",{className:"text-xs text-dim",children:t("profile.integrations.blurb")})]}),o.jsxs("a",{href:"https://fashiolabs.com/integrations",target:"_blank",rel:"noopener noreferrer",className:"flex flex-shrink-0 items-center gap-1 rounded text-xs font-medium text-dim transition-colors hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong",children:[t("profile.integrations.browse"),o.jsx(F3,{size:13})]})]}),o.jsx("div",{className:"overflow-hidden rounded-panel border border-line bg-surface",children:e===null?o.jsx("div",{className:"divide-y divide-line","aria-hidden":"true",children:[0,1].map(h=>o.jsxs("div",{className:"flex items-center gap-3 px-5 py-4",children:[o.jsx("div",{className:"h-[18px] w-[18px] rounded bg-raised"}),o.jsxs("div",{className:"flex-1 space-y-1.5",children:[o.jsx("div",{className:"h-3 w-24 rounded bg-raised"}),o.jsx("div",{className:"h-2.5 w-40 rounded bg-raised"})]})]},h))}):c.length>0?o.jsx("div",{className:"divide-y divide-line",children:c}):o.jsx("p",{className:"px-5 py-6 text-sm text-dim",children:t("profile.integrations.none")})})]})},o0=({eyebrow:t,title:e,subtitle:n,actions:s,aside:a,children:c})=>o.jsxs("div",{className:"w-full",children:[o.jsxs("header",{className:"mb-8 flex flex-wrap items-end justify-between gap-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-mono text-[11px] uppercase tracking-[0.14em] text-accent",children:t}),o.jsx("h1",{className:"mt-1.5 text-3xl font-bold tracking-tight text-ink",children:e}),n&&o.jsx("p",{className:"mt-2 max-w-prose text-sm text-dim",children:n})]}),s&&o.jsx("div",{className:"flex flex-shrink-0 items-center gap-2",children:s})]}),a?o.jsxs("div",{className:"grid gap-8 lg:grid-cols-[minmax(0,1fr)_320px] lg:items-start",children:[o.jsx("div",{className:"min-w-0 lg:order-1",children:c}),o.jsx("aside",{className:"min-w-0 lg:order-2 lg:sticky lg:top-20",children:a})]}):c]}),B$=({user:t,onLogout:e,onTopUp:n,onUpgrade:s})=>{var $,q,I,S,C;const a=De(),c=Xn(),[u,h]=v.useState(!1),[m,p]=v.useState(""),[b,x]=v.useState(!1),w=($=t.subscription_snapshot)==null?void 0:$.source,T=!!t.is_premium||!!((q=t.subscription_snapshot)!=null&&q.isActive)||["active","will_expire","billing_issue"].includes(String(t.subscription_status||((I=t.subscription_snapshot)==null?void 0:I.status)||"")),N=T,j=w==="ios_app_store"?"App Store":w==="android_play_store"?"Google Play":w==="web_gumroad"?"Gumroad":a("profile.providerOther"),A=String(((S=t.subscription_snapshot)==null?void 0:S.planProductId)||"").toLowerCase(),F=T?A.includes("annual")||A.includes("year")?a("profile.planYearly"):A.includes("month")?a("profile.planMonthly"):a("profile.planPro"):a("profile.planFree"),V=async()=>{const R=m.trim();if(!(!R||b)){x(!0);try{await ct(ut,"submitFeatureRequest")({title:"",message:R}),h(!1),p(""),_t.showSuccess(a("profile.feedback.sent"))}catch{_t.showError(a("profile.feedback.failed"))}finally{x(!1)}}},L=({icon:R,label:D,onClick:z})=>o.jsxs("button",{onClick:z,className:"flex w-full items-center gap-3 px-5 py-3.5 text-left transition-colors hover:bg-raised focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong focus-visible:-outline-offset-2",children:[o.jsx(R,{size:16,className:"flex-shrink-0 text-faint"}),o.jsx("span",{className:"flex-1 text-sm font-medium text-ink",children:D}),o.jsx(Vd,{size:16,className:"flex-shrink-0 text-faint"})]}),Y=o.jsxs("div",{className:"rounded-panel border border-line bg-surface",children:[o.jsxs("div",{className:"flex items-center gap-4 p-5",children:[o.jsx("div",{className:"h-14 w-14 flex-shrink-0 overflow-hidden rounded-full border border-line bg-raised",children:t.avatar_url?o.jsx("img",{src:t.avatar_url,alt:"",width:56,height:56,className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full w-full items-center justify-center bg-ink text-xl font-bold text-base",children:((C=t.name)==null?void 0:C.charAt(0))||"?"})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"truncate font-bold text-ink",children:t.name}),o.jsx("p",{className:"truncate text-xs text-dim",children:t.email})]})]}),o.jsxs("div",{className:"flex items-end justify-between border-t border-line px-5 py-4",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-3xl font-bold leading-none tabular-nums text-ink",children:t.diamond_balance}),o.jsx("p",{className:"mt-1 text-[11px] text-faint",children:a("profile.creditBalance")})]}),o.jsx(rr,{className:"fill-accent text-accent",size:20})]}),o.jsxs("div",{className:"border-t border-line px-5 py-4",children:[o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("span",{className:"text-sm font-semibold text-ink",children:F}),T?o.jsx("span",{className:"rounded-full border border-ok/25 bg-ok/10 px-2 py-0.5 text-[10px] font-bold text-ok",children:a("profile.active")}):o.jsx("span",{className:"rounded-full bg-raised px-2 py-0.5 text-[10px] font-bold text-dim",children:a("profile.freePlan")})]}),o.jsx("p",{className:"mt-1.5 text-xs text-dim",children:T?`${a("profile.manageBilling")}${N&&j!==a("profile.providerOther")?` ${a("profile.providerNote",{provider:j})}`:""}`:a("profile.upgradeBlurb")}),o.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[o.jsx(An,{onClick:n,variant:"outline",size:"sm",children:a(T?"profile.buyCredits":"profile.goProToBuy")}),!N&&o.jsx(An,{onClick:s,size:"sm",children:a("profile.upgrade")})]}),N&&!T&&o.jsx("p",{className:"mt-3 text-xs text-dim",children:a("profile.existingSubscription",{provider:j})})]})]});return o.jsxs(o0,{eyebrow:a("profile.eyebrow"),title:a("profile.title"),aside:Y,children:[o.jsx(z$,{}),o.jsxs("div",{className:"mb-8 divide-y divide-line overflow-hidden rounded-panel border border-line bg-surface",children:[o.jsx(L,{icon:LS,label:a("profile.billing"),onClick:()=>c("/billing",{state:{from:"/profile"}})}),o.jsx(L,{icon:Tp,label:a("profile.apiKeys"),onClick:()=>c("/api-keys")}),o.jsx(L,{icon:hh,label:a("profile.privacy"),onClick:()=>window.open("https://fashiolabs.com/legal","_blank","noopener,noreferrer")}),o.jsx(L,{icon:x5,label:a("profile.terms"),onClick:()=>window.open("https://fashiolabs.com/legal","_blank","noopener,noreferrer")}),o.jsx(L,{icon:e5,label:a("profile.help"),onClick:()=>h(!0)})]}),o.jsxs("div",{className:"text-center",children:[o.jsxs("button",{onClick:e,className:"mx-auto flex items-center justify-center gap-2 rounded-xl px-3 py-2 font-medium text-bad transition-opacity hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong",children:[o.jsx(Tx,{size:20})," ",a("profile.signOut")]}),o.jsx("p",{className:"text-faint text-xs mt-4",children:a("profile.version",{version:"1.0.0"})})]}),u&&o.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-end sm:items-center justify-center z-50 p-4",children:o.jsxs("div",{className:"flex w-full max-w-lg flex-col rounded-panel border border-line bg-surface",style:{maxHeight:"85vh"},children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-line flex-shrink-0",children:[o.jsx("h3",{className:"text-xl font-bold text-ink",children:a("profile.feedback.title")}),o.jsx("button",{onClick:()=>{h(!1),p("")},className:"rounded-full bg-raised p-2 text-dim transition-colors hover:bg-overlay hover:text-ink",children:o.jsx(Wt,{size:18})})]}),o.jsx("div",{className:"px-6 py-4 flex-1 overflow-y-auto",children:o.jsx("textarea",{value:m,onChange:R=>p(R.target.value),disabled:b,rows:10,placeholder:a("profile.feedback.placeholder"),className:"w-full border border-line rounded-xl px-4 py-3 text-sm text-ink placeholder-faint resize-none focus:outline-none focus:border-line-strong transition-colors disabled:opacity-50"})}),o.jsx("div",{className:"px-6 pb-6 pt-2 flex-shrink-0",children:o.jsx("button",{onClick:V,disabled:b||!m.trim(),className:"flex h-12 w-full items-center justify-center gap-2 rounded-xl bg-ink font-semibold text-base transition-opacity hover:opacity-90 disabled:opacity-50",children:b?o.jsx(et,{size:18,className:"animate-spin"}):a("common.send")})})]})})]})};function BT(t){return!t||typeof t._seconds!="number"?null:new Date(t._seconds*1e3)}const tx=5,K$=()=>{const{t,locale:e}=nu(),[n,s]=v.useState([]),[a,c]=v.useState(!0),[u,h]=v.useState(!1),[m,p]=v.useState(""),[b,x]=v.useState(null),[w,T]=v.useState(null),[N,j]=v.useState(!1),[A,F]=v.useState(null),V=n.filter(S=>S.status==="active").length,L=async()=>{var S;c(!0);try{const R=await ct(ut,"listMyApiKeys")({});s(((S=R.data)==null?void 0:S.keys)||[])}catch(C){console.error("[ApiKeys] load failed",C)}finally{c(!1)}};v.useEffect(()=>{L()},[]);const Y=async()=>
5423{if(!(u||V>=tx)){h(!0);try{const C=await ct(ut,"createMyApiKey")({label:m.trim()||void 0});T(C.data.apiKey),p(""),await L()}catch(S){const C=(S==null?void 0:S.code)==="functions/resource-exhausted"?t("apiKeys.limitReached"):t("apiKeys.createFailed");_t.showError(C)}finally{h(!1)}}},$=async S=>{F(null),x(S);try{await ct(ut,"revokeMyApiKey")({keyId:S}),await L()}catch{_t.showError(t("apiKeys.revokeFailed"))}finally{x(null)}},q=async S=>{await navigator.clipboard.writeText(S),j(!0),setTimeout(()=>j(!1),2e3)},I=o.jsxs("div",{className:"rounded-panel border border-line bg-surface p-5",children:[o.jsx("h2",{className:"text-sm font-semibold text-ink",children:t("apiKeys.aside.title")}),o.jsx("p",{className:"mt-1.5 text-xs leading-relaxed text-dim",children:t("apiKeys.aside.body")}),o.jsx("a",{href:"https://fashiolabs.com/api",target:"_blank",rel:"noopener noreferrer",className:"mt-3 inline-flex items-center gap-1 rounded text-xs font-medium text-ink underline decoration-line-strong underline-offset-4 transition-colors hover:decoration-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong",children:t("apiKeys.aside.docs")})]});return o.jsxs(o0,{eyebrow:t("apiKeys.eyebrow"),title:t("apiKeys.title"),subtitle:t("apiKeys.subtitle"),aside:I,children:[o.jsxs("div",{className:"mb-6 flex flex-col gap-3 rounded-panel border border-line bg-surface p-5 sm:flex-row sm:items-center",children:[o.jsx("input",{value:m,onChange:S=>p(S.target.value),placeholder:t("apiKeys.labelPlaceholder"),disabled:u||V>=tx,className:"flex-1 rounded-xl border border-line bg-surface px-3.5 py-2 text-sm text-ink placeholder-faint transition-colors focus:border-line-strong focus:outline-none disabled:opacity-50"}),o.jsx(An,{onClick:Y,size:"sm",isLoading:u,disabled:V>=tx,children:t("apiKeys.createButton")})]}),o.jsx("div",{className:"mb-8 overflow-hidden rounded-panel border border-line bg-surface",children:a?o.jsx("div",{className:"flex items-center justify-center p-10 text-dim",children:o.jsx(et,{size:22,className:"animate-spin"})}):n.length===0?o.jsx("p",{className:"p-6 text-center text-dim",children:t("apiKeys.empty")}):n.map(S=>{const C=BT(S.createdAt),R=BT(S.lastUsedAt),D=S.status==="revoked";return o.jsxs("div",{className:"flex items-center justify-between gap-4 border-b border-line p-4 last:border-0",children:[o.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[o.jsx("div",{className:"flex-shrink-0 text-faint",children:o.jsx(Tp,{size:18})}),o.jsxs("div",{className:"min-w-0",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"font-medium text-ink truncate",children:S.label}),o.jsx("span",{className:"flex-shrink-0 rounded-full px-2 py-0.5 text-[10px] font-bold "+(D?"bg-raised text-faint":"bg-ok/10 text-ok"),children:t(D?"apiKeys.statusRevoked":"apiKeys.statusActive")})]}),o.jsxs("p",{className:"text-xs text-dim mt-0.5",children:[C?t("apiKeys.created",{date:C.toLocaleDateString(e)}):""," · ",R?t("apiKeys.lastUsed",{date:R.toLocaleDateString(e)}):t("apiKeys.neverUsed")]})]})]}),!D&&o.jsx("button",{onClick:()=>F(S),disabled:b===S.keyId,className:"flex-shrink-0 rounded-full bg-raised p-2 text-dim transition-colors hover:bg-bad/10 hover:text-bad disabled:opacity-50","aria-label":t("apiKeys.revoke"),children:b===S.keyId?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(Np,{size:16})})]},S.keyId)})}),A&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-end justify-center bg-black/60 p-4 backdrop-blur-sm sm:items-center",children:o.jsxs("div",{className:"w-full max-w-md rounded-panel border border-line bg-surface",children:[o.jsxs("div",{className:"flex items-start gap-3 px-6 pb-2 pt-6",children:[o.jsx("span",{className:"flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-full bg-bad/10 text-bad",children:o.jsx(oo,{size:18})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("h3",{className:"text-lg font-bold text-ink",children:t("apiKeys.revoke")}),o.jsx("p",{className:"mt-1 text-sm text-dim",children:t("apiKeys.revokeConfirm")}),o.jsx("p",{className:"mt-2 truncate font-mono text-xs text-faint",children:A.label})]})]}),o.jsxs("div",{className:"flex gap-3 px-6 pb-6 pt-4",children:[o.jsx(An,{variant:"secondary",fullWidth:!0,onClick:()=>F(null),children:t("common.cancel")}),o.jsx(An,{fullWidth:!0,onClick:()=>$(A.keyId),className:"bg-bad text-white hover:bg-bad/90",children:t("apiKeys.revoke")})]})]})}),w&&o.jsx("div",{className:"fixed inset-0 bg-black/60 backdrop-blur-sm flex items-end sm:items-center justify-center z-50 p-4",children:o.jsxs("div",{className:"w-full max-w-lg rounded-panel border border-line bg-surface",children:[o.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b border-line",children:[o.jsx("h3",{className:"text-xl font-bold text-ink",children:t("apiKeys.newKeyTitle")}),o.jsx("button",{onClick:()=>T(null),className:"rounded-full bg-raised p-2 text-dim transition-colors hover:bg-overlay hover:text-ink",children:o.jsx(Wt,{size:18})})]}),o.jsxs("div",{className:"px-6 py-4",children:[o.jsx("p",{className:"text-sm text-dim mb-3",children:t("apiKeys.newKeyWarning")}),o.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-line bg-raised px-4 py-3",children:[o.jsx("code",{className:"flex-1 truncate text-xs text-ink",children:w}),o.jsx("button",{onClick:()=>q(w),className:"flex-shrink-0 rounded-full bg-surface p-2 text-dim border border-line transition-colors hover:text-ink",children:N?o.jsx(Cn,{size:16,className:"text-ok"}):o.jsx(a5,{size:16})})]})]}),o.jsx("div",{className:"px-6 pb-6 pt-2",children:o.jsx(An,{onClick:()=>T(null),fullWidth:!0,children:t("apiKeys.done")})})]})})]})},$$="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fhistory_before.jpg?alt=media",q$="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fhistory_result-min.jpg?alt=media",qo=t=>t.type==="video"?!0:typeof t.generationType=="string"?t.generationType.toLowerCase().includes("video"):!1,jc=t=>t.type==="3d"||t.generationType==="imageTo3d"||t.styleId==="image_to_3d",nr=t=>t.mediaUrl??t.url,H$=t=>jc(t)?"":qo(t)&&t.thumbnailUrl?t.thumbnailUrl:nr(t),G$=t=>jc(t)?Wa("creations.tag.model3d"):qo(t)?Wa("creations.tag.video"):Wa("creations.tag.
5423image"),_d=t=>t.kind==="pack"||t.generationType==="pack"||typeof t.packTotal=="number"&&t.packTotal>0||Array.isArray(t.resultUrls)&&t.resultUrls.length>1;let nx=!1;function Y$(){return nx?Promise.resolve():new Promise(t=>{if(document.querySelector('script[src*="model-viewer"]')){nx=!0,t();return}const e=document.createElement("script");e.type="module",e.src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js",e.onload=()=>{nx=!0,t()},document.head.appendChild(e)})}const W$=()=>{const t=De(),e=Xn(),[n,s]=v.useState([]),[a,c]=v.useState(null),[u,h]=v.useState(!0),[m,p]=v.useState(!1),[b,x]=v.useState(null),[w,T]=v.useState(null),[N,j]=v.useState(!1),[A,F]=v.useState([]),[V,L]=v.useState(0),[Y,$]=v.useState(!1),q=v.useMemo(()=>n.find(ie=>ie.id===a)??null,[n,a]);v.useEffect(()=>{if(!q||!_d(q)){F([]);return}const ie=(q.resultUrls??[]).map(W=>W.url).filter(Boolean);if(ie.length){L(0),F(ie),$(!1);return}let _e=!1;return $(!0),L(0),F([]),Ln.getPackChildren(q.id).then(W=>{if(_e)return;const J=W.filter(fe=>fe.status==="completed").map(fe=>fe.mediaUrl??fe.url).filter(Boolean);F(J.length?J:[nr(q)].filter(Boolean))}).finally(()=>{_e||$(!1)}),()=>{_e=!0}},[a]);const I=async(ie=!1)=>{ie?p(!0):h(!0),x(null);try{const _e=await Ln.getUserMediaItems(50);s(_e)}catch(_e){console.error("Failed to load media items:",_e),x("creations.loadFailed")}finally{h(!1),p(!1)}};v.useEffect(()=>{I(),Y$()},[]);const S=async ie=>{const _e=t("creations.shareText"),W=nr(ie);try{if(navigator.share){await navigator.share({title:"Fashio",text:_e,url:W});return}await navigator.clipboard.writeText(`${_e}
5424${W}`)}catch(J){console.error("Share failed:",J)}},C=async ie=>{try{const W=await(await fetch(nr(ie))).blob(),J=URL.createObjectURL(W),fe=document.createElement("a");fe.href=J;const ce=jc(ie)?"glb":qo(ie)?"mp4":"jpg";fe.download=`${ie.id}.${ce}`,document.body.appendChild(fe),fe.click(),fe.remove(),URL.revokeObjectURL(J)}catch(_e){console.error("Download failed:",_e)}},R=async()=>{for(let ie=0;ie<A.length;ie++)try{const W=await(await fetch(A[ie])).blob(),J=URL.createObjectURL(W),fe=document.createElement("a");fe.href=J,fe.download=`${(q==null?void 0:q.id)??"pack"}_${ie+1}.jpg`,document.body.appendChild(fe),fe.click(),fe.remove(),URL.revokeObjectURL(J)}catch(_e){console.error("Pack download failed:",_e)}},D=async ie=>{T(ie.id)},z=async()=>{if(w){j(!0);try{if(!await Ln.deleteMediaItem(w))return;s(_e=>_e.filter(W=>W.id!==w)),c(null)}catch(ie){console.error("Delete failed:",ie)}finally{j(!1),T(null)}}},P=()=>o.jsx("div",{className:"min-h-[70vh] flex items-center justify-center",children:o.jsxs("div",{className:"max-w-2xl mx-auto text-center",children:[o.jsx("h2",{className:"text-3xl font-bold text-ink",children:t("creations.emptyTitle")}),o.jsx("p",{className:"text-dim mt-3",children:t("creations.emptyBody")}),o.jsxs("div",{className:"grid grid-cols-2 gap-3 mt-8",children:[o.jsxs("div",{className:"rounded-xl overflow-hidden relative",children:[o.jsx("img",{src:$$,alt:t("creations.before"),className:"w-full aspect-[3/4] object-cover"}),o.jsx("span",{className:"absolute top-2 left-2 text-[10px] font-semibold bg-black/70 text-white px-2 py-1 rounded",children:t("creations.beforeCaps")})]}),o.jsxs("div",{className:"rounded-xl overflow-hidden relative",children:[o.jsx("img",{src:q$,alt:t("creations.after"),className:"w-full aspect-[3/4] object-cover"}),o.jsx("span",{className:"absolute top-2 left-2 text-[10px] font-semibold bg-black/70 text-white px-2 py-1 rounded",children:t("creations.afterCaps")})]})]}),o.jsxs("button",{onClick:()=>e("/try-on"),className:"mt-8 inline-flex items-center gap-2 bg-ink text-base px-6 py-3 rounded-xl font-semibold hover:opacity-90",children:[o.jsx(ir,{size:16}),t("creations.create")]})]})});return o.jsxs("div",{children:[o.jsxs("div",{className:"mb-6 flex items-center justify-between gap-3",children:[o.jsx("h1",{className:"text-2xl font-bold text-ink",children:t("creations.title")}),o.jsxs("button",{onClick:()=>void I(!0),disabled:m||u,className:"inline-flex items-center gap-2 px-3 py-2 rounded-lg border border-line text-sm text-dim hover:bg-raised disabled:opacity-50",children:[o.jsx(qS,{size:14,className:m?"animate-spin":""}),t("common.refresh")]})]}),u?o.jsx("div",{className:"min-h-[50vh] grid place-items-center",children:o.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-ink/20 border-t-black animate-spin"})}):b?o.jsx("div",{className:"min-h-[50vh] grid place-items-center text-center",children:o.jsxs("div",{children:[o.jsx("p",{className:"text-red-600 font-medium",children:t(b)}),o.jsx("button",{onClick:()=>void I(!0),className:"mt-3 px-4 py-2 rounded-lg bg-ink text-base text-sm",children:t("common.tryAgain")})]})}):n.length===0?P():o.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3 md:gap-4",children:n.map(ie=>{var _e;return o.jsxs("button",{onClick:()=>c(ie.id),className:"relative rounded-2xl overflow-hidden bg-raised group text-left",children:[jc(ie)?o.jsx("div",{className:"w-full aspect-[3/4] bg-gradient-to-br from-gray-800 to-gray-900 flex items-center justify-center",children:o.jsx(Ev,{size:36,className:"text-white/40"})}):qo(ie)&&!ie.thumbnailUrl?o.jsx("video",{src:nr(ie),preload:"metadata",muted:!0,playsInl
5424ine:!0,className:"w-full aspect-[3/4] object-cover object-top"}):o.jsx("img",{src:H$(ie),alt:ie.prompt||ie.id,className:"w-full aspect-[3/4] object-cover object-top transition-transform duration-500 group-hover:scale-105"}),qo(ie)&&o.jsx("div",{className:"absolute inset-0 bg-black/15 flex items-center justify-center",children:o.jsx(XE,{className:"text-white",size:32})}),o.jsx("span",{className:"absolute left-2 bottom-2 bg-black/70 text-white text-[10px] font-semibold px-2 py-1 rounded",children:G$(ie)}),_d(ie)&&o.jsxs("span",{className:"absolute left-2 top-2 inline-flex items-center gap-1 bg-surface text-ink text-[10px] font-bold px-2 py-1 rounded-md shadow-sm",children:[o.jsx(Sv,{size:11}),t("creations.tag.pack"),ie.packTotal?` · ${ie.packTotal}`:(_e=ie.resultUrls)!=null&&_e.length?` · ${ie.resultUrls.length}`:""]})]},ie.id)})}),q&&o.jsxs("div",{className:"fixed inset-0 z-50 bg-black",children:[o.jsxs("div",{className:"absolute top-5 left-4 right-4 flex items-center justify-between z-10",children:[o.jsx("button",{onClick:()=>c(null),className:"p-2 rounded-full bg-black/40 text-white hover:bg-black/60",children:o.jsx(di,{size:20})}),o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:()=>void S(q),className:"p-2 rounded-full bg-black/40 text-white hover:bg-black/60",children:o.jsx(lM,{size:18})}),o.jsx("button",{onClick:()=>void(_d(q)?R():C(q)),className:"p-2 rounded-full bg-black/40 text-white hover:bg-black/60",children:o.jsx(aa,{size:18})}),o.jsx("button",{onClick:()=>void D(q),className:"p-2 rounded-full bg-black/40 text-white hover:bg-black/60",children:o.jsx(Np,{size:18})})]})]}),o.jsx("div",{className:"h-full w-full flex items-center justify-center p-6",children:jc(q)?o.jsx("model-viewer",{src:nr(q),alt:t("creations.tag.model3d"),"auto-rotate":!0,"camera-controls":!0,"shadow-intensity":"1",style:{width:"100%",height:"100%",backgroundColor:"transparent"}}):qo(q)?o.jsx("video",{src:nr(q),controls:!0,autoPlay:!0,loop:!0,className:"max-h-full max-w-full"}):_d(q)?o.jsx("div",{className:"h-full w-full flex flex-col items-center justify-center gap-4",children:Y?o.jsx("div",{className:"h-7 w-7 rounded-full border-2 border-white/30 border-t-white animate-spin"}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"flex-1 min-h-0 w-full flex items-center justify-center",children:o.jsx("img",{src:A[V],alt:q.prompt||q.id,className:"max-h-full max-w-full object-contain"})}),A.length>1&&o.jsx("div",{className:"flex gap-2 overflow-x-auto max-w-full pb-1 scrollbar-hide",children:A.map((ie,_e)=>o.jsx("button",{onClick:()=>L(_e),className:`relative h-16 w-16 flex-shrink-0 overflow-hidden rounded-lg border-2 transition-all ${_e===V?"border-white scale-105":"border-transparent opacity-60 hover:opacity-100"}`,children:o.jsx("img",{src:ie,alt:"",className:"h-full w-full object-cover"})},`${ie}-${_e}`))})]})}):o.jsx("img",{src:nr(q),alt:q.prompt||q.id,className:"max-h-full max-w-full object-contain"})}),!qo(q)&&!jc(q)&&!_d(q)&&o.jsx("div",{className:"absolute bottom-0 inset-x-0 p-4 bg-gradient-to-t from-black via-black/80 to-transparent",children:o.jsxs("div",{className:"max-w-md mx-auto",children:[o.jsx("p",{className:"text-white text-sm font-medium mb-3",children:t("creations.transform")}),o.jsxs("div",{className:"grid grid-cols-4 gap-2",children:[o.jsxs("button",{onClick:()=>e("/video",{state:{sourceUrl:nr(q)}}),className:"h-16 rounded-xl bg-raised text-ink flex flex-col items-center justify-center gap-1",children:[o.jsx(XE,{size:16}),o.jsx("span",{className:"text-[10px]",children:t("creations.animate")})]}),o.jsxs("button",{onClick:()=>e("/tools/photo_enhance",{state:{sourceUrl:nr(q)}}),className:"h-16 rounded-xl bg-raised text-ink flex flex-col items-center justify-center gap-1",children:[o.jsx(us,{size:16}),o.jsx("span",{className:"text-[10px]",children:"HD"})]}),o.jsxs("button",{onClick:()=>e("/tools/amateur_to_pro",{state:{sourceUrl:nr(q)}}),className:"h-16 rounded-xl bg-raised text-ink flex flex-col items-center justify-center gap-1",children:[o.jsx(ir,{size:16}),o.jsx("span",{className:"text-[10px]",children:t("creations.retouch")})]}),o.jsxs("button",{onClick:()=>e("/tools/remove_background",{state:{sourceUrl:nr(q)}}),className:"h-16 rounded-xl bg-raised text-ink flex flex-col items-center justify-center gap-1",children:[o.jsx(US,{size:16}),o.jsx("span",{className:"text-[10px]",children:t("creations.removeBg")})]})]})]})})]}),w&&o.jsx("div",{className:"fixed inset-0 z-[60] bg-black/60 flex items-center justify-center p-4",children:o.jsxs("div",{className:"bg-surface rounded-2xl shadow-2xl w-full max-w-sm p-6",children:[o.jsx("h3",{className:"text-lg font-bold text-ink mb-2",children:t("creations.deleteTitle")}),o.jsx("p",{className:"text-sm text-dim mb-6",children:t("creations.deleteBody")}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx("button",{onClick:()=>T(null),className:"flex-1 py-2.5 rounded-xl border border-line text-sm font-medium text-dim hover:bg-raised transition-colors",children:t("common.cancel")}),o.jsxs("button",{onClick:()=>void z(),disabled:N,className:"flex-1 py-2.5 rounded-xl bg-red-500 hover:bg-red-600 disabled:opacity-60 text-white text-sm font-semibold transition-colors inline-flex items-center justify-center gap-2",children:[N&&o.jsxs("svg",{className:"animate-spin w-4 h-4",viewBox:"0 0 24 24",fill:"none",children:[o.jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),o.jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v8z"})]}),t(N?"common.deleting":"common.delete")]})]})]})})]})},X$=()=>{const t=De(),[e,n]=v.useState([]),[s,a]=v.useState(!0),[c,u]=v.useState(!1),[h,m]=v.useState(!1),[p,b]=v.useState(null),x=v.useRef(null);v.useEffect(()=>{var j;const N=(j=xt.currentUser)==null?void 0:j.uid;if(!N){a(!1);return}return qi.watch(N,A=>{n(A),a(!1)},()=>a(!1))},[]);const w=async N=>{var F;const j=(F=xt.currentUser)==null?void 0:F.uid,A=N.filter(V=>
5424V.type.startsWith("image/"));if(!(!j||A.length===0)){u(!0);try{await qi.addFiles(j,A)}catch(V){console.error("[uploads] add failed",V)}finally{u(!1)}}},T=async N=>{var A;const j=(A=xt.currentUser)==null?void 0:A.uid;b(null),j&&await qi.remove(j,N)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("div",{onDragOver:N=>{N.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:N=>{N.preventDefault(),m(!1),w(Array.from(N.dataTransfer.files))},className:`flex flex-col items-center justify-center gap-2 rounded-panel border border-dashed p-8 text-center transition-colors ${h?"border-accent bg-accent-soft":"border-line bg-surface"}`,children:[o.jsx("input",{ref:x,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:N=>{w(Array.from(N.target.files??[])),N.target.value=""}}),c?o.jsx(et,{size:20,className:"animate-spin text-faint"}):o.jsx(fl,{size:20,className:"text-faint"}),o.jsx("button",{type:"button",onClick:()=>{var N;return(N=x.current)==null?void 0:N.click()},disabled:c,className:"text-sm font-bold text-ink underline decoration-line-strong underline-offset-4 hover:decoration-ink disabled:opacity-50",children:t(c?"common.uploading":"studio.uploadPhotos")}),o.jsx("p",{className:"text-xs text-faint",children:t("studio.orDropPhotos")})]}),s?o.jsx("div",{className:"flex justify-center py-20 text-faint",children:o.jsx(et,{size:20,className:"animate-spin"})}):e.length===0?o.jsxs("div",{className:"rounded-panel border border-dashed border-line bg-surface px-6 py-16 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Jo,{size:22,className:"text-accent"})}),o.jsx("h2",{className:"text-[15px] font-bold text-ink",children:t("uploads.empty")}),o.jsx("p",{className:"mx-auto mt-2 max-w-sm text-sm leading-relaxed text-dim",children:t("uploads.emptyBody")})]}):o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5",children:e.map(N=>o.jsxs("div",{className:"group relative aspect-square overflow-hidden rounded-panel border border-line bg-surface",children:[o.jsx("img",{src:N.url,alt:"",className:"h-full w-full object-cover"}),o.jsx("button",{onClick:()=>b(N),"aria-label":t("common.delete"),className:"absolute right-2 top-2 rounded-lg bg-black/60 p-1.5 text-white opacity-0 backdrop-blur transition-opacity hover:bg-black/80 group-hover:opacity-100",children:o.jsx(Np,{size:12})})]},N.id))}),p&&o.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:()=>b(null),children:o.jsxs("div",{className:"w-full max-w-sm rounded-panel border border-line bg-surface p-6 shadow-lift",onClick:N=>N.stopPropagation(),children:[o.jsx("h3",{className:"text-[15px] font-bold text-ink",children:t("uploads.deleteTitle")}),o.jsx("p",{className:"mt-2 text-sm leading-relaxed text-dim",children:t("uploads.deleteBody")}),o.jsxs("div",{className:"mt-5 flex gap-2",children:[o.jsx("button",{onClick:()=>b(null),className:"flex-1 rounded-xl border border-line py-2.5 text-sm font-bold text-dim transition-colors hover:bg-overlay hover:text-ink",children:t("common.keep")}),o.jsx("button",{onClick:()=>void T(p),className:"flex-1 rounded-xl bg-bad py-2.5 text-sm font-bold text-white transition-opacity hover:opacity-90",children:t("common.delete")})]})]})})]})},Q$=({product:t,onClose:e,onSaved:n})=>{var fe;const s=((fe=xt.currentUser)==null?void 0:fe.uid)??"",a=v.useMemo(()=>(t==null?void 0:t.id)??(s?un.newId(s):""),[t,s]),c=De(),[u,h]=v.useState(t?t.imageUrls.map((ce,ae)=>({url:ce,path:t.imagePaths[ae]??""})):[]),[m,p]=v.useState([]),[b,x]=v.useState([]),[w,T]=v.useState([]),[N,j]=v.useState([]),[A,F]=v.useState((t==null?void 0:t.name)??""),[V,L]=v.useState((t==null?void 0:t.coverIndex)??0),[Y,$]=v.useState("editing"),[q,I]=v.useState(zc),[S,
5424C]=v.useState(null);v.useEffect(()=>()=>N.forEach(ce=>URL.revokeObjectURL(ce)),[N]);const R=u.length+w.length,D=Y==="uploading"||Y==="checking"||Y==="saving",z=ce=>{const ae=Wo-R,O=ce.slice(0,Math.max(0,ae));O.length&&(T(B=>[...B,...O]),j(B=>[...B,...O.map(re=>URL.createObjectURL(re))]),I(zc),$("editing"))},P=ce=>{if(ce<u.length){const ae=u[ce];h(O=>O.filter((B,re)=>re!==ce)),ae.path&&x(O=>[...O,ae.path])}else{const ae=ce-u.length;URL.revokeObjectURL(N[ae]),T(O=>O.filter((B,re)=>re!==ae)),j(O=>O.filter((B,re)=>re!==ae))}L(ae=>ae===ce?0:ae>ce?ae-1:ae),I(zc),$("editing")},ie=[...u.map(ce=>ce.url),...N],_e=async()=>{if(!s||R===0)return;C(null);let ce=u;if(w.length>0){$("uploading");try{const O=await un.uploadPhotos(s,a,w);ce=[...u,...O],h(ce),p(B=>[...B,...O.map(re=>re.path)]),N.forEach(B=>URL.revokeObjectURL(B)),T([]),j([])}catch(O){console.error(O),C("products.error.upload"),$("editing");return}}$("checking");const ae=await un.precheck({imageUrls:ce.map(O=>O.url),name:A});if(I(ae),!MK(ae)){await W(ce,ae.suggestedName);return}$("review")},W=async(ce,ae)=>{if(!s)return;const O=A.trim()||(ae==null?void 0:ae.trim())||Wa("products.untitled");$("saving");try{const B=t?await un.commitUpdate(s,t,O,ce,b,V):await un.commitNew(s,a,O,ce,V);n(B)}catch(B){console.error(B),C("products.error.save"),$("review")}},J=()=>{e(),m.length&&un.discardUploads(m)};return o.jsx("div",{className:"fixed inset-0 z-[70] flex items-end justify-center bg-black/70 p-0 backdrop-blur-sm sm:items-center sm:p-4",onClick:()=>!D&&J(),children:o.jsxs("div",{className:"max-h-[92vh] w-full max-w-lg overflow-y-auto rounded-t-panel border border-line bg-surface shadow-lift sm:rounded-panel",onClick:ce=>ce.stopPropagation(),children:[o.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-4",children:[o.jsx("h3",{className:"text-[15px] font-bold text-ink",children:c(t?"products.edit":"products.new")}),o.jsx("button",{onClick:()=>J(),disabled:D,className:"rounded-lg p-1.5 text-faint transition-colors hover:bg-overlay hover:text-ink disabled:opacity-40",children:o.jsx(Wt,{size:16})})]}),o.jsxs("div",{className:"space-y-5 p-5",children:[o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("label",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:c("products.name")}),o.jsx("input",{value:A,onChange:ce=>F(ce.target.value),placeholder:c("products.namePlaceholder"),disabled:D,className:"w-full rounded-xl border border-line bg-base px-3 py-2.5 text-sm text-ink outline-none transition-colors placeholder:text-faint focus:border-line-strong disabled:opacity-50"})]}),o.jsxs("div",{className:"space-y-1.5",children:[o.jsxs("div",{className:"flex items-baseline justify-between",children:[o.jsx("label",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:c("products.photos")}),o.jsxs("span",{className:"font-mono text-[10px] text-faint",children:[R,"/",Wo]})]}),o.jsx(ho,{previews:ie,onFiles:z,onRemove:D?void 0:P,max:Wo,hint:c("products.photosHint")}),ie.length>1&&o.jsx("div",{className:"flex flex-wrap gap-1.5 pt-1",children:ie.map((ce,ae)=>o.jsxs("button",{type:"button",onClick:()=>L(ae),className:`inline-flex items-center gap-1 rounded-md border px-2 py-1 font-mono text-[10px] uppercase tracking-[0.06em] transition-colors ${V===ae?"border-accent bg-accent-soft text-accent":"border-line text-faint hover:text-ink"}`,children:[o.jsx(mM,{size:9,className:V===ae?"fill-accent":""}),ae+1]},ae))})]}),Y==="review"&&o.jsxs("div",{className:"space-y-3 rounded-panel border border-line bg-base p-4",children:[q.sameProduct===!1&&o.jsxs("div",{className:"flex gap-2.5",children:[o.jsx(oo,{size:15,className:"mt-0.5 shrink-0 text-warn"}),o.jsx("p",{className:"text-sm leading-relaxed text-ink",children:c("products.mixedWarning")})]}),q.advice&&o.jsxs("div",{className:"flex gap-2.5",children:[o.jsx(Nv,{size:15,className:"mt-0.5 shrink-0 text-accent"}),o.jsx("p",{className:"text-sm leading-relaxed text-dim",children:q.advice})]}),q.suggestions.length>0&&o.jsxs("div",{className:"space-y-1.5",children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:c("products.addForBetter")}),o.jsx("ul",{className:"space-y-1.5",children:q.suggestions.map(ce=>o.jsxs("li",{className:"flex gap-2 text-sm leading-relaxed text-dim",children:[o.jsx(Kc,{size:13,className:"mt-0.5 shrink-0 text-accent"}),ce]},ce))})]})]}),S&&o.jsx("p",{className:"rounded-lg border border-bad/25 bg-bad/10 px-3 py-2 text-xs text-bad",children:c(S)})]}),o.jsx("div",{className:"flex gap-2 border-t border-line px-5 py-4",children:Y==="review"?o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>$("editing"),className:"flex-1 rounded-xl border border-line py-2.5 text-sm font-bold text-dim transition-colors hover:bg-overlay hover:text-ink",children:c("products.addPhotos")}),o.jsx("button",{onClick:()=>void W(u,q.suggestedName),className:"flex-1 rounded-xl bg-ink py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:c("products.saveAnyway")})]}):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>J(),disabled:D,className:"flex-1 rounded-xl border border-line py-2.5 text-sm font-bold text-dim transition-colors hover:bg-overlay hover:text-ink disabled:opacity-40",children:c("common.cancel")}),o.jsxs("button",{onClick:()=>void _e(),disabled:D||R===0,className:"flex-1 rounded-xl bg-ink py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90 disabled:opacity-40",children:[Y==="uploading"&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(et,{size:13,className:"animate-spin"})," ",c("common.uploading")]}),Y==="checking"&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(us,{size:13,className:"animate-pulse"})," ",c("products.checking")]}),Y==="saving"&&o.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[o.jsx(et,{size:13,className:"animate-spin"})," ",c("common.saving")]}),Y==="editing"&&c("products.save")]})]})})]})})},J$=({product:t,onEdit:e,onDelete:n})=>{const s=De(),a=tR(t);return o.jsxs("div",{className:"group overflow-hidden rounded-panel border border-line bg-surface transition-colors hover:border-line-strong",children:[o.jsxs("div",{className:"relative aspect-square overflow-hidden bg-base",children:[a?o.jsx("img",{src:a,alt:"",className:"h-full w-full object-cover"}):o.jsx("div",{className:"flex h-full items-center justify-center text-faint",children:o.jsx(Tv,{size:22})}),o.jsxs("div",{className:"absolute right-2 top-2 flex gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[o.jsx("button",{onClick:e,"aria-label":s("products.edit"),className:"rounded-lg bg-black/60 p-1.5 text-white backdrop-blur transition-colors hover:bg-black/80",children:o.jsx(G5,{size:12})}),o.jsx("button",{onClick:n,"aria-label":s("products.delete"),className:"rounded-lg bg-black/60 p-1.5 text-white backdrop-blur transition-colors hover:bg-black/80",children:o.jsx(Np,{size:12})})]}),o.jsxs("span",{className:"absolute bottom-2 left-2 rounded-md bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.06em] text-white backdrop-blur",children:[t.imageUrls.length," photo",t.imageUrls.length===1?"":"s"]})]}),o.jsx("div",{className:"p-3",children:o.jsx("p",{className:"truncate text-sm font-semibold text-ink",children:t.name||s("products.untitled")})})]})},Z$=()=>{const t=De(),[e]=k3(),[n,s]=v.useState(e.get("tab")==="uploads"?"uploads":"products"),[a,c]=v.useState([]),[u,h]=v.useState(!0),[m,p]=v.useState(null),[b,x]=v.useState(!1),[w,T]=v.useState(null);v.useEffect(()=>{e.get("tab")==="uploads"&&s("uploads")},[e]),v.useEffect(()=>{var F;const A=(F=xt.currentUser)==null?void 0:F.uid;if(!A){h(!1);return}return un.watch(A,V=>{c(V),h(!1)},()=>h(!1))},[]);const N=()=>{p(null),x(!0)},j=async A=>{var V;const F=(V=xt.currentUser)==null?void 0:V.uid;T(null),F&&await un.remove(F,A)};return o.jsxs("div",{className:"space-y-6",children:[o.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-faint",children:t("products.library")}),o.jsx("h1",{className:"mt-1 text-2xl font-bold tracking-tight text-ink",children:t(n==="products"?"nav.products.label":"nav.uploads.label")}),o.jsx("p",{className:"mt-1.5 max-w-lg text-sm text-dim",children:t(n==="products"?"products.subtitle":"uploads.subtitle")})]}),n==="products"&&o.jsxs("button",{onClick:N,className:"inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(Kc,{size:14})," New product"]})]}),o.jsx("div",{className:"grid w-full max-w-sm grid-cols-2 gap-1 rounded-2xl border border-line bg-raised p-1",children:[{id:"products",labelKey:"nav.products.label",Icon:Tr},{id:"uploads",labelKey:"nav.uploads.label",Icon:Jo}].map(({id:A,labelKey:F,Icon:V})=>{const L=n===A;return o.jsxs("button",{type:"button",onClick:()=>s(A),"aria-pressed":L,className:`flex items-center justify-center gap-2 rounded-xl py-2 text-sm font-semibold transition-colors ${L?"bg-ink text-base":"text-dim hover:bg-overlay hover:text-ink"}`,children:[o.jsx(V,{size:14}),t(F)]},A)})}),n==="uploads"?o.jsx(X$,{}):u?o.jsx("div",{className:"flex justify-center py-20 text-faint",children:o.jsx(et,{size:20,className:"animate-spin"})}):a.length===0?o.jsxs("div",{className:"rounded-panel border border-dashed border-line bg-surface px-6 py-16 text-center",children:[o.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Tr,{size:22,className:"text-accent"})}),o.jsx("h2",{className:"text-[15px] font-bold text-ink",children:t("products.empty")}),o.jsx("p",{className:"mx-auto mt-2 max-w-sm text-sm leading-relaxed text-dim",children:t("products.emptyBody")}),o.jsxs("button",{onClick:N,className:"mt-5 inline-flex items-center gap-1.5 rounded-xl bg-ink px-4 py-2.5 text-sm font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(Kc,{size:14})," New product"]})]}):o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5",children:a.map(A=>o.jsx(J$,{product:A,onEdit:()=>{p(A),x(!0)},onDelete:()=>T(A)},A.id))}),b&&o.jsx(Q$,{product:m,onClose:()=>x(!1),onSaved:()=>x(!1)}),w&&o.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:()=>T(null),children:o.jsxs("div",{className:"w-full max-w-sm rounded-panel border border-line bg-surface p-6 shadow-lift",onClick:A=>A.stopPropagation(),children:[o.jsx("h3",{className:"text-[15px] font-bold text-ink",children:t("products.deleteTitle",{name:w.name||t("products.untitled")})}),o.jsx("p",{className:"mt-2 text-sm leading-relaxed text-dim",children:t("products.deleteBody")}),o.jsxs("div",{className:"mt-5 flex gap-2",children:[o.jsx("button",{onClick:()=>T(null),className:"flex-1 rounded-xl border border-line py-2.5 text-sm font-bold text-dim transition-colors hover:bg-overlay hover:text-ink",children:t("common.keep")}),o.jsx("button",{onClick:()=>void j(w),className:"flex-1 rounded-xl bg-bad py-2.5 text-sm font-bold text-white transition-opacity hover:opacity-90",children:t("common.delete")})]})]})})]})},eq=({user:t,onUpgrade:e,onTopUp:n})=>{var $e,Ue,Qe,Ke,Ne,H,oe;const{t:s,locale:a}=nu(),c=Xn(),u=rs(),[h,m]=v.useState(!1),[p,b]=v.useState(!1),[x,w]=v.useState(null),[T,N]=v.useState(!1),[j,A]=v.useState(!1),[F,V]=v.useState(()=>$t.getCachedBillingCatalog("membership")),[L,Y]=v.useState("month"),[$,q]=v.useState(null),I=(($e=t.subscription_snapshot)==null?void 0:$e.source)||null,S=((Ue=t.subscription_snapshot)==null?void 0:Ue.provider)||null,C=String(t.subscription_status||((Qe=t.subscription_snapshot)==null?void 0:Qe.status)||""),R=!!t.is_premium||!!((Ke
5424=t.subscription_snapshot)!=null&&Ke.isActive)||["active","will_expire","billing_issue"].includes(C),D=R,z=String(((Ne=t.subscription_snapshot)==null?void 0:Ne.planProductId)||"").trim(),P=(oe=(H=t.subscription_snapshot)==null?void 0:H.currentPeriodEndAt)!=null&&oe.seconds?new Date(t.subscription_snapshot.currentPeriodEndAt.seconds*1e3):null,ie=s(C==="will_expire"?"billing.status.willExpire":C==="billing_issue"?"billing.status.paymentIssue":C==="expired"?"billing.status.expired":C==="refunded"?"billing.status.refunded":R?"billing.status.active":"billing.status.free"),_e=P?s("billing.cancelsOn",{date:P.toLocaleDateString(a)}):s("billing.status.willExpire"),W=z.includes("annual")||z.includes("year")?s("billing.plan.yearly"):z.includes("month")?s("billing.plan.monthly"):s(R?"billing.plan.pro":"billing.plan.free"),J=z?z.includes("annual")||z.includes("year")?s("billing.product.yearly"):z.includes("month")?s("billing.product.monthly"):s("billing.product.pro"):null;v.useEffect(()=>{let se=!0;return N(!0),Promise.all([$t.getPurchaseEligibility(),$t.getBillingCatalog("membership")]).then(([Ee,Me])=>{se&&(w(Ee),V(Me))}).finally(()=>{se&&N(!1)}),()=>{se=!1}},[]);const fe=v.useMemo(()=>{const se={};for(const Ee of(F==null?void 0:F.membership)||[])se[Ee.id]=Ee;return se},[F]),ce=v.useMemo(()=>{const se=Os.map(Ee=>{var Me;return((Me=fe[Ee.planIds.year])==null?void 0:Me.trialDays)??0});return se.length>0&&se.every(Ee=>Ee>0)?Math.min(...se):0},[fe]),ae=v.useMemo(()=>{var Ee,Me,ot;const se=Os.find(sn=>sn.recommended)??Os[0];return se?((ot=xp(((Ee=fe[se.planIds.month])==null?void 0:Ee.basePriceDisplay)||null,((Me=fe[se.planIds.year])==null?void 0:Me.basePriceDisplay)||null))==null?void 0:ot.savings)??null:null},[fe]),O=v.useMemo(()=>Os.map(se=>{const Ee=fe[se.planIds.month]||null,Me=fe[se.planIds.year]||null,ot=L==="year"?Me:Ee;return{tier:se,plan:ot,planId:se.planIds[L],perCredit:iR((ot==null?void 0:ot.basePriceDisplay)||null,typeof(ot==null?void 0:ot.credits)=="number"?ot.credits:null,L==="year"?12:1),savings:L==="year"?xp((Ee==null?void 0:Ee.basePriceDisplay)||null,(Me==null?void 0:Me.basePriceDisplay)||null):null}}).filter(se=>se.plan),[L,fe]),B=()=>{m(!0),b(!1)},re=async se=>{q(se);const Ee=fe[se]||null,Me=(Ee==null?void 0:Ee.canonicalProductId)||se,ot=(Ee==null?void 0:Ee.title)||se,sn=(Ee==null?void 0:Ee.basePriceDisplay)||null,pn=sn?parseFloat(sn.replace(/[^0-9.]/g,"")):0;ns.addToCart({content_id:Me,content_name:ot,content_category:"membership",value:isNaN(pn)?0:pn});try{const wt=await $t.createMembershipCheckoutIntent({plan:se,email:t.email});if(!wt){_t.showError(s("billing.checkoutFailed"));return}if(wt.canStartCheckout===!1){w(wt),_t.showError(wt.reason==="pending_web_membership_checkout"?s("billing.pendingCheckout"):s("billing.alreadySubscribed",{provider:wt.manageAt||s("billing.providerOther")}));return}$t.openPopup(wt.checkoutUrl)||window.open(wt.checkoutUrl,"_blank","noopener,noreferrer"),Jc({provider:wt.provider,content_id:Me,content_name:ot,content_category:"membership",value:isNaN(pn)?0:pn}),ns.initiateCheckout({content_id:Me,content_name:ot,content_category:"membership",value:isNaN(pn)?0:pn}),_t.showSuccess(s("pro.checkoutOpened",{provider:wt.provider==="creem"?"Creem":"Gumroad"}))}finally{q(null)}},pe=async se=>{const Ee=await $t.createCreditsCheckoutIntent({amount:se,email:t.email});if(!Ee||Ee.canStartCheckout===!1){_t.showError(s("billing.creditsCheckoutFailed"));return}$t.openPopup(Ee.checkoutUrl,`${Ee.provider||"billing"}_credits_${se}`)||window.open(Ee.checkoutUrl,"_blank","noopener,noreferrer"),Jc({provider:Ee.provider,content_id:`credits_${se}`,content_name:`${se} credits`,content_category:"credits",value:0}),ns.initiateCheckout({content_id:`credits_${se}`,content_name:`${se} credits`,content_category:"credits",value:0,num_items:se})},de=(x==null?void 0:x.manageAt)||(I==="ios_app_store"?"App Store":I==="android_play_store"?"Google Play":I==="web_gumroad"?"Gumroad":s("billing.providerOther")),me=s(I==="web_gumroad"||S==="gumroad"?"billing.manage.gumroad":I==="web_creem"||S==="creem"?j?"billing.manage.openingPortal":"billing.manage.creem":I==="ios_app_store"?"billing.manage.a
5424ppStore":I==="android_play_store"?"billing.manage.googlePlay":"billing.manage.generic"),we=s(I==="ios_app_store"?"billing.cancel.appStore":I==="android_play_store"?"billing.cancel.googlePlay":I==="web_gumroad"||S==="gumroad"?"billing.cancel.gumroad":(I==="web_creem"||S==="creem")&&j?"billing.cancel.openingFlow":"billing.cancel.generic"),Se=()=>{if(I==="ios_app_store"){_t.showSuccess(s("billing.manageInAppStore"));return}if(I==="android_play_store"){_t.showSuccess(s("billing.manageInGooglePlay"));return}if(I==="web_gumroad"||S==="gumroad"){window.open("https://gumroad.com/help/article/192-how-do-i-cancel-my-membership.html","_blank","noopener,noreferrer");return}if(I==="web_creem"||S==="creem"){A(!0),$t.createBillingManagementPortalLink().then(se=>{if(!se||!se.canManage||!se.portalUrl){_t.showError(s("billing.portalFailed"));return}$t.openPopup(se.portalUrl,"billing_portal")||window.open(se.portalUrl,"_blank","noopener,noreferrer")}).catch(se=>{console.error(se),_t.showError(s("billing.portalFailed"))}).finally(()=>A(!1));return}b(!0)},Re=()=>{var Ee;if(((Ee=u.state)==null?void 0:Ee.from)==="/profile"){c("/profile");return}c("/profile")},Ce=o.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-4 rounded-panel border border-line bg-surface px-5 py-4",children:[o.jsxs("div",{className:"min-w-0",children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.14em] text-faint",children:s("billing.account")}
5424),o.jsx("p",{className:"mt-1 truncate text-sm font-semibold text-ink",children:t.name}),o.jsx("p",{className:"truncate text-xs text-dim",children:t.email})]}),o.jsxs("div",{className:"flex items-center gap-4",children:[o.jsxs("div",{className:"text-right",children:[o.jsx("div",{className:"text-2xl font-bold leading-none tabular-nums text-ink",children:t.diamond_balance}),o.jsx("p",{className:"mt-1 text-[11px] text-faint",children:s("profile.creditBalance")})]}),o.jsx(An,{onClick:n,variant:"outline",size:"sm",children:s("profile.buyCredits")})]})]});return o.jsxs(o0,{eyebrow:s("profile.eyebrow"),title:s("billing.title"),subtitle:s("billing.subtitle"),actions:o.jsx("button",{onClick:Re,className:"rounded-xl px-2 py-1 text-sm text-dim transition-colors hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-line-strong",children:s("billing.back")}),children:[R&&Ce,o.jsxs("section",{className:"bg-surface rounded-panel p-6 border border-line shadow-sm mb-8",children:[R&&o.jsxs("div",{className:"flex flex-col md:flex-row justify-between md:items-center gap-4 mb-6",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-3 mb-1",children:[o.jsx("h2",{className:"text-xl font-bold text-ink",children:W}),R&&!h?o.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-green-100 text-ok text-xs font-bold border border-ok/25 flex items-center gap-1",children:[o.jsx(kv,{size:10})," ",ie]}):R?o.jsxs("span",{className:"px-2 py-0.5 rounded-full bg-yellow-100 text-yellow-700 text-xs font-bold border border-yellow-200 flex items-center gap-1",children:[o.jsx(dh,{size:10})," ",_e]}):o.jsx("span",{className:"px-2 py-0.5 rounded-full bg-raised text-dim text-xs font-bold border border-line",children:s("billing.status.free")})]}),J&&o.jsx("p",{className:"text-dim text-sm mt-1",children:s("billing.membershipLine",{product:J})}),P&&o.jsx("p",{className:"text-dim text-sm mt-1",children:C==="will_expire"?s("billing.accessEnds",{date:P.toLocaleDateString(a)}):s("billing.periodEnds",{date:P.toLocaleDateString(a)})})]}),o.jsxs("div",{className:"text-right",children:[o.jsx("span",{className:"block text-2xl font-bold",children:s(R?"billing.pro":"billing.free")}),o.jsx("span",{className:"text-faint text-sm",children:s(R?"billing.membershipWord":"billing.planWord")})]})]}),R&&o.jsxs("div",{className:"bg-raised rounded-xl p-4 mb-6",children:[o.jsxs("div",{className:"flex justify-between text-sm mb-2",children:[o.jsx("span",{className:"font-medium text-dim",children:s("nav.credits")}),o.jsx("span",{className:"font-bold text-ink",children:s("billing.creditsCount",{count:t.diamond_balance})})]}),o.jsx("p",{className:"mt-2 text-xs text-dim",children:s("billing.proCreditsNote")})]}),D?o.jsxs("div",{className:"mb-6 rounded-xl border border-warn/25 bg-warn/10 p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-warn",children:s("billing.manageTitle")}),o.jsx("p",{className:"mt-1 text-xs text-warn",children:s("billing.manageBlurb",{status:ie,provider:de})})]}),T&&o.jsx("span",{className:"text-xs text-warn",children:s("billing.checking")})]}),o.jsxs("div",{className:"mt-4 flex flex-wrap gap-3",children:[o.jsx(An,{variant:"outline",className:"border-amber-300 bg-surface text-warn hover:bg-amber-100",onClick:Se,disabled:j,children:me}),o.jsx(An,{variant:"outline",className:"border-bad/25 bg-surface text-red-600 hover:bg-bad/10",onClick:Se,disabled:j,children:we})]})]}):o.jsxs("div",{className:"mb-6 rounded-xl border border-line bg-raised p-4",children:[o.jsxs("div",{className:"flex items-start justify-between gap-3",children:[o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-semibold text-ink",children:s("billing.startTitle")}),o.jsx("p",{className:"mt-1 text-xs text-dim",children:s("billing.startBlurb")})]}),T&&o.jsx("span",{className:"text-xs text-dim",children:s("billing.checking")})]}),o.jsx(s0,{value:L,onChange:Y,trialDays:ce,savingsAmount:ae}),o.jsx("div",{className:"mt-4 grid grid-cols-1 gap-3 md:grid-cols-3",children:O.map(({tier:se,plan:Ee,planId:Me,perCredit:ot,savings:sn})=>o.jsx(rR,{t:s,name:s(se.nameKey),tagline:s(se.taglineKey),price:Ee.basePriceDisplay||null,period:s(L==="year"?"pro.yearly.period":"pro.monthly.period"),credits:typeof Ee.credits=="number"?Ee.credits:null,benefitKeys:sR,cta:s("pro.startPlan",{plan:s(se.nameKey)}),badge:ot?s("pro.perCredit",{price:ot}):void 0,yearlyNote:sn?s("pro.yearlyNote",sn):void 0,trialNote:Ee.trialDays?s("pro.tri
5424alDays",{days:Ee.trialDays}):void 0,recommended:se.recommended,loading:$===Me,disabled:$!==null,onSelect:()=>re(Me)},se.key))})]}),o.jsx("div",{className:"flex gap-3 flex-wrap",children:R&&h&&o.jsx(An,{onClick:Se,children:s(I==="web_creem"||S==="creem"?j?"billing.manage.openingPortal":"billing.resume":"billing.manage.generic")})})]}),o.jsxs("section",{className:"bg-surface rounded-panel p-6 border border-line shadow-sm mb-8",children:[o.jsx("div",{className:"flex items-start justify-between gap-3 mb-4",children:o.jsxs("div",{children:[o.jsx("h2",{className:"text-lg font-bold",children:s("billing.packsTitle")}),o.jsx("p",{className:"text-sm text-dim",children:s(R?"billing.packsBlurbPro":"billing.packsBlurbFree")})]})}),R?o.jsx("div",{className:"flex flex-wrap gap-2",children:[40,120,1200].map(se=>o.jsx("button",{onClick:()=>pe(se),className:"px-3 py-2 rounded-xl border border-line hover:bg-raised text-sm font-medium",children:s("billing.buyCreditsCount",{count:se})},se))}):o.jsx(An,{onClick:e,children:s("nav.goPro")})]}),p&&o.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",children:o.jsxs("div",{className:"bg-surface rounded-xl p-6 max-w-md w-full shadow-2xl animate-in fade-in zoom-in-95",children:[o.jsx("h3",{className:"text-xl font-bold mb-2",children:s("billing.cancelSure")}),o.jsx("p",{className:"text-dim mb-6",children:s("billing.cancelBlurb")}),o.jsxs("div",{className:"flex gap-3",children:[o.jsx(An,{variant:"outline",fullWidth:!0,onClick:()=>b(!1),children:s("billing.keepPlan")}),o.jsx(An,{fullWidth:!0,className:"bg-red-500 hover:bg-red-600 border-none text-white shadow-red-200",onClick:B,children:s("billing.confirmCancel")})]})]})}),o.jsxs("div",{className:"mt-8 text-center text-faint text-xs flex items-center justify-center gap-2",children:[o.jsx(hh,{size:12})," ",s("billing.ssl")]}),!R&&Ce]})},tq=()=>{const t=De(),[e,n]=v.useState("checking"),s=v.useRef(cg()),[a,c]=v.useState(0),[u,h]=v.useState("/");return v.useEffect(()=>{let m=!0,p;const b=s.current;let x=0;const w=zv(xt,T=>{clearTimeout(p);const N=++x;if(!T){n("waiting");return}h(f7(T.uid)),n("checking");let j=0;const A=async()=>{var L;const F=await sa.getUserMe();if(!m||N!==x)return;if(F&&GC(b,{uid:T.uid,isPremium:F.isPremium,credits:Number(F.diamondBalance)})){n("confirmed");const Y=new URLSearchParams(window.location.search),$=Y.get("order_id")||Y.get("checkout_id")||void 0,q=HC({transactionId:$});q&&ns.purchase({content_id:q.content_id,content_name:q.content_name,content_type:q.content_category,value:q.value,currency:q.currency,transaction_id:$||q.id});try{(L=window.opener)==null||L.postMessage({type:"billing:return",source:"fashio_billing"},window.location.origin)}catch{}return}++j<10&&b?p=setTimeout(A,2e3):n("waiting")};A()});return()=>{m=!1,w(),clearTimeout(p)}},[a]),o.jsx("main",{className:"flex min-h-[100dvh] items-center justify-center bg-base p-4",children:o.jsxs("div",{className:"w-full max-w-md 
5424space-y-5 rounded-3xl border border-line bg-surface p-6 text-center shadow-lg",children:[o.jsx("span",{className:"mx-auto flex h-14 w-14 items-center justify-center rounded-full bg-accent-soft text-accent",children:e==="confirmed"?o.jsx(Cn,{size:26}):o.jsx(et,{size:26,className:e==="checking"?"animate-spin":""})}),o.jsx("h1",{className:"text-xl font-bold text-ink",children:t(e==="confirmed"?"billingReturn.title":"flow.confirming")}),e==="confirmed"&&o.jsx("p",{className:"text-sm text-dim",children:t("flow.continue")}),e==="waiting"&&o.jsx("p",{className:"text-sm text-dim",children:t("billingReturn.body")}),e==="waiting"&&o.jsx("button",{type:"button",onClick:()=>c(m=>m+1),className:"min-h-11 text-sm font-semibold text-ink",children:t("common.tryAgain")}),o.jsxs("a",{href:u,className:"flex min-h-12 items-center justify-center gap-2 rounded-2xl bg-accent px-4 py-3 text-sm font-bold text-white",children:[t("flow.back"),o.jsx(ks,{size:16})]})]})})},_c="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o",nq={model_to_flat_lay:{id:"model_to_flat_lay",fallbackNameKey:"nav.flatLay.label",fallbackDescKey:"tools.flatLay.desc",imageUrl:`${_c}/fal_outputs%2Fmanken_to_pro.jpg?alt=media&token=a016c243-03c7-40a1-a444-012a6d8dcbec`},amateur_to_pro:{id:"amateur_to_pro",fallbackNameKey:"nav.amateurToPro.label",fallbackDescKey:"tools.amateurToPro.desc",imageUrl:`${_c}/fal_outputs%2FpYs_32YDt2cDsffLXKNTh.jpg?alt=media&token=7c49da0e-0c7a-42bd-b327-902074dc5493`},photo_edit:{id:"photo_edit",fallbackNameKey:"nav.photoEdit.label",fallbackDescKey:"tool.photoEdit.blurb",imageUrl:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2F746219bb-2dfd-4796-ae79-2f01cc2d9be3.jpeg?alt=media&token=55ace926-1bec-4963-8f33-64db027a5960"},model_swap:{id:"model_swap",fallbackNameKey:"nav.modelSwap.label",fallbackDescKey:"tool.modelSwap.blurb",imageUrl:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/admin%2Ftool_samples%2F60eb5c3d-9e18-48fd-83fd-4fd0b219e1f9.jpeg?alt=media&token=fe135a66-4f98-4322-b794-c8352f960115"},pose_angle_switch:{id:"pose_angle_switch",fallbackNameKey:"nav.poseVariation.label",fallbackDescKey:"tools.poseVariation.desc",imageUrl:`${_c}/fal_outputs%2Fangle2.jpg?alt=media&token=b3c0d7b6-6041-40cf-990b-784a6d4102e7`},remove_background:{id:"remove_background",fallbackNameKey:"nav.removeBackground.label",fallbackDescKey:"tools.removeBackground.desc",imageUrl:`${_c}/fal_outputs%2Fremove_bg.jpg?alt=media`},photo_enhance:{id:"photo_enhance",fallbackNameKey:"tools.upscaler.name",fallbackDescKey:"tools.upscaler.desc",imageUrl:`${_c}/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b`},photo_reframe:{id:"photo_reframe",fallbackNameKey:"nav.reframe.label",fallbackDescKey:"nav.reframe.blurb",imageUrl:`${_c}/fal_outputs%2Fenhance.jpg?alt=media&token=e30249c1-aa4f-4c3c-addb-3920451dc58b`}},sq=t=>new Promise(e=>setTimeout(e,t)),sx=(t,e)=>zi(t,e),rq=(t,e)=>{var a,c;const n=e==null?void 0:e.configuration.uiSections.find(u=>u.type==="parameters"&&u.fieldMapping==="ratio");if(n){const h=(c=(a=n.config.parameters)==null?void 0:a[0])==null?void 0:c.defaultValue;if(h)return h}const s=cr(t);return s?WC(s):"1:1"},iq=t=>t?t.mediaUrl??t.url??null:null,aq=()=>{var pn,wt,is;const t=Xn(),e=rs(),{id:n}=D4(),s=(pn=e.state)==null?void 0:pn.sourceUrl,a=De(),[c,u]=v.useState(null),[h,m]=v.useState(null),[p,b]=v.useState(null),[x,w]=v.useState(!1),[T,N]=ze("sourceFile",null),[j,A]=v.useState(s??null),[F,V]=ze("sourceRemoteUrl",s??null);lg(T,A),v.useEffect(()=>{!T&&F&&A(F)},[]);const[L,Y]=ze("prompt","");v.useEffect(()=>{const He=n?ia(n):null;He&&(V(He.url),A(He.url),He.prompt&&Y(He.prompt),He.ratio&&q(He.ratio),He.pose&&nn.getFashionPoses().then(lt=>{const te=lt.find(ke=>ke.id===He.pose);te&&S(te)}).catch(lt=>console.error("ToolDetail handoff pose error:",lt)))},[]);const[$,q]=ze("ratio","1:1"),[I,S]=ze("selectedPose",null),[C,R]=v.useState(!1),[D,z]=ze("selectedModel",null),[P,ie]=v.useState(!1),[_e,W]=v.useState(!1),[J,fe]=v.useState("idle"),[ce,ae]=v.useState(null),{user:O,isSubscriptionModalOpen:B,isDiamondModalOpen:re,setIsSubscriptionModalOpen:pe,setIsDiamondModalOpen:de,ensureCanGenerate:me}=hr(),we=v.useMemo(()=>n?nq[n]:void 0,[n]),Se=cr(n),Re=n==="pose_angle_switch",Ce=n==="photo_reframe",$e=!!(Se!=null&&Se.requires.includes("fashion_model"));v.useEffect(()=>()=>{j&&!F&&URL.revokeObjectURL(j)},[j,F]),v.useEffect(()=>{!n||!we||yB({tool_id:n,tool_name:a(we.fallbackNameKey)})},[n,we]),v.useEffect(()=>{if(!$e)return;let He=!1;return nn.getFashionModels({pageSize:1}).then(lt=>{!He&&lt.models.length&&z(lt.models[0])}).catch(lt=>console.error("Model preload failed:",lt)),()=>{He=!0}},[$e]),v.useEffect(()=>{if(!n)return;let He=!1;return Rr.getStyleById(n).then(lt=>{He||(u(lt),q(rq(n,lt)))}).catch(lt=>console.error("Failed to load tool style:",lt)),()=>{He=!0}},[n]);const Ue=sx(c==null?void 0:c.displayNames,a(we?we.fallbackNameKey:"nav.dashboard")),Qe=sx(c==null?void 0:c.description,a(we?we.fallbackDescKey:"tool.aiTool")),Ke=Number(c==null?void 0:c.price)||(Se==null?void 0:Se.price)||0,Ne=!!(T||F),H=He=>{const lt=He[0];lt&&(j&&!F&&URL.revokeObjectURL(j),V(null),N(lt),A(URL.createObjectURL(lt)),ae(null),fe("idle"))},oe=He=>{const lt=He[0];lt&&(j&&!F&&URL.revokeObjectURL(j),N(null),V(lt),A(lt),ae(null),fe("idle"))},se=()=>{j&&!F&&URL.revokeObjectURL(j),N(null),A(null),V(null),ae(null),fe("idle")},Ee=async He=>{for(let lt=0;lt<90;lt+=1){await sq(3e3);const te=await Ln.getMediaById(He);
5424if(!te)continue;const ke=te.status||"processing";if(ke==="completed"){ae(te),fe("completed");return}if(ke==="failed"){ae(te),fe("failed"),b(te.errorMessage||null),m(te.errorMessage?null:"tool.error.processingFailed");return}}fe("failed"),m("studio.error.timeoutGallery")},Me=async()=>{if(!(!n||!we)){if(!Ne){m("studio.error.uploadImage");return}if($e&&!D){m("tool.error.chooseModel");return}if(n==="photo_edit"&&!L.trim()){m("tool.error.describeChange");return}if(await me(Ke)){m(null),b(null),W(!0),fe("processing"),ae(null);try{let He;F?He=F:He=(await Ks.uploadPhoto(T,`users/${O.uid}/uploads/tools/${n}`)).downloadUrl;const lt=await ra.run({tool:n,imageUrls:[He]});if(!lt.proceed){fe("idle");return}const te={user_photo:He};I&&(te.pose=I.id),$e&&D&&(te.fashion_model=D.id);const ke=await uo.generate({toolId:n,prompt:L.trim(),imageFields:te,ratio:$,precheckHints:lt.hints});await Ee(ke.mediaItemId)}catch(He){console.error("Tool start failed:",He),fe("failed"),b((He==null?void 0:He.message)||null),m(He!=null&&He.message?null:"tool.error.startFailed")}finally{W(!1)}}}};if(!we||!Se)return o.jsx("div",{className:"flex min-h-[60vh] items-center justify-center text-center",children:o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-ink",children:a("tool.notFound")}),o.jsx("button",{onClick:()=>t("/"),className:"mt-3 rounded-xl bg-ink px-4 py-2 text-sm font-bold text-base",children:a("tool.back")})]})});const ot=iq(ce),sn=J==="processing"?o.jsx(Tl,{}):J==="failed"?o.jsx(Sl,{message:p??a(h??"studio.error.generic")}):ot?o.jsx(jh,{url:ot,mediaId:ce==null?void 0:ce.id,fileName:`${Se.id}.jpg`}):j?o.jsx("img",{src:j,alt:a("tool.source"),className:"h-full w-full object-contain opacity-60"}):o.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center gap-4 p-6",children:[o.jsx("img",{src:we.imageUrl,alt:"",className:"max-h-[55%] rounded-panel border border-line object-contain"}),o.jsx("p",{className:"max-w-sm text-center text-xs text-faint",children:Qe})]});return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:Ue,subtitle:Qe,status:J,canvas:sn,action:o.jsx(wl,{onClick:()=>void Me(),busy:_e,disabled:!Ne||Re&&!I||$e&&!D||n==="photo_edit"&&!L.trim(),cost:Ke,label:a("tool.run"),busyLabel:a("tool.running")}),children:[o.jsx(Nt,{label:a("tool.sourcePhoto"),children:o.jsx(ho,{previews:j?[j]:[],onFiles:H,onRemove:se,onPickLibrary:()=>w(!0),max:1})}),Re&&o.jsx(Nt,{label:a("tool.targetPose"),children:o.jsx(Za,{label:a("studio.pose"),value:I?sx(I.displayNames,I.id):null,imageUrl:(I==null?void 0:I.image_url)||(I==null?void 0:I.imageUrl),placeholder:a("studio.choosePose"),onClick:()=>R(!0),onClear:()=>S(null)})}),$e&&o.jsx(Nt,{label:a("tool.newModel"),hint:a("common.required"),children:o.jsx(Za,{label:a("studio.model"),value:D?Vc(D):null,imageUrl:((wt=D==null?void 0:D.image_urls)==null?void 0:wt[0])??((is=D==null?void 0:D.imageUrls)==null?void 0:is[0])??(D==null?void 0:D.imageUrl)??null,placeholder:a("studio.chooseModel"),onClick:()=>ie(!0)})}),Se.promptMode==="custom"||Se.freeText||Re?o.jsx(Nt,{label:a(n==="photo_edit"?"tool.whatChanges":"studio.prompt"),hint:a(n==="photo_edit"?"common.required":"common.optional"),children:o.jsx(a0,{value:L,onChange:He=>Y(He.target.value),placeholder:a(n==="photo_edit"?"tool.editPlaceholder":"tool.extraDirection")})}):null,bT(Se)&&o.jsx(Nt,{label:a(Ce?"tool.targetRatio":"studio.ratio"),hint:Ce?a("tool.ratioExtended"):void 0,children:o.jsx(_l,{value:$,options:Sh,onChange:q})}),!bT(Se)&&o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:a("tool.ratioKept")}),(p||h)&&o.jsx(El,{children:p??a(h)})]}),o.jsx(vl,{isOpen:P,onClose:()=>ie(!1),onSelect:He=>{z(He),ie(!1)},selectedModel:D}),o.jsx(nR,{isOpen:C,onClose:()=>R(!1),onSelect:He=>{S(He),R(!1)},selectedPose:I}),o.jsx(fu,{open:x,onClose:()=>w(!1),remaining:1,onPick:oe}),o.jsx(Ts,{isOpen:B,onClose:()=>pe(!1),user:O}),o.jsx(dr,{isOpen:re,onClose:()=>de(!1),user:O})]})},oq=({beforeUrl:t,afterUrl:e,beforeLabel:n,afterLabel:s,className:a=""})=>{const c=De(),u=n??c("nav.reel.before"),h=s??c("nav.reel.after"),[m,p]=v.useState(50),[b,x]=v.useState(!1),w=v.useRef(null),T=v.useCallback(A=>{if(!w.current)return m;const F=w.current.getBoundingClientRect(),L=(A-F.left)/F.width*100;return Math.min(100,Math.max(0,L))},[m]),N=v.useCallback(A=>{A.preventDefault(),x(!0),p(T(A.clientX))},[T]),j=v.useCallback(A=>{x(!0);const F=A.touches[0];p(T(F.clientX))},[T]);return v.useEffect(()=>{if(!b)return;const A=L=>{L.preventDefault(),p(T(L.clientX))},F=L=>{const Y=L.touches[0];p(T(Y.clientX))},V=()=>{x(!1)};return window.addEventListener("mousemove",A),window.addEventListener("mouseup",V),window.addEventListener("touchmove",F,{passive:!0}),window.addEventListener("touchend",V),()=>{window.removeEventListener("mousemove",A),window.removeEventListener("mouseup",V),window.removeEventListener("touchmove",F),window.removeEventListener("touchend",V)}},[b,T]),o.jsxs("div",{ref:w,className:`relative overflow-hidden rounded-2xl select-none ${a}`,style:{cursor:b?"ew-resize":"default"},onMouseDown:N,onTouchStart:j,children:[o.jsx("img",{src:e,alt:h,className:"block w-full h-full object-cover",draggable:!1}),o.jsx("div",{className:"absolute inset-0",style:{clipPath:`inset(0 ${100-m}% 0 0)`},children:o.jsx("img",{src:t,alt:u,className:"block w-full h-full object-cover",draggable:!1})}),o.jsx("div",{className:"absolute top-0 bottom-0 w-0.5 bg-surface",style:{left:`${m}%`,transform:"translateX(-50%)",pointerEvents:"none"}}),o.jsx("div",{className:"absolute top-1/2 z-10 flex items-center justify-center w-10 h-10 bg-surface rounded-full shadow-lg",style:{left:`${m}%`,transform:"translate(-50%, -50%)",cursor:"ew-resize",pointerEvents:"none"},children:o.jsx($5,{className:"w-5 h-5 text-dim"})}),o.jsx("span",{className:"absolute bottom-3 left-3 px-2.5 py-1 text-xs font-medium text-base bg-ink/50 rounded-full backdrop-blur-sm",children:u}),o.jsx("span",{className:"absolute bottom-3 right-3 px-2.5 py-1 text-xs font-medium text-base bg-ink/50 rounded-full backdrop-blur-sm",children:h})]})},rx="body_editor",wd=[{id:"regular",labelKey:"body.type.regular",descKey:"body.type.regularHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has a healthy average regular body size with natural proportions"},{id:"slim",labelKey:"body.type.slim",descKey:"body.type.slimHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has a slim lean slender body with toned proportions"},{id:"curvy",labelKey:"body.type.curvy",descKey:"body.type.curvyHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has a curvy fuller body with wider hips and natural curves"},{id:"plus_size",labelKey:"body.type.plusSize",descKey:"body.type.plusSizeHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has a plus size larger body with fuller proportions, realistic and natural looking"},{id:"athletic",labelKey:"body.type.athletic",descKey:"body.type.athleticHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has an athletic toned muscular body with fit proportions"}
5424,{id:"petite",labelKey:"body.type.petite",descKey:"body.type.petiteHint",prompt:"Same exact fashion photo, same pose, same outfit, same background, same lighting, same composition, but the model has a petite smaller compact body frame with delicate proportions"}],lq=t=>new Promise(e=>setTimeout(e,t)),ix=t=>t?t.mediaUrl??t.url??null:null,cq=()=>{const t=Xn(),e=De(),[n,s]=ze("sourceFile",null),[a,c]=v.useState(null),[u,h]=ze("sourceRemoteUrl",null);lg(n,c),v.useEffect(()=>{!n&&u&&c(u)},[]);const m=!!(n||u);v.useEffect(()=>{const ce=ia("body-editor");ce&&(h(ce.url),c(ce.url),ce.preset&&wd.some(ae=>ae.id===ce.preset)&&S(ce.preset))},[]);const[p,b]=v.useState(!1),[x,w]=v.useState("idle"),[T,N]=v.useState(null),[j,A]=v.useState(null),[F,V]=v.useState(null),[L,Y]=v.useState(0),[$,q]=ze("ratio","1:1"),[I,S]=ze("selectedPreset",wd[0].id),{user:C,isSubscriptionModalOpen:R,isDiamondModalOpen:D,setIsSubscriptionModalOpen:z,setIsDiamondModalOpen:P,ensureCanGenerate:ie}=hr();v.useEffect(()=>()=>{a&&URL.revokeObjectURL(a)},[a]),v.useEffect(()=>{Rr.getStyleById(rx).then(ce=>Y(Number((ce==null?void 0:ce.price)||0))).catch(console.error)},[]);const _e=ce=>{var O;const ae=(O=ce.target.files)==null?void 0:O[0];ae&&(a&&URL.revokeObjectURL(a),s(ae),c(URL.createObjectURL(ae)),N(null),w("idle"))},W=()=>{a&&URL.revokeObjectURL(a),s(null),c(null),N(null),w("idle")},J=async ce=>{for(let ae=0;ae<40;ae+=1){await lq(2e3);const O=await Ln.getMediaById(ce);if(!O)continue;const B=O.status||"processing";if(B==="completed"){N(O),w("completed");return}if(B==="failed"){N(O),w("failed"),V(O.errorMessage||null),A(O.errorMessage?null:"body.error.failed");return}}w("failed"),A("studio.error.timeoutGallery")},fe=async()=>{if(!m){A("studio.error.uploadImage");return}if(await ie(L)){A(null),V(null),b(!0),w("processing"),N(null);try{const ce=u??(await Ks.uploadPhoto(n,`users/${C.uid}/uploads/tools/${rx}`)).downloadUrl,ae=wd.find(re=>re.id===I)||wd[0],B=(await nn.createFashionJob({prompt:ae.prompt,styleId:rx,imageFields:{image:ce},ratio:$})).mediaItemId??void 0;if(!B)throw new Error("mediaItemId not returned from createFashionJob");await J(B)}catch(ce){console.error("Body resize failed:",ce),w("failed"),A("body.error.startFailed")}finally{b(!1)}}};return o.jsxs("div",{className:"flex flex-col h-auto xl:h-[calc(100vh-5rem)]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4 shrink-0",children:[o.jsx("button",{onClick:()=>t(-1),className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(di,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-bold text-ink",children:e("body.title")}),o.jsx("p",{className:"text-xs text-dim",children:e("body.subtitle")})]})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 xl:grid-cols-12 gap-5 min-h-0 overflow-y-auto xl:overflow-hidden pb-[calc(6rem+var(--mobile-nav-height,0px))] xl:pb-0",children:[o.jsxs("div",{className:"xl:col-span-5 flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto rounded-2xl border border-line bg-[#f6f6f4] p-4 space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("body.sourceImage")}),a?o.jsxs("div",{className:"relative mt-2 rounded-xl overflow-hidden bg-raised flex items-center justify-center",children:[o.jsx("img",{src:a,alt:e("body.sourceImage"),className:"max-h-36 object-contain"}),o.jsx("button",{onClick:W,className:"absolute top-1.5 right-1.5 w-6 h-6 rounded-full bg-black/60 flex items-center justify-center text-white hover:bg-black",children:o.jsx(Wt,{size:12})})]}):o.jsxs("label",{className:"mt-2 block rounded-xl border-2 border-dashed border-line-strong bg-surface p-4 cursor-pointer hover:border-line-strong transition-colors text-center",children:[o.jsx("input",{type:"file",accept:"image/*",onChange:_e,className:"hidden"}),o.jsx(fl,{size:18,className:"mx-auto text-faint mb-1"}),o.jsx("p",{className:"text-xs text-dim",children:e("studio.clickToUpload")})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("body.bodyType")}),o.jsx("div",{className:"grid grid-cols-2 gap-1.5 mt-2",children:wd.map(ce=>o.jsxs("button",{onClick:()=>S(ce.id),className:`text-left px-3 py-2 rounded-lg border transition-colors ${I===ce.id?"bg-ink text-base border-ink":"bg-surface text-dim border-line hover:border-line-strong"}`,children:[o.jsx("p",{className:"text-xs font-semibold",children:e(ce.labelKey)}),o.jsx("p",{className:`text-[10px] mt-0.5 ${I===ce.id?"text-white/70":"text-faint"}`,children:e(ce.descKey)})]},ce.id))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("studio.ratio")}),o.jsx("div",{className:"flex gap-1.5 mt-2",children:["1:1","3:4","9:16","16:9"].map(ce=>o.jsx("button",{onClick:()=>q(ce),className:`flex-1 py-1.5 rounded-lg text-xs font-medium border transition-all ${$===ce?"bg-ink text-base border-ink":"bg-surface text-dim border-line hover:bg-raised"}`,children:ce},ce))})]}),x!=="idle"&&o.jsxs("div",{className:"rounded-xl bg-surface border border-line p-3 text-sm",children:[x==="processing"&&o.jsxs("p",{className:"text-dim inline-flex items-center gap-2",children:[o.jsx(et,{size:14,className:"animate-spin"}),e("body.processing")]}),x==="completed"&&o.jsxs("p",{className:"text-ok inline-flex items-center gap-2",children:[o.jsx(Ya,{size:14}),e("studio.completed")]}),x==="failed"&&o.jsxs("p",{className:"text-bad inline-flex items-center gap-2",children:[o.jsx(oo,{size:14}),F??e(j??"studio.error.processingFailed")]})]})]}),o.jsxs("button",{onClick:()=>void fe(),disabled:p||!m,className:"hidden xl:inline-flex mt-3 w-full items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:[p?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}
5424),p?e("common.processing"):L>0?e("common.withCost",{label:e("body.transform"),count:L}):e("body.transform")]})]}),o.jsx("div",{className:"fixed bottom-[var(--mobile-nav-height,0px)] left-0 right-0 z-30 bg-surface border-t border-line p-3 xl:hidden",children:o.jsxs("button",{onClick:()=>void fe(),disabled:p||!m,className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[p?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),p?e("common.processing"):L>0?e("common.withCost",{label:e("body.transform"),count:L}):e("body.transform")]})}),o.jsx("div",{className:"xl:col-span-7 rounded-2xl border border-line bg-surface overflow-hidden relative flex items-center justify-center min-h-[250px] xl:min-h-[400px]",children:x==="completed"&&a&&ix(T)?o.jsxs(o.Fragment,{children:[o.jsx(oq,{beforeUrl:a,afterUrl:ix(T),beforeLabel:e("common.original"),afterLabel:e("body.resized"),className:"w-full h-full"}),o.jsxs("button",{onClick:()=>void fo(ix(T),"body-editor-result.jpg"),className:"absolute bottom-4 right-4 inline-flex items-center gap-2 bg-ink text-base px-4 py-2 rounded-xl text-sm font-semibold hover:opacity-90",children:[o.jsx(aa,{size:14})," ",e("common.download")]})]}):o.jsx("div",{className:"flex flex-col items-center justify-center text-faint gap-3",children:x==="processing"?o.jsxs(o.Fragment,{children:[o.jsx(et,{size:36,className:"animate-spin text-faint"}),o.jsx("p",{className:"text-sm font-medium",children:"Processing..."})]}):o.jsxs(o.Fragment,{children:[o.jsx(us,{size:40,className:"opacity-30"}),o.jsx("p",{className:"text-sm",children:e("studio.resultHere")})]})})})]}),o.jsx(Ts,{isOpen:R,onClose:()=>z(!1),user:C}),o.jsx(dr,{isOpen:D,onClose:()=>P(!1),user:C})]})};function hg(){return(hg=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t}).apply(this,arguments)}function aR(t,e){if(t==null)return{};var n,s,a={},c=Object.keys(t);for(s=0;s<c.length;s++)e.indexOf(n=c[s])>=0||(a[n]=t[n]);return a}function uv(t){var e=v.useRef(t),n=v.useRef(function(s){e.current&&e.current(s)});return e.current=t,n.current}var lh=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=1),t>n?n:t<e?e:t},Ud=function(t){return"touches"in t},dv=function(t){return t&&t.ownerDocument.defaultView||self},KT=function(t,e,n){var s=t.getBoundingClientRect(),a=Ud(e)?(function(c,u){for(var h=0;h<c.length;h++)if(c[h].identifier===u)return c[h];return c[0]})(e.touches,n):e;return{left:lh((a.pageX-(s.left+dv(t).pageXOffset))/s.width),top:lh((a.pageY-(s.top+dv(t).pageYOffset))/s.height)}},$T=function(t){!Ud(t)&&t.preventDefault()},oR=fn.memo(function(t){var e=t.onMove,n=t.onKey,s=aR(t,["onMove","onKey"]),a=v.useRef(null),c=uv(e),u=uv(n),h=v.useRef(null),m=v.useRef(!1),p=v.useMemo(function(){var T=function(A){$T(A),(Ud(A)?A.touches.length>0:A.buttons>0)&&a.current?c(KT(a.current,A,h.current)):j(!1)},N=function(){return j(!1)};function j(A){var F=m.current,V=dv(a.current),L=A?V.addEventListener:V.removeEventListener;L(F?"touchmove":"mousemove",T),L(F?"touchend":"mouseup",N)}return[function(A){var F=A.nativeEvent,V=a.current;if(V&&($T(F),!(function(Y,$){return $&&!Ud(Y)})(F,m.current)&&V)){if(Ud(F)){m.current=!0;var L=F.changedTouches||[];L.length&&(h.current=L[0].identifier)}V.focus(),c(KT(V,F,h.current)),j(!0)}},function(A){var F=A.which||A.keyCode;F<37||F>40||(A.preventDefault(),u({left:F===39?.05:F===37?-.05:0,top:F===40?.05:F===38?-.05:0}))},j]},[u,c]),b=p[0],x=p[1],w=p[2];return v.useEffect(function(){return w},[w]),fn.createElement("div",hg({},s,{onTouchStart:b,onMouseDown:b,className:"react-colorful__interactive",ref:a,onKeyDown:x,tabIndex:0,role:"slider"}))}),l0=function(t){return t.filter(Boolean).join(" ")},lR=function(t){var e=t.color,n=t.left,s=t.top,a=s===void 0?.5:s,c=l0(["react-colorful__pointer",t.className]);return fn.createElement("div",{className:c,style:{top:100*a+"%",left:100*n+"%"}},fn.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:e}}))},Gn=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=Math.pow(10,e)),Math.round(n*t)/n},uq=function(t){return pq(hv(t))},hv=function(t){return t[0]==="#"&&(t=t.substring(1)),t.length<6?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?Gn(parseInt(t[3]+t[3],16)/255,2):1}:{r:parseInt(t.substring(0,2),16),g:parseInt(t.substring(2,4),16),b:parseInt(t.substring(4,6),16),a:t.length===8?Gn(parseInt(t.substring(6,8),16)/255,2):1}}
vendor: 4,711 bytes, line 5424
5424,dq=function(t){return mq(fq(t))},hq=function(t){var e=t.s,n=t.v,s=t.a,a=(200-e)*n/100;return{h:Gn(t.h),s:Gn(a>0&&a<200?e*n/100/(a<=100?a:200-a)*100:0),l:Gn(a/2),a:Gn(s,2)}},fv=function(t){var e=hq(t);return"hsl("+e.h+", "+e.s+"%, "+e.l+"%)"},fq=function(t){var e=t.h,n=t.s,s=t.v,a=t.a;e=e/360*6,n/=100,s/=100;var c=Math.floor(e),u=s*(1-n),h=s*(1-(e-c)*n),m=s*(1-(1-e+c)*n),p=c%6;return{r:Gn(255*[s,h,u,u,m,s][p]),g:Gn(255*[m,s,s,h,u,u][p]),b:Gn(255*[u,u,m,s,s,h][p]),a:Gn(a,2)}},ym=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},mq=function(t){var e=t.r,n=t.g,s=t.b,a=t.a,c=a<1?ym(Gn(255*a)):"";return"#"+ym(e)+ym(n)+ym(s)+c},pq=function(t){var e=t.r,n=t.g,s=t.b,a=t.a,c=Math.max(e,n,s),u=c-Math.min(e,n,s),h=u?c===e?(n-s)/u:c===n?2+(s-e)/u:4+(e-n)/u:0;return{h:Gn(60*(h<0?h+6:h)),s:Gn(c?u/c*100:0),v:Gn(c/255*100),a}},gq=fn.memo(function(t){var e=t.hue,n=t.onChange,s=l0(["react-colorful__hue",t.className]);return fn.createElement("div",{className:s},fn.createElement(oR,{onMove:function(a){n({h:360*a.left})},onKey:function(a){n({h:lh(e+360*a.left,0,360)})},"aria-label":"Hue","aria-valuenow":Gn(e),"aria-valuemax":"360","aria-valuemin":"0"},fn.createElement(lR,{className:"react-colorful__hue-pointer",left:e/360,color:fv({h:e,s:100,v:100,a:1})})))}),yq=fn.memo(function(t){var e=t.hsva,n=t.onChange,s={backgroundColor:fv({h:e.h,s:100,v:100,a:1})};return fn.createElement("div",{className:"react-colorful__saturation",style:s},fn.createElement(oR,{onMove:function(a){n({s:100*a.left,v:100-100*a.top})},onKey:function(a){n({s:lh(e.s+100*a.left,0,100),v:lh(e.v-100*a.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Gn(e.s)+"%, Brightness "+Gn(e.v)+"%"},fn.createElement(lR,{className:"react-colorful__saturation-pointer",top:1-e.v/100,left:e.s/100,color:fv(e)})))}),cR=function(t,e){if(t===e)return!0;for(var n in t)if(t[n]!==e[n])return!1;return!0},bq=function(t,e){return t.toLowerCase()===e.toLowerCase()||cR(hv(t),hv(e))};function xq(t,e,n){var s=uv(n),a=v.useState(function(){return t.toHsva(e)}),c=a[0],u=a[1],h=v.useRef({color:e,hsva:c});v.useEffect(function(){if(!t.equal(e,h.current.color)){var p=t.toHsva(e);h.current={hsva:p,color:e},u(p)}},[e,t]),v.useEffect(function(){var p;cR(c,h.current.hsva)||t.equal(p=t.fromHsva(c),h.current.color)||(h.current={hsva:c,color:p},s(p))},[c,t,s]);var m=v.useCallback(function(p){u(function(b){return Object.assign({},b,p)})},[]);return[c,m]}var vq=typeof window<"u"?v.useLayoutEffect:v.useEffect,_q=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},qT=new Map,wq=function(t){vq(function(){var e=t.current?t.current.ownerDocument:document;if(e!==void 0&&!qT.has(e)){var n=e.createElement("style");n.innerHTML=`.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill-opacity=".05"><path d="M8 0h8v8H8zM0 8h8v8H0z"/></svg>')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}`,qT.set(e,n);var s=_q();s&&n.setAttribute("nonce",s),e.head.appendChild(n)}},[])},Eq=function(t){var e=t.className,n=t.colorModel,s=t.color,a=s===void 0?n.defaultColor:s,c=t.onChange,u=aR(t,["className","colorModel","color","onChange"]),h=v.useRef(null);
5424wq(h);var m=xq(n,a,c),p=m[0],b=m[1],x=l0(["react-colorful",e]);return fn.createElement("div",hg({},u,{ref:h,className:x}),fn.createElement(yq,{hsva:p,onChange:b}),fn.createElement(gq,{hue:p.h,onChange:b,className:"react-colorful__last-control"}))},kq={defaultColor:"000",toHsva:uq,fromHsva:function(t){return dq({h:t.h,s:t.s,v:t.v,a:1})},equal:bq},Tq=function(t){return fn.createElement(Eq,hg({},t,{colorModel:kq}))};const HT={necklace:{offsetX:50,offsetY:35},earring:{offsetX:35,offsetY:25},ring:{offsetX:50,offsetY:65},bracelet:{offsetX:45,offsetY:60}},ax=.2,GT=2,YT=30,uR=v.forwardRef(({modelImageUrl:t,jewelryPreviewUrl:e,jewelryType:n,onPositionChange:s,className:a=""},c)=>{const u=De(),[h,m]=ze(`jewelry.position.${n}`,()=>({scale:1,...HT[n]})),[p,b]=v.useState(null),x=v.useRef(null),w=v.useRef(null),T=v.useRef(null),N=v.useRef(null);v.useEffect(()=>{s(h)},[h,s]);const j=(R,D,z)=>Math.min(z,Math.max(D,R));v.useImperativeHandle(c,()=>({captureImage:async()=>{const R=w.current,D=T.current;if(!R||!D)return null;const z=document.createElement("canvas"),P=z.getContext("2d");if(!P)return null;z.width=R.naturalWidth,z.height=R.naturalHeight,P.drawImage(R,0,0,z.width,z.height);const ie=YT/100*z.width*h.scale,_e=D.naturalHeight/D.naturalWidth,W=ie*_e,J=h.offsetX/100*z.width-ie/2,fe=h.offsetY/100*z.height-W/2;return P.drawImage(D,J,fe,ie,W),new Promise(ce=>{z.toBlob(ae=>ce(ae),"image/png",1)})}}));const A=v.useCallback((R,D,z)=>{b(z),N.current={startX:R,startY:D,startOffsetX:h.offsetX,startOffsetY:h.offsetY,startScale:h.scale}},[h.offsetX,h.offsetY,h.scale]),F=v.useCallback((R,D="move")=>{R.preventDefault(),R.stopPropagation(),A(R.clientX,R.clientY,D)},[A]),V=v.useCallback((R,D="move")=>{R.stopPropagation();const z=R.touches[0];A(z.clientX,z.clientY,D)},[A]);v.useEffect(()=>{if(!p)return;const R=(ie,_e)=>{if(!x.current||!N.current)return;const W=x.current.getBoundingClientRect(),{startX:J,startY:fe,startOffsetX:ce,startOffsetY:ae,startScale:O}=N.current;if(p==="move"){const B=(ie-J)/W.width*100,re=(_e-fe)/W.height*100;m(pe=>({...pe,offsetX:j(ce+B,0,100),offsetY:j(ae+re,0,100)}))}else{const B=ie-J,re=_e-fe;let pe=0;const de=3/W.width;switch(p){case"se":pe=(B+re)*.5*de;break;case"nw":pe=(-B+-re)*.5*de;break;case"ne":pe=(B+-re)*.5*de;break;case"sw":pe=(-B+re)*.5*de;break;case"e":pe=B*de;break;case"w":pe=-B*de;break;case"s":pe=re*de;break;case"n":pe=-re*de;break}m(me=>({...me,scale:j(O+pe,ax,GT)}))}},D=ie=>{ie.preventDefault(),R(ie.clientX,ie.clientY)},z=ie=>{const _e=ie.touches[0];R(_e.clientX,_e.clientY)},P=()=>{b(null),N.current=null};return window.addEventListener("mousemove",D),window.addEventListener("mouseup",P),window.addEventListener("touchmove",z,{passive:!0}),window.addEventListener("touchend",P),()=>{window.removeEventListener("mousemove",D),window.removeEventListener("mouseup",P),window.removeEventListener("touchmove",z),window.removeEventListener("touchend",P)}},[p]);const L=v.useCallback(()=>{const R=HT[n];m({scale:1,offsetX:R.offsetX,offsetY:R.offsetY})},[n]),Y=Math.round((h.scale-ax)/(GT-ax)*100),$=R=>{switch(R){case"nw":case"se":return"nwse-resize";case"ne":case"sw":return"nesw-resize";case"n":case"s":return"ns-resize";case"e":case"w":return"ew-resize";default:return"grab"}},q="absolute bg-surface border-2 border-purple-600 z-10 hover:bg-purple-100 transition-colors",I="w-3.5 h-3.5 rounded-full",S="w-5 h-2 rounded-full",C="w-2 h-5 rounded-full";return o.jsxs("div",{ref:x,className:`relative overflow-hidden rounded-2xl bg-transparent select-none ${a}`,children:[o.jsx("img",{ref:w,src:t,alt:u("studio.model"),className:"block w-full h-full object-cover",draggable:!1,crossOrigin:"anonymous"}),o.jsxs("div",{className:"absolute",style:{left:`${h.offsetX}%`,top:`${h.offsetY}%`,transform:`translate(-50%, -50%) scale(${h.scale})`,width:`${YT}%`,touchAction:"none"},children:[o.jsx("div",{className:"relative border-2 border-dashed border-accent rounded-md p-1",style:{cursor:p==="move"?"grabbing":"grab"},onMouseDown:R=>F(R,"move"),onTouchStart:R=>V(R,"move"),children:o.jsx("img",{ref:T,src:e,alt:u("jewelry.positioner.title"),className:"block w-full h-auto object-contain",draggable:!1,
5424crossOrigin:"anonymous"})}),o.jsx("div",{className:`${q} ${I} -top-2 -left-2`,style:{cursor:$("nw")},onMouseDown:R=>F(R,"nw"),onTouchStart:R=>V(R,"nw")}),o.jsx("div",{className:`${q} ${I} -top-2 -right-2`,style:{cursor:$("ne")},onMouseDown:R=>F(R,"ne"),onTouchStart:R=>V(R,"ne")}),o.jsx("div",{className:`${q} ${I} -bottom-2 -left-2`,style:{cursor:$("sw")},onMouseDown:R=>F(R,"sw"),onTouchStart:R=>V(R,"sw")}),o.jsx("div",{className:`${q} ${I} -bottom-2 -right-2`,style:{cursor:$("se")},onMouseDown:R=>F(R,"se"),onTouchStart:R=>V(R,"se")}),o.jsx("div",{className:`${q} ${S} -top-1.5 left-1/2 -translate-x-1/2`,style:{cursor:$("n")},onMouseDown:R=>F(R,"n"),onTouchStart:R=>V(R,"n")}),o.jsx("div",{className:`${q} ${S} -bottom-1.5 left-1/2 -translate-x-1/2`,style:{cursor:$("s")},onMouseDown:R=>F(R,"s"),onTouchStart:R=>V(R,"s")}),o.jsx("div",{className:`${q} ${C} top-1/2 -left-1.5 -translate-y-1/2`,style:{cursor:$("w")},onMouseDown:R=>F(R,"w"),onTouchStart:R=>V(R,"w")}),o.jsx("div",{className:`${q} ${C} top-1/2 -right-1.5 -translate-y-1/2`,style:{cursor:$("e")},onMouseDown:R=>F(R,"e"),onTouchStart:R=>V(R,"e")})]}),o.jsx("div",{className:"absolute bottom-0 inset-x-0 bg-gradient-to-t from-black/60 to-transparent pt-10 pb-4 px-4",children:o.jsxs("div",{className:"flex items-center gap-3",children:[o.jsxs("span",{className:"text-xs text-white/80 font-semibold tabular-nums flex-shrink-0",children:[Y,"%"]}),o.jsx("button",{type:"button",onClick:L,className:"flex items-center justify-center w-8 h-8 bg-white text-gray-900 rounded-full shadow-sm active:bg-gray-200 transition-colors flex-shrink-0","aria-label":u("jewelry.positioner.reset"),children:o.jsx(rM,{className:"w-4 h-4 text-dim"})})]})})]})});uR.displayName="JewelryPositioner";const ox=5,lx="jewelry_on_model",Sq=["necklace","earring","ring","bracelet"],Nq=[{id:"necklace",labelKey:"jewelry.type.necklace"},{id:"earring",labelKey:"jewelry.type.earring"},{id:"ring",labelKey:"jewelry.type.ring"},{id:"bracelet",labelKey:"jewelry.type.bracelet"}],WT={necklace:"/images/mannequins/mannequin-necklace-v5.png",earring:"/images/mannequins/mannequin-earring-v5.png",ring:"/images/mannequins/mannequin-ring-v5.png",bracelet:"/images/mannequins/mannequin-bracelet-v5.png"},jq=[{hex:"#FFFFFF",labelKey:"colour.white"},{hex:"#FFFFF0",labelKey:"colour.ivory"},{hex:"#F5F0E8",labelKey:"colour.beige"},{hex:"#E8DCCA",labelKey:"colour.sand"},{hex:"#F8E0E0",labelKey:"colour.blush"},{hex:"#FBCFE8",labelKey:"colour.pink"},{hex:"#E8E0F0",labelKey:"colour.lavender"},{hex:"#D1D5DB",labelKey:"colour.gray"},{hex:"#94A3B8",labelKey:"colour.slate"},{hex:"#1F2937",labelKey:"colour.black"}],Aq={necklace:"jewelry.hint.necklace",earring:"jewelry.hint.earring",ring:"jewelry.hint.ring",bracelet:"jewelry.hint.bracelet"},Cq=t=>new Promise(e=>setTimeout(e,t));function Rq(t){return t?t.mediaUrl??t.url??null:null}function XT(t){return t.image_urls&&t.image_urls.length>0?t.image_urls[0]:t.imageUrls&&t.imageUrls.length>0?t.imageUrls[0]:t.imageUrl?t.imageUrl:null}function QT(t){return hu(t)||t.id}function JT(t){const e=t.replace("#","");if(e.length!==6)return!1;const[n,s,a]=[0,2,4].map(c=>parseInt(e.slice(c,c+2),16));return(n*299+s*587+a*114)/1e3<140}const Iq=()=>{var Ke;const t=De(),[e,n]=ze("jewelryType","necklace"),s=Ah(ox),a=v.useRef(void 0);v.useEffect(()=>{let Ne=!0;const H=a.current===void 0;H&&(a.current=ia("jewelry-on-model"));const oe=a.current;return oe&&(H&&s.addLibrary([oe.url]),oe.preset&&Sq.includes(oe.preset)&&n(oe.preset),oe.model&&nn.getFashionModelById(oe.model).then(se=>{Ne&&se&&m(se)}).catch(se=>console.error("JewelryOnModel handoff model error:",se))),()=>{Ne=!1}},[]);const[c,u]=v.useState(0),[h,m]=ze("selectedModel",null),[p,b]=v.useState(!1),[x,w]=v.useState([]),[T,N]=ze("selectedPose",null),[j,A]=ze("bgColor","#FFFFFF"),[F,V]=v.useState(!1),[L,Y]=ze("ratio","1:1"),[$,q]=v.useState(!1),[I,S]=v.useState("idle"),[C,R]=v.useState(null),[D,z]=v.useState(null),[P,ie]=v.useState(null),[_e,W]=v.useState(((Ke=cr(lx))==null?void 0:Ke.price)??4),{user:J,isSubscriptionModalOpen:fe,isDiamondModalOpen:ce,setIsSubscriptionModalOpen:ae,setIsDiamondModalOpen:O,ensureCanGenerate:B}=hr(),re=v.useRef(null);v.useEffect(()=>{let Ne=!0;return Rr.getStyleById(lx).then(H=>{const oe=Number(H==null?void 0:H.price);Ne&&oe>0&&W(oe)}
5424).catch(H=>console.error("Failed to load jewelry style price:",H)),()=>{Ne=!1}},[]),v.useEffect(()=>{let Ne=!0;return nn.getFashionModels({pageSize:1}).then(H=>{Ne&&H.models.length>0&&m(oe=>oe??H.models[0])}).catch(H=>console.error("Failed to load fashion models:",H)),()=>{Ne=!1}},[]),v.useEffect(()=>{let Ne=!0;return w([]),nn.getFashionPoses({type:e}).then(H=>{Ne&&(w(H),N(oe=>H.find(se=>se.id===(oe==null?void 0:oe.id))??H[0]??null))}).catch(H=>console.error(`Failed to load ${e} poses:`,H)),()=>{Ne=!1}},[e]);const pe=()=>{R(null),S("idle"),z(null),ie(null)},de=Ne=>{s.addFiles(Ne),pe()},me=Ne=>{s.addLibrary(Ne),pe()},we=Ne=>{s.removeAt(Ne),c>=Ne&&c>0&&u(H=>H-1)},Se=async Ne=>{for(let H=0;H<90;H+=1){await Cq(3e3);const oe=await Ln.getMediaById(Ne);if(!oe)continue;const se=oe.status||"processing";if(se==="completed"){R(oe),S("completed");return}if(se==="failed"){R(oe),S("failed"),ie(oe.errorMessage||null),z(oe.errorMessage?null:"studio.error.processingFailed");return}}S("failed"),z("jewelry.error.timeout")},Re=async()=>{if(s.count===0){z("jewelry.error.uploadFirst");return}if(!await B(_e))return;const Ne=re.current?await re.current.captureImage():null;if(!Ne){z("jewelry.error.capture");return}q(!0),S("processing"),z(null),ie(null),R(null);try{const H=new File([Ne],"positioned-preview.png",{type:"image/png"}),oe=await Ks.uploadPhoto(H,`users/${J.uid}/uploads/tools/jewelry_on_model/previews`),se=await uo.generate({toolId:lx,imageFields:{jewelry_image:oe.downloadUrl},ratio:L});await Se(se.mediaItemId)}catch(H){console.error("Jewelry generation failed:",H),S("failed"),ie((H==null?void 0:H.message)||null),z(H!=null&&H.message?null:"studio.error.startFailed")}finally{q(!1)}},Ce=Rq(C),$e=s.previews[c],Ue=h?XT(h)??WT[e]:WT[e],Qe=I==="processing"?o.jsx(Tl,{}):I==="failed"?o.jsx(Sl,{message:P??t(D??"studio.error.generic")}):Ce?o.jsx(jh,{url:Ce,mediaId:C==null?void 0:C.id,fileName:"jewelry-on-model.jpg"}):$e?o.jsxs("div",{className:"flex h-full w-full flex-col items-center gap-2 p-4",style:{backgroundColor:j},children:[o.jsx(uR,{ref:re,modelImageUrl:Ue,jewelryPreviewUrl:$e,jewelryType:e,onPositionChange:()=>{},className:"min-h-0 flex-1"},e),o.jsx("p",{className:"text-center text-[11px]",style:{color:JT(j)?"#FFFFFFB0":"#00000090"},children:t(Aq[e])})]}):o.jsx(Nh,{message:t("jewelry.canvasEmpty"),children:o.jsx(rr,{size:26,className:"text-faint"})});return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:t("nav.jewelry.label"),subtitle:t("jewelry.subtitle"),status:I,canvas:Qe,action:o.jsx(wl,{onClick:()=>void Re(),busy:$,disabled:s.count===0,cost:_e}),children:[o.jsx(Nt,{label:t("jewelry.type"),children:o.jsx("div",{className:"grid grid-cols-4 gap-1.5",children:Nq.map(Ne=>{const H=e===Ne.id;return o.jsx("button",{type:"button",onClick:()=>n(Ne.id),"aria-pressed":H,className:`rounded-lg border px-2 py-2 text-[11px] font-semibold transition-colors ${H?"border-accent bg-accent-soft text-ink":"border-line bg-base text-dim hover:border-line-strong hover:text-ink"}`,children:t(Ne.labelKey)},Ne.id)})})}),o.jsxs(Nt,{label:t("jewelry.photos"),hint:`${s.count}/${ox}`,children:[o.jsx(ho,{previews:s.previews,onFiles:de,onRemove:we,onPickLibrary:s.openPicker,max:ox,hint:t("jewelry.photosHint")}),s.previews.length>1&&o.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:s.previews.map((Ne,H)=>o.jsxs("button",{type:"button",onClick:()=>u(H),"aria-pressed":c===H,className:`rounded-md border px-2 py-1 font-mono text-[10px] transition-colors ${c===H?"border-accent bg-accent-soft text-ink":"border-line text-faint hover:text-ink"}`,children:["#",H+1]},H))})]}),o.jsx(Nt,{label:t("studio.model"),children:o.jsx(Za,{label:t("jewelry.wornBy"),value:(h==null?void 0:h.name)??null,imageUrl:h?XT(h):null,placeholder:t("jewelry.worn.mannequin"),onClick:()=>b(!0),onClear:()=>m(null)})}),x.length>0&&o.jsx(Nt,{label:t("studio.pose"),hint:String(x.length),children:o.jsx("div",{className:"grid max-h-72 grid-cols-4 gap-1.5 overflow-y-auto",children:x.map(Ne=>{const H=(T==null?void 0:T.id)===Ne.id,oe=Ne.image_url||Ne.imageUrl;return o.jsx("button",{type:"button",onClick:()=>N(Ne),"aria-pressed":H,title:QT(Ne),className:`aspect-square overflow-hidden rounded-lg border transition-colors ${H?"border-accent":"border-line opacity-60 hover:opacity-100"}`,children:oe?o.jsx("img",{src:oe,alt:"",className:"h-full w-full object-cover"}):o.jsx("span",{className:"flex h-full items-center justify-center bg-base text-[9px] text-faint",children:QT(Ne).slice(0,6)})},Ne.id)})})}),o.jsxs(Nt,{label:t("jewelry.background"),children:[o.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[jq.map(Ne=>o.jsx("button",{type:"button",onClick:()=>A(Ne.hex),title:t(Ne.labelKey),"aria-pressed":j===Ne.hex,className:`h-7 w-7 rounded-md border-2 transition-transform ${j===Ne.hex?"scale-110 border-accent":"border-line hover:scale-105"}`,style:{backgroundColor:Ne.hex}},Ne.hex)),o.jsx("button",{type:"button",onClick:()=>V(Ne=>!Ne),"aria-label":t("jewelry.customColour"),"aria-expanded":F,className:"flex h-7 w-7 items-center justify-center rounded-md border-2 border-line text-faint hover:border-line-strong hover:text-ink",children:o.jsx(Q5,{size:12})})]}),F&&o.jsxs("div",{className:"mt-2 space-y-2",children:[o.jsx(Tq,{color:j,onChange:A}),o.jsx("div",{className:"rounded-lg px-3 py-1.5 text-center font-mono text-xs",style:{backgroundColor:j,color:JT(j)?"#FFFFFF":"#111111"},children:j.toUpperCase()})]})]}),o.jsx(Nt,{label:t("studio.ratio"),children:o.jsx(_l,{value:L,options:Sh,onChange:Y})}),(P||D)&&o.jsx(El,{children:P??t(D)})]}),o.jsx(vl,{isOpen:p,onClose:()=>b(!1),onSelect:Ne=>{m(Ne),b(!1)},selectedModel:h}),o.jsx(fu,{open:s.pickerOpen,onClose:s.closePicker,remaining:s.remaining,onPick:me}),o.jsx(Ts,{isOpen:fe,onClose:()=>ae(!1),user:J}),o.jsx(dr,{isOpen:ce,onClose:()=>O(!1),user:J})]})},Mq=t=>new Promise(e=>setTimeout(e,t)),cx={std:20,pro:40},ux=20,bm=({className:t=""})=>o.jsx("div",{className:`animate-pulse bg-line rounded-xl ${t}`}),ZT=({src:t,thumbnailUrl:e,className:n="",forcePlay:s=!1,withSound:a=!1})=>{const c=v.useRef(null);return v.useEffect(()=>{s&&c.current&&c.current.play().catch(()=>{})},[s]),s?o.jsx("div",{className:`relative overflow-hidden ${n}
5424`,children:o.jsx("video",{ref:c,src:t,muted:!a,loop:!0,playsInline:!0,preload:"auto",className:"w-full h-full object-cover"})}):o.jsx("div",{className:`relative overflow-hidden ${n}`,children:e?o.jsx("img",{src:e,alt:"",className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-raised flex items-center justify-center",children:o.jsx(Vd,{className:"w-4 h-4 text-faint"})})})},Pq=()=>{const t=Xn(),{user:e,isSubscriptionModalOpen:n,isDiamondModalOpen:s,setIsSubscriptionModalOpen:a,setIsDiamondModalOpen:c,ensureCanGenerate:u,refreshUser:h}=hr(),[m,p]=v.useState(cx),[b,x]=v.useState([]),[w,T]=v.useState([]),N=De(),[j,A]=v.useState("all"),[F,V]=v.useState("all"),[L,Y]=ze("selectedEffect",null),[$,q]=v.useState(null),[I,S]=v.useState(!0),[C,R]=v.useState(1),[D,z]=v.useState([]),[P,ie]=ze("selectedModel",null),[_e,W]=v.useState(!1),[J,fe]=ze("sourceFile",null),[ce,ae]=v.useState(null),[O,B]=ze("sourceRemoteUrl",null);lg(J,ae),v.useEffect(()=>{!J&&O&&ae(O)},[]),v.useEffect(()=>{const he=ia("ugc-creator");he&&(B(he.url),ae(he.url),he.prompt&&pe(he.prompt))},[]);const[re,pe]=ze("script",""),[de,me]=ze("mode","std"),[we,Se]=ze("ratio","9:16"),[Re,Ce]=v.useState(!1),[$e,Ue]=v.useState(""),[Qe,Ke]=v.useState(null),[Ne,H]=v.useState(null),[oe,se]=v.useState(null);v.useEffect(()=>{(async()=>{var Fe;try{S(!0);const[Oe,Xe,rn,jt]=await Promise.all([Yb.getEffectTypes(),Yb.getEffectCategories(),rg(si(sl,"styles","ugc_creator")),nn.getFashionModels({pageSize:50})]);x(Oe),T(Xe);const mo=(Fe=rn.data())==null?void 0:Fe.pricing;mo&&p(mo),z(jt.models)}catch(Oe){console.error("Failed to load UGC creator data:",Oe)}finally{S(!1)}})()},[]);const Ee=v.useMemo(()=>{let he=b;return j!=="all"&&(he=he.filter(Fe=>Fe.category===j)),F!=="all"&&(he=he.filter(Fe=>Fe.subcategory===F)),he},[b,j,F]),Me=Math.ceil(Ee.length/ux),ot=Ee.slice((C-1)*ux,C*ux),sn=v.useMemo(()=>{var he;return j==="all"?[]:((he=w.find(Fe=>Fe.key===j))==null?void 0:he.subcategories)||[]},[j,w]),pn=m[de]??cx[de]??20,wt=he=>{var Oe;const Fe=(Oe=he.target.files)==null?void 0:Oe[0];Fe&&(fe(Fe),ae(URL.createObjectURL(Fe)),Ke(null),H(null),se(null))},is=()=>{fe(null),ae(null),Ke(null),H(null),se(null)},He=async he=>{for(let Fe=0;Fe<100;Fe++){await Mq(3e3);try{const Oe=await Ln.getMediaById(he);if(!Oe)continue;if(Oe.status==="completed"){Ke(Oe),Ue("");return}if(Oe.status==="failed"){se(Oe.errorMessage||null),H(Oe.errorMessage?null:"ugc.error.refunded"),Ue("");return}}catch{}}H("ugc.error.timeout"),Ue("")},lt=async()=>{var Fe,Oe;if(!(!L||!(J||O)||!re.trim()||!await u(pn))){Ce(!0),H(null),se(null),Ke(null),Ue(N("ugc.uploading"));try{const Xe=O??(await Ks.uploadPhoto(J,`users/${e.uid}/uploads/tools/ugc_creator`)).downloadUrl;Ue(N("ugc.submitting"));const rn=P?((Fe=P.image_urls)==null?void 0:Fe[0])??((Oe=P.imageUrls)==null?void 0:Oe[0])??P.imageUrl:void 0,jt=await Yb.createUgcJob({effectType:L.value,mode:de,inputImageUrl:Xe,script:re.trim(),ratio:we,modelImageUrl:rn});Ue(N("ugc.generating")),await He(jt.mediaItemId),await h()}catch(Xe){se((Xe==null?void 0:Xe.message)||null),H(Xe!=null&&Xe.message?null:"ugc.error.failed")}finally{Ce(!1),Ue("")}}},te=!!(L&&(J||O)&&re.trim().length>0&&!Re),ke=(Qe==null?void 0:Qe.mediaUrl)??(Qe==null?void 0:Qe.url)??null,nt=he=>{var Fe,Oe;return((Fe=he.image_urls)==null?void 0:Fe[0])??((Oe=he.imageUrls)==null?void 0:Oe[0])??he.imageUrl??""};return o.jsxs("div",{className:"flex flex-col h-auto xl:h-[calc(100vh-5rem)]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4 shrink-0",children:[o.jsx("button",{onClick:()=>t(-1),className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(di,{size:18})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h1",{className:"text-xl font-bold text-ink",children:N("ugc.title")}),o.jsx("p",{className:"text-xs text-dim",children:N("ugc.subtitle")})]})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 xl:grid-cols-12 gap-5 min-h-0 overflow-y-auto xl:overflow-hidden pb-[calc(6rem+var(--mobile-nav-height,0px))] xl:pb-0",children:[o.jsxs("div",{className:"xl:col-span-5 flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto rounded-2xl border border-line bg-[#f6f6f4] p-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:N("ugc.productPhoto")}),ce?o.jsxs("div",{className:"relative mt-2 rounded-xl overflow-hidden bg-raised flex items-center justify-center",children:[o.jsx("img",{src:ce,alt:N("ugc.productPhoto"),className:"max-h-40 object-contain"}),o.jsx("button",{onClick:is,className:"absolute top-1.5 right-1.5 w-6 h-6 rounded-full bg-black/60 flex items-center justify-center text-white hover:bg-black",children:o.jsx(Wt,{size:12})})]}):o.jsxs("label",{className:"mt-2 block rounded-xl border-2 border-dashed border-line-strong bg-surface p-5 cursor-pointer hover:border-line-strong transition-colors text-center",children:[o.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:wt}),o.jsx(fl,{size:18,className:"mx-auto text-faint mb-1"}),o.jsx("p",{className:"text-xs text-dim",children:N("studio.clickToUpload")})]})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:N("ugc.aiModel")}),D.length>5&&o.jsxs("button",{onClick:()=>W(!0),className:"text-xs font-medium text-dim hover:text-ink inline-flex items-center gap-1",children:[N("common.viewAll")," ",o.jsx(Vd,{size:12})]})]}),o.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-1",children:[I&&D.length===0&&Array.from({length:5}).map((he,Fe)=>o.jsxs("div",{className:"flex-shrink-0 flex flex-col items-center gap-1",children:[o.jsx(bm,{className:"w-12 h-12 rounded-xl"}),o.jsx(bm,{className:"w-8 h-2"})]},Fe)),(!I||D.length>0)&&o.jsxs(o.Fragment,{children:[o.jsxs("button",{onClick:()=>ie(null),className:"flex-shrink-0 flex flex-col items-center gap-1",children:[o.jsx("div",{className:`w-12 h-12 rounded-xl border-2 flex items-center justify-center transition-all ${P?"border-line bg-raised":"border-ink bg-ink"}`,children:o.jsx(YS,{className:`w-5 h-5 ${P?"text-faint":"text-white"}`})}),o.jsx("span",{className:"text-[9px] text-dim font-medium",children:N("ugc.aiPick")})]}),[...P?[P]:[],...D.filter(he=>he.id!==(P==null?void 0:P.id))].slice(0,5).map(he=>o.jsxs("button",{onClick:()=>ie(he),className:"flex-shrink-0 flex flex-col items-center gap-1",children:[o.jsx("div",{className:`w-12 h-12 rounded-xl border-2 overflow-hidden transition-all ${(P==null?void 0:P.id)===he.id?"border-ink":"border-transparent"}`,children:nt(he)?o.jsx("img",{src:nt(he),alt:he.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-line flex items-center justify-center text-[10px] text-faint",children:he.name[0]})}),o.jsx("span",{className:"text-[9px] text-dim font-medium truncate w-12 text-center",children:he.name})]},he.id))]})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:N("ugc.whatToSay")}),o.jsx("p",{className:"text-[11px] text-faint mt-0.5 mb-1.5",children:N("ugc.whatToSayHint")}),o.jsx("textarea",{value:re,onChange:he=>pe(he.target.value),placeholder:N("ugc.scriptPlaceholder"),maxLength:200,rows:3,className:"w-full rounded-xl border border-line bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-black/10 resize-none"}),o.jsxs("p",{className:"text-[10px] text-faint text-right",children:[re.length,"/200"]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:N("ugc.duration")}),o.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:["std","pro"].map(he=>o.jsxs("button",{onClick:()=>me(he),className:`py-2.5 rounded-xl text-sm font-medium transition-colors ${de===he?"bg-ink text-base":"bg-surface border border-line text-dim hover:border-line-strong"}`,children:[N(he==="std"?"ugc.quality.standard":"ugc.quality.pro"),o.jsxs("span",{className:"block text-[11px] opacity-60 mt-0.5",children:[he==="std"?"5s":"10s"," · ",m[he]??cx[he]," 💎"]})]},he))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:N("ugc.aspectRatio")}),o.jsx("div",{className:"grid grid-cols-3 gap-2 mt-2",children:["9:16","16:9","1:1"].map(he=>o.jsx("button",{onClick:()=>Se(he),className:`py-2 rounded-xl text-sm font-medium transition-colors ${we===he?"bg-ink text-base":"bg-surface border border-line text-dim hover:border-line-strong"}`,children:he},he))})]}),(Ne||oe||Re&&$e)&&o.jsxs("div",{className:`rounded-xl border p-3 text-sm ${Ne||oe?"bg-bad/10 border-bad/25":"bg-surface border-line"}`,children:[Re&&$e&&!Ne&&!oe&&o.jsxs("p",{className:"text-dim inline-flex items-center gap-2",children:[o.jsx(et,{size:14,className:"animate-spin"}),$e]}),(Ne||oe)&&o.jsxs("p",{className:"text-bad inline-flex items-center gap-2",children:[o.jsx(oo,{size:14}),oe??N(Ne)]})]})]}),o.jsxs("button",{onClick:lt,disabled:!te,className:"hidden xl:inline-flex mt-3 w-full items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed shrink-0",children:[Re?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),Re?$e||N("ugc.generating"):N("common.withCost",{label:N("ugc.generate"),count:pn})]})]}),o.jsx("div",{className:"fixed bottom-[var(--mobile-nav-height,0px)] left-0 right-0 z-30 bg-surface border-t border-line p-3 xl:hidden",children:o.jsxs("button",{onClick:lt,disabled:!te,className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",children:[Re?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),Re?$e||N("ugc.generating"):N("common.withCost",{label:N("ugc.generate"),count:pn})]})}),o.jsx("div",{className:"xl:col-span-7 flex flex-col min-h-0 overflow-hidden rounded-2xl border border-line bg-surface",children:ke?o.jsxs("div",{className:"flex-1 flex flex-col items-center justify-center p-6",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[o.jsx(Ya,{className:"w-5 h-5 text-green-500"}),o.jsx("h3",{className:"font-semibold text-ink",children:N("ugc.ready")})]}),o.jsxs("div",{className:"relative rounded-xl overflow-hidden bg-black w-full max-w-xs",children:[o.jsx("video",{src:ke,controls:!0,autoPlay:!0,loop:!0,playsInl
5424ine:!0,className:"w-full"}),o.jsxs("div",{className:"absolute bottom-0 left-0 right-0 flex gap-2 p-3 bg-gradient-to-t from-black/70 to-transparent",children:[o.jsxs("button",{onClick:()=>fo(ke,`ugc_${Qe.id}.mp4`),className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/50 hover:bg-black/60 backdrop-blur-sm rounded-xl text-white text-xs font-semibold transition-colors",children:[o.jsx(aa,{size:13})," ",N("common.download")]}),o.jsxs("button",{onClick:()=>Ke(null),className:"flex-1 flex items-center justify-center gap-1.5 px-3 py-2 bg-black/50 hover:bg-black/60 backdrop-blur-sm rounded-xl text-white text-xs font-semibold transition-colors",children:[o.jsx(ir,{size:13})," ",N("ugc.newVideo")]})]})]})]}):o.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[o.jsxs("div",{className:"p-3 border-b border-line shrink-0",children:[o.jsx("div",{className:"flex gap-1.5 flex-wrap mb-1.5",children:I?Array.from({length:6}).map((he,Fe)=>o.jsx(bm,{className:`h-6 rounded-full ${Fe===0?"w-8":Fe%3===0?"w-20":"w-14"}`},Fe)):o.jsxs(o.Fragment,{children:[o.jsx("button",{onClick:()=>{A("all"),V("all"),R(1)},className:`px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${j==="all"?"bg-ink text-base":"bg-raised text-dim hover:bg-line"}`,children:N("model.filter.all")}),w.map(he=>o.jsx("button",{onClick:()=>{A(he.key),V("all"),R(1)},className:`px-2.5 py-1 rounded-full text-xs font-medium transition-colors ${j===he.key?"bg-ink text-base":"bg-raised text-dim hover:bg-line"}`,children:zi(he.displayNames,he.key)},he.id))]})}),sn.length>0&&o.jsxs("div",{className:"flex gap-1.5 flex-wrap",children:[o.jsx("button",{onClick:()=>{V("all"),R(1)},className:`px-2 py-0.5 rounded-full text-[11px] font-medium transition-colors ${F==="all"?"bg-ink text-base":"bg-raised text-dim hover:bg-line"}`,children:N("model.filter.all")}),sn.map(he=>o.jsx("button",{onClick:()=>{V(he),R(1)},className:`px-2 py-0.5 rounded-full text-[11px] font-medium capitalize transition-colors ${F===he?"bg-ink text-base":"bg-raised text-dim hover:bg-line"}`,children:he},he))]})]}),o.jsx("div",{className:"flex-1 overflow-y-auto p-3",children:I?o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-5 md:grid-cols-6 gap-2",children:Array.from({length:18}).map((he,Fe)=>o.jsx(bm,{className:"w-full aspect-[9/16] rounded-xl"},Fe))}):ot.length===0?o.jsx("p",{className:"text-center text-faint py-10 text-sm",children:N("ugc.noEffects")}):o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-5 md:grid-cols-6 gap-2",children:ot.map(he=>o.jsxs("div",{className:"relative group",children:[o.jsxs("button",{onClick:()=>Y(he),className:`w-full rounded-xl overflow-hidden aspect-[9/16] transition-all ${(L==null?void 0:L.id)===he.id?"ring-2 ring-black ring-offset-1":"hover:ring-1 hover:ring-gray-300"}`,children:[o.jsx(ZT,{src:he.coverUrl,thumbnailUrl:he.thumbnailUrl,className:"w-full h-full"}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black/80 to-transparent p-1",children:o.jsx("p",{className:"text-[8px] text-white font-medium truncate",children:he.displayName})}),(L==null?void 0:L.id)===he.id&&o.jsx("div",{className:"absolute top-1 right-1 bg-accent rounded-full p-0.5",children:o.jsx(Ya,{className:"w-3 h-3 text-white"})})]}),o.jsx("button",{onClick:Fe=>{Fe.stopPropagation(),q(he)},className:"absolute top-1 left-1 bg-black/50 hover:bg-black/70 rounded-full p-1 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(PM,{className:"w-2.5 h-2.5 text-white"})})]},he.id))})}),Me>1&&o.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-line shrink-0",children:[o.jsxs("button",{onClick:()=>R(he=>Math.max(1,he-1)),disabled:C===1,className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg text-xs font-medium disabled:opacity-40 hover:bg-raised transition-colors",children:[o.jsx(G3,{className:"w-3.5 h-3.5"})," Prev"]}),o.jsxs("span",{className:"text-xs text-faint",children:[C," / ",Me," · ",Ee.length," effects"]}),o.jsxs("button",{onClick:()=>R(he=>Math.min(Me,he+1)),disabled:C===Me,className:"flex items-center gap-1 px-2.5 py-1.5 rounded-lg text-xs font-medium disabled:opacity-40 hover:bg-raised transition-colors",children:["Next ",o.jsx(Vd,{className:"w-3.5 h-3.5"})]})]})]})})]}),$&&o.jsx("div",{className:"fixed inset-0 bg-black/70 z-50 flex items-center justify-center p-4",onClick:()=>q(null),children:o.jsxs("div",{className:"relative bg-surface rounded-2xl overflow-hidden max-w-xs w-full shadow-2xl",onClick:he=>he.stopPropagation(),children:[o.jsx("div",{className:"aspect-[9/16]",children:o.jsx(ZT,{src:$.coverUrl,className:"w-full h-full",forcePlay:!0,withSound:!0})}),o.jsxs("div",{className:"p-4 flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-semibold text-sm",children:$.displayName}),o.jsxs("p",{className:"text-xs text-faint capitalize",children:[$.category," · ",$.subcategory]})]}),o.jsx("button",{onClick:()=>{Y($),q(null)},className:"px-4 py-2 bg-ink text-base text-sm font-semibold rounded-xl hover:opacity-90 transition-colors",children:N("common.select")})]}),o.jsx("button",{onClick:()=>q(null),className:"absolute top-3 right-3 bg-black/40 text-white p-1.5 rounded-full hover:bg-black/60",children:o.jsx(Wt,{className:"w-4 h-4"})})]})}),o.jsx(vl,{isOpen:_e,selectedModel:P,onSelect:he=>ie(he),onClose:()=>W(!1)}),o.jsx(Ts,{isOpen:n,onClose:()=>a(!1),user:e}),o.jsx(dr,{isOpen:s,onClose:()=>c(!1),user:e})]})};class Dq{static async createJob(e){return(await ct(ut,"createLingerieTryOnJob")(e)).data}}const eS="lingerie_try_on",Oq=4,xm=13,Lq="https://imagedelivery.net/7rExjEZEypWvglDwZ5-zxA/997c930e-93c6-4b0f-d6e1-c2f2b13d7000/public?w=1080";function dx(t){return t.image_urls&&t.image_urls.length>0?t.image_urls[0]:t.imageUrls&&t.imageUrls.length>0?t.imageUrls[0]:t.imageUrl?t.imageUrl:null}const Uq=t=>new Promise(e=>setTimeout(e,t)),hx=t=>t?t.mediaUrl??t.url??null:null,Fq="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Flingerie_samples%2F",Xo=t=>`${Fq}${t}.jpg?alt=media`,Vq=[{value:"virtual-try-on",labelKey:"lingerie.subtitle",descKey:"lingerie.style.keep",icon:Tv,gradient:"from-rose-500 to-pink-600",image:Xo("style_virtual-try-on")},{value:"studio",labelKey:"lingerie.style.studio",descKey:"lingerie.style.studioHint",icon:kp,gradient:"from-zinc-700 to-zinc-900",image:Xo("style_studio")}
5424,{value:"indoor",labelKey:"lingerie.style.indoor",descKey:"lingerie.style.indoorHint",icon:T5,gradient:"from-amber-500 to-orange-600",image:Xo("style_indoor")},{value:"outdoor",labelKey:"lingerie.style.outdoor",descKey:"lingerie.style.outdoorHint",icon:kM,gradient:"from-emerald-500 to-teal-600",image:Xo("style_outdoor")}],zq=[{value:"auto",labelKey:"lingerie.shot.auto",icon:us},{value:"standing",labelKey:"lingerie.posture.standing",image:Xo("posture_standing")},{value:"sitting",labelKey:"lingerie.posture.sitting",image:Xo("posture_sitting")},{value:"side-profile",labelKey:"lingerie.shot.side",image:Xo("posture_side-profile")}],tS=[{value:"auto",labelKey:"lingerie.shot.auto",descKey:"lingerie.shot.autoHint",crop:[0,100]},{value:"headshot",labelKey:"lingerie.shot.headshot",descKey:"lingerie.shot.headshotHint",crop:[0,34]},{value:"medium-shot",labelKey:"lingerie.shot.medium",descKey:"lingerie.shot.mediumHint",crop:[0,62]},{value:"wide-shot",labelKey:"lingerie.shot.full",descKey:"lingerie.shot.fullHint",crop:[0,100]}],Bq=["auto","1:1","9:16","16:9"],Kq=({crop:t,active:e,auto:n})=>{const a=t[0]/100*140,c=t[1]/100*140,u=e?"#ffffff":"#9ca3af";return o.jsxs("svg",{viewBox:"0 0 100 140",className:"w-full h-full",preserveAspectRatio:"xMidYMid meet",children:[o.jsxs("g",{fill:u,opacity:e?.95:.55,children:[o.jsx("circle",{cx:"50",cy:"20",r:"11"}),o.jsx("path",{d:"M37 36 Q50 30 63 36 L60 86 Q50 92 40 86 Z"}),o.jsx("path",{d:"M40 84 L60 84 L57 104 L43 104 Z"}),o.jsx("rect",{x:"43",y:"104",width:"6",height:"34",rx:"3"}),o.jsx("rect",{x:"51",y:"104",width:"6",height:"34",rx:"3"})]}),a>0&&o.jsx("rect",{x:"0",y:"0",width:"100",height:a,fill:"#000",opacity:"0.55"}),c<140&&o.jsx("rect",{x:"0",y:c,width:"100",height:140-c,fill:"#000",opacity:"0.55"}),o.jsx("rect",{x:"6",y:Math.max(a,1)+1,width:"88",height:Math.max(c-a-4,10),rx:"6",fill:"none",stroke:e?"#f43f5e":"#d1d5db",strokeWidth:"2.5"}),n&&o.jsx("text",{x:"50",y:"74",textAnchor:"middle",fontSize:"13",fill:e?"#f43f5e":"#9ca3af",fontWeight:"bold",children:"AUTO"})]})},$q=()=>{const t=De(),e=Xn(),[n,s]=v.useState([]),[a,c]=ze("selectedModel",null),[u,h]=ze("uploadedFiles",[]),[m,p]=v.useState([]),b=v.useRef(u);v.useEffect(()=>{if(!b.current.length)return;const H=b.current.map(oe=>URL.createObjectURL(oe));return p(H),()=>H.forEach(oe=>URL.revokeObjectURL(oe))},[]);const[x,w]=ze("hostedUrls",[]),T=x.length+u.length,[N,j]=ze("photoStyle","virtual-try-on"),[A,F]=ze("pose","auto"),[V,L]=ze("shotType","auto"),[Y,$]=ze("ratio","auto"),[q,I]=v.useState(!1),[S,C]=v.useState("idle"),[R,D]=v.useState(null),[z,P]=v.useState(null),[ie,_e]=v.useState(null),[W,J]=v.useState(Oq),[fe,ce]=v.useState(!1),[ae,O]=v.useState(!0),{user:B,isSubscriptionModalOpen:re,isDiamondModalOpen:pe,setIsSubscriptionModalOpen:de,setIsDiamondModalOpen:me,ensureCanGenerate:we}=hr(),Se=v.useRef(null),Re=v.useRef(!1),Ce=v.useRef(void 0);v.useEffect(()=>{(async()=>{if(!Re.current){Re.current=!0;try{const oe=await nn.getFashionModels({});s(oe.models),oe.models.length>0&&c(se=>se??oe.models[0])}catch{}finally{O(!1),Re.current=!1}}})()},[]),v.useEffect(()=>{let H=!0;return Rr.getStyleById(eS).then(oe=>{H&&(oe!=null&&oe.price)&&J(Number(oe.price))}).catch(()=>{}),()=>{H=!1}},[]),v.useEffect(()=>{let H=!0;return(async()=>{Ce.current===void 0&&(Ce.current=ia("lingerie"));const oe=Ce.current;if(!(!oe||!H)&&(w(se=>se.includes(oe.url)?se:[...se,oe.url]),oe.model))try{const se=await nn.getFashionModelById(oe.model);H&&se&&c(se)}catch(se){console.error("LingerieTryOn handoff model error:",se)}})(),()=>{H=!1}},[]);const $e=H=>{const oe=H.currentTarget.files;if(!oe)return;const se=[],Ee=[];Array.from(oe).forEach(Me=>{T+se.length<xm&&(se.push(Me),Ee.push(URL.createObjectURL(Me)))}),h([...u,...se]),p([...m,...Ee]),H.currentTarget.value=""},Ue=H=>{if(H<x.length){w(x.filter((se,Ee)=>Ee!==H));return}const oe=H-x.length;URL.revokeObjectURL(m[oe]),h(u.filter((se,Ee)=>Ee!==oe)),p(m.filter((se,Ee)=>Ee!==oe))},Qe=async H=>{for(let oe=0;oe<60;oe+=1){await Uq(3e3);const se=await Ln.getMediaById(H);if(!se)continue;const Ee=se.status||"processing";if(Ee==="completed"){D(se),C("completed");return}if(Ee==="failed"){D(se),C("failed"),_e(se.error||se.errorMessage||null),P(se.error||se.errorMessage?null:"studio.error.processingFailed");return}}C("failed"),P("studio.error.timeoutGallery")},Ke=async()=>
5424{if(!q){if(P(null),_e(null),T===0){P("studio.error.uploadGarment");return}if(!a){P("studio.error.selectModel");return}if(await we(W)){I(!0),C("processing"),D(null);try{const H=xt.currentUser;if(!H)throw new Error(t("studio.error.loginFirst"));const oe=dx(a);if(!oe)throw new Error(t("lingerie.error.noModelImage"));const se=[...x];for(const ot of u){const sn=await Ks.uploadPhoto(ot,`users/${H.uid}/uploads/tools/${eS}`);se.push(sn.downloadUrl)}if(se.length===0)throw new Error(t("studio.error.uploadFailed"));const Me=(await Dq.createJob({modelImageUrl:oe,garmentImageUrls:se,style:N,pose:A,plan:V,ratio:Y})).mediaItemId;if(!Me)throw new Error("mediaItemId not returned from createLingerieTryOnJob");await Qe(Me)}catch(H){C("failed"),_e(H.message||null),P(H.message?null:"studio.error.imageFailed")}finally{I(!1)}}}},Ne=T>0&&!!a;return o.jsxs("div",{className:"flex flex-col h-auto xl:h-[calc(100vh-5rem)]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4 shrink-0",children:[o.jsx("button",{onClick:()=>e(-1),className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(di,{size:18})}),o.jsxs("div",{className:"flex-1",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("h1",{className:"text-xl font-bold text-ink",children:t("lingerie.title")}),o.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 rounded-full bg-bad/10 text-rose-600 text-[10px] font-bold border border-rose-100",children:[o.jsx(HS,{size:11})," ",t("lingerie.engine")]})]}),o.jsx("p",{className:"text-xs text-dim",children:t("lingerie.pitch")})]})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 xl:grid-cols-12 gap-5 min-h-0 overflow-y-auto xl:overflow-hidden pb-[calc(6rem+var(--mobile-nav-height,0px))] xl:pb-0",children:[o.jsxs("div",{className:"xl:col-span-5 flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto rounded-2xl border border-line bg-[#f6f6f4] p-4 space-y-4",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:t("studio.garmentPhotosCount",{count:T,max:xm})}),T>0&&o.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-1.5 mt-2",children:[...x,...m].map((H,oe)=>o.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden group",children:[o.jsx("img",{src:H,alt:t("lingerie.garmentAlt",{n:oe+1}),className:"w-full h-full object-cover"}),o.jsx("button",{onClick:()=>Ue(oe),className:"absolute top-0.5 right-0.5 bg-black/70 text-white rounded-full p-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:o.jsx(Wt,{size:10})})]},oe))}),o.jsxs("button",{onClick:()=>{var H;return(H=Se.current)==null?void 0:H.click()},disabled:T>=xm,className:"mt-2 w-full border-2 border-dashed border-line-strong rounded-xl py-3 text-center hover:border-line-strong transition-colors disabled:opacity-50",children:[o.jsx(fl,{size:16,className:"mx-auto text-faint mb-0.5"}),o.jsx("p",{className:"text-xs text-dim",children:T>0?t("lingerie.addMore"):t("lingerie.upload")})]}),o.jsx("input",{ref:Se,type:"file",multiple:!0,accept:"image/*",onChange:$e,disabled:T>=xm,className:"hidden"})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:"Model"}),o.jsxs("button",{onClick:()=>ce(!0),className:"text-xs font-medium text-dim hover:text-ink inline-flex items-center gap-1",children:[t("common.viewAll")," ",o.jsx(Vd,{size:12})]})]}),ae?o.jsx("div",{className:"h-[4.5rem] bg-line rounded-xl animate-pulse mt-2"}):o.jsx("div",{className:"flex gap-1.5 overflow-x-auto mt-2 pb-1",children:[...a?[a]:[],...n.filter(H=>H.id!==(a==null?void 0:a.id))].slice(0,6).map(H=>o.jsx("button",{onClick:()=>c(H),className:`flex-shrink-0 w-14 h-[4.5rem] rounded-lg overflow-hidden border-2 transition-all ${(a==null?void 0:a.id)===H.id?"border-ink ring-2 ring-black/10":"border-line hover:border-line-strong"}`,children:dx(H)?o.jsx("img",{src:dx(H),alt:H.name,className:"w-full h-full object-cover"}):o.jsx("div",{className:"w-full h-full bg-line flex items-center justify-center",children:o.jsx("span",{className:"text-dim text-[8px]",children:H.name})})},H.id))})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:t("lingerie.photographyStyle")}
5424),o.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:Vq.map(H=>{const oe=H.icon,se=N===H.value;return o.jsxs("button",{onClick:()=>j(H.value),className:`group relative text-left rounded-xl border-2 overflow-hidden transition-all ${se?"border-ink ring-2 ring-black/10":"border-line hover:border-line-strong"}`,children:[o.jsxs("div",{className:"relative h-28 bg-raised",children:[o.jsx("img",{src:H.image,alt:t(H.labelKey),loading:"lazy",className:"w-full h-full object-cover object-top"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent"}),o.jsxs("div",{className:"absolute bottom-0 inset-x-0 px-2 py-1.5",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(oe,{size:11,className:"text-white/90"}),o.jsx("p",{className:"text-[11px] font-bold text-white leading-tight",children:t(H.labelKey)})]}),o.jsx("p",{className:"text-[9px] text-dim leading-tight line-clamp-1",children:t(H.descKey)})]})]}),se&&o.jsx(Ya,{size:18,className:"absolute top-1.5 right-1.5 text-white drop-shadow-lg"})]},H.value)})})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:t("lingerie.posture")}),o.jsx("div",{className:"grid grid-cols-4 gap-2 mt-2",children:zq.map(H=>{const oe=A===H.value,se=H.icon;return o.jsxs("button",{onClick:()=>F(H.value),className:`group relative rounded-xl border-2 overflow-hidden transition-all ${oe?"border-ink ring-2 ring-black/10":"border-line hover:border-line-strong"}`,children:[o.jsxs("div",{className:"relative aspect-[3/4] bg-gradient-to-br from-rose-400 to-pink-600",children:[H.image?o.jsx("img",{src:H.image,alt:t(H.labelKey),loading:"lazy",className:"w-full h-full object-cover object-top"}):o.jsx("div",{className:"w-full h-full flex items-center justify-center",children:se&&o.jsx(se,{size:20,className:"text-white/90"})}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 to-transparent"}),o.jsx("p",{className:"absolute bottom-1 inset-x-0 text-center text-[9px] font-bold text-white leading-tight px-0.5",children:t(H.labelKey)})]}),oe&&o.jsx(Ya,{size:15,className:"absolute top-1 right-1 text-white drop-shadow"})]},H.value)})})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:t("lingerie.shotType")}),o.jsx("div",{className:"grid grid-cols-4 gap-2 mt-2",children:tS.map(H=>{const oe=V===H.value;return o.jsxs("button",{onClick:()=>L(H.value),className:`flex flex-col items-center rounded-xl border-2 p-1.5 transition-all ${oe?"border-ink ring-2 ring-black/10 bg-surface":"border-line bg-surface hover:border-line-strong"}`,children:[o.jsx("div",{className:"w-full aspect-[5/7] rounded-lg bg-raised overflow-hidden",children:o.jsx(Kq,{crop:H.crop,active:oe,auto:H.value==="auto"})}),o.jsx("p",{className:`text-[10px] font-bold mt-1 leading-tight ${oe?"text-ink":"text-dim"}`,children:t(H.labelKey)})]},H.value)})}),o.jsx("p",{className:"text-[10px] text-faint mt-1.5",children:(()=>{const H=tS.find(oe=>oe.value===V);return H?t(H.descKey):null})()})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:t("studio.ratio")}),o.jsx("div",{className:"flex gap-1.5 mt-2",children:Bq.map(H=>o.jsx("button",{onClick:()=>$(H),className:`flex-1 py-1.5 rounded-lg text-xs font-medium border transition-all ${Y===H?"bg-ink text-base border-ink":"bg-surface text-dim border-line hover:bg-raised"}`,children:H==="auto"?t("lingerie.shot.auto"):H},H))})]}),S!=="idle"&&o.jsxs("div",{className:"rounded-xl bg-surface border border-line p-3 text-sm",children:[S==="processing"&&o.jsxs("p",{className:"text-dim inline-flex items-center gap-2",children:[o.jsx(et,{size:14,className:"animate-spin"}),t("lingerie.generating")]}),S==="completed"&&o.jsxs("p",{className:"text-ok inline-flex items-center gap-2",children:[o.jsx(Ya,{size:14}),t("studio.completed")]}),S==="failed"&&o.jsxs("p",{className:"text-bad inline-flex items-center gap-2",children:[o.jsx(oo,{size:14}),ie??t(z??"studio.error.processingFailed")]})]})]}),o.jsxs("button",{onClick:()=>void Ke(),disabled:q||!Ne,className:"hidden xl:inline-flex mt-3 w-full items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:[q?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),q?t("ugc.generating"):W>0?t("common.withCost",{label:t("studio.generateAction"),count:W}):t("studio.generateAction")]})]}),o.jsx("div",{className:"fixed bottom-[var(--mobile-nav-height,0px)] left-0 right-0 z-30 bg-surface border-t border-line p-3 xl:hidden",children:o.jsxs("button",{onClick:()=>void Ke(),disabled:q||!Ne,className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[q?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),q?t("ugc.generating"):W>0?t("common.withCost",{label:t("studio.generateAction"),count:W}):t("studio.generateAction")]})}),o.jsx("div",{className:"xl:col-span-7 rounded-2xl border border-line bg-surface overflow-hidden relative flex items-center justify-center min-h-[320px] xl:min-h-[400px]",children:hx(R)?o.jsxs(o.Fragment,{children:[o.jsx("img",{src:hx(R),alt:t("spin.output"),className:"max-h-full max-w-full object-contain",style:{minHeight:"320px"}}),S==="completed"&&o.jsxs("button",{onClick:()=>void fo(hx(R),"lingerie-try-on.jpg"),className:"absolute bottom-4 right-4 inline-flex items-center gap-2 bg-ink text-base px-4 py-2 rounded-xl text-sm font-semibold hover:opacity-90",children:[o.jsx(aa,{size:14})," ",t("common.download")]})]}):S==="processing"?o.jsxs("div",{className:"flex flex-col items-center justify-center text-faint gap-3",children:[o.jsx(et,{size:36,className:"animate-spin text-faint"}),o.jsx("p",{className:"text-sm font-medium",children:t("ugc.generating")})]}):o.jsxs("div",{className:"absolute inset-0",children:[o.jsx("img",{src:Lq,alt:t("lingerie.exampleResult"),className:"w-full h-full object-cover object-top"}),o.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/10 to-black/30"}),o.jsxs("span",{className:"absolute top-4 left-4 inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-black/50 backdrop-blur-md text-white text-[10px] font-bold tracking-wider border border-white/20",children:[o.jsx(us,{size:12})," ",t("lingerie.exampleOutput")]}),o.jsxs("div",{className:"absolute bottom-0 inset-x-0 p-5",children:[o.jsx("p",{className:"text-white font-semibold text-sm",children:t("lingerie.canvasEmpty")}),o.jsx("p",{className:"text-dim text-xs",children:t("lingerie.resultHere")})]})]})})]}),o.jsx(vl,{isOpen:fe,selectedModel:a,onSelect:c,onClose:()=>ce(!1)}),o.jsx(Ts,{isOpen:re,onClose:()=>de(!1),user:B}),o.jsx(dr,{isOpen:pe,onClose:()=>me(!1),user:B})]})},vm=5,fx=15,qq=t=>new Promise(e=>setTimeout(e,t));let mx=!1;function Hq(){return mx?Promise.resolve():new Promise(t=>{if(document.querySelector('script[src*="model-viewer"]')){mx=!0,t();return}const e=document.createElement("script");e.type="module",e.src="https://ajax.googleapis.com/ajax/libs/model-viewer/3.5.0/model-viewer.min.js",e.onload=()=>{mx=!0,t()},document.head.appendChild(e)})}const Gq=()=>{const t=Xn(),e=De(),[n,s]=ze("images",[]),a=v.useRef(n);v.useEffect(()=>{if(!a.current.length)return;const z=a.current.map(P=>({...P,preview:URL.createObjectURL(P.file)}));return s(z),()=>z.forEach(P=>URL.revokeObjectURL(P.preview))},[]);const[c,u]=ze("prompt",""),[h,m]=v.useState(!1),[p,b]=v.useState("idle"),[x,w]=v.useState(null),[T,N]=v.useState(null),[j,A]=v.useState(null),F=v.useRef(null),{user:V,isSubscriptionModalOpen:L,isDiamondModalOpen:Y,setIsSubscriptionModalOpen:$,setIsDiamondModalOpen:q,ensureCanGenerate:I}=hr();v.useEffect(()=>{Hq()},[]),v.useEffect(()=>()=>
5424{n.forEach(z=>URL.revokeObjectURL(z.preview))},[n]);const S=z=>{const P=z.target.files;if(!P)return;const ie=[],_e=vm-n.length;for(let W=0;W<Math.min(P.length,_e);W++){const J=P[W];ie.push({file:J,preview:URL.createObjectURL(J)})}ie.length>0&&(s(W=>[...W,...ie]),A(null),b("idle"),w(null),N(null)),z.target.value=""},C=z=>{s(P=>{const ie=P[z];return URL.revokeObjectURL(ie.preview),P.filter((_e,W)=>W!==z)})},R=async z=>{for(let P=0;P<90;P++){await qq(3e3);const ie=await Ln.getMediaById(z);if(!ie)continue;const _e=ie.status||"processing";if(_e==="completed"){const W=ie.mediaUrl||ie.url||null;if(W){A(W),b("completed");return}}if(_e==="failed"){b("failed"),N(ie.errorMessage||null),w(ie.errorMessage?null:"threed.error.failed");return}}b("failed"),w("studio.error.timeoutGallery")},D=async()=>{if(n.length===0){w("threed.error.needImage");return}if(!c.trim()){w("threed.error.needPrompt");return}if(await I(fx)){w(null),N(null),m(!0),b("processing"),A(null);try{const z=[];for(const ie of n){const _e=await Ks.uploadPhoto(ie.file,`users/${V.uid}/uploads/tools/image_to_3d`);z.push(_e.downloadUrl)}const P=await wK.createImageTo3dJob({prompt:c.trim(),imageUrls:z});if(!P.mediaItemId)throw new Error("No mediaItemId returned");await R(P.mediaItemId)}catch(z){console.error("3D generation failed:",z),b("failed"),N(z.message||null),w(z.message?null:"threed.error.failed")}finally{m(!1)}}};return o.jsxs("div",{className:"flex flex-col h-auto xl:h-[calc(100vh-5rem)]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4 shrink-0",children:[o.jsx("button",{onClick:()=>t(-1),className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(di,{size:18})}),o.jsxs("div",{className:"flex-1 min-w-0",children:[o.jsx("h1",{className:"text-xl font-bold text-ink truncate",children:e("threed.title")}),o.jsx("p",{className:"text-xs text-dim truncate",children:e("threed.subtitle")})]})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 xl:grid-cols-12 gap-5 min-h-0 overflow-y-auto xl:overflow-hidden pb-[calc(6rem+var(--mobile-nav-height,0px))] xl:pb-0",children:[o.jsxs("div",{className:"xl:col-span-5 flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto rounded-2xl border border-line bg-[#f6f6f4] p-4 space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("threed.productImages",{count:n.length,max:vm})}),n.length>0&&o.jsx("div",{className:"mt-2 grid grid-cols-3 gap-2",children:n.map((z,P)=>o.jsxs("div",{className:"relative rounded-xl overflow-hidden bg-raised aspect-square",children:[o.jsx("img",{src:z.preview,alt:`upload-${P}`,className:"w-full h-full object-cover"}),o.jsx("button",{onClick:()=>C(P),className:"absolute top-1 right-1 w-5 h-5 rounded-full bg-black/60 flex items-center justify-center text-white hover:bg-black",children:o.jsx(Wt,{size:10})})]},P))}),n.length<vm&&o.jsxs("label",{className:"mt-2 block rounded-xl border-2 border-dashed border-line-strong bg-surface p-4 cursor-pointer hover:border-line-strong transition-colors text-center",children:[o.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:S,className:"hidden"}),o.jsx(fl,{size:18,className:"mx-auto text-faint mb-1"}),o.jsx("p",{className:"text-xs text-dim",children:e("threed.clickToUpload",{count:vm-n.length})})]})]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("studio.prompt")}),o.jsx("textarea",{value:c,onChange:z=>u(z.target.value),rows:3,placeholder:e("threed.promptPlaceholder"),className:"mt-2 w-full rounded-xl border border-line bg-surface px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-black/10 resize-none"})]}),p!=="idle"&&o.jsxs("div",{className:"rounded-xl bg-surface border border-line p-3 text-sm",children:[p==="processing"&&o.jsx("p",{className:"text-dim",children:e("threed.generatingLong")}),p==="completed"&&o.jsxs("p",{className:"text-ok inline-flex items-center gap-2",children:[o.jsx(Ya,{size:14}),e("threed.ready")]}),p==="failed"&&o.jsxs("p",{className:"text-bad inline-flex items-center gap-2",children:[o.jsx(oo,{size:14}),T??e(x??"studio.error.processingFailed")]})]})]}),o.jsxs("button",{onClick:()=>void D(),disabled:h||n.length===0||!c.trim(),className:"hidden xl:inline-flex mt-3 w-full items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:[h?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),h?e("threed.generatingShort"):e("common.withCost",{label:e("threed.generate"),count:fx})]})]}),o.jsx("div",{className:"fixed bottom-[var(--mobile-nav-height,0px)] left-0 right-0 z-30 bg-surface border-t border-line p-3 xl:hidden",children:o.jsxs("button",{onClick:()=>void D(),disabled:h||n.length===0||!c.trim(),className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[h?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(ir,{size:16}),h?e("threed.generatingShort"):e("common.withCost",{label:e("threed.generate"),count:fx})]})}),o.jsx("div",{ref:F,className:"xl:col-span-7 rounded-2xl border border-line bg-surface overflow-hidden relative flex items-center justify-center min-h-[300px] xl:min-h-[400px]",children:j?o.jsxs(o.Fragment,{children:[o.jsx("model-viewer",{src:j,alt:e("threed.generated"),"auto-rotate":!0,"camera-controls":!0,"shadow-intensity":"1",style:{width:"100%",height:"100%",minHeight:"300px",backgroundColor:"#f9f9f9"}}),p==="completed"&&o.jsxs("button",{onClick:()=>void fo(j,"3d-model.glb"),className:"absolute bottom-4 right-4 inline-flex items-center gap-2 bg-ink text-base px-4 py-2 rounded-xl text-sm font-semibold hover:opacity-90",children:[o.jsx(aa,{size:14})," ",e("threed.downloadGlb")]})]}):o.jsx("div",{className:"flex flex-col items-center justify-center text-faint gap-3",children:p==="processing"?o.jsxs(o.Fragment,{children:[o.jsx(et,{size:36,className:"animate-spin text-faint"}),o.jsx("p",{className:"text-sm font-medium",children:e("threed.generating")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Ev,{size:40,className:"opacity-30"}),o.jsx("p",{className:"text-sm",children:"3D model will appear here"})]})})})]}),o.jsx(Ts,{isOpen:L,onClose:()=>$(!1),user:V}),o.jsx(dr,{isOpen:Y,onClose:()=>q(!1),user:V})]})},Yq=t=>new Promise(e=>setTimeout(e,t)),px=6,Wq=4,wc={white_bg:"pack.shot.whiteBg",on_model:"pack.shot.onModel",pose:"pack.shot.altPose",detail:"pack.shot.detail",lifestyle:"pack.shot.lifestyle",macro:"pack.shot.macro"},Xq="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fpack_examples%2F",Va=t=>`${Xq}${t}.png?alt=media&token=99763aa2-d2bd-4c85-97c6-c9ef98adf2aa`,gx=[{id:"clothing_ecom_pack",labelKey:"pack.clothing",descKey:"pack.clothingShots",icon:jv,examples:[{key:"white_bg",url:Va("clo_white")},{key:"on_model",url:Va("clo_onmodel")},{key:"pose",url:Va("clo_pose")},{key:"detail",url:Va("clo_detail")}]},{id:"jewelry_ecom_pack",labelKey:"pack.jewelry",descKey:"pack.jewelrySh
5424ots",icon:rr,examples:[{key:"white_bg",url:Va("jew_white")},{key:"on_model",url:Va("jew_onmodel")},{key:"lifestyle",url:Va("jew_lifestyle")},{key:"macro",url:Va("jew_macro")}]}],Qq=t=>t.image_urls&&t.image_urls.length>0?t.image_urls[0]:t.imageUrls&&t.imageUrls.length>0?t.imageUrls[0]:t.imageUrl?t.imageUrl:null,Jq=()=>{var O;const[t,e]=ze("selectedPackId",gx[0].id),n=Ah(px),[s,a]=ze("ratio","1:1"),[c,u]=ze("selectedModel",null),[h,m]=v.useState(!1),[p,b]=v.useState(!1),[x,w]=v.useState("idle"),[T,N]=v.useState([]),[j,A]=v.useState(null),[F,V]=v.useState(null),[L,Y]=v.useState(((O=cr("clothing_ecom_pack"))==null?void 0:O.price)??0),{user:$,isSubscriptionModalOpen:q,isDiamondModalOpen:I,setIsSubscriptionModalOpen:S,setIsDiamondModalOpen:C,ensureCanGenerate:R}=hr();v.useEffect(()=>{Rr.getStyleById(t).then(B=>{var pe;const re=Number(B==null?void 0:B.price)||((pe=cr(t))==null?void 0:pe.price)||0;Y(re)}).catch(console.error)},[t]),v.useEffect(()=>{nn.getFashionModels({pageSize:1}).then(B=>{B.models.length>0&&u(re=>re??B.models[0])}).catch(console.error)},[]);const D=B=>{n.addFiles(B),N([]),w("idle")},z=B=>{n.addLibrary(B),N([]),w("idle")},P=async B=>{var re;for(let pe=0;pe<80;pe+=1){await Yq(2500);const de=await Ln.getMediaById(B);if(de){if(de.status==="completed"){const me=((re=de.resultUrls)==null?void 0:re.filter(Se=>Se.url))??[],we=de.mediaUrl??de.url;N(me.length?me:we?[{key:"image",url:we}]:[]),w(me.length||we?"completed":"failed"),!me.length&&!we&&A("pack.error.noImages");return}if(de.status==="failed"){w("failed"),V(de.errorMessage||null),A(de.errorMessage?null:"pack.error.failed");return}}}w("failed"),A("pack.error.timeout")},ie=async()=>{if(n.count===0){A("pack.error.uploadFirst");return}if(await R(L)){A(null),V(null),b(!0),w("processing"),N([]);try{const B=await n.resolve(de=>Ks.uploadPhoto(de,`users/${$.uid}/uploads/packs/${t}`).then(me=>me.downloadUrl)),re=await ra.run({tool:t,imageUrls:B});if(!re.proceed){w("idle");return}const pe=await uo.generate({toolId:t,imageFields:{user_photo:B,...c?{fashion_model:c.id}:{}},ratio:s,precheckHints:re.hints});await P(pe.mediaItemId)}catch(B){console.error("Pack generation failed:",B),w("failed"),V((B==null?void 0:B.message)||null),A(B!=null&&B.message?null:"pack.error.startFailed")}finally{b(!1)}}},_e=T.length||Wq,W=async()=>{for(let B=0;B<T.length;B+=1)await fo(T[B].url,`pack_${T[B].key||B+1}.jpg`)},J=De(),fe=gx.find(B=>B.id===t),ce=x==="idle"?o.jsxs("div",{className:"h-full w-full overflow-y-auto p-4",children:[o.jsx("p",{className:"mb-3 text-center text-xs text-faint",children:J("pack.exampleOutput")}),o.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:fe.examples.map(B=>o.jsxs("div",{className:"relative aspect-[3/4] overflow-hidden rounded-xl border border-line bg-base",children:[o.jsx("img",{src:B.url,alt:wc[B.key]?J(wc[B.key]):B.key,loading:"lazy",className:"h-full w-full object-cover"}),o.jsx("span",{className:"absolute bottom-1.5 left-1.5 rounded bg-black/70 px-1.5 py-0.5 font-mono text-[9px] uppercase tracking-[0.06em] text-white backdrop-blur",children:wc[B.key]?J(wc[B.key]):B.key})]},B.key))})]}):x==="failed"&&!T.length?o.jsx(Sl,{message:F??J(j??"pack.error.failed")}):x==="processing"?o.jsx(Tl,{label:J("pack.renderingShots",{count:_e})}):o.jsx("div",{className:"h-full w-full overflow-y-auto p-4",children:o.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:Array.from({length:_e}).map((B,re)=>{const pe=T[re],de=pe&&wc[pe.key]?J(wc[pe.key]):void 0;return o.jsxs("div",{className:"relative flex aspect-[3/4] items-center justify-center overflow-hidden rounded-xl border border-line bg-base",children:[pe?o.jsx("img",{src:pe.url,alt:de??"",className:"h-full w-full object-cover"}):o.jsx(et,{size:18,className:"animate-spin text-faint"}),de&&o.jsxs("span",{className:"absolute bottom-1.5 left-1.5 inline-flex items-center gap-1 rounded bg-base/80 px-1.5 py-0.5 font-mono text-[9px] uppercase text-ink backdrop-blur",children:[o.jsx(Cn,{size:9})," ",de]})]},(pe==null?void 0:pe.key)??re)})})}),ae=T.length>0?o.jsxs("div",{className:"flex items-center justify-between rounded-panel border border-line bg-surface px-3 py-2",children:[o.jsxs("span",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:[T.length," shots rendered"]}),o.jsxs("button",{onClick:()=>void W(),className:"inline-flex items-center gap-1.5 rounded-lg bg-ink px-3 py-1.5 text-[11px] font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(aa,{size:12})," ",J("common.downloadAll")]})]}):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:J("pack.title"),subtitle:J(fe.descKey),status:x,canvas:ce,runStrip:ae,action:o.jsx(wl,{onClick:()=>void ie(),busy:p,disabled:n.count===0,cost:L,label:J("pack.generate"),busyLabel:J("pack.rendering")}),children:[o.jsx(Nt,{label:J("pack.type"),children:o.jsx(u$,{value:t,onChange:B=>{e(B),N([]),w("idle")},options:gx.map(B=>({value:B.id,label:J(B.labelKey),icon:o.jsx(B.icon,{size:12})}))})}),o.jsx(Nt,{label:J("pack.productPhotos"),hint:`${n.count}/${px}`,children:o.jsx(ho,{previews:n.previews,onFiles:D,onRemove:n.removeAt,onPickLibrary:n.openPicker,max:px,hint:J("pack.photosHint")})}),o.jsx(Nt,{label:J("studio.model"),hint:J("common.optional"),children:o.jsx(Za,{label:J("pack.onModelUse"),value:(c==null?void 0:c.name)??null,imageUrl:c?Qq(c):null,placeholder:J("pack.anyModel"),onClick:()=>m(!0),onClear:()=>u(null)})}),o.jsx(Nt,{label:J("studio.ratio"),children:o.jsx(_l,{value:s,options:Sh,onChange:a})}),(F||j)&&o.jsx(El,{children:F??J(j)})]}),o.jsx(vl,{isOpen:h,onClose:()=>m(!1),onSelect:B=>{u(B),m(!1)},selectedModel:c}),o.jsx(fu,{open:n.pickerOpen,onClose:n.closePicker,remaining:n.remaining,onPick:z}),o.jsx(Ts,{isOpen:q,onClose:()=>S(!1),user:$}),o.jsx(dr,{isOpen:I,onClose:()=>C(!1),user:$})]})},Zq=t=>new Promise(e=>setTimeout(e,t)),yx=4,eH=["3:4","1:1","9:16"],nS=3,sS=24,bx=t=>t.mediaUrl??t.url??"",tH=()=>{const t=De(),[e,n]=ze("step","browse"),[s,a]=v.useState([]),[c,u]=v.useState(null),[h,m]=v.useState(!0),[p,b]=v.useState(!1),[x,w]=v.useState(""),[T,N]=v.useState(""),[j,A]=ze("set",null),[F,V]=ze("shotIds",[]),L=Ah(yx);v.useEffect(()=>{const H=ia("catalogue");return H&&L.addLibrary([H.url]),()=>{}},[]);const[Y,$]=ze("ratio","3:4"),[q,I]=v.useState(nS),[S,C]=v.useState(!1),[R,D]=v.useState("idle"),[z,P]=v.useState([]),[ie,_e]=v.useState(null),{user:W,ensureCanGenerate:J,isSubscriptionModalOpen:fe,setIsSubscriptionModalOpen:ce,isDiamondModalOpen:ae,setIsDiamondModalOpen:O}=hr();v.useEffect(()=>{(async()=>{await bp.initialize();const H=bp.getNumber("catalog_shoot_cost_per_shot");if(H>0){I(H);return}const oe=await Rr.getStyleById("catalog_shoot");I(Number(oe==null?void 0:oe.price)||nS)})()},[]),v.useEffect(()=>{let H=!0;return m(!0),Ld.getTemplateSets({sort:T?"popular":"curated",query:T||void 0,limit:sS}).then(oe=>{H&&(a(oe.sets),u(oe.nextCursor))}).catch(()=>{H&&a([])}).finally(()=>{H&&m(!1)}),()=>{H=!1}},[T]);const B=async()=>
5424{if(!(c===null||p)){b(!0);try{const H=await Ld.getTemplateSets({sort:T?"popular":"curated",query:T||void 0,limit:sS,startAfter:c});a(oe=>[...oe,...H.sets]),u(H.nextCursor)}catch(H){console.warn("[catalogue] load more failed",H)}finally{b(!1)}}},re=H=>{A(H),V(H.shots.filter(oe=>oe.isDefault).map(oe=>oe.id)),P([]),D("idle"),_e(null),n("shots")},pe=H=>V(oe=>oe.includes(H)?oe.filter(se=>se!==H):[...oe,H]),de=H=>{L.addFiles(H),P([]),D("idle")},me=H=>{L.addLibrary(H),P([]),D("idle")},we=q*F.length,Se=v.useMemo(()=>z.filter(H=>H.status==="completed"&&bx(H)),[z]),Re=async H=>{for(let oe=0;oe<120;oe+=1){await Zq(2500);const se=await Ln.getPackChildren(H);se.length&&P(se);const Ee=se.filter(Me=>Me.status==="completed"||Me.status==="failed").length;if(se.length>0&&Ee>=se.length){const Me=se.some(ot=>ot.status==="completed");D(Me?"completed":"failed"),Me||_e(t("catalogue.error.allFailed"));return}}D("failed"),_e(t("catalogue.error.timeout"))},Ce=async()=>{if(!j){_e(t("catalogue.error.pickSet"));return}if(L.count===0){_e(t("catalogue.error.uploadGarment"));return}if(!F.length){_e(t("catalogue.error.selectShot"));return}if(await J(we)){_e(null),C(!0),D("processing"),P([]);try{const H=await L.resolve(Ee=>Ks.uploadPhoto(Ee,`users/${W.uid}/uploads/catalogue/${j.id}`).then(Me=>Me.downloadUrl));if(!(await ra.run({tool:"pro_studio",imageUrls:H})).proceed){D("idle");return}const se=await Ld.createCatalogJob({templateSetId:j.id,garmentUrls:H,shotIds:F,ratio:Y});await Re(se.mediaItemId)}catch(H){console.error("Catalogue generation failed:",H),D("failed"),_e((H==null?void 0:H.message)||t("catalogue.error.startFailed"))}finally{C(!1)}}},$e=async()=>{for(let H=0;H<Se.length;H+=1)await fo(bx(Se[H]),`catalogue_${H+1}.jpg`)},Ue=o.jsxs(o.Fragment,{children:[o.jsx(fu,{open:L.pickerOpen,onClose:L.closePicker,remaining:L.remaining,onPick:me}),o.jsx(Ts,{isOpen:fe,onClose:()=>ce(!1),user:W}),o.jsx(dr,{isOpen:ae,onClose:()=>O(!1),user:W})]});if(e==="browse")return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-6",children:[o.jsxs("header",{className:"flex flex-wrap items-end justify-between gap-4",children:[o.jsxs("div",{children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-faint",children:t("catalogue.step1")}),o.jsx("h1",{className:"mt-1 text-2xl font-bold tracking-tight text-ink",children:t("catalogue.title")}),o.jsx("p",{className:"mt-1.5 max-w-lg text-sm text-dim",children:t("catalogue.intro")})]}),o.jsxs("form",{onSubmit:H=>{H.preventDefault(),N(x.trim())},className:"flex items-center gap-2 rounded-xl border border-line bg-surface px-3 py-2",children:[o.jsx(zd,{size:14,className:"shrink-0 text-faint"}),o.jsx("input",{value:x,onChange:H=>w(H.target.value),placeholder:t("catalogue.searchSets"),className:"w-44 bg-transparent text-sm text-ink outline-none placeholder:text-faint"}),T&&o.jsx("button",{type:"button","aria-label":t("catalogue.clearSearch"),onClick:()=>{w(""),N("")},className:"text-faint transition-colors hover:text-ink",children:o.jsx(Wt,{size:13})})]})]}),h?o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6",children:Array.from({length:12}).map((H,oe)=>o.jsx("div",{className:"aspect-[3/4] animate-pulse rounded-panel bg-raised"},oe))}):s.length===0?o.jsx("div",{className:"rounded-panel border border-dashed border-line px-6 py-16 text-center",children:o.jsx("p",{className:"text-sm text-dim",children:t("catalogue.noMatch",{query:T})})}):o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-5 xl:grid-cols-6",children:s.map(H=>o.jsxs("button",{type:"button",onClick:()=>re(H),className:"group relative aspect-[3/4] overflow-hidden rounded-panel border border-line transition-colors hover:border-accent",children:[H.coverUrl?o.jsx("img",{src:H.coverUrl,alt:"",loading:"lazy",className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-105"}):o.jsx("span",{className:"flex h-full items-center justify-center bg-base text-[10px] text-faint",children:H.id}),o.jsxs("span",{className:"absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 to-transparent px-2.5 pb-2 pt-8 text-left",children:[o.jsx("span",{className:"block truncate text-xs font-bold text-white",children:zi(H.displayNames,H.id)}),o.jsx("span",{className:"mt-0.5 block font-mono text-[9px] uppercase tracking-[0.06em] text-white/70",children:t("catalogue.shotsCount",{count:H.shotCount})})]}),o.jsxs("span",{className:"absolute inset-x-2 top-2 flex items-center justify-center gap-1 rounded-md bg-accent py-1 text-[10px] font-bold uppercase tracking-[0.06em] text-base opacity-0 transition-opacity group-hover:opacity-100",children:[t("catalogue.choose")," ",o.jsx(ks,{size:10})]})]},H.id))}),c!==null&&o.jsx("div",{className:"flex justify-center",children:o.jsxs("button",{onClick:()=>void B(),disabled:p,className:"inline-flex items-center gap-2 rounded-xl border border-line px-5 py-2.5 text-sm font-bold text-dim transition-colors hover:border-line-strong hover:text-ink disabled:opacity-50",children:[p&&o.jsx(et,{size:13,className:"animate-spin"}),t("catalogue.loadMore")]})})]})]}),Ue]});if(e==="shots"&&j){const H=F.length===j.shots.length;return o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"space-y-6 pb-24",children:[o.jsxs("header",{className:"flex items-start gap-3",children:[o.jsx("button",{onClick:()=>n("browse"),"aria-label":t("catalogue.backToSets"),className:"mt-0.5 rounded-xl p-2 text-dim transition-colors hover:bg-raised hover:text-ink",children:o.jsx(di,{size:18})}),j.coverUrl&&o.jsx("img",{src:j.coverUrl,alt:"",className:"h-16 w-12 shrink-0 rounded-lg border border-line object-cover"}),o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.1em] text-faint",children:t("catalogue.step2")}),o.jsx("h1",{className:"mt-0.5 truncate text-xl font-bold tracking-tight text-ink",children:zi(j.displayNames,j.id)}),o.jsx("p",{className:"mt-0.5 line-clamp-2 text-sm text-dim",children:zi(j.description,"")||t("catalogue.shotsInShoot",{count:j.shotCount})})]})]}),o.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[o.jsx("button",{type:"button",onClick:()=>V(H?[]:j.shots.map(oe=>oe.id)),className:"rounded-lg border border-line px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.06em] text-dim transition-colors hover:border-line-strong hover:text-ink",children:H?t("catalogue.clearAll"):t("catalogue.selectAll",{count:j.shots.length})}),o.jsx("button",{type:"button",onClick:()=>V(j.shots.filter(oe=>oe.isDefault).map(oe=>oe.id)),className:"rounded-lg border border-line px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.06em] text-dim transition-colors hover:border-line-strong hover:text-ink",children:t("catalogue.recommended")}),o.jsx("span",{className:"font-mono text-[11px] uppercase tracking-[0.06em] text-faint",children:t("catalogue.selectedCount",{selected:F.length,total:j.shots.length})})]}),o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4 lg:grid-cols-6",children:j.shots.map(oe=>{const se=F.includes(oe.id);return o.jsxs("button",{type:"button",onClick:()=>pe(oe.id),"aria-pressed":se,className:`group relative aspect-[4/5] overflow-hidden rounded-panel border-2 transition-all ${se?"border-accent":"border-transparent opacity-45 hover:opacity-80"}`,children:[oe.thumbUrl||oe.previewUrl?o.jsx("img",{src:oe.thumbUrl||oe.previewUrl,alt:oe.shotType,loading:"lazy",className:"h-full w-full object-cover"}):o.jsx("span",{className:"flex h-full items-center justify-center bg-base text-[10px] text-faint",children:oe.shotType}),se&&o.jsx("span",{className:"absolute right-1.5 top-1.5 rounded-full bg-accent p-1 text-base",children:o.jsx(Cn,{size:11})}),o.jsx("span",{className:"absolute inset-x-1.5 bottom-1.5 flex items-center justify-center gap-1 rounded-md bg-black/70 py-1 text-[10px] font-bold uppercase tracking-[0.06em] text-white opacity-0 backdrop-blur transition-opacity group-hover:opacity-100",children:se?o.jsxs(o.Fragment,{children:[o.jsx(Wt,{size:10})," ",t("catalogue.drop")]}):o.jsxs(o.Fragment,{children:[o.jsx(Cn,{size:10})," ",t("catalogue.add")]})})]},oe.id)})})]}),o.jsx("div",{className:"fixed inset-x-0 bottom-[var(--mobile-nav-height,0px)] z-40 border-t border-line bg-surface/95 backdrop-blur",children:o.jsxs("div",{className:"flex items-center gap-4 px-6 py-3",children:[o.jsxs("div",{className:"min-w-0 flex-1",children:[o.jsx("p",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:t("catalogue.shotsTimesPr
5424ice",{count:F.length,price:q})}),o.jsxs("p",{className:"inline-flex items-center gap-1 text-sm font-bold text-ink",children:[o.jsx(Bc,{size:12,className:"text-accent"}),t("catalogue.total",{total:we})]})]}),o.jsxs("button",{onClick:()=>n("setup"),disabled:F.length===0,className:"inline-flex items-center gap-2 rounded-xl bg-ink px-6 py-3 text-sm font-bold text-base transition-opacity hover:opacity-90 disabled:opacity-40",children:[t("catalogue.continue")," ",o.jsx(ks,{size:14})]})]})}),Ue]})}const Qe=z.length||F.length||(j==null?void 0:j.shotCount)||4,Ke=R==="idle"?o.jsx(Nh,{message:t("catalogue.canvasEmpty"),children:o.jsx(kp,{size:26,className:"text-faint"})}):R==="failed"&&!Se.length?o.jsx(Sl,{message:ie??t("catalogue.error.generic")}):R==="processing"&&!z.length?o.jsx(Tl,{label:t("catalogue.rendering",{count:F.length})}):o.jsx("div",{className:"h-full w-full overflow-y-auto p-4",children:o.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 lg:grid-cols-4",children:Array.from({length:Qe}).map((H,oe)=>{const se=z[oe],Ee=(se==null?void 0:se.status)==="completed",Me=(se==null?void 0:se.status)==="failed";return o.jsx("div",{className:"relative flex aspect-[4/5] items-center justify-center overflow-hidden rounded-xl border border-line bg-base",children:Ee?o.jsx("img",{src:bx(se),alt:"",className:"h-full w-full object-cover"}):Me?o.jsx("span",{className:"text-[11px] text-bad",children:t("catalogue.shotFailed")}):o.jsx(et,{size:18,className:"animate-spin text-faint"})},(se==null?void 0:se.id)??oe)})})}),Ne=Se.length>0?o.jsxs("div",{className:"flex items-center justify-between rounded-panel border border-line bg-surface px-3 py-2",children:[o.jsx("span",{className:"font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:t("catalogue.renderedCount",{done:Se.length,total:Qe})}),o.jsxs("button",{onClick:()=>void $e(),className:"inline-flex items-center gap-1.5 rounded-lg bg-ink px-3 py-1.5 text-[11px] font-bold text-base transition-opacity hover:opacity-90",children:[o.jsx(aa,{size:12})," ",t("catalogue.downloadAll")]})]}):void 0;return o.jsxs(o.Fragment,{children:[o.jsxs(kl,{title:j?zi(j.displayNames,j.id):t("catalogue.title"),subtitle:t("catalogue.step3",{c
5424ount:F.length}),status:R,canvas:Ke,runStrip:Ne,onBack:()=>n("shots"),action:o.jsxs("div",{className:"space-y-2",children:[o.jsx("p",{className:"text-center font-mono text-[10px] uppercase tracking-[0.08em] text-faint",children:t("catalogue.priceLine",{price:q,count:F.length})}),o.jsx(wl,{onClick:()=>void Ce(),busy:S,disabled:!j||L.count===0||!F.length,cost:we,label:t("catalogue.render"),busyLabel:t("catalogue.renderingShort")})]}),children:[o.jsx(Nt,{label:t("catalogue.garmentPhotos"),hint:`${L.count}/${yx}`,children:o.jsx(ho,{previews:L.previews,onFiles:de,onRemove:L.removeAt,onPickLibrary:L.openPicker,max:yx,hint:t("catalogue.garmentHint")})}),o.jsx(Nt,{label:t("catalogue.ratio"),children:o.jsx(_l,{value:Y,options:eH,onChange:$})}),o.jsx(Nt,{label:t("catalogue.selectedShoot"),children:o.jsxs("button",{type:"button",onClick:()=>n("shots"),className:"flex w-full items-center gap-3 rounded-xl border border-line bg-base p-2 text-left transition-colors hover:border-line-strong",children:[(j==null?void 0:j.coverUrl)&&o.jsx("img",{src:j.coverUrl,alt:"",className:"h-11 w-11 shrink-0 rounded-lg object-cover"}),o.jsxs("span",{className:"min-w-0 flex-1",children:[o.jsx("span",{className:"block truncate text-sm font-medium text-ink",children:j?zi(j.displayNames,j.id):"—"}),o.jsx("span",{className:"block font-mono text-[10px] uppercase tracking-[0.06em] text-faint",children:t("catalogue.changeShoot",{count:F.length})})]})]})}),ie&&o.jsx(El,{children:ie})]}),Ue]})},nH=t=>new Promise(e=>setTimeout(e,t)),rS="spin_360_onmodel",iS="spin_360_standalone",sH="spin_360",xx=9,rH=OC,iH=t=>t?t.mediaUrl??t.url??null:null,aH=()=>{const t=Xn(),e=De(),[n,s]=ze("mode","on_model"),[a,c]=v.useState(null),[u,h]=v.useState(null),[m,p]=ze("photos",[]),b=v.useRef(m);v.useEffect(()=>{if(!b.current.length)return;const ae=b.current.map(O=>({...O,preview:URL.createObjectURL(O.file)}));return p(ae),()=>ae.forEach(O=>URL.revokeObjectURL(O.preview))},[]);const[x,w]=v.useState(!1),[T,N]=v.useState("idle"),[j,A]=v.useState(null),[F,V]=v.useState(null),[L,Y]=v.useState(null),$=n==="on_model"?a:u,q=v.useMemo(()=>Number(($==null?void 0:$.price)||(n==="on_model"?40:30)),[$,n]),{user:I,isSubscriptionModalOpen:S,isDiamondModalOpen:C,setIsSubscriptionModalOpen:R,setIsDiamondModalOpen:D,ensureCanGenerate:z}=hr();v.useEffect(()=>{let ae=!0;return Rr.getStyleById(rS).then(O=>ae&&c(O)).catch(()=>{}),Rr.getStyleById(iS).then(O=>ae&&h(O)).catch(()=>{}),()=>{ae=!1}},[]),v.useEffect(()=>()=>{m.forEach(ae=>URL.revokeObjectURL(ae.preview))},[]);const P=ae=>{const O=Array.from(ae.target.files??[]);O.length!==0&&(p(B=>{const re=xx-B.length,pe=O.slice(0,re).map(de=>({file:de,preview:URL.createObjectURL(de)}));return[...B,...pe]}),A(null),N("idle"),ae.target.value="")},ie=ae=>{p(O=>{const B=O[ae];return B&&URL.revokeObjectURL(B.preview),O.filter((re,pe)=>pe!==ae)}),A(null),N("idle")},_e=ae=>{s(ae),A(null),N("idle"),V(null),Y(null)},W=m.length>=1,J=async ae=>{for(let O=0;O<80;O++){await nH(3e3);const B=await Ln.getMediaById(ae);if(!B)continue;const re=B.status||"processing";if(re==="completed"){A(B),N("completed");return}if(re==="failed"){A(B),N("failed"),Y(B.errorMessage||null),V(B.errorMessage?null:"spin.error.failed");return}}N("failed"),V("studio.error.timeoutGallery")},fe=async()=>{if(!W){V("studio.error.uploadGarment");return}if(await z(q)){V(null),Y(null),w(!0),N("processing"),A(null);try{const ae=await Promise.all(m.map(async de=>(await Ks.uploadPhoto(de.file,`users/${I.uid}/uploads/tools/${sH}`)).downloadUrl));let O,B;n==="on_model"?(O=rS,B={front:ae[0],references:ae.slice(1)}):(O=iS,B={images:ae});const pe=(await nn.createFashionJob({prompt:"360 degree spinning packshot video",styleId:O,imageFields:B})).mediaItemId;if(!pe)throw new Error("mediaItemId not returned");await J(pe)}catch(ae){console.error("360 packshot generation failed:",ae),N("failed"),Y((ae==null?void 0:ae.message)||null),V(ae!=null&&ae.message?null:"studio.error.startFailed")}finally{w(!1)}}},ce=iH(j);return o.jsxs("div",{className:"flex flex-col h-auto xl:h-[calc(100vh-5rem)]",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-4 shrink-0",children:[o.jsx("button",{onClick:()=>t(-1),className:"p-2 rounded-xl hover:bg-raised text-dim",children:o.jsx(di,{size:18})}),o.jsxs("div",{children:[o.jsx("h1",{className:"text-xl font-bold text-ink",children:"360 Spinning Packshot"}),o.jsx("p",{className:"text-xs text-dim",children:e("spin.pitch")})]})]}),o.jsxs("div",{className:"flex-1 grid grid-cols-1 xl:grid-cols-12 gap-5 min-h-0 overflow-y-auto xl:overflow-hidden pb-[calc(6rem+var(--mobile-nav-height,0px))] xl:pb-0",children:[o.jsxs("div",{className:"xl:col-span-5 flex flex-col min-h-0",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto rounded-2xl border border-line bg-[#f6f6f4] p-4 space-y-3",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("spin.output")}),o.jsx("div",{className:"flex p-0.5 bg-surface rounded-xl border border-line gap-0.5 mt-2",children:[{m:"on_model",labelKey:"spin.onModel",icon:Bd},{m:"standalone",labelKey:"spin.standalone",icon:Tr}].map(({m:ae,labelKey:O,icon:B})=>o.jsxs("button",{onClick:()=>_e(ae),className:`flex-1 flex items-center justify-center gap-1.5 py-1.5 rounded-lg text-xs font-semibold transition-all ${n===ae?"bg-ink text-base":"text-dim hover:text-ink"}`,children:[o.jsx(B,{size:12}),e(O)]},ae))})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsx("label",{className:"text-xs font-semibold text-dim uppercase tracking-wide",children:e("studio.garmentPhotosCount",{count:m.length,max:x
5424x})}),o.jsx("span",{className:"text-[11px] text-faint",children:e("spin.moreAngles")})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-2 mt-2",children:[m.map((ae,O)=>o.jsxs("div",{className:"relative rounded-xl overflow-hidden bg-raised aspect-square flex items-center justify-center",children:[o.jsx("img",{src:ae.preview,alt:`angle-${O+1}`,className:"w-full h-full object-cover"}),O===0&&n==="on_model"&&o.jsx("span",{className:"absolute bottom-1 left-1 text-[9px] font-semibold bg-black/70 text-white px-1.5 py-0.5 rounded",children:"FRONT"}),o.jsx("button",{onClick:()=>ie(O),className:"absolute top-1 right-1 w-5 h-5 rounded-full bg-black/60 flex items-center justify-center text-white hover:bg-black",children:o.jsx(Wt,{size:10})})]},O)),m.length<xx&&o.jsxs("label",{className:"rounded-xl border-2 border-dashed border-line-strong bg-surface aspect-square flex flex-col items-center justify-center cursor-pointer hover:border-line-strong transition-colors text-center",children:[o.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:P,className:"hidden"}),m.length===0?o.jsxs(o.Fragment,{children:[o.jsx(fl,{size:18,className:"text-faint mb-1"}),o.jsx("span",{className:"text-[11px] text-dim",children:e("common.upload")})]}):o.jsxs(o.Fragment,{children:[o.jsx(Kc,{size:18,className:"text-faint mb-1"}),o.jsx("span",{className:"text-[11px] text-dim",children:"Add angle"})]})]})]})]}),o.jsx("div",{className:"rounded-xl bg-surface border border-line p-3 text-[11px] text-dim leading-relaxed",children:n==="on_model"?o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-semibold text-dim",children:e("spin.tip")})," ",e("spin.tipOnModel")]}):o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"font-semibold text-dim",children:e("spin.tip")})," ",e("spin.tipStandalone")]})}),T!=="idle"&&o.jsxs("div",{className:"rounded-xl bg-surface border border-line p-3 text-sm",children:[T==="processing"&&o.jsxs("p",{className:"text-dim inline-flex items-center gap-2",children:[o.jsx(et,{size:14,className:"animate-spin"}),e("spin.generating")]}),T==="completed"&&o.jsxs("p",{className:"text-ok inline-flex items-center gap-2",children:[o.jsx(Ya,{size:14}),e("spin.ready")]}),T==="failed"&&o.jsxs("p",{className:"text-bad inline-flex items-center gap-2",children:[o.jsx(oo,{size:14}),L??e(F??"studio.error.generic")]})]})]}),o.jsxs("button",{onClick:()=>void fe(),disabled:x||!W,className:"hidden xl:inline-flex mt-3 w-full items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed shrink-0",children:[x?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(Sx,{size:16}),x?e("common.processing"):q>0?e("common.withCost",{label:e("spin.generate"),count:q}):e("spin.generate")]})]}),o.jsx("div",{className:"fixed bottom-[var(--mobile-nav-height,0px)] left-0 right-0 z-30 bg-surface border-t border-line p-3 xl:hidden",children:o.jsxs("button",{onClick:()=>void fe(),disabled:x||!W,className:"w-full inline-flex items-center justify-center gap-2 rounded-xl bg-ink text-base px-4 py-3.5 font-semibold hover:opacity-90 disabled:opacity-50 disabled:cursor-not-allowed",children:[x?o.jsx(et,{size:16,className:"animate-spin"}):o.jsx(Sx,{size:16}),x?e("common.processing"):q>0?e("common.withCost",{label:e("spin.generate"),count:q}):e("spin.generate")]})}),o.jsx("div",{className:"xl:col-span-7 rounded-2xl border border-line bg-surface overflow-hidden relative flex items-center justify-center min-h-[250px] xl:min-h-[400px]",children:ce?o.jsxs(o.Fragment,{children:[o.jsx("video",{src:ce,controls:!0,autoPlay:!0,loop:!0,className:"max-h-full max-w-full",style:{minHeight:"250px"}}),T==="completed"&&o.jsxs("button",{onClick:()=>void fo(ce,"spin-360-packshot.mp4"),className:"absolute bottom-4 right-4 inline-flex items-center gap-2 bg-ink text-base px-4 py-2 rounded-xl text-sm font-semibold hover:opacity-90",children:[o.jsx(aa,{size:14})," ",e("common.download")]})]}):T==="processing"?o.jsxs("div",{className:"flex flex-col items-center justify-center text-faint gap-3",children:[o.jsx(et,{size:36,className:"animate-spin text-faint"}),o.jsx("p",{className:"text-sm font-medium",children:e("spin.spinningUp")}),o.jsx("p",{className:"text-xs text-faint",children:e("spin.takesSeconds")})]}):o.jsxs(o.Fragment,{children:[o.jsx("video",{src:rH[n],autoPlay:!0,muted:!0,loop:!0,playsInl
5424ine:!0,className:"max-h-full max-w-full",style:{minHeight:"250px"}}),o.jsxs("span",{className:"absolute top-3 left-3 inline-flex items-center gap-1.5 bg-black/60 text-white text-[11px] font-semibold px-2.5 py-1 rounded-full",children:[o.jsx(us,{size:12})," ",e("common.example")]})]})})]}),o.jsx(Ts,{isOpen:S,onClose:()=>R(!1),user:I}),o.jsx(dr,{isOpen:C,onClose:()=>D(!1),user:I})]})},oH={success:kv,error:n5,info:FS,warning:oo},lH={success:{bar:"bg-surface border border-line shadow-xl",icon:"text-emerald-500",progress:"bg-emerald-400"},error:{bar:"bg-surface border border-line shadow-xl",icon:"text-red-500",progress:"bg-red-400"},info:{bar:"bg-surface border border-line shadow-xl",icon:"text-blue-500",progress:"bg-blue-400"},warning:{bar:"bg-surface border border-line shadow-xl",icon:"text-amber-500",progress:"bg-amber-400"}},cH=3500,uH=({toast:t,onDismiss:e})=>{const n=De(),[s,a]=v.useState(!1),[c,u]=v.useState(!1),h=t.durationMs??cH,m=lH[t.type],p=oH[t.type],b=v.useCallback(()=>{u(!0),setTimeout(()=>e(t.id),350)},[t.id,e]);return v.useEffect(()=>{const x=setTimeout(()=>a(!0),10),w=setTimeout(b,h);return()=>{clearTimeout(x),clearTimeout(w)}},[b,h]),o.jsxs("div",{className:`flex items-start gap-3 rounded-2xl px-4 py-3 min-w-[280px] max-w-sm transition-all duration-350 ease-out ${m.bar} ${s&&!c?"translate-x-0 opacity-100":"translate-x-12 opacity-0"}`,children:[o.jsx(p,{size:20,className:`flex-shrink-0 mt-0.5 ${m.icon}`}),o.jsx("p",{className:"flex-1 text-sm font-medium text-ink leading-snug",children:t.message}),o.jsx("button",{onClick:b,"aria-label":n("common.dismiss"),className:"flex-shrink-0 text-faint hover:text-dim transition-colors",children:o.jsx(Wt,{size:16})}),o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-[3px] rounded-b-2xl overflow-hidden",children:o.jsx("div",{className:`h-full ${m.progress} origin-left`,style:{animation:`shrink ${h}ms linear forwards`}})})]})};let dH=1;const hH=()=>{const[t,e]=v.useState([]);v.useEffect(()=>_t.subscribe(s=>{const a=dH++;e(c=>[...c,{...s,id:a}])}),[]);const n=v.useCallback(s=>{e(a=>a.filter(c=>c.id!==s))},[]);return t.length===0?null:o.jsxs(o.Fragment,{children:[o.jsx("style",{children:`
5425        @keyframes shrink {
5426          from { transform: scaleX(1); }
5427          to   { transform: scaleX(0); }
5428        }
5429      `}),o.jsx("div",{className:"fixed bottom-6 right-6 z-[100] flex flex-col items-end gap-3 lg:bottom-20",children:t.map(s=>o.jsx("div",{className:"relative",children:o.jsx(uH,{toast:s,onDismiss:n})},s.id))})]})},fH=()=>{const t=De(),[e,n]=v.useState(null);return v.useEffect(()=>ra.subscribe(n),[]),v.useEffect(()=>{if(!e)return;const s=a=>{a.key==="Escape"&&e.resolve(!1)};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e]),e?o.jsx("div",{className:"fixed inset-0 z-[60] flex items-end justify-center bg-black/70 p-0 backdrop-blur-sm sm:items-center sm:p-4",onClick:()=>e.resolve(!1),children:o.jsxs("div",{className:"max-h-[85vh] w-full max-w-md overflow-y-auto rounded-t-panel border border-line bg-surface p-6 shadow-lift sm:rounded-panel",onClick:s=>s.stopPropagation(),children:[o.jsx("div",{className:"mx-auto mb-4 flex h-11 w-11 items-center justify-center rounded-full bg-accent-soft",children:o.jsx(Nv,{size:22,className:"text-accent"})}),o.jsx("h3",{className:"text-center text-[17px] font-bold text-ink",children:t("precheck.title")}),o.jsx("p",{className:"mt-1 text-center text-[13px] leading-relaxed text-faint",children:t("precheck.subtitle")}),o.jsx("ul",{className:"mt-4 space-y-2",children:e.findings.map((s,a)=>{var h;const c=s.severity==="strong",u=c?dh:FS;return o.jsx("li",{className:"rounded-xl bg-black/[0.035] p-3.5 dark:bg-white/[0.04]",children:o.jsxs("div",{className:"flex items-start gap-2",children:[o.jsx(u,{size:17,className:`mt-0.5 shrink-0 ${c?"text-red-500":"text-dim"}`}),o.jsxs("div",{className:"min-w-0",children:[s.imageIndex!=null&&o.jsx("div",{className:`text-[11px] font-bold uppercase tracking-wide ${c?"text-red-500":"text-dim"}`,children:t("precheck.photoIndex",{index:s.imageIndex})}),o.jsx("p",{className:"text-sm font-semibold leading-snug text-ink",children:s.message}),((h=s.fix)==null?void 0:h.trim())&&o.jsx("p",{className:"mt-1 text-[13px] leading-relaxed text-dim",children:s.fix})]})]})},`${s.code}-${a}`)})}),o.jsx("button",{onClick:()=>e.resolve(!1),className:"mt-5 w-full rounded-xl bg-ink py-3 text-[15px] font-bold text-base transition-opacity hover:opacity-90",children:t("precheck.fixPhoto")}),o.jsx("button",{onClick:()=>e.resolve(!0),className:"mt-2 w-full py-2 text-sm font-semibold text-faint transition-colors hover:text-ink",children:t("precheck.continueAnyway")})]})}):null},mH=()=>{const{pathname:t}=rs();return v.useEffect(()=>{ns.pageView()},[t]),null},Qo="https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o",pH=["/images/onboarding/catalog_flatlay.jpg","/images/onboarding/catalog_pose_1.jpg",`${Qo}/fal_outputs%2Fonboard_catalog%2Fpose_s3.jpg?alt=media`,`${Qo}/fal_outputs%2Fonboard_catalog%2Fpose_s4.jpg?alt=media`,`${Qo}/fal_outputs%2Fonboard_catalog%2Fpose_s5.jpg?alt=media`],gH=[`${Qo}/fal_outputs%2Fmin%2Fposes%2Fearring%2Fearring_sun_profile.png?alt=media`,`${Qo}/fal_outputs%2Fmin%2Fposes%2Fnecklace%2Fnecklace_pendant_touch.png?alt=media`,`${Qo}/fal_outputs%2Fmin%2Fposes%2Fring%2Fring_hands_face.png?alt=media`,`${Qo}/fal_outputs%2Fmin%2Fposes%2Fbracelet%2Fbracelet_statement_drape.png?alt=media`],_m="#6A3AFF",vx=2400,aS=78,yH=58,oS=5,lS=({frames:t,scanFirstTransition:e=!1,holdMs:n=1500})=>{const[s,a]=v.useState(0),[c,u]=v.useState(!1),[h,m]=v.useState(!1),p=v.useRef(!1);v.useEffect(()=>{t.forEach(x=>{const w=new Image;w.src=x})},[t]),v.useEffect(()=>{let x=!1;const w=[],T=()=>{w.push(window.setTimeout(()=>{if(x)return;e&&!p.current&&t.length>1?(p.current=!0,u(!0),m(!0),w.push(window.setTimeout(()=>{x||(m(!1),a(1),T())},vx))):(u(!1),a(j=>(j+1)%t.length),T())},n))};return T(),()=>
5429{x=!0,w.forEach(N=>window.clearTimeout(N))}},[t,e,n]);const b=c?1:s;return o.jsxs("div",{className:"flex h-[56%] w-full flex-col items-center px-6 pt-4",children:[o.jsx("style",{children:`
5430        @keyframes reel-scan { from { --p: 0; } to { --p: 1; } }
5431        @keyframes reel-reveal { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
5432        @keyframes reel-beam { from { top: 0%; } to { top: 100%; } }
5433        @media (prefers-reduced-motion: reduce) {
5434          .reel-anim { animation-duration: 1ms !important; }
5435        }
5436      `}),o.jsxs("div",{className:"relative min-h-0 w-auto max-w-full flex-1 overflow-hidden rounded-[20px] bg-[#171717]",style:{aspectRatio:"3 / 4"},children:[t.map((x,w)=>o.jsx("img",{src:x,alt:"",className:"absolute inset-0 h-full w-full object-cover transition-opacity duration-[550ms]",style:{opacity:w===s?1:0}},x)),c&&t.length>1&&o.jsx("img",{src:t[1],alt:"",className:h?"reel-anim absolute inset-0 h-full w-full object-cover":"absolute inset-0 h-full w-full object-cover",style:h?{animation:`reel-reveal ${vx}ms linear forwards`}:void 0},`reveal-${t[1]}`),h&&o.jsx("div",{className:"reel-anim pointer-events-none absolute inset-x-0 flex h-14 -translate-y-1/2 items-center",style:{animation:`reel-beam ${vx}ms linear forwards`,background:`linear-gradient(to bottom, ${_m}00, ${_m}73, ${_m}00)`},children:o.jsx("div",{className:"h-[2px] w-full",style:{backgroundColor:"rgba(255,255,255,0.92)",boxShadow:`0 0 14px 1px ${_m}e6`}})})]}),o.jsx("div",{className:"mt-3.5 flex w-full shrink-0 items-center justify-center",style:{height:aS},children:t.map((x,w)=>o.jsx("div",{className:"rounded-[9px] border-2 transition-colors duration-[260ms]",style:{width:`min(${yH}px, calc((100% - ${t.length*2*oS}px) / ${t.length}))`,height:aS,margin:`0 ${oS}px`,padding:2,borderColor:w===b?"#fff":"transparent"},children:o.jsx("img",{src:x,alt:"",className:"h-full w-full rounded-[6px] object-cover transition-opacity duration-[260ms]",style:{opacity:w===b?1:.45}})},x))})]})},dR="fashio-onboarding:",bH=7;function xH(t){try{return window.localStorage.getItem(t)}catch{return null}}function vH(t,e){try{window.localStorage.setItem(t,e)}catch{}}function _H(t){return xH(dR+t)==="1"}function cS(t){vH(dR+t,"1")}function wH(t,e){if(t==null)return null;let n=null;if(typeof t=="number")n=t<1e11?t*1e3:t;else if(typeof t=="string"){const a=Date.parse(t);n=Number.isNaN(a)?null:a}else if(typeof t=="object"){const a=t,c=a._seconds??a.seconds;typeof c=="number"&&(n=c*1e3)}if(n==null||!Number.isFinite(n))return null;const s=e-n;return s<0?0:s}function EH(t){const{uid:e,createdAt:n,isPremium:s,now:a}=t;if(!e||s||_H(e))return!1;const c=wH(n,a);return c==null?!1:c<=bH*24*60*60*1e3}const wm=[{titleKey:"onboarding.studio.title",descKey:"onboarding.studio.desc",backgroundImage:"https://fashiolabs.com/min/images/remote/8DboEz7maKFmar45EUTWB-f8cea6629004.jpg"},{titleKey:"onboarding.anywhere.title",descKey:"onboarding.anywhere.desc",backgroundImage:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fonboard2%2Fonboard2.png?alt=media&token=222bef43-4987-494b-8210-53333ae20291"},{titleKey:"onboarding.models.title",descKey:"onboarding.models.desc",backgroundImage:"https://firebasestorage.googleapis.com/v0/b/fashio-ai-app.firebasestorage.app/o/fal_outputs%2Fonboard2%2Fonboard3.jpg?alt=media&token=860ae505-da39-4f85-8325-82e954dfcdd3"},{titleKey:"onboarding.catalogue.title",descKey:"onboarding.catalogue.desc",reel:o.jsx(lS,{frames:pH,scanFirstTransition:!0})},{titleKey:"onboarding.jewelry.title",descKey:"onboarding.jewelry.desc",reel:o.jsx(lS,{frames:gH,holdMs:1800})}],kH=({uid:t,onComplete:e,onDismiss:n})=>{const s=De(),[a,c]=v.useState(0),u=wm[a],h=a===wm.length-1;v.useEffect(()=>{const b=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=b}},[]),v.useEffect(()=>{const b="fashio-bodoni";if(document.getElementById(b))return;const x=document.createElement("link");x.id=b,x.rel="stylesheet",x.href="https://fonts.googleapis.com/css2?family=Bodoni+Moda:wght@700&display=swap",document.head.appendChild(x)},[]);const m=()=>{if(!h){c(b=>b+1);return}cS(t),pB(),e()},p=()=>{cS(t),n()};return o.jsx("div",{className:"fixed inset-0 z-[70] flex items-center justify-center overflow-hidden bg-black",children:o.jsxs("div",{className:"relative h-full w-full overflow-hidden",style:{maxWidth:"min(100vw, calc(100vh * 9 / 16))"},children:[wm.map((b,x)=>o.jsx("div",{"aria-hidden":x!==a,className:"absolute inset-0 transition-opacity duration-1000",style:{opacity:x===a?1:0},children:b.reel??(x===a||x===a+1?o.jsxs(o.Fragment,{children:[o.jsx("img",{src:b.backgroundImage,alt:"","aria-hidden":!0,
5436className:"absolute inset-0 h-full w-full scale-110 object-cover blur-2xl"}),o.jsx("img",{src:b.backgroundImage,alt:"",className:"relative h-full w-full object-contain object-top"})]}):null)},x)),o.jsx("div",{className:"pointer-events-none absolute inset-0",style:{background:"linear-gradient(to bottom, transparent 0%, rgba(0,0,0,0.1) 40%, rgba(0,0,0,0.5) 70%, #000 100%)"}}),o.jsx("button",{type:"button",onClick:p,"aria-label":s("onboarding.skipAria"),className:"absolute right-4 top-4 z-10 rounded-xl p-2 text-white/60 transition-colors hover:bg-white/10 hover:text-white",children:o.jsx(Wt,{size:20})}),o.jsxs("div",{className:"absolute inset-0 flex flex-col justify-end p-8",children:[o.jsx("h2",{className:"whitespace-pre-line font-bold text-white",style:{fontFamily:"'Bodoni Moda', Georgia, serif",fontSize:"clamp(2.25rem, 8vw, 3rem)",lineHeight:1.1},children:s(u.titleKey)},`t-${a}`),o.jsx("p",{className:"mt-4 text-lg leading-relaxed text-white/90",children:s(u.descKey)},`d-${a}`),o.jsxs("div",{className:"mt-10 flex items-center justify-between gap-4",children:[o.jsx("div",{className:"flex items-center gap-2",children:wm.map((b,x)=>o.jsx("span",{className:"h-2 w-2 rounded-full transition-colors",style:{backgroundColor:x===a?"#fff":"rgba(255,255,255,0.2)"}},x))}),o.jsxs("button",{type:"button",onClick:m,className:"inline-flex items-center gap-2 rounded-full bg-white px-7 py-3 text-lg font-bold text-black transition-transform hover:scale-[1.02] active:scale-[0.99]",children:[s(h?"onboarding.getStarted":"onboarding.next"),o.jsx(ks,{size:20})]})]})]})]})})};function TH(){const[t,e]=v.useState(null),[n,s]=v.useState({uid:"",name:"",email:"",diamond_balance:0,is_premium:!1,plan:"free"}),[a,c]=v.useState(!1),[u,h]=v.useState("membership"),[m,p]=v.useState(null),[b,x]=v.useState(!1),[w,T]=v.useState("nav_upgrade"),[N,j]=v.useState(!1);v.useEffect(()=>{let S=!1;return bp.initialize().finally(()=>{S||j(!0)}),()=>{S=!0}},[]);const A=async S=>{const C=await sa.getUserMe();C&&(ns.identify({email:C.email||S.email||void 0,uid:S.uid}),s(R=>({...R,uid:S.uid,diamond_balance:C.diamondBalance??R.diamond_balance??0,is_premium:C.isPremium??!1,plan:C.activeSubscriptionId?"pro_monthly":"free",active_subscription_id:C.activeSubscriptionId??null,subscription_status:C.subscriptionStatus??null,subscription_snapshot:C.subscription_snapshot||C.subscriptionSnapshot||null,avatar_url:C.avatarUrl,name:C.displayName||S.displayName||R.name||Wa("common.designer"),email:C.email||S.email||R.email||"",created_at:C.created_at??C.createdAt??null})))};v.useEffect(()=>{PS(),$t.getBillingCatalog("all")},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search).get("onboarding");if(S===null)return;const C=["0","false","no"].includes(S.toLowerCase());sessionStorage.setItem(C?"skip_onboarding":"force_onboarding","1")},[]),v.useEffect(()=>{const S=new URLSearchParams(window.location.search);if(!S.has("checkout"))return;const C=S.get("plan"),D=["starter","monthly","pro","starter_yearly","yearly","pro_yearly"].includes(C)?C:null,P=S.get("focus")==="credits"?"credits":"membership";sessionStorage.setItem("checkout_intent",JSON.stringify({plan:D,focus:P}));const ie=window.location.pathname+window.location.hash;window.history.replaceState({},"",ie)},[]),v.useEffect(()=>{if(!(!t||!n.uid)&&!sessionStorage.getItem("skip_onboarding")){if(sessionStorage.getItem("force_onboarding")){x(!0);return}bp.isOnboardingEnabled&&n.created_at!=null&&(sessionStorage.getItem("checkout_intent")||sessionStorage.getItem("shoot_intent")||EH({uid:n.uid,createdAt:n.created_at,isPremium:n.is_premium,now:Date.now()})&&x(!0))}},[t,n.uid,n.created_at,n.is_premium,N]),v.useEffect(()=>{if(!t||!n.uid)return;const S=sessionStorage.getItem("checkout_intent");if(S){sessionStorage.removeItem("checkout_intent");try{const{plan:C,focus:R}=JSON.parse(S);h(R??"membership"),p(C??null),T("marketing_checkout"),c(!0)}catch{}}},[t,n.uid]),v.useEffect(()=>{const S=zv(xt,async C=>{C?(e(!0),s(R=>({...R,uid:C.uid,email:C.email||"",name:C.displayName||Wa("common.designer")})),await A(C)):e(!1)});return()=>S()},[]);const F=v.useRef(n);F.current=n,v.useEffect(()=>wB(()=>{EB({uid:F.current.uid,isPremium:F.current.is_premium,credits:F.current.diamond_balance??0})}),[]),v.useEffect(()=>{if(!n.uid||window.location.pathname==="/billing-return")return;const S=kB({uid:n.uid,isPremium:n.is_premium,credits:n.diamond_balance??0});S&&ns.purchase({content_id:S.content_id,content_name:S.content_name,content_type:S.content_category,value:S.value||void 0,currency:S.currency,transaction_id:S.id})},[n.uid,n.is_premium,n.diamond_balance]),v.useEffect(()=>{const S=async()=>{const R=xt.currentUser;if(!R)return;const D=[0,1e3,2500];for(const z of D)z>0&&await new Promise(P=>window.setTimeout(P,z)),await A(R)},C=R=>{R.origin!==window.location.origin||(R.data||{}).type!=="billing:return"||(_t.showInfo(Wa("billing.paymentReceived")),S())};return window.addEventListener("message",C),()=>window.removeEventListener("message",C)},[]),v.useEffect(()=>{const S=async()=>{const R=xt.currentUser;R&&await A(R)},C=()=>{document.visibilityState==="visible"&&S()};return window.addEventListener("focus",S),document.addEventListener("visibilitychange",C),()=>{window.removeEventListener("focus",S),document.removeEventListener("visibilitychange",C)}},[]);const V=i0(n),L=()=>{sessionStorage.removeItem("force_onboarding"),x(!1)},Y=()=>{p(null),h(V?"credits":"membership"),T("nav_upgrade"),c(!0)},$=()=>{p(null),h("membership"),T("nav_upgrade"),c(!0)},q=()=>{};if(t===null)return o.jsx("div",{className:"min-h-screen flex items-center justify-center bg-white",children:o.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-gray-900"})});const I=DS()??"/";return o.jsxs(v3,{children:[o.jsxs(GE,{children:[o.jsx(Lt,{path:"/handoff",element:o.jsx(kK,{})}),o.jsx(Lt,{path:"/login",element:t?o.jsx(mc,{to:I,replace:!0}):o.jsx(ST,{onLogin:q})}),o.jsx(Lt,{path:"/logindirekt",element:t?o.jsx(mc,{to:"/",replace:!0}):o.jsx(ST,{onLogin:q})}),o.jsx(Lt,{path:"/register",element:t?o.jsx(mc,{to:I,replace:!0}):o.jsx(CK,{onLogin:q})}),o.jsx(Lt,{path:"/reset-password",element:t?o.jsx(mc,{to:"/",replace:!0}):o.jsx(IK,{})}),o.jsx(Lt,{path:"/billing-return",element:o.jsx(tq,{})}),o.jsx(Lt,{path:"*",element:t?o.jsx(M7,{onLogout:()=>xt.signOut(),diamondBalance:n.diamond_balance,userName:n.name,userEmail:n.email,isSubscriber:V,onTopUp:Y,onReplayOnboarding:()=>{sessionStorage.setItem("force_onboarding","1"),x(!0)},children:o.jsxs(GE,{children:[o.jsx(Lt,{path:"/",element:o.jsx($K,{user:n,onUpgrade:$})}),o.jsx(Lt,{path:"/try-on",element:o.jsx(j$,{})}),o.jsx(Lt,{path:"/pro-studio",element:o.jsx(I$,{})}),o.jsx(Lt,{path:"/video",element:o.jsx(L$,{})}),o.jsx(Lt,{path:"/tools",element:o.jsx(F$,{})}),o.jsx(Lt,{path:"/tools/:id",element:o.jsx(aq,{})}),o.jsx(Lt,{path:"/body-editor",element:o.jsx(cq,{})}),o.jsx(Lt,{path:"/jewelry-on-model",element:o.jsx(Iq,{})}),o.jsx(Lt,{path:"/ugc-creator",element:o.jsx(Pq,{})}),o.jsx(Lt,{path:"/lingerie-studio",element:o.jsx($q,{})}),o.jsx(Lt,{path:"/spin-360",element:o.jsx(aH,{})}),o.jsx(Lt,{path:"/image-to-3d",element:o.jsx(Gq,{})}),o.jsx(Lt,{path:"/packs",element:o.jsx(Jq,{})}),o.jsx(Lt,{path:"/catalogue",element:o.jsx(tH,{})}),o.jsx(Lt,{path:"/products",element:o.jsx(Z$,{})}),o.jsx(Lt,{path:"/history",element:o.jsx(W$,{})}),o.jsx(Lt,{path:"/billing",element:o.jsx(eq,{user:n,onUpgrade:$,onTopUp:Y})}),o.jsx(Lt,{path:"/api-keys",element:o.jsx(K$,{})}),o.jsx(Lt,{path:"/profile",element:o.jsx(B$,{user:n,onLogout:()=>
5436xt.signOut(),onTopUp:Y,onUpgrade:$})}),o.jsx(Lt,{path:"*",element:o.jsx(mc,{to:"/",replace:!0})})]})}):o.jsx(mc,{to:"/login",replace:!0})})]}),o.jsx(mH,{}),o.jsx(hH,{}),o.jsx(fH,{}),t&&b&&o.jsx(kH,{uid:n.uid,onComplete:()=>{L(),p(null),h("membership"),T("onboarding_end"),c(!0)},onDismiss:L}),t&&o.jsx(o.Fragment,{children:o.jsx(Ts,{isOpen:a,onClose:()=>c(!1),user:n,initialFocus:u,initialPlan:m,trigger:w})})]})}const hR=document.getElementById("root");if(!hR)throw new Error("Could not find root element to mount to");const SH=JI.createRoot(hR);SH.render(o.jsx(fn.StrictMode,{children:o.jsx(zM,{children:o.jsx(TH,{})})}));

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.