lt)&&(lt!=3||this.g&&(this.h.h||this.g.oa()||ba(this.g)))){this.J||lt!=4||d==7||(d==8||0>=wr?qi(3):qi(2)),ei(this);var f=this.g.Z();this.X=f;t:if(Jt(this)){var y=ba(this.g);a="";var P=y.length,O=Xt(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){mr(this),ti(this);var G="";break t}this.h.i=new l.TextDecoder}for(d=0;dd.length?Hs:(d=d.slice(y,y+f),a.C=y+f,d)))}Cn.prototype.cancel=function(){this.J=!0,mr(this)};function Ks(a){a.S=Date.now()+a.I,pr(a,a.I)}function pr(a,d){if(a.B!=null)throw Error("WatchDog timer not null");a.B=hr(g(a.ba,a),d)}function ei(a){a.B&&(l.clearTimeout(a.B),a.B=null)}Cn.prototype.ba=function(){this.B=null;const a=Date.now();0<=a-this.S?(qs(this.i,this.A),this.L!=2&&(qi(),Fe(17)),mr(this),this.s=2,ti(this)):pr(this,this.S-a)};function ti(a){a.j.G==0||a.J||Ac(a.j,a)}function mr(a){ei(a);var d=a.M;d&&typeof d.ma=="function"&&d.ma(),a.M=null,Vs(a.U),a.g&&(d=a.g,a.g=null,d.abort(),d.ma())}function wa(a,d){try{var f=a.j;if(f.G!=0&&(f.g==a||Ki(f.h,a))){if(!a.K&&Ki(f.h,a)&&f.G==3){try{var y=f.Da.g.parse(d)}catch{y=null}if(Array.isArray(y)&&y.length==3){var P=y;if(P[0]==0){e:if(!f.u){if(f.g)if(f.g.F+3e3P[2]&&f.F&&f.v==0&&!f.C&&(f.C=hr(g(f.Za,f),6e3));if(1>=Qs(f.h)&&f.ca){try{f.ca()}catch{}f.ca=void 0}}else yr(f,11)}else if((a.K||f.g==a)&&io(f),!k(d))for(P=f.Da.g.parse(d),d=0;d=a.j:!1}function Qs(a){return a.h?1:a.g?a.g.size:0}function Ki(a,d){return a.h?a.h==d:a.g?a.g.has(d):!1}function Gi(a,d){a.g?a.g.add(d):a.h=d}function Qi(a,d){a.h&&a.h==d?a.h=null:a.g&&a.g.has(d)&&a.g.delete(d)}Gs.prototype.cancel=function(){if(this.i=Ys(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const a of this.g.values())a.cancel();this.g.clear()}};function Ys(a){if(a.h!=null)return a.i.concat(a.h.D);if(a.g!=null&&a.g.size!==0){let d=a.i;for(const f of a.g.values())d=d.concat(f.D);return d}return L(a.i)}function rh(a){if(a.V&&typeof a.V=="function")return a.V();if(typeof Map<"u"&&a instanceof Map||typeof Set<"u"&&a instanceof Set)return Array.from(a.values());if(typeof a=="string")return a.split("");if(u(a)){for(var d=[],f=a.length,y=0;yd)throw Error("Bad port number "+d);a.s=d}else a.s=null}function _c(a,d,f){d instanceof _?(a.i=d,lh(a.i,a.h)):(f||(d=Yi(d,ii)),a.i=new _(d,a.h))}function xe(a,d,f){a.i.set(d,f)}function ri(a){return xe(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),a}function Pn(a,d){return a?d?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Yi(a,d,f){return typeof a=="string"?(a=encodeURI(a).replace(d,sh),f&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function sh(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Js=/[#\/\?@]/g,oh=/[#\?:]/g,Xs=/[#\?]/g,ii=/[#\?@]/g,ah=/#/g;function _(a,d){this.h=this.g=null,this.i=a||null,this.j=!!d}function Hn(a){a.g||(a.g=new Map,a.h=0,a.i&&ih(a.i,function(d,f){a.add(decodeURIComponent(d.replace(/\+/g," ")),f)}))}t=_.prototype,t.add=function(a,d){Hn(this),this.i=null,a=si(this,a);var f=this.g.get(a);return f||this.g.set(a,f=[]),f.push(d),this.h+=1,this};function xc(a,d){Hn(a),d=si(a,d),a.g.has(d)&&(a.i=null,a.h-=a.g.get(d).length,a.g.delete(d))}function wt(a,d){return Hn(a),d=si(a,d),a.g.has(d)}t.forEach=function(a,d){Hn(this),this.g.forEach(function(f,y){f.forEach(function(P){a.call(d,P,y,this)},this)},this)},t.na=function(){Hn(this);const a=Array.from(this.g.values()),d=Array.from(this.g.keys()),f=[];for(let y=0;y{y.abort(),Kn(f,"TestPingServer: timeout",!1,d)},1e4);fetch(a,{signal:y.signal}).then(O=>{clearTimeout(P),O.ok?Kn(f,"TestPingServer: ok",!0,d):Kn(f,"TestPingServer: server error",!1,d)}).catch(()=>{clearTimeout(P),Kn(f,"TestPingServer: error",!1,d)})}function Kn(a,d,f,y,P){try{P&&(P.onload=null,P.onerror=null,P.onabort=null,P.ontimeout=null),y(f)}catch{}}function dh(){this.g=new gc}function hh(a,d,f){const y=f||"";try{Wn(a,function(P,O){let G=P;h(P)&&(G=Fs(P)),d.push(y+O+"="+encodeURIComponent(G))})}catch(P){throw d.push(y+"type="+encodeURIComponent("_badmap")),P}}function eo(a){this.l=a.Ub||null,this.j=a.eb||!1}D(eo,Gr),eo.prototype.g=function(){return new to(this.l,this.j)},eo.prototype.i=function(a){return function(){return a}}({});function to(a,d){Ke.call(this),this.D=a,this.o=d,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}D(to,Ke),t=to.prototype,t.open=function(a,d){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=a,this.A=d,this.readyState=1,Xi(this)},t.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const d={headers:this.u,method:this.B,credentials:this.m,cache:void 0};a&&(d.body=a),(this.D||l).fetch(new Request(this.A,d)).then(this.Sa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,Ji(this)),this.readyState=0},t.Sa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,Xi(this)),this.g&&(this.readyState=3,Xi(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof l.ReadableStream<"u"&&"body"in a){if(this.j=a.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;_a(this)}else a.text().then(this.Ra.bind(this),this.ga.bind(this))};function _a(a){a.j.read().then(a.Pa.bind(a)).catch(a.ga.bind(a))}t.Pa=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var d=a.value?a.value:new Uint8Array(0);(d=this.v.decode(d,{stream:!a.done}))&&(this.response=this.responseText+=d)}a.done?Ji(this):Xi(this),this.readyState==3&&_a(this)}},t.Ra=function(a){this.g&&(this.response=this.responseText=a,Ji(this))},t.Qa=function(a){this.g&&(this.response=a,Ji(this))},t.ga=function(){this.g&&Ji(this)};function Ji(a){a.readyState=4,a.l=null,a.j=null,a.v=null,Xi(a)}t.setRequestHeader=function(a,d){this.u.append(a,d)},t.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const a=[],d=this.h.entries();for(var f=d.next();!f.done;)f=f.value,a.push(f[0]+": "+f[1]),f=d.next();return a.join(`\r
-`)};function Xi(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(to.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function Ec(a){let d="";return H(a,function(f,y){d+=y,d+=":",d+=f,d+=`\r
-`}),d}function Rn(a,d,f){e:{for(y in f){var y=!1;break e}y=!0}y||(f=Ec(f),typeof a=="string"?f!=null&&encodeURIComponent(String(f)):xe(a,d,f))}function Re(a){Ke.call(this),this.headers=new Map,this.o=a||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}D(Re,Ke);var xa=/^https?$/i,fh=["POST","PUT"];t=Re.prototype,t.Ha=function(a){this.J=a},t.ea=function(a,d,f,y){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);d=d?d.toUpperCase():"GET",this.D=a,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():ma.g(),this.v=this.o?ha(this.o):ha(ma),this.g.onreadystatechange=g(this.Ea,this);try{this.B=!0,this.g.open(d,String(a),!0),this.B=!1}catch(O){kc(this,O);return}if(a=f||"",f=new Map(this.headers),y)if(Object.getPrototypeOf(y)===Object.prototype)for(var P in y)f.set(P,y[P]);else if(typeof y.keys=="function"&&typeof y.get=="function")for(const O of y.keys())f.set(O,y.get(O));else throw Error("Unknown input type for opt_headers: "+String(y));y=Array.from(f.keys()).find(O=>O.toLowerCase()=="content-type"),P=l.FormData&&a instanceof l.FormData,!(0<=Array.prototype.indexOf.call(fh,d,void 0))||y||P||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[O,G]of f)this.g.setRequestHeader(O,G);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Ta(this),this.u=!0,this.g.send(a),this.u=!1}catch(O){kc(this,O)}};function kc(a,d){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=d,a.m=5,Ea(a),no(a)}function Ea(a){a.A||(a.A=!0,Ze(a,"complete"),Ze(a,"error"))}t.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=a||7,Ze(this,"complete"),Ze(this,"abort"),no(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),no(this,!0)),Re.aa.N.call(this)},t.Ea=function(){this.s||(this.B||this.u||this.j?ka(this):this.bb())},t.bb=function(){ka(this)};function ka(a){if(a.h&&typeof o<"u"&&(!a.v[1]||Xt(a)!=4||a.Z()!=2)){if(a.u&&Xt(a)==4)ca(a.Ea,0,a);else if(Ze(a,"readystatechange"),Xt(a)==4){a.h=!1;try{const G=a.Z();e:switch(G){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var d=!0;break e;default:d=!1}var f;if(!(f=d)){var y;if(y=G===0){var P=String(a.D).match(wc)[1]||null;!P&&l.self&&l.self.location&&(P=l.self.location.protocol.slice(0,-1)),y=!xa.test(P?P.toLowerCase():"")}f=y}if(f)Ze(a,"complete"),Ze(a,"success");else{a.m=6;try{var O=2{}:null;a.g=null,a.v=null,d||Ze(a,"ready");try{f.onreadystatechange=y}catch{}}}function Ta(a){a.I&&(l.clearTimeout(a.I),a.I=null)}t.isActive=function(){return!!this.g};function Xt(a){return a.g?a.g.readyState:0}t.Z=function(){try{return 2=a.h.j-(a.s?1:0)?!1:a.s?(a.i=d.D.concat(a.i),!0):a.G==1||a.G==2||a.B>=(a.Va?0:a.Wa)?!1:(a.s=hr(g(a.Ga,a,d),Nc(a,a.B)),a.B++,!0)}t.Ga=function(a){if(this.s)if(this.s=null,this.G==1){if(!a){this.U=Math.floor(1e5*Math.random()),a=this.U++;const P=new Cn(this,this.j,a);let O=this.o;if(this.S&&(O?(O=w(O),S(O,this.S)):O=this.S),this.m!==null||this.O||(P.H=O,O=null),this.P)e:{for(var d=0,f=0;fge)O=Math.max(0,P[et].g-100),Ee=!1;else try{hh(at,G,"req"+ge+"_")}catch{y&&y(at)}}if(Ee){y=G.join("&");break e}}}return a=a.i.splice(0,f),d.D=a,y}function Ic(a){if(!a.g&&!a.u){a.Y=1;var d=a.Fa;Qt||se(),Y||(Qt(),Y=!0),ae.add(d,a),a.v=0}}function ro(a){return a.g||a.u||3<=a.v?!1:(a.Y++,a.u=hr(g(a.Fa,a),Nc(a,a.v)),a.v++,!0)}t.Fa=function(){if(this.u=null,Cc(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var a=2*this.R;this.j.info("BP detection timer enabled: "+a),this.A=hr(g(this.ab,this),a)}},t.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,Fe(10),es(this),Cc(this))};function Ca(a){a.A!=null&&(l.clearTimeout(a.A),a.A=null)}function Cc(a){a.g=new Cn(a,a.j,"rpc",a.Y),a.m===null&&(a.g.H=a.o),a.g.O=0;var d=yn(a.qa);xe(d,"RID","rpc"),xe(d,"SID",a.K),xe(d,"AID",a.T),xe(d,"CI",a.F?"0":"1"),!a.F&&a.ja&&xe(d,"TO",a.ja),xe(d,"TYPE","xmlhttp"),ts(a,d),a.m&&a.o&&Rn(d,a.m,a.o),a.L&&(a.g.I=a.L);var f=a.g;a=a.ia,f.L=1,f.v=ri(yn(d)),f.m=null,f.P=!0,ya(f,a)}t.Za=function(){this.C!=null&&(this.C=null,es(this),ro(this),Fe(19))};function io(a){a.C!=null&&(l.clearTimeout(a.C),a.C=null)}function Ac(a,d){var f=null;if(a.g==d){io(a),Ca(a),a.g=null;var y=2}else if(Ki(a.h,d))f=d.D,Qi(a.h,d),y=1;else return;if(a.G!=0){if(d.o)if(y==1){f=d.m?d.m.length:0,d=Date.now()-d.F;var P=a.B;y=st(),Ze(y,new pa(y,f)),Dn(a)}else Ic(a);else if(P=d.s,P==3||P==0&&0y.length)){var P=y[1];if(Array.isArray(P)&&!(1>P.length)){var O=P[0];if(O!="noop"&&O!="stop"&&O!="close")for(var Q=1;Qat)&&(at!=3||this.g&&(this.h.h||this.g.oa()||Sa(this.g)))){this.J||at!=4||d==7||(d==8||0>=Sr?et(3):et(2)),xa(this);var f=this.g.Z();this.X=f;t:if(gn(this)){var y=Sa(this.g);a="";var P=y.length,O=_n(this.g)==4;if(!this.h.i){if(typeof TextDecoder>"u"){vn(this),yn(this);var Q="";break t}this.h.i=new l.TextDecoder}for(d=0;dd.length?qs:(d=d.slice(y,y+f),a.C=y+f,d)))}Wn.prototype.cancel=function(){this.J=!0,vn(this)};function Nt(a){a.S=Date.now()+a.I,Ws(a,a.I)}function Ws(a,d){if(a.B!=null)throw Error("WatchDog timer not null");a.B=Xt(g(a.ba,a),d)}function xa(a){a.B&&(l.clearTimeout(a.B),a.B=null)}Wn.prototype.ba=function(){this.B=null;const a=Date.now();0<=a-this.S?($s(this.i,this.A),this.L!=2&&(et(),wt(17)),vn(this),this.s=2,yn(this)):Ws(this,this.S-a)};function yn(a){a.j.G==0||a.J||Pa(a.j,a)}function vn(a){xa(a);var d=a.M;d&&typeof d.ma=="function"&&d.ma(),a.M=null,Fs(a.U),a.g&&(d=a.g,a.g=null,d.abort(),d.ma())}function Hs(a,d){try{var f=a.j;if(f.G!=0&&(f.g==a||Hn(f.h,a))){if(!a.K&&Hn(f.h,a)&&f.G==3){try{var y=f.Da.g.parse(d)}catch{y=null}if(Array.isArray(y)&&y.length==3){var P=y;if(P[0]==0){e:if(!f.u){if(f.g)if(f.g.F+3e3P[2]&&f.F&&f.v==0&&!f.C&&(f.C=Xt(g(f.Za,f),6e3));if(1>=Ks(f.h)&&f.ca){try{f.ca()}catch{}f.ca=void 0}}else br(f,11)}else if((a.K||f.g==a)&&oo(f),!k(d))for(P=f.Da.g.parse(d),d=0;d=a.j:!1}function Ks(a){return a.h?1:a.g?a.g.size:0}function Hn(a,d){return a.h?a.h==d:a.g?a.g.has(d):!1}function Ji(a,d){a.g?a.g.add(d):a.h=d}function Gs(a,d){a.h&&a.h==d?a.h=null:a.g&&a.g.has(d)&&a.g.delete(d)}_c.prototype.cancel=function(){if(this.i=Qs(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&this.g.size!==0){for(const a of this.g.values())a.cancel();this.g.clear()}};function Qs(a){if(a.h!=null)return a.i.concat(a.h.D);if(a.g!=null&&a.g.size!==0){let d=a.i;for(const f of a.g.values())d=d.concat(f.D);return d}return L(a.i)}function Ys(a){if(a.V&&typeof a.V=="function")return a.V();if(typeof Map<"u"&&a instanceof Map||typeof Set<"u"&&a instanceof Set)return Array.from(a.values());if(typeof a=="string")return a.split("");if(u(a)){for(var d=[],f=a.length,y=0;yd)throw Error("Bad port number "+d);a.s=d}else a.s=null}function Le(a,d,f){d instanceof wn?(a.i=d,ba(a.i,a.h)):(f||(d=Er(d,ah)),a.i=new wn(d,a.h))}function _e(a,d,f){a.i.set(d,f)}function Js(a){return _e(a,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)),a}function Rn(a,d){return a?d?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""}function Er(a,d,f){return typeof a=="string"?(a=encodeURI(a).replace(d,Zi),f&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null}function Zi(a){return a=a.charCodeAt(0),"%"+(a>>4&15).toString(16)+(a&15).toString(16)}var Ec=/[#\/\?@]/g,oh=/[#\?:]/g,Ta=/[#\?]/g,ah=/[#\?@]/g,Xs=/#/g;function wn(a,d){this.h=this.g=null,this.i=a||null,this.j=!!d}function Kn(a){a.g||(a.g=new Map,a.h=0,a.i&&_r(a.i,function(d,f){a.add(decodeURIComponent(d.replace(/\+/g," ")),f)}))}t=wn.prototype,t.add=function(a,d){Kn(this),this.i=null,a=Ke(this,a);var f=this.g.get(a);return f||this.g.set(a,f=[]),f.push(d),this.h+=1,this};function _(a,d){Kn(a),d=Ke(a,d),a.g.has(d)&&(a.i=null,a.h-=a.g.get(d).length,a.g.delete(d))}function kc(a,d){return Kn(a),d=Ke(a,d),a.g.has(d)}t.forEach=function(a,d){Kn(this),this.g.forEach(function(f,y){f.forEach(function(P){a.call(d,P,y,this)},this)},this)},t.na=function(){Kn(this);const a=Array.from(this.g.values()),d=Array.from(this.g.keys()),f=[];for(let y=0;y{y.abort(),Gn(f,"TestPingServer: timeout",!1,d)},1e4);fetch(a,{signal:y.signal}).then(O=>{clearTimeout(P),O.ok?Gn(f,"TestPingServer: ok",!0,d):Gn(f,"TestPingServer: server error",!1,d)}).catch(()=>{clearTimeout(P),Gn(f,"TestPingServer: error",!1,d)})}function Gn(a,d,f,y,P){try{P&&(P.onload=null,P.onerror=null,P.onabort=null,P.ontimeout=null),y(f)}catch{}}function uh(){this.g=new yc}function dh(a,d,f){const y=f||"";try{xc(a,function(P,O){let Q=P;h(P)&&(Q=Us(P)),d.push(y+O+"="+encodeURIComponent(Q))})}catch(P){throw d.push(y+"type="+encodeURIComponent("_badmap")),P}}function Zs(a){this.l=a.Ub||null,this.j=a.eb||!1}j(Zs,ti),Zs.prototype.g=function(){return new eo(this.l,this.j)},Zs.prototype.i=function(a){return function(){return a}}({});function eo(a,d){He.call(this),this.D=a,this.o=d,this.m=void 0,this.status=this.readyState=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.u=new Headers,this.h=null,this.B="GET",this.A="",this.g=!1,this.v=this.j=this.l=null}j(eo,He),t=eo.prototype,t.open=function(a,d){if(this.readyState!=0)throw this.abort(),Error("Error reopening a connection");this.B=a,this.A=d,this.readyState=1,Qn(this)},t.send=function(a){if(this.readyState!=1)throw this.abort(),Error("need to call open() first. ");this.g=!0;const d={headers:this.u,method:this.B,credentials:this.m,cache:void 0};a&&(d.body=a),(this.D||l).fetch(new Request(this.A,d)).then(this.Sa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.u=new Headers,this.status=0,this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),1<=this.readyState&&this.g&&this.readyState!=4&&(this.g=!1,es(this)),this.readyState=0},t.Sa=function(a){if(this.g&&(this.l=a,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=a.headers,this.readyState=2,Qn(this)),this.g&&(this.readyState=3,Qn(this),this.g)))if(this.responseType==="arraybuffer")a.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(typeof l.ReadableStream<"u"&&"body"in a){if(this.j=a.body.getReader(),this.o){if(this.responseType)throw Error('responseType must be empty for "streamBinaryChunks" mode responses.');this.response=[]}else this.response=this.responseText="",this.v=new TextDecoder;bc(this)}else a.text().then(this.Ra.bind(this),this.ga.bind(this))};function bc(a){a.j.read().then(a.Pa.bind(a)).catch(a.ga.bind(a))}t.Pa=function(a){if(this.g){if(this.o&&a.value)this.response.push(a.value);else if(!this.o){var d=a.value?a.value:new Uint8Array(0);(d=this.v.decode(d,{stream:!a.done}))&&(this.response=this.responseText+=d)}a.done?es(this):Qn(this),this.readyState==3&&bc(this)}},t.Ra=function(a){this.g&&(this.response=this.responseText=a,es(this))},t.Qa=function(a){this.g&&(this.response=a,es(this))},t.ga=function(){this.g&&es(this)};function es(a){a.readyState=4,a.l=null,a.j=null,a.v=null,Qn(a)}t.setRequestHeader=function(a,d){this.u.append(a,d)},t.getResponseHeader=function(a){return this.h&&this.h.get(a.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";const a=[],d=this.h.entries();for(var f=d.next();!f.done;)f=f.value,a.push(f[0]+": "+f[1]),f=d.next();return a.join(`\r
+`)};function Qn(a){a.onreadystatechange&&a.onreadystatechange.call(a)}Object.defineProperty(eo.prototype,"withCredentials",{get:function(){return this.m==="include"},set:function(a){this.m=a?"include":"same-origin"}});function Sc(a){let d="";return H(a,function(f,y){d+=y,d+=":",d+=f,d+=`\r
+`}),d}function to(a,d,f){e:{for(y in f){var y=!1;break e}y=!0}y||(f=Sc(f),typeof a=="string"?f!=null&&encodeURIComponent(String(f)):_e(a,d,f))}function Me(a){He.call(this),this.headers=new Map,this.o=a||null,this.h=!1,this.v=this.g=null,this.D="",this.m=0,this.l="",this.j=this.B=this.u=this.A=!1,this.I=null,this.H="",this.J=!1}j(Me,He);var hh=/^https?$/i,fh=["POST","PUT"];t=Me.prototype,t.Ha=function(a){this.J=a},t.ea=function(a,d,f,y){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+a);d=d?d.toUpperCase():"GET",this.D=a,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():ft.g(),this.v=this.o?ma(this.o):ma(ft),this.g.onreadystatechange=g(this.Ea,this);try{this.B=!0,this.g.open(d,String(a),!0),this.B=!1}catch(O){Yn(this,O);return}if(a=f||"",f=new Map(this.headers),y)if(Object.getPrototypeOf(y)===Object.prototype)for(var P in y)f.set(P,y[P]);else if(typeof y.keys=="function"&&typeof y.get=="function")for(const O of y.keys())f.set(O,y.get(O));else throw Error("Unknown input type for opt_headers: "+String(y));y=Array.from(f.keys()).find(O=>O.toLowerCase()=="content-type"),P=l.FormData&&a instanceof l.FormData,!(0<=Array.prototype.indexOf.call(fh,d,void 0))||y||P||f.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");for(const[O,Q]of f)this.g.setRequestHeader(O,Q);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{Ic(this),this.u=!0,this.g.send(a),this.u=!1}catch(O){Yn(this,O)}};function Yn(a,d){a.h=!1,a.g&&(a.j=!0,a.g.abort(),a.j=!1),a.l=d,a.m=5,no(a),io(a)}function no(a){a.A||(a.A=!0,Ze(a,"complete"),Ze(a,"error"))}t.abort=function(a){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=a||7,Ze(this,"complete"),Ze(this,"abort"),io(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),io(this,!0)),Me.aa.N.call(this)},t.Ea=function(){this.s||(this.B||this.u||this.j?ro(this):this.bb())},t.bb=function(){ro(this)};function ro(a){if(a.h&&typeof o<"u"&&(!a.v[1]||_n(a)!=4||a.Z()!=2)){if(a.u&&_n(a)==4)ha(a.Ea,0,a);else if(Ze(a,"readystatechange"),_n(a)==4){a.h=!1;try{const Q=a.Z();e:switch(Q){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var d=!0;break e;default:d=!1}var f;if(!(f=d)){var y;if(y=Q===0){var P=String(a.D).match(ka)[1]||null;!P&&l.self&&l.self.location&&(P=l.self.location.protocol.slice(0,-1)),y=!hh.test(P?P.toLowerCase():"")}f=y}if(f)Ze(a,"complete"),Ze(a,"success");else{a.m=6;try{var O=2<_n(a)?a.g.statusText:""}catch{O=""}a.l=O+" ["+a.Z()+"]",no(a)}}finally{io(a)}}}}function io(a,d){if(a.g){Ic(a);const f=a.g,y=a.v[0]?()=>{}:null;a.g=null,a.v=null,d||Ze(a,"ready");try{f.onreadystatechange=y}catch{}}}function Ic(a){a.I&&(l.clearTimeout(a.I),a.I=null)}t.isActive=function(){return!!this.g};function _n(a){return a.g?a.g.readyState:0}t.Z=function(){try{return 2<_n(this)?this.g.status:-1}catch{return-1}},t.oa=function(){try{return this.g?this.g.responseText:""}catch{return""}},t.Oa=function(a){if(this.g){var d=this.g.responseText;return a&&d.indexOf(a)==0&&(d=d.substring(a.length)),mr(d)}};function Sa(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.H){case"":case"text":return a.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}return null}catch{return null}}function ph(a){const d={};a=(a.g&&2<=_n(a)&&a.g.getAllResponseHeaders()||"").split(`\r
+`);for(let y=0;y=a.h.j-(a.s?1:0)?!1:a.s?(a.i=d.D.concat(a.i),!0):a.G==1||a.G==2||a.B>=(a.Va?0:a.Wa)?!1:(a.s=Xt(g(a.Ga,a,d),Nc(a,a.B)),a.B++,!0)}t.Ga=function(a){if(this.s)if(this.s=null,this.G==1){if(!a){this.U=Math.floor(1e5*Math.random()),a=this.U++;const P=new Wn(this,this.j,a);let O=this.o;if(this.S&&(O?(O=w(O),S(O,this.S)):O=this.S),this.m!==null||this.O||(P.H=O,O=null),this.P)e:{for(var d=0,f=0;fge)O=Math.max(0,P[tt].g-100),Ee=!1;else try{dh(ot,Q,"req"+ge+"_")}catch{y&&y(ot)}}if(Ee){y=Q.join("&");break e}}}return a=a.i.splice(0,f),d.D=a,y}function Cc(a){if(!a.g&&!a.u){a.Y=1;var d=a.Fa;Yt||se(),Y||(Yt(),Y=!0),ae.add(d,a),a.v=0}}function Aa(a){return a.g||a.u||3<=a.v?!1:(a.Y++,a.u=Xt(g(a.Fa,a),Nc(a,a.v)),a.v++,!0)}t.Fa=function(){if(this.u=null,Ac(this),this.ba&&!(this.M||this.g==null||0>=this.R)){var a=2*this.R;this.j.info("BP detection timer enabled: "+a),this.A=Xt(g(this.ab,this),a)}},t.ab=function(){this.A&&(this.A=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.M=!0,wt(10),ai(this),Ac(this))};function Na(a){a.A!=null&&(l.clearTimeout(a.A),a.A=null)}function Ac(a){a.g=new Wn(a,a.j,"rpc",a.Y),a.m===null&&(a.g.H=a.o),a.g.O=0;var d=Pn(a.qa);_e(d,"RID","rpc"),_e(d,"SID",a.K),_e(d,"AID",a.T),_e(d,"CI",a.F?"0":"1"),!a.F&&a.ja&&_e(d,"TO",a.ja),_e(d,"TYPE","xmlhttp"),ns(a,d),a.m&&a.o&&to(d,a.m,a.o),a.L&&(a.g.I=a.L);var f=a.g;a=a.ia,f.L=1,f.v=Js(Pn(d)),f.m=null,f.P=!0,_a(f,a)}t.Za=function(){this.C!=null&&(this.C=null,ai(this),Aa(this),wt(19))};function oo(a){a.C!=null&&(l.clearTimeout(a.C),a.C=null)}function Pa(a,d){var f=null;if(a.g==d){oo(a),Na(a),a.g=null;var y=2}else if(Hn(a.h,d))f=d.D,Gs(a.h,d),y=1;else return;if(a.G!=0){if(d.o)if(y==1){f=d.m?d.m.length:0,d=Date.now()-d.F;var P=a.B;y=Ue(),Ze(y,new Gi(y,f)),kr(a)}else Cc(a);else if(P=d.s,P==3||P==0&&0`${this.name}: [code=${this.code}]: ${this.message}`}}/**
+ */const U={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 Z extends fr{constructor(e,n){super(e,n),this.code=e,this.message=n,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1854,7 +1854,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Dr{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
+ */class Ur{constructor(){this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1869,7 +1869,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Lx{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class iA{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Ot.UNAUTHENTICATED))}shutdown(){}}class sA{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 oA{constructor(e){this.t=e,this.currentUser=Ot.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Se(this.o===void 0);let r=this.i;const i=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let s=new Dr;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Dr,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},l=u=>{re("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>l(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?l(u):(re("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Dr)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(re("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Se(typeof r.accessToken=="string"),new Lx(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Se(e===null||typeof e=="string"),new Ot(e)}}class aA{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=Ot.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class lA{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new aA(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(Ot.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class cA{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 uA{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){Se(this.o===void 0);const r=s=>{s.error!=null&&re("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,re("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{re("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):re("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Se(typeof n.token=="string"),this.R=n.token,new cA(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
+ */class Ux{constructor(e,n){this.user=n,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class lA{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,n){e.enqueueRetryable(()=>n(Ot.UNAUTHENTICATED))}shutdown(){}}class cA{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 uA{constructor(e){this.t=e,this.currentUser=Ot.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,n){Se(this.o===void 0);let r=this.i;const i=u=>this.i!==r?(r=this.i,n(u)):Promise.resolve();let s=new Ur;this.o=()=>{this.i++,this.currentUser=this.u(),s.resolve(),s=new Ur,e.enqueueRetryable(()=>i(this.currentUser))};const o=()=>{const u=s;e.enqueueRetryable(async()=>{await u.promise,await i(this.currentUser)})},l=u=>{re("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=u,this.o&&(this.auth.addAuthTokenListener(this.o),o())};this.t.onInit(u=>l(u)),setTimeout(()=>{if(!this.auth){const u=this.t.getImmediate({optional:!0});u?l(u):(re("FirebaseAuthCredentialsProvider","Auth not yet detected"),s.resolve(),s=new Ur)}},0),o()}getToken(){const e=this.i,n=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(n).then(r=>this.i!==e?(re("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):r?(Se(typeof r.accessToken=="string"),new Ux(r.accessToken,this.currentUser)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.auth&&this.o&&this.auth.removeAuthTokenListener(this.o),this.o=void 0}u(){const e=this.auth&&this.auth.getUid();return Se(e===null||typeof e=="string"),new Ot(e)}}class dA{constructor(e,n,r){this.l=e,this.h=n,this.P=r,this.type="FirstParty",this.user=Ot.FIRST_PARTY,this.I=new Map}T(){return this.P?this.P():null}get headers(){this.I.set("X-Goog-AuthUser",this.l);const e=this.T();return e&&this.I.set("Authorization",e),this.h&&this.I.set("X-Goog-Iam-Authorization-Token",this.h),this.I}}class hA{constructor(e,n,r){this.l=e,this.h=n,this.P=r}getToken(){return Promise.resolve(new dA(this.l,this.h,this.P))}start(e,n){e.enqueueRetryable(()=>n(Ot.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class fA{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 pA{constructor(e){this.A=e,this.forceRefresh=!1,this.appCheck=null,this.R=null}start(e,n){Se(this.o===void 0);const r=s=>{s.error!=null&&re("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${s.error.message}`);const o=s.token!==this.R;return this.R=s.token,re("FirebaseAppCheckTokenProvider",`Received ${o?"new":"existing"} token.`),o?n(s.token):Promise.resolve()};this.o=s=>{e.enqueueRetryable(()=>r(s))};const i=s=>{re("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=s,this.o&&this.appCheck.addTokenListener(this.o)};this.A.onInit(s=>i(s)),setTimeout(()=>{if(!this.appCheck){const s=this.A.getImmediate({optional:!0});s?i(s):re("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){const e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(n=>n?(Se(typeof n.token=="string"),this.R=n.token,new fA(n.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -1884,7 +1884,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function dA(t){const e=typeof self<"u"&&(self.crypto||self.msCrypto),n=new Uint8Array(t);if(e&&typeof e.getRandomValues=="function")e.getRandomValues(n);else for(let r=0;re?1:0}function Wo(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/**
+ */class zx{static newId(){const e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=Math.floor(256/e.length)*e.length;let r="";for(;r.length<20;){const i=mA(40);for(let s=0;se?1:0}function Go(t,e,n){return t.length===e.length&&t.every((r,i)=>n(r,e[i]))}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1914,7 +1914,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ft{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new Z(U.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new Z(U.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new Z(U.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Z(U.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ft.fromMillis(Date.now())}static fromDate(e){return ft.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new ft(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?_e(this.nanoseconds,e.nanoseconds):_e(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
+ */class ht{constructor(e,n){if(this.seconds=e,this.nanoseconds=n,n<0)throw new Z(U.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(n>=1e9)throw new Z(U.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+n);if(e<-62135596800)throw new Z(U.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e);if(e>=253402300800)throw new Z(U.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}static now(){return ht.fromMillis(Date.now())}static fromDate(e){return ht.fromMillis(e.getTime())}static fromMillis(e){const n=Math.floor(e/1e3),r=Math.floor(1e6*(e-1e3*n));return new ht(n,r)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?xe(this.nanoseconds,e.nanoseconds):xe(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{seconds:this.seconds,nanoseconds:this.nanoseconds}}valueOf(){const e=this.seconds- -62135596800;return String(e).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1929,7 +1929,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class de{constructor(e){this.timestamp=e}static fromTimestamp(e){return new de(e)}static min(){return new de(new ft(0,0))}static max(){return new de(new ft(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
+ */class de{constructor(e){this.timestamp=e}static fromTimestamp(e){return new de(e)}static min(){return new de(new ht(0,0))}static max(){return new de(new ht(253402300799,999999999))}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1944,7 +1944,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Vl{constructor(e,n,r){n===void 0?n=0:n>e.length&&ce(),r===void 0?r=e.length-n:r>e.length-n&&ce(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Vl.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Vl?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.lengtho)return 1}return e.lengthn.length?1:0}}class Le extends Vl{construct(e,n,r){return new Le(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new Z(U.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new Le(n)}static emptyPath(){return new Le([])}}const hA=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Tt extends Vl{construct(e,n,r){return new Tt(e,n,r)}static isValidIdentifier(e){return hA.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Tt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new Tt(["__name__"])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new Z(U.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;ie.length&&ce(),r===void 0?r=e.length-n:r>e.length-n&&ce(),this.segments=e,this.offset=n,this.len=r}get length(){return this.len}isEqual(e){return Fl.comparator(this,e)===0}child(e){const n=this.segments.slice(this.offset,this.limit());return e instanceof Fl?e.forEach(r=>{n.push(r)}):n.push(e),this.construct(n)}limit(){return this.offset+this.length}popFirst(e){return e=e===void 0?1:e,this.construct(this.segments,this.offset+e,this.length-e)}popLast(){return this.construct(this.segments,this.offset,this.length-1)}firstSegment(){return this.segments[this.offset]}lastSegment(){return this.get(this.length-1)}get(e){return this.segments[this.offset+e]}isEmpty(){return this.length===0}isPrefixOf(e){if(e.lengtho)return 1}return e.lengthn.length?1:0}}class De extends Fl{construct(e,n,r){return new De(e,n,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){const n=[];for(const r of e){if(r.indexOf("//")>=0)throw new Z(U.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);n.push(...r.split("/").filter(i=>i.length>0))}return new De(n)}static emptyPath(){return new De([])}}const gA=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class Tt extends Fl{construct(e,n,r){return new Tt(e,n,r)}static isValidIdentifier(e){return gA.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),Tt.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return this.length===1&&this.get(0)==="__name__"}static keyField(){return new Tt(["__name__"])}static fromServerFormat(e){const n=[];let r="",i=0;const s=()=>{if(r.length===0)throw new Z(U.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);n.push(r),r=""};let o=!1;for(;i=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&&Le.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return Le.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ie(new Le(e.slice()))}}function fA(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=de.fromTimestamp(r===1e9?new ft(n+1,0):new ft(n,r));return new Ri(i,ie.empty(),e)}function pA(t){return new Ri(t.readTime,t.key,-1)}class Ri{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new Ri(de.min(),ie.empty(),-1)}static max(){return new Ri(de.max(),ie.empty(),-1)}}function mA(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=ie.comparator(t.documentKey,e.documentKey),n!==0?n:_e(t.largestBatchId,e.largestBatchId))}/**
+ */class ie{constructor(e){this.path=e}static fromPath(e){return new ie(De.fromString(e))}static fromName(e){return new ie(De.fromString(e).popFirst(5))}static empty(){return new ie(De.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&&De.comparator(this.path,e.path)===0}toString(){return this.path.toString()}static comparator(e,n){return De.comparator(e.path,n.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ie(new De(e.slice()))}}function yA(t,e){const n=t.toTimestamp().seconds,r=t.toTimestamp().nanoseconds+1,i=de.fromTimestamp(r===1e9?new ht(n+1,0):new ht(n,r));return new ji(i,ie.empty(),e)}function vA(t){return new ji(t.readTime,t.key,-1)}class ji{constructor(e,n,r){this.readTime=e,this.documentKey=n,this.largestBatchId=r}static min(){return new ji(de.min(),ie.empty(),-1)}static max(){return new ji(de.max(),ie.empty(),-1)}}function wA(t,e){let n=t.readTime.compareTo(e.readTime);return n!==0?n:(n=ie.comparator(t.documentKey,e.documentKey),n!==0?n:xe(t.largestBatchId,e.largestBatchId))}/**
* @license
* Copyright 2020 Google LLC
*
@@ -1974,7 +1974,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const gA="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class yA{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
+ */const _A="The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab.";class xA{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -1989,7 +1989,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function nc(t){if(t.code!==U.FAILED_PRECONDITION||t.message!==gA)throw t;re("LocalStore","Unexpectedly lost primary lease")}/**
+ */async function rc(t){if(t.code!==U.FAILED_PRECONDITION||t.message!==_A)throw t;re("LocalStore","Unexpectedly lost primary lease")}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2004,7 +2004,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ${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&&ce(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new $((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof $?n:$.resolve(n)}catch(n){return $.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):$.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):$.reject(n)}static resolve(e){return new $((n,r)=>{n(e)})}static reject(e){return new $((n,r)=>{r(e)})}static waitFor(e){return new $((n,r)=>{let i=0,s=0,o=!1;e.forEach(l=>{++i,l.next(()=>{++s,o&&s===i&&n()},u=>r(u))}),o=!0,s===i&&n()})}static or(e){let n=$.resolve(!1);for(const r of e)n=n.next(i=>i?$.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new $((r,i)=>{const s=e.length,o=new Array(s);let l=0;for(let u=0;u{o[h]=m,++l,l===s&&r(o)},m=>i(m))}})}static doWhile(e,n){return new $((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function vA(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function rc(t){return t.name==="IndexedDbTransactionError"}/**
+ */class ${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&&ce(),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new $((r,i)=>{this.nextCallback=s=>{this.wrapSuccess(e,s).next(r,i)},this.catchCallback=s=>{this.wrapFailure(n,s).next(r,i)}})}toPromise(){return new Promise((e,n)=>{this.next(e,n)})}wrapUserFunction(e){try{const n=e();return n instanceof $?n:$.resolve(n)}catch(n){return $.reject(n)}}wrapSuccess(e,n){return e?this.wrapUserFunction(()=>e(n)):$.resolve(n)}wrapFailure(e,n){return e?this.wrapUserFunction(()=>e(n)):$.reject(n)}static resolve(e){return new $((n,r)=>{n(e)})}static reject(e){return new $((n,r)=>{r(e)})}static waitFor(e){return new $((n,r)=>{let i=0,s=0,o=!1;e.forEach(l=>{++i,l.next(()=>{++s,o&&s===i&&n()},u=>r(u))}),o=!0,s===i&&n()})}static or(e){let n=$.resolve(!1);for(const r of e)n=n.next(i=>i?$.resolve(i):r());return n}static forEach(e,n){const r=[];return e.forEach((i,s)=>{r.push(n.call(this,i,s))}),this.waitFor(r)}static mapArray(e,n){return new $((r,i)=>{const s=e.length,o=new Array(s);let l=0;for(let u=0;u{o[h]=m,++l,l===s&&r(o)},m=>i(m))}})}static doWhile(e,n){return new $((r,i)=>{const s=()=>{e()===!0?n().next(()=>{s()},i):r()};s()})}}function EA(t){const e=t.match(/Android ([\d.]+)/i),n=e?e[1].split(".").slice(0,2).join("."):"-1";return Number(n)}function ic(t){return t.name==="IndexedDbTransactionError"}/**
* @license
* Copyright 2018 Google LLC
*
@@ -2019,7 +2019,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Mm{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ie(r),this.se=r=>n.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}Mm.oe=-1;function Ud(t){return t==null}function ld(t){return t===0&&1/t==-1/0}function wA(t){return typeof t=="number"&&Number.isInteger(t)&&!ld(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
+ */class Vm{constructor(e,n){this.previousValue=e,n&&(n.sequenceNumberHandler=r=>this.ie(r),this.se=r=>n.writeSequenceNumber(r))}ie(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){const e=++this.previousValue;return this.se&&this.se(e),e}}Vm.oe=-1;function Bd(t){return t==null}function ud(t){return t===0&&1/t==-1/0}function kA(t){return typeof t=="number"&&Number.isInteger(t)&&!ud(t)&&t<=Number.MAX_SAFE_INTEGER&&t>=Number.MIN_SAFE_INTEGER}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2034,7 +2034,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function Cv(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Rs(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Vx(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
+ */function Rv(t){let e=0;for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e++;return e}function Ds(t,e){for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function Bx(t){for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2049,7 +2049,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class He{constructor(e,n){this.comparator=e,this.root=n||kt.EMPTY}insert(e,n){return new He(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,kt.BLACK,null,null))}remove(e){return new He(this.comparator,this.root.remove(e,this.comparator).copy(null,null,kt.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new nu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new nu(this.root,e,this.comparator,!1)}getReverseIterator(){return new nu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new nu(this.root,e,this.comparator,!0)}}class nu{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class kt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??kt.RED,this.left=i??kt.EMPTY,this.right=s??kt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new kt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return kt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return kt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,kt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,kt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw ce();const e=this.left.check();if(e!==this.right.check())throw ce();return e+(this.isRed()?0:1)}}kt.EMPTY=null,kt.RED=!0,kt.BLACK=!1;kt.EMPTY=new class{constructor(){this.size=0}get key(){throw ce()}get value(){throw ce()}get color(){throw ce()}get left(){throw ce()}get right(){throw ce()}copy(e,n,r,i,s){return this}insert(e,n,r){return new kt(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}};/**
+ */class We{constructor(e,n){this.comparator=e,this.root=n||kt.EMPTY}insert(e,n){return new We(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,kt.BLACK,null,null))}remove(e){return new We(this.comparator,this.root.remove(e,this.comparator).copy(null,null,kt.BLACK,null,null))}get(e){let n=this.root;for(;!n.isEmpty();){const r=this.comparator(e,n.key);if(r===0)return n.value;r<0?n=n.left:r>0&&(n=n.right)}return null}indexOf(e){let n=0,r=this.root;for(;!r.isEmpty();){const i=this.comparator(e,r.key);if(i===0)return n+r.left.size;i<0?r=r.left:(n+=r.left.size+1,r=r.right)}return-1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((n,r)=>(e(n,r),!1))}toString(){const e=[];return this.inorderTraversal((n,r)=>(e.push(`${n}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new iu(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new iu(this.root,e,this.comparator,!1)}getReverseIterator(){return new iu(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new iu(this.root,e,this.comparator,!0)}}class iu{constructor(e,n,r,i){this.isReverse=i,this.nodeStack=[];let s=1;for(;!e.isEmpty();)if(s=n?r(e.key,n):1,n&&i&&(s*=-1),s<0)e=this.isReverse?e.left:e.right;else{if(s===0){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop();const n={key:e.key,value:e.value};if(this.isReverse)for(e=e.left;!e.isEmpty();)this.nodeStack.push(e),e=e.right;else for(e=e.right;!e.isEmpty();)this.nodeStack.push(e),e=e.left;return n}hasNext(){return this.nodeStack.length>0}peek(){if(this.nodeStack.length===0)return null;const e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class kt{constructor(e,n,r,i,s){this.key=e,this.value=n,this.color=r??kt.RED,this.left=i??kt.EMPTY,this.right=s??kt.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,n,r,i,s){return new kt(e??this.key,n??this.value,r??this.color,i??this.left,s??this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,n,r){let i=this;const s=r(e,i.key);return i=s<0?i.copy(null,null,null,i.left.insert(e,n,r),null):s===0?i.copy(null,n,null,null,null):i.copy(null,null,null,null,i.right.insert(e,n,r)),i.fixUp()}removeMin(){if(this.left.isEmpty())return kt.EMPTY;let e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()}remove(e,n){let r,i=this;if(n(e,i.key)<0)i.left.isEmpty()||i.left.isRed()||i.left.left.isRed()||(i=i.moveRedLeft()),i=i.copy(null,null,null,i.left.remove(e,n),null);else{if(i.left.isRed()&&(i=i.rotateRight()),i.right.isEmpty()||i.right.isRed()||i.right.left.isRed()||(i=i.moveRedRight()),n(e,i.key)===0){if(i.right.isEmpty())return kt.EMPTY;r=i.right.min(),i=i.copy(r.key,r.value,null,null,i.right.removeMin())}i=i.copy(null,null,null,null,i.right.remove(e,n))}return i.fixUp()}isRed(){return this.color}fixUp(){let e=this;return e.right.isRed()&&!e.left.isRed()&&(e=e.rotateLeft()),e.left.isRed()&&e.left.left.isRed()&&(e=e.rotateRight()),e.left.isRed()&&e.right.isRed()&&(e=e.colorFlip()),e}moveRedLeft(){let e=this.colorFlip();return e.right.left.isRed()&&(e=e.copy(null,null,null,null,e.right.rotateRight()),e=e.rotateLeft(),e=e.colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=e.rotateRight(),e=e.colorFlip()),e}rotateLeft(){const e=this.copy(null,null,kt.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){const e=this.copy(null,null,kt.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){const e=this.left.copy(null,null,!this.left.color,null,null),n=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,n)}checkMaxDepth(){const e=this.check();return Math.pow(2,e)<=this.size+1}check(){if(this.isRed()&&this.left.isRed()||this.right.isRed())throw ce();const e=this.left.check();if(e!==this.right.check())throw ce();return e+(this.isRed()?0:1)}}kt.EMPTY=null,kt.RED=!0,kt.BLACK=!1;kt.EMPTY=new class{constructor(){this.size=0}get key(){throw ce()}get value(){throw ce()}get color(){throw ce()}get left(){throw ce()}get right(){throw ce()}copy(e,n,r,i,s){return this}insert(e,n,r){return new kt(e,n)}remove(e,n){return this}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}isRed(){return!1}checkMaxDepth(){return!0}check(){return 0}};/**
* @license
* Copyright 2017 Google LLC
*
@@ -2064,7 +2064,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class St{constructor(e){this.comparator=e,this.data=new He(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new Av(this.data.getIterator())}getIteratorFrom(e){return new Av(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{n=n.add(r)}),n}isEqual(e){if(!(e instanceof St)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new St(this.comparator);return n.data=e,n}}class Av{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
+ */class St{constructor(e){this.comparator=e,this.data=new We(this.comparator)}has(e){return this.data.get(e)!==null}first(){return this.data.minKey()}last(){return this.data.maxKey()}get size(){return this.data.size}indexOf(e){return this.data.indexOf(e)}forEach(e){this.data.inorderTraversal((n,r)=>(e(n),!1))}forEachInRange(e,n){const r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){const i=r.getNext();if(this.comparator(i.key,e[1])>=0)return;n(i.key)}}forEachWhile(e,n){let r;for(r=n!==void 0?this.data.getIteratorFrom(n):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){const n=this.data.getIteratorFrom(e);return n.hasNext()?n.getNext().key:null}getIterator(){return new Dv(this.data.getIterator())}getIteratorFrom(e){return new Dv(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{n=n.add(r)}),n}isEqual(e){if(!(e instanceof St)||this.size!==e.size)return!1;const n=this.data.getIterator(),r=e.data.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(this.comparator(i,s)!==0)return!1}return!0}toArray(){const e=[];return this.forEach(n=>{e.push(n)}),e}toString(){const e=[];return this.forEach(n=>e.push(n)),"SortedSet("+e.toString()+")"}copy(e){const n=new St(this.comparator);return n.data=e,n}}class Dv{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2079,7 +2079,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class hn{constructor(e){this.fields=e,e.sort(Tt.comparator)}static empty(){return new hn([])}unionWith(e){let n=new St(Tt.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new hn(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Wo(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
+ */class dn{constructor(e){this.fields=e,e.sort(Tt.comparator)}static empty(){return new dn([])}unionWith(e){let n=new St(Tt.comparator);for(const r of this.fields)n=n.add(r);for(const r of e)n=n.add(r);return new dn(n.toArray())}covers(e){for(const n of this.fields)if(n.isPrefixOf(e))return!0;return!1}isEqual(e){return Go(this.fields,e.fields,(n,r)=>n.isEqual(r))}}/**
* @license
* Copyright 2023 Google LLC
*
@@ -2094,7 +2094,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Fx extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
+ */class $x extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2109,7 +2109,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Ct{constructor(e){this.binaryString=e}static fromBase64String(e){const n=function(i){try{return atob(i)}catch(s){throw typeof DOMException<"u"&&s instanceof DOMException?new Fx("Invalid base64 string: "+s):s}}(e);return new Ct(n)}static fromUint8Array(e){const n=function(i){let s="";for(let o=0;oeelr(n,e))!==void 0}function Ho(t,e){if(t===e)return 0;const n=Ss(t),r=Ss(e);if(n!==r)return _e(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return _e(t.booleanValue,e.booleanValue);case 2:return function(s,o){const l=Ye(s.integerValue||s.doubleValue),u=Ye(o.integerValue||o.doubleValue);return lu?1:l===u?0:isNaN(l)?isNaN(u)?0:-1:1}(t,e);case 3:return Nv(t.timestampValue,e.timestampValue);case 4:return Nv(Fl(t),Fl(e));case 5:return _e(t.stringValue,e.stringValue);case 6:return function(s,o){const l=bs(s),u=bs(o);return l.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const l=s.split("/"),u=o.split("/");for(let h=0;he.mapValue.fields[n]=pl(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=pl(t.arrayValue.values[n]);return e}return Object.assign({},t)}function kA(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
+ */const su={mapValue:{}};function Is(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?Fm(t)?4:IA(t)?9007199254740991:SA(t)?10:11:ce()}function dr(t,e){if(t===e)return!0;const n=Is(t);if(n!==Is(e))return!1;switch(n){case 0:case 9007199254740991:return!0;case 1:return t.booleanValue===e.booleanValue;case 4:return Ul(t).isEqual(Ul(e));case 3:return function(i,s){if(typeof i.timestampValue=="string"&&typeof s.timestampValue=="string"&&i.timestampValue.length===s.timestampValue.length)return i.timestampValue===s.timestampValue;const o=Oi(i.timestampValue),l=Oi(s.timestampValue);return o.seconds===l.seconds&&o.nanos===l.nanos}(t,e);case 5:return t.stringValue===e.stringValue;case 6:return function(i,s){return Ss(i.bytesValue).isEqual(Ss(s.bytesValue))}(t,e);case 7:return t.referenceValue===e.referenceValue;case 8:return function(i,s){return Ye(i.geoPointValue.latitude)===Ye(s.geoPointValue.latitude)&&Ye(i.geoPointValue.longitude)===Ye(s.geoPointValue.longitude)}(t,e);case 2:return function(i,s){if("integerValue"in i&&"integerValue"in s)return Ye(i.integerValue)===Ye(s.integerValue);if("doubleValue"in i&&"doubleValue"in s){const o=Ye(i.doubleValue),l=Ye(s.doubleValue);return o===l?ud(o)===ud(l):isNaN(o)&&isNaN(l)}return!1}(t,e);case 9:return Go(t.arrayValue.values||[],e.arrayValue.values||[],dr);case 10:case 11:return function(i,s){const o=i.mapValue.fields||{},l=s.mapValue.fields||{};if(Rv(o)!==Rv(l))return!1;for(const u in o)if(o.hasOwnProperty(u)&&(l[u]===void 0||!dr(o[u],l[u])))return!1;return!0}(t,e);default:return ce()}}function Bl(t,e){return(t.values||[]).find(n=>dr(n,e))!==void 0}function Qo(t,e){if(t===e)return 0;const n=Is(t),r=Is(e);if(n!==r)return xe(n,r);switch(n){case 0:case 9007199254740991:return 0;case 1:return xe(t.booleanValue,e.booleanValue);case 2:return function(s,o){const l=Ye(s.integerValue||s.doubleValue),u=Ye(o.integerValue||o.doubleValue);return lu?1:l===u?0:isNaN(l)?isNaN(u)?0:-1:1}(t,e);case 3:return jv(t.timestampValue,e.timestampValue);case 4:return jv(Ul(t),Ul(e));case 5:return xe(t.stringValue,e.stringValue);case 6:return function(s,o){const l=Ss(s),u=Ss(o);return l.compareTo(u)}(t.bytesValue,e.bytesValue);case 7:return function(s,o){const l=s.split("/"),u=o.split("/");for(let h=0;he.mapValue.fields[n]=ml(r)),e}if(t.arrayValue){const e={arrayValue:{values:[]}};for(let n=0;n<(t.arrayValue.values||[]).length;++n)e.arrayValue.values[n]=ml(t.arrayValue.values[n]);return e}return Object.assign({},t)}function IA(t){return(((t.mapValue||{}).fields||{}).__type__||{}).stringValue==="__max__"}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2169,7 +2169,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class tn{constructor(e){this.value=e}static empty(){return new tn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(l)){const u=this.getFieldsMap(n);this.applyChanges(u,r,i),r={},i=[],n=l.popLast()}o?r[l.lastSegment()]=pl(o):i.push(l.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());bu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return lr(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[i]=s);for(const i of r)delete e[i]}clone(){return new tn(pl(this.value))}}function Ux(t){const e=[];return Rs(t.fields,(n,r)=>{const i=new Tt([n]);if(bu(r)){const s=Ux(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new hn(e)}/**
+ */class tn{constructor(e){this.value=e}static empty(){return new tn({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let n=this.value;for(let r=0;r{if(!n.isImmediateParentOf(l)){const u=this.getFieldsMap(n);this.applyChanges(u,r,i),r={},i=[],n=l.popLast()}o?r[l.lastSegment()]=ml(o):i.push(l.lastSegment())});const s=this.getFieldsMap(n);this.applyChanges(s,r,i)}delete(e){const n=this.field(e.popLast());Iu(n)&&n.mapValue.fields&&delete n.mapValue.fields[e.lastSegment()]}isEqual(e){return dr(this.value,e.value)}getFieldsMap(e){let n=this.value;n.mapValue.fields||(n.mapValue={fields:{}});for(let r=0;re[i]=s);for(const i of r)delete e[i]}clone(){return new tn(ml(this.value))}}function qx(t){const e=[];return Ds(t.fields,(n,r)=>{const i=new Tt([n]);if(Iu(r)){const s=qx(r.mapValue).fields;if(s.length===0)e.push(i);else for(const o of s)e.push(i.child(o))}else e.push(i)}),new dn(e)}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2199,7 +2199,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class cd{constructor(e,n){this.position=e,this.inclusive=n}}function Ov(t,e,n){let r=0;for(let i=0;i":return e>0;case">=":return e>=0;default:return ce()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class $n extends zx{constructor(e,n){super(),this.filters=e,this.op=n,this.ae=null}static create(e,n){return new $n(e,n)}matches(e){return Bx(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function Bx(t){return t.op==="and"}function $x(t){return bA(t)&&Bx(t)}function bA(t){for(const e of t.filters)if(e instanceof $n)return!1;return!0}function gp(t){if(t instanceof it)return t.field.canonicalString()+t.op.toString()+Ko(t.value);if($x(t))return t.filters.map(e=>gp(e)).join(",");{const e=t.filters.map(n=>gp(n)).join(",");return`${t.op}(${e})`}}function qx(t,e){return t instanceof it?function(r,i){return i instanceof it&&r.op===i.op&&r.field.isEqual(i.field)&&lr(r.value,i.value)}(t,e):t instanceof $n?function(r,i){return i instanceof $n&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,l)=>s&&qx(o,i.filters[l]),!0):!1}(t,e):void ce()}function Wx(t){return t instanceof it?function(n){return`${n.field.canonicalString()} ${n.op} ${Ko(n.value)}`}(t):t instanceof $n?function(n){return n.op.toString()+" {"+n.getFilters().map(Wx).join(" ,")+"}"}(t):"Filter"}class SA extends it{constructor(e,n,r){super(e,n,r),this.key=ie.fromName(r.referenceValue)}matches(e){const n=ie.comparator(e.key,this.key);return this.matchesComparison(n)}}class IA extends it{constructor(e,n){super(e,"in",n),this.keys=Hx("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class CA extends it{constructor(e,n){super(e,"not-in",n),this.keys=Hx("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Hx(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>ie.fromName(r.referenceValue))}class AA extends it{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return Um(n)&&zl(n.arrayValue,this.value)}}class NA extends it{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&zl(this.value.arrayValue,n)}}class PA extends it{constructor(e,n){super(e,"not-in",n)}matches(e){if(zl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!zl(this.value.arrayValue,n)}}class RA extends it{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!Um(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>zl(this.value.arrayValue,r))}}/**
+ */class Wx{}class st extends Wx{constructor(e,n,r){super(),this.field=e,this.op=n,this.value=r}static create(e,n,r){return e.isKeyField()?n==="in"||n==="not-in"?this.createKeyFieldInFilter(e,n,r):new NA(e,n,r):n==="array-contains"?new DA(e,r):n==="in"?new jA(e,r):n==="not-in"?new OA(e,r):n==="array-contains-any"?new LA(e,r):new st(e,n,r)}static createKeyFieldInFilter(e,n,r){return n==="in"?new PA(e,r):new RA(e,r)}matches(e){const n=e.data.field(this.field);return this.op==="!="?n!==null&&this.matchesComparison(Qo(n,this.value)):n!==null&&Is(this.value)===Is(n)&&this.matchesComparison(Qo(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 ce()}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class Bn extends Wx{constructor(e,n){super(),this.filters=e,this.op=n,this.ae=null}static create(e,n){return new Bn(e,n)}matches(e){return Hx(this)?this.filters.find(n=>!n.matches(e))===void 0:this.filters.find(n=>n.matches(e))!==void 0}getFlattenedFilters(){return this.ae!==null||(this.ae=this.filters.reduce((e,n)=>e.concat(n.getFlattenedFilters()),[])),this.ae}getFilters(){return Object.assign([],this.filters)}}function Hx(t){return t.op==="and"}function Kx(t){return AA(t)&&Hx(t)}function AA(t){for(const e of t.filters)if(e instanceof Bn)return!1;return!0}function yp(t){if(t instanceof st)return t.field.canonicalString()+t.op.toString()+Yo(t.value);if(Kx(t))return t.filters.map(e=>yp(e)).join(",");{const e=t.filters.map(n=>yp(n)).join(",");return`${t.op}(${e})`}}function Gx(t,e){return t instanceof st?function(r,i){return i instanceof st&&r.op===i.op&&r.field.isEqual(i.field)&&dr(r.value,i.value)}(t,e):t instanceof Bn?function(r,i){return i instanceof Bn&&r.op===i.op&&r.filters.length===i.filters.length?r.filters.reduce((s,o,l)=>s&&Gx(o,i.filters[l]),!0):!1}(t,e):void ce()}function Qx(t){return t instanceof st?function(n){return`${n.field.canonicalString()} ${n.op} ${Yo(n.value)}`}(t):t instanceof Bn?function(n){return n.op.toString()+" {"+n.getFilters().map(Qx).join(" ,")+"}"}(t):"Filter"}class NA extends st{constructor(e,n,r){super(e,n,r),this.key=ie.fromName(r.referenceValue)}matches(e){const n=ie.comparator(e.key,this.key);return this.matchesComparison(n)}}class PA extends st{constructor(e,n){super(e,"in",n),this.keys=Yx("in",n)}matches(e){return this.keys.some(n=>n.isEqual(e.key))}}class RA extends st{constructor(e,n){super(e,"not-in",n),this.keys=Yx("not-in",n)}matches(e){return!this.keys.some(n=>n.isEqual(e.key))}}function Yx(t,e){var n;return(((n=e.arrayValue)===null||n===void 0?void 0:n.values)||[]).map(r=>ie.fromName(r.referenceValue))}class DA extends st{constructor(e,n){super(e,"array-contains",n)}matches(e){const n=e.data.field(this.field);return zm(n)&&Bl(n.arrayValue,this.value)}}class jA extends st{constructor(e,n){super(e,"in",n)}matches(e){const n=e.data.field(this.field);return n!==null&&Bl(this.value.arrayValue,n)}}class OA extends st{constructor(e,n){super(e,"not-in",n)}matches(e){if(Bl(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;const n=e.data.field(this.field);return n!==null&&!Bl(this.value.arrayValue,n)}}class LA extends st{constructor(e,n){super(e,"array-contains-any",n)}matches(e){const n=e.data.field(this.field);return!(!zm(n)||!n.arrayValue.values)&&n.arrayValue.values.some(r=>Bl(this.value.arrayValue,r))}}/**
* @license
* Copyright 2019 Google LLC
*
@@ -2244,7 +2244,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class DA{constructor(e,n=null,r=[],i=[],s=null,o=null,l=null){this.path=e,this.collectionGroup=n,this.orderBy=r,this.filters=i,this.limit=s,this.startAt=o,this.endAt=l,this.ue=null}}function Mv(t,e=null,n=[],r=[],i=null,s=null,o=null){return new DA(t,e,n,r,i,s,o)}function zm(t){const e=he(t);if(e.ue===null){let n=e.path.canonicalString();e.collectionGroup!==null&&(n+="|cg:"+e.collectionGroup),n+="|f:",n+=e.filters.map(r=>gp(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),Ud(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Ko(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Ko(r)).join(",")),e.ue=n}return e.ue}function Bm(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;nyp(r)).join(","),n+="|ob:",n+=e.orderBy.map(r=>function(s){return s.field.canonicalString()+s.dir}(r)).join(","),Bd(e.limit)||(n+="|l:",n+=e.limit),e.startAt&&(n+="|lb:",n+=e.startAt.inclusive?"b:":"a:",n+=e.startAt.position.map(r=>Yo(r)).join(",")),e.endAt&&(n+="|ub:",n+=e.endAt.inclusive?"a:":"b:",n+=e.endAt.position.map(r=>Yo(r)).join(",")),e.ue=n}return e.ue}function $m(t,e){if(t.limit!==e.limit||t.orderBy.length!==e.orderBy.length)return!1;for(let n=0;n0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let l=new St(Tt.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(h=>{h.isInequality()&&(l=l.add(h.field))})}),l})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.ce.push(new ud(s,r))}),n.has(Tt.keyField().canonicalString())||e.ce.push(new ud(Tt.keyField(),r))}return e.ce}function sr(t){const e=he(t);return e.le||(e.le=OA(e,ml(t))),e.le}function OA(t,e){if(t.limitType==="F")return Mv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new ud(i.field,s)});const n=t.endAt?new cd(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new cd(t.startAt.position,t.startAt.inclusive):null;return Mv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function vp(t,e){const n=t.filters.concat([e]);return new ic(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function wp(t,e,n){return new ic(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function Bd(t,e){return Bm(sr(t),sr(e))&&t.limitType===e.limitType}function Gx(t){return`${zm(sr(t))}|lt:${t.limitType}`}function uo(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>Wx(i)).join(", ")}]`),Ud(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Ko(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Ko(i)).join(",")),`Target(${r})`}(sr(t))}; limitType=${t.limitType})`}function $d(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):ie.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of ml(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,l,u){const h=Ov(o,l,u);return o.inclusive?h<=0:h<0}(r.startAt,ml(r),i)||r.endAt&&!function(o,l,u){const h=Ov(o,l,u);return o.inclusive?h>=0:h>0}(r.endAt,ml(r),i))}(t,e)}function LA(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Qx(t){return(e,n)=>{let r=!1;for(const i of ml(t)){const s=MA(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function MA(t,e,n){const r=t.field.isKeyField()?ie.comparator(e.key,n.key):function(s,o,l){const u=o.data.field(s),h=l.data.field(s);return u!==null&&h!==null?Ho(u,h):ce()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ce()}}/**
+ */class sc{constructor(e,n=null,r=[],i=[],s=null,o="F",l=null,u=null){this.path=e,this.collectionGroup=n,this.explicitOrderBy=r,this.filters=i,this.limit=s,this.limitType=o,this.startAt=l,this.endAt=u,this.ce=null,this.le=null,this.he=null,this.startAt,this.endAt}}function VA(t,e,n,r,i,s,o,l){return new sc(t,e,n,r,i,s,o,l)}function $d(t){return new sc(t)}function Bv(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 Jx(t){return t.collectionGroup!==null}function gl(t){const e=he(t);if(e.ce===null){e.ce=[];const n=new Set;for(const s of e.explicitOrderBy)e.ce.push(s),n.add(s.field.canonicalString());const r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";(function(o){let l=new St(Tt.comparator);return o.filters.forEach(u=>{u.getFlattenedFilters().forEach(h=>{h.isInequality()&&(l=l.add(h.field))})}),l})(e).forEach(s=>{n.has(s.canonicalString())||s.isKeyField()||e.ce.push(new hd(s,r))}),n.has(Tt.keyField().canonicalString())||e.ce.push(new hd(Tt.keyField(),r))}return e.ce}function lr(t){const e=he(t);return e.le||(e.le=FA(e,gl(t))),e.le}function FA(t,e){if(t.limitType==="F")return zv(t.path,t.collectionGroup,e,t.filters,t.limit,t.startAt,t.endAt);{e=e.map(i=>{const s=i.dir==="desc"?"asc":"desc";return new hd(i.field,s)});const n=t.endAt?new dd(t.endAt.position,t.endAt.inclusive):null,r=t.startAt?new dd(t.startAt.position,t.startAt.inclusive):null;return zv(t.path,t.collectionGroup,e,t.filters,t.limit,n,r)}}function wp(t,e){const n=t.filters.concat([e]);return new sc(t.path,t.collectionGroup,t.explicitOrderBy.slice(),n,t.limit,t.limitType,t.startAt,t.endAt)}function _p(t,e,n){return new sc(t.path,t.collectionGroup,t.explicitOrderBy.slice(),t.filters.slice(),e,n,t.startAt,t.endAt)}function qd(t,e){return $m(lr(t),lr(e))&&t.limitType===e.limitType}function Xx(t){return`${Bm(lr(t))}|lt:${t.limitType}`}function po(t){return`Query(target=${function(n){let r=n.path.canonicalString();return n.collectionGroup!==null&&(r+=" collectionGroup="+n.collectionGroup),n.filters.length>0&&(r+=`, filters: [${n.filters.map(i=>Qx(i)).join(", ")}]`),Bd(n.limit)||(r+=", limit: "+n.limit),n.orderBy.length>0&&(r+=`, orderBy: [${n.orderBy.map(i=>function(o){return`${o.field.canonicalString()} (${o.dir})`}(i)).join(", ")}]`),n.startAt&&(r+=", startAt: ",r+=n.startAt.inclusive?"b:":"a:",r+=n.startAt.position.map(i=>Yo(i)).join(",")),n.endAt&&(r+=", endAt: ",r+=n.endAt.inclusive?"a:":"b:",r+=n.endAt.position.map(i=>Yo(i)).join(",")),`Target(${r})`}(lr(t))}; limitType=${t.limitType})`}function Wd(t,e){return e.isFoundDocument()&&function(r,i){const s=i.key.path;return r.collectionGroup!==null?i.key.hasCollectionId(r.collectionGroup)&&r.path.isPrefixOf(s):ie.isDocumentKey(r.path)?r.path.isEqual(s):r.path.isImmediateParentOf(s)}(t,e)&&function(r,i){for(const s of gl(r))if(!s.field.isKeyField()&&i.data.field(s.field)===null)return!1;return!0}(t,e)&&function(r,i){for(const s of r.filters)if(!s.matches(i))return!1;return!0}(t,e)&&function(r,i){return!(r.startAt&&!function(o,l,u){const h=Fv(o,l,u);return o.inclusive?h<=0:h<0}(r.startAt,gl(r),i)||r.endAt&&!function(o,l,u){const h=Fv(o,l,u);return o.inclusive?h>=0:h>0}(r.endAt,gl(r),i))}(t,e)}function UA(t){return t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2))}function Zx(t){return(e,n)=>{let r=!1;for(const i of gl(t)){const s=zA(i,e,n);if(s!==0)return s;r=r||i.field.isKeyField()}return 0}}function zA(t,e,n){const r=t.field.isKeyField()?ie.comparator(e.key,n.key):function(s,o,l){const u=o.data.field(s),h=l.data.field(s);return u!==null&&h!==null?Qo(u,h):ce()}(t.field,e,n);switch(t.dir){case"asc":return r;case"desc":return-1*r;default:return ce()}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2274,7 +2274,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ia{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s{for(const[i,s]of r)e(i,s)})}isEmpty(){return Vx(this.inner)}size(){return this.innerSize}}/**
+ */class aa{constructor(e,n){this.mapKeyFn=e,this.equalsFn=n,this.inner={},this.innerSize=0}get(e){const n=this.mapKeyFn(e),r=this.inner[n];if(r!==void 0){for(const[i,s]of r)if(this.equalsFn(i,e))return s}}has(e){return this.get(e)!==void 0}set(e,n){const r=this.mapKeyFn(e),i=this.inner[r];if(i===void 0)return this.inner[r]=[[e,n]],void this.innerSize++;for(let s=0;s{for(const[i,s]of r)e(i,s)})}isEmpty(){return Bx(this.inner)}size(){return this.innerSize}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2289,7 +2289,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const VA=new He(ie.comparator);function zr(){return VA}const Yx=new He(ie.comparator);function tl(...t){let e=Yx;for(const n of t)e=e.insert(n.key,n);return e}function Jx(t){let e=Yx;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function hs(){return gl()}function Xx(){return gl()}function gl(){return new ia(t=>t.toString(),(t,e)=>t.isEqual(e))}const FA=new He(ie.comparator),UA=new St(ie.comparator);function me(...t){let e=UA;for(const n of t)e=e.add(n);return e}const zA=new St(_e);function BA(){return zA}/**
+ */const BA=new We(ie.comparator);function Gr(){return BA}const eE=new We(ie.comparator);function nl(...t){let e=eE;for(const n of t)e=e.insert(n.key,n);return e}function tE(t){let e=eE;return t.forEach((n,r)=>e=e.insert(n,r.overlayedDocument)),e}function fs(){return yl()}function nE(){return yl()}function yl(){return new aa(t=>t.toString(),(t,e)=>t.isEqual(e))}const $A=new We(ie.comparator),qA=new St(ie.comparator);function me(...t){let e=qA;for(const n of t)e=e.add(n);return e}const WA=new St(xe);function HA(){return WA}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2304,7 +2304,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function $m(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:ld(e)?"-0":e}}function Zx(t){return{integerValue:""+t}}function $A(t,e){return wA(e)?Zx(e):$m(t,e)}/**
+ */function qm(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:ud(e)?"-0":e}}function rE(t){return{integerValue:""+t}}function KA(t,e){return kA(e)?rE(e):qm(t,e)}/**
* @license
* Copyright 2018 Google LLC
*
@@ -2319,7 +2319,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class qd{constructor(){this._=void 0}}function qA(t,e,n){return t instanceof dd?function(i,s){const o={fields:{__type__:{stringValue:"server_timestamp"},__local_write_time__:{timestampValue:{seconds:i.seconds,nanos:i.nanoseconds}}}};return s&&Vm(s)&&(s=Fm(s)),s&&(o.fields.__previous_value__=s),{mapValue:o}}(n,e):t instanceof Bl?tE(t,e):t instanceof $l?nE(t,e):function(i,s){const o=eE(i,s),l=Fv(o)+Fv(i.Pe);return mp(o)&&mp(i.Pe)?Zx(l):$m(i.serializer,l)}(t,e)}function WA(t,e,n){return t instanceof Bl?tE(t,e):t instanceof $l?nE(t,e):n}function eE(t,e){return t instanceof hd?function(r){return mp(r)||function(s){return!!s&&"doubleValue"in s}(r)}(e)?e:{integerValue:0}:null}class dd extends qd{}class Bl extends qd{constructor(e){super(),this.elements=e}}function tE(t,e){const n=rE(e);for(const r of t.elements)n.some(i=>lr(i,r))||n.push(r);return{arrayValue:{values:n}}}class $l extends qd{constructor(e){super(),this.elements=e}}function nE(t,e){let n=rE(e);for(const r of t.elements)n=n.filter(i=>!lr(i,r));return{arrayValue:{values:n}}}class hd extends qd{constructor(e,n){super(),this.serializer=e,this.Pe=n}}function Fv(t){return Ye(t.integerValue||t.doubleValue)}function rE(t){return Um(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function HA(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof Bl&&i instanceof Bl||r instanceof $l&&i instanceof $l?Wo(r.elements,i.elements,lr):r instanceof hd&&i instanceof hd?lr(r.Pe,i.Pe):r instanceof dd&&i instanceof dd}(t.transform,e.transform)}class KA{constructor(e,n){this.version=e,this.transformResults=n}}class $t{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new $t}static exists(e){return new $t(void 0,e)}static updateTime(e){return new $t(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 Su(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Wd{}function iE(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Hd(t.key,$t.none()):new sc(t.key,t.data,$t.none());{const n=t.data,r=tn.empty();let i=new St(Tt.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new Fi(t.key,r,new hn(i.toArray()),$t.none())}}function GA(t,e,n){t instanceof sc?function(i,s,o){const l=i.value.clone(),u=zv(i.fieldTransforms,s,o.transformResults);l.setAll(u),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):t instanceof Fi?function(i,s,o){if(!Su(i.precondition,s))return void s.convertToUnknownDocument(o.version);const l=zv(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(sE(i)),u.setAll(l),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function yl(t,e,n,r){return t instanceof sc?function(s,o,l,u){if(!Su(s.precondition,o))return l;const h=s.value.clone(),m=Bv(s.fieldTransforms,u,o);return h.setAll(m),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),null}(t,e,n,r):t instanceof Fi?function(s,o,l,u){if(!Su(s.precondition,o))return l;const h=Bv(s.fieldTransforms,u,o),m=o.data;return m.setAll(sE(s)),m.setAll(h),o.convertToFoundDocument(o.version,m).setHasLocalMutations(),l===null?null:l.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(v=>v.field))}(t,e,n,r):function(s,o,l){return Su(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):l}(t,e,n)}function QA(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=eE(r.transform,i||null);s!=null&&(n===null&&(n=tn.empty()),n.set(r.field,s))}return n||null}function Uv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Wo(r,i,(s,o)=>HA(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class sc extends Wd{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class Fi extends Wd{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function sE(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function zv(t,e,n){const r=new Map;Se(t.length===n.length);for(let i=0;idr(i,r))||n.push(r);return{arrayValue:{values:n}}}class ql extends Hd{constructor(e){super(),this.elements=e}}function oE(t,e){let n=aE(e);for(const r of t.elements)n=n.filter(i=>!dr(i,r));return{arrayValue:{values:n}}}class pd extends Hd{constructor(e,n){super(),this.serializer=e,this.Pe=n}}function $v(t){return Ye(t.integerValue||t.doubleValue)}function aE(t){return zm(t)&&t.arrayValue.values?t.arrayValue.values.slice():[]}function YA(t,e){return t.field.isEqual(e.field)&&function(r,i){return r instanceof $l&&i instanceof $l||r instanceof ql&&i instanceof ql?Go(r.elements,i.elements,dr):r instanceof pd&&i instanceof pd?dr(r.Pe,i.Pe):r instanceof fd&&i instanceof fd}(t.transform,e.transform)}class JA{constructor(e,n){this.version=e,this.transformResults=n}}class qt{constructor(e,n){this.updateTime=e,this.exists=n}static none(){return new qt}static exists(e){return new qt(void 0,e)}static updateTime(e){return new qt(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 Cu(t,e){return t.updateTime!==void 0?e.isFoundDocument()&&e.version.isEqual(t.updateTime):t.exists===void 0||t.exists===e.isFoundDocument()}class Kd{}function lE(t,e){if(!t.hasLocalMutations||e&&e.fields.length===0)return null;if(e===null)return t.isNoDocument()?new Gd(t.key,qt.none()):new oc(t.key,t.data,qt.none());{const n=t.data,r=tn.empty();let i=new St(Tt.comparator);for(let s of e.fields)if(!i.has(s)){let o=n.field(s);o===null&&s.length>1&&(s=s.popLast(),o=n.field(s)),o===null?r.delete(s):r.set(s,o),i=i.add(s)}return new zi(t.key,r,new dn(i.toArray()),qt.none())}}function XA(t,e,n){t instanceof oc?function(i,s,o){const l=i.value.clone(),u=Wv(i.fieldTransforms,s,o.transformResults);l.setAll(u),s.convertToFoundDocument(o.version,l).setHasCommittedMutations()}(t,e,n):t instanceof zi?function(i,s,o){if(!Cu(i.precondition,s))return void s.convertToUnknownDocument(o.version);const l=Wv(i.fieldTransforms,s,o.transformResults),u=s.data;u.setAll(cE(i)),u.setAll(l),s.convertToFoundDocument(o.version,u).setHasCommittedMutations()}(t,e,n):function(i,s,o){s.convertToNoDocument(o.version).setHasCommittedMutations()}(0,e,n)}function vl(t,e,n,r){return t instanceof oc?function(s,o,l,u){if(!Cu(s.precondition,o))return l;const h=s.value.clone(),m=Hv(s.fieldTransforms,u,o);return h.setAll(m),o.convertToFoundDocument(o.version,h).setHasLocalMutations(),null}(t,e,n,r):t instanceof zi?function(s,o,l,u){if(!Cu(s.precondition,o))return l;const h=Hv(s.fieldTransforms,u,o),m=o.data;return m.setAll(cE(s)),m.setAll(h),o.convertToFoundDocument(o.version,m).setHasLocalMutations(),l===null?null:l.unionWith(s.fieldMask.fields).unionWith(s.fieldTransforms.map(v=>v.field))}(t,e,n,r):function(s,o,l){return Cu(s.precondition,o)?(o.convertToNoDocument(o.version).setHasLocalMutations(),null):l}(t,e,n)}function ZA(t,e){let n=null;for(const r of t.fieldTransforms){const i=e.data.field(r.field),s=iE(r.transform,i||null);s!=null&&(n===null&&(n=tn.empty()),n.set(r.field,s))}return n||null}function qv(t,e){return t.type===e.type&&!!t.key.isEqual(e.key)&&!!t.precondition.isEqual(e.precondition)&&!!function(r,i){return r===void 0&&i===void 0||!(!r||!i)&&Go(r,i,(s,o)=>YA(s,o))}(t.fieldTransforms,e.fieldTransforms)&&(t.type===0?t.value.isEqual(e.value):t.type!==1||t.data.isEqual(e.data)&&t.fieldMask.isEqual(e.fieldMask))}class oc extends Kd{constructor(e,n,r,i=[]){super(),this.key=e,this.value=n,this.precondition=r,this.fieldTransforms=i,this.type=0}getFieldMask(){return null}}class zi extends Kd{constructor(e,n,r,i,s=[]){super(),this.key=e,this.data=n,this.fieldMask=r,this.precondition=i,this.fieldTransforms=s,this.type=1}getFieldMask(){return this.fieldMask}}function cE(t){const e=new Map;return t.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){const r=t.data.field(n);e.set(n,r)}}),e}function Wv(t,e,n){const r=new Map;Se(t.length===n.length);for(let i=0;i{const s=e.get(i.key),o=s.overlayedDocument;let l=this.applyToLocalView(o,s.mutatedFields);l=n.has(i.key)?null:l;const u=iE(o,l);u!==null&&r.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(de.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),me())}isEqual(e){return this.batchId===e.batchId&&Wo(this.mutations,e.mutations,(n,r)=>Uv(n,r))&&Wo(this.baseMutations,e.baseMutations,(n,r)=>Uv(n,r))}}class qm{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Se(e.mutations.length===r.length);let i=function(){return FA}();const s=e.mutations;for(let o=0;o{const s=e.get(i.key),o=s.overlayedDocument;let l=this.applyToLocalView(o,s.mutatedFields);l=n.has(i.key)?null:l;const u=lE(o,l);u!==null&&r.set(i.key,u),o.isValidDocument()||o.convertToNoDocument(de.min())}),r}keys(){return this.mutations.reduce((e,n)=>e.add(n.key),me())}isEqual(e){return this.batchId===e.batchId&&Go(this.mutations,e.mutations,(n,r)=>qv(n,r))&&Go(this.baseMutations,e.baseMutations,(n,r)=>qv(n,r))}}class Wm{constructor(e,n,r,i){this.batch=e,this.commitVersion=n,this.mutationResults=r,this.docVersions=i}static from(e,n,r){Se(e.mutations.length===r.length);let i=function(){return $A}();const s=e.mutations;for(let o=0;o=8)throw new nl(`Invalid padding: ${n}`);if(r<0)throw new nl(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new nl(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new nl(`Invalid padding when bitmap length is 0: ${n}`);this.Ie=8*e.length-n,this.Te=gs.fromNumber(this.Ie)}Ee(e,n,r){let i=e.add(n.multiply(gs.fromNumber(r)));return i.compare(nN)===1&&(i=new gs([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<o.insert(l)),o}insert(e){if(this.Ie===0)return;const n=$v(e),[r,i]=qv(n);for(let s=0;s=8)throw new rl(`Invalid padding: ${n}`);if(r<0)throw new rl(`Invalid hash count: ${r}`);if(e.length>0&&this.hashCount===0)throw new rl(`Invalid hash count: ${r}`);if(e.length===0&&n!==0)throw new rl(`Invalid padding when bitmap length is 0: ${n}`);this.Ie=8*e.length-n,this.Te=ys.fromNumber(this.Ie)}Ee(e,n,r){let i=e.add(n.multiply(ys.fromNumber(r)));return i.compare(oN)===1&&(i=new ys([i.getBits(0),i.getBits(1)],0)),i.modulo(this.Te).toNumber()}de(e){return(this.bitmap[Math.floor(e/8)]&1<o.insert(l)),o}insert(e){if(this.Ie===0)return;const n=Kv(e),[r,i]=Gv(n);for(let s=0;s0&&(this.we=!0,this.pe=e)}ve(){let e=me(),n=me(),r=me();return this.ge.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:ce()}}),new oc(this.pe,this.ye,e,n,r)}Ce(){this.we=!1,this.ge=Kv()}Fe(e,n){this.we=!0,this.ge=this.ge.insert(e,n)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,Se(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class rN{constructor(e){this.Le=e,this.Be=new Map,this.ke=zr(),this.qe=Hv(),this.Qe=new He(_e)}Ke(e){for(const n of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(n,e.Ve):this.Ue(n,e.key,e.Ve);for(const n of e.removedTargetIds)this.Ue(n,e.key,e.Ve)}We(e){this.forEachTarget(e,n=>{const r=this.Ge(n);switch(e.state){case 0:this.ze(n)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(n);break;case 3:this.ze(n)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(n)&&(this.je(n),r.De(e.resumeToken));break;default:ce()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.Be.forEach((r,i)=>{this.ze(i)&&n(i)})}He(e){const n=e.targetId,r=e.me.count,i=this.Je(n);if(i){const s=i.target;if(yp(s))if(r===0){const o=new ie(s.path);this.Ue(n,o,Mt.newNoDocument(o,de.min()))}else Se(r===1);else{const o=this.Ye(n);if(o!==r){const l=this.Ze(e),u=l?this.Xe(l,e,o):1;if(u!==0){this.je(n);const h=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(n,h)}}}}}Ze(e){const n=e.me.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,l;try{o=bs(r).toUint8Array()}catch(u){if(u instanceof Fx)return qo("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{l=new Wm(o,i,s)}catch(u){return qo(u instanceof nl?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return l.Ie===0?null:l}Xe(e,n,r){return n.me.count===r-this.nt(e,n.targetId)?0:2}nt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Le.tt(),l=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(l)||(this.Ue(n,s,null),i++)}),i}rt(e){const n=new Map;this.Be.forEach((s,o)=>{const l=this.Je(o);if(l){if(s.current&&yp(l.target)){const u=new ie(l.target.path);this.ke.get(u)!==null||this.it(o,u)||this.Ue(o,u,Mt.newNoDocument(u,e))}s.be&&(n.set(o,s.ve()),s.Ce())}});let r=me();this.qe.forEach((s,o)=>{let l=!0;o.forEachWhile(u=>{const h=this.Je(u);return!h||h.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(s))}),this.ke.forEach((s,o)=>o.setReadTime(e));const i=new Kd(e,n,this.Qe,this.ke,r);return this.ke=zr(),this.qe=Hv(),this.Qe=new He(_e),i}$e(e,n){if(!this.ze(e))return;const r=this.it(e,n.key)?2:0;this.Ge(e).Fe(n.key,r),this.ke=this.ke.insert(n.key,n),this.qe=this.qe.insert(n.key,this.st(n.key).add(e))}Ue(e,n,r){if(!this.ze(e))return;const i=this.Ge(e);this.it(e,n)?i.Fe(n,1):i.Me(n),this.qe=this.qe.insert(n,this.st(n).delete(e)),r&&(this.ke=this.ke.insert(n,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const n=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let n=this.Be.get(e);return n||(n=new Wv,this.Be.set(e,n)),n}st(e){let n=this.qe.get(e);return n||(n=new St(_e),this.qe=this.qe.insert(e,n)),n}ze(e){const n=this.Je(e)!==null;return n||re("WatchChangeAggregator","Detected inactive target",e),n}Je(e){const n=this.Be.get(e);return n&&n.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new Wv),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.Ue(e,n,null)})}it(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function Hv(){return new He(ie.comparator)}function Kv(){return new He(ie.comparator)}const iN={asc:"ASCENDING",desc:"DESCENDING"},sN={"<":"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"},oN={and:"AND",or:"OR"};class aN{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function _p(t,e){return t.useProto3Json||Ud(e)?e:{value:e}}function fd(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 cE(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function lN(t,e){return fd(t,e.toTimestamp())}function or(t){return Se(!!t),de.fromTimestamp(function(n){const r=Di(n);return new ft(r.seconds,r.nanos)}(t))}function Hm(t,e){return xp(t,e).canonicalString()}function xp(t,e){const n=function(i){return new Le(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function uE(t){const e=Le.fromString(t);return Se(mE(e)),e}function Ep(t,e){return Hm(t.databaseId,e.path)}function ef(t,e){const n=uE(e);if(n.get(1)!==t.databaseId.projectId)throw new Z(U.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 Z(U.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ie(hE(n))}function dE(t,e){return Hm(t.databaseId,e)}function cN(t){const e=uE(t);return e.length===4?Le.emptyPath():hE(e)}function kp(t){return new Le(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function hE(t){return Se(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function Gv(t,e,n){return{name:Ep(t,e),fields:n.value.mapValue.fields}}function uN(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(h){return h==="NO_CHANGE"?0:h==="ADD"?1:h==="REMOVE"?2:h==="CURRENT"?3:h==="RESET"?4:ce()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(h,m){return h.useProto3Json?(Se(m===void 0||typeof m=="string"),Ct.fromBase64String(m||"")):(Se(m===void 0||m instanceof Buffer||m instanceof Uint8Array),Ct.fromUint8Array(m||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,l=o&&function(h){const m=h.code===void 0?U.UNKNOWN:oE(h.code);return new Z(m,h.message||"")}(o);n=new lE(r,i,s,l||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=ef(t,r.document.name),s=or(r.document.updateTime),o=r.document.createTime?or(r.document.createTime):de.min(),l=new tn({mapValue:{fields:r.document.fields}}),u=Mt.newFoundDocument(i,s,o,l),h=r.targetIds||[],m=r.removedTargetIds||[];n=new Iu(h,m,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=ef(t,r.document),s=r.readTime?or(r.readTime):de.min(),o=Mt.newNoDocument(i,s),l=r.removedTargetIds||[];n=new Iu([],l,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=ef(t,r.document),s=r.removedTargetIds||[];n=new Iu([],s,i,null)}else{if(!("filter"in e))return ce();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new ZA(i,s),l=r.targetId;n=new aE(l,o)}}return n}function dN(t,e){let n;if(e instanceof sc)n={update:Gv(t,e.key,e.value)};else if(e instanceof Hd)n={delete:Ep(t,e.key)};else if(e instanceof Fi)n={update:Gv(t,e.key,e.data),updateMask:_N(e.fieldMask)};else{if(!(e instanceof YA))return ce();n={verify:Ep(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const l=o.transform;if(l instanceof dd)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof Bl)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof $l)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof hd)return{fieldPath:o.field.canonicalString(),increment:l.Pe};throw ce()}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:lN(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:ce()}(t,e.precondition)),n}function hN(t,e){return t&&t.length>0?(Se(e!==void 0),t.map(n=>function(i,s){let o=i.updateTime?or(i.updateTime):or(s);return o.isEqual(de.min())&&(o=or(s)),new KA(o,i.transformResults||[])}(n,e))):[]}function fN(t,e){return{documents:[dE(t,e.path)]}}function pN(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=dE(t,i);const s=function(h){if(h.length!==0)return pE($n.create(h,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(h){if(h.length!==0)return h.map(m=>function(g){return{field:ho(g.field),direction:yN(g.dir)}}(m))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const l=_p(t,e.limit);return l!==null&&(n.structuredQuery.limit=l),e.startAt&&(n.structuredQuery.startAt=function(h){return{before:h.inclusive,values:h.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(h){return{before:!h.inclusive,values:h.position}}(e.endAt)),{_t:n,parent:i}}function mN(t){let e=cN(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Se(r===1);const m=n.from[0];m.allDescendants?i=m.collectionId:e=e.child(m.collectionId)}let s=[];n.where&&(s=function(v){const g=fE(v);return g instanceof $n&&$x(g)?g.getFilters():[g]}(n.where));let o=[];n.orderBy&&(o=function(v){return v.map(g=>function(D){return new ud(fo(D.field),function(B){switch(B){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(D.direction))}(g))}(n.orderBy));let l=null;n.limit&&(l=function(v){let g;return g=typeof v=="object"?v.value:v,Ud(g)?null:g}(n.limit));let u=null;n.startAt&&(u=function(v){const g=!!v.before,N=v.values||[];return new cd(N,g)}(n.startAt));let h=null;return n.endAt&&(h=function(v){const g=!v.before,N=v.values||[];return new cd(N,g)}(n.endAt)),jA(e,i,o,s,l,"F",u,h)}function gN(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ce()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function fE(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=fo(n.unaryFilter.field);return it.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=fo(n.unaryFilter.field);return it.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=fo(n.unaryFilter.field);return it.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=fo(n.unaryFilter.field);return it.create(o,"!=",{nullValue:"NULL_VALUE"});default:return ce()}}(t):t.fieldFilter!==void 0?function(n){return it.create(fo(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return ce()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return $n.create(n.compositeFilter.filters.map(r=>fE(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return ce()}}(n.compositeFilter.op))}(t):ce()}function yN(t){return iN[t]}function vN(t){return sN[t]}function wN(t){return oN[t]}function ho(t){return{fieldPath:t.canonicalString()}}function fo(t){return Tt.fromServerFormat(t.fieldPath)}function pE(t){return t instanceof it?function(n){if(n.op==="=="){if(jv(n.value))return{unaryFilter:{field:ho(n.field),op:"IS_NAN"}};if(Dv(n.value))return{unaryFilter:{field:ho(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(jv(n.value))return{unaryFilter:{field:ho(n.field),op:"IS_NOT_NAN"}};if(Dv(n.value))return{unaryFilter:{field:ho(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:ho(n.field),op:vN(n.op),value:n.value}}}(t):t instanceof $n?function(n){const r=n.getFilters().map(i=>pE(i));return r.length===1?r[0]:{compositeFilter:{op:wN(n.op),filters:r}}}(t):ce()}function _N(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function mE(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/**
+ */class Au{constructor(e,n,r,i){this.Re=e,this.removedTargetIds=n,this.key=r,this.Ve=i}}class dE{constructor(e,n){this.targetId=e,this.me=n}}class hE{constructor(e,n,r=Ct.EMPTY_BYTE_STRING,i=null){this.state=e,this.targetIds=n,this.resumeToken=r,this.cause=i}}class Qv{constructor(){this.fe=0,this.ge=Jv(),this.pe=Ct.EMPTY_BYTE_STRING,this.ye=!1,this.we=!0}get current(){return this.ye}get resumeToken(){return this.pe}get Se(){return this.fe!==0}get be(){return this.we}De(e){e.approximateByteSize()>0&&(this.we=!0,this.pe=e)}ve(){let e=me(),n=me(),r=me();return this.ge.forEach((i,s)=>{switch(s){case 0:e=e.add(i);break;case 2:n=n.add(i);break;case 1:r=r.add(i);break;default:ce()}}),new ac(this.pe,this.ye,e,n,r)}Ce(){this.we=!1,this.ge=Jv()}Fe(e,n){this.we=!0,this.ge=this.ge.insert(e,n)}Me(e){this.we=!0,this.ge=this.ge.remove(e)}xe(){this.fe+=1}Oe(){this.fe-=1,Se(this.fe>=0)}Ne(){this.we=!0,this.ye=!0}}class aN{constructor(e){this.Le=e,this.Be=new Map,this.ke=Gr(),this.qe=Yv(),this.Qe=new We(xe)}Ke(e){for(const n of e.Re)e.Ve&&e.Ve.isFoundDocument()?this.$e(n,e.Ve):this.Ue(n,e.key,e.Ve);for(const n of e.removedTargetIds)this.Ue(n,e.key,e.Ve)}We(e){this.forEachTarget(e,n=>{const r=this.Ge(n);switch(e.state){case 0:this.ze(n)&&r.De(e.resumeToken);break;case 1:r.Oe(),r.Se||r.Ce(),r.De(e.resumeToken);break;case 2:r.Oe(),r.Se||this.removeTarget(n);break;case 3:this.ze(n)&&(r.Ne(),r.De(e.resumeToken));break;case 4:this.ze(n)&&(this.je(n),r.De(e.resumeToken));break;default:ce()}})}forEachTarget(e,n){e.targetIds.length>0?e.targetIds.forEach(n):this.Be.forEach((r,i)=>{this.ze(i)&&n(i)})}He(e){const n=e.targetId,r=e.me.count,i=this.Je(n);if(i){const s=i.target;if(vp(s))if(r===0){const o=new ie(s.path);this.Ue(n,o,Mt.newNoDocument(o,de.min()))}else Se(r===1);else{const o=this.Ye(n);if(o!==r){const l=this.Ze(e),u=l?this.Xe(l,e,o):1;if(u!==0){this.je(n);const h=u===2?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch";this.Qe=this.Qe.insert(n,h)}}}}}Ze(e){const n=e.me.unchangedNames;if(!n||!n.bits)return null;const{bits:{bitmap:r="",padding:i=0},hashCount:s=0}=n;let o,l;try{o=Ss(r).toUint8Array()}catch(u){if(u instanceof $x)return Ko("Decoding the base64 bloom filter in existence filter failed ("+u.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw u}try{l=new Hm(o,i,s)}catch(u){return Ko(u instanceof rl?"BloomFilter error: ":"Applying bloom filter failed: ",u),null}return l.Ie===0?null:l}Xe(e,n,r){return n.me.count===r-this.nt(e,n.targetId)?0:2}nt(e,n){const r=this.Le.getRemoteKeysForTarget(n);let i=0;return r.forEach(s=>{const o=this.Le.tt(),l=`projects/${o.projectId}/databases/${o.database}/documents/${s.path.canonicalString()}`;e.mightContain(l)||(this.Ue(n,s,null),i++)}),i}rt(e){const n=new Map;this.Be.forEach((s,o)=>{const l=this.Je(o);if(l){if(s.current&&vp(l.target)){const u=new ie(l.target.path);this.ke.get(u)!==null||this.it(o,u)||this.Ue(o,u,Mt.newNoDocument(u,e))}s.be&&(n.set(o,s.ve()),s.Ce())}});let r=me();this.qe.forEach((s,o)=>{let l=!0;o.forEachWhile(u=>{const h=this.Je(u);return!h||h.purpose==="TargetPurposeLimboResolution"||(l=!1,!1)}),l&&(r=r.add(s))}),this.ke.forEach((s,o)=>o.setReadTime(e));const i=new Qd(e,n,this.Qe,this.ke,r);return this.ke=Gr(),this.qe=Yv(),this.Qe=new We(xe),i}$e(e,n){if(!this.ze(e))return;const r=this.it(e,n.key)?2:0;this.Ge(e).Fe(n.key,r),this.ke=this.ke.insert(n.key,n),this.qe=this.qe.insert(n.key,this.st(n.key).add(e))}Ue(e,n,r){if(!this.ze(e))return;const i=this.Ge(e);this.it(e,n)?i.Fe(n,1):i.Me(n),this.qe=this.qe.insert(n,this.st(n).delete(e)),r&&(this.ke=this.ke.insert(n,r))}removeTarget(e){this.Be.delete(e)}Ye(e){const n=this.Ge(e).ve();return this.Le.getRemoteKeysForTarget(e).size+n.addedDocuments.size-n.removedDocuments.size}xe(e){this.Ge(e).xe()}Ge(e){let n=this.Be.get(e);return n||(n=new Qv,this.Be.set(e,n)),n}st(e){let n=this.qe.get(e);return n||(n=new St(xe),this.qe=this.qe.insert(e,n)),n}ze(e){const n=this.Je(e)!==null;return n||re("WatchChangeAggregator","Detected inactive target",e),n}Je(e){const n=this.Be.get(e);return n&&n.Se?null:this.Le.ot(e)}je(e){this.Be.set(e,new Qv),this.Le.getRemoteKeysForTarget(e).forEach(n=>{this.Ue(e,n,null)})}it(e,n){return this.Le.getRemoteKeysForTarget(e).has(n)}}function Yv(){return new We(ie.comparator)}function Jv(){return new We(ie.comparator)}const lN={asc:"ASCENDING",desc:"DESCENDING"},cN={"<":"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"},uN={and:"AND",or:"OR"};class dN{constructor(e,n){this.databaseId=e,this.useProto3Json=n}}function xp(t,e){return t.useProto3Json||Bd(e)?e:{value:e}}function md(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 fE(t,e){return t.useProto3Json?e.toBase64():e.toUint8Array()}function hN(t,e){return md(t,e.toTimestamp())}function cr(t){return Se(!!t),de.fromTimestamp(function(n){const r=Oi(n);return new ht(r.seconds,r.nanos)}(t))}function Km(t,e){return Ep(t,e).canonicalString()}function Ep(t,e){const n=function(i){return new De(["projects",i.projectId,"databases",i.database])}(t).child("documents");return e===void 0?n:n.child(e)}function pE(t){const e=De.fromString(t);return Se(wE(e)),e}function kp(t,e){return Km(t.databaseId,e.path)}function tf(t,e){const n=pE(e);if(n.get(1)!==t.databaseId.projectId)throw new Z(U.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 Z(U.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+t.databaseId.database);return new ie(gE(n))}function mE(t,e){return Km(t.databaseId,e)}function fN(t){const e=pE(t);return e.length===4?De.emptyPath():gE(e)}function Tp(t){return new De(["projects",t.databaseId.projectId,"databases",t.databaseId.database]).canonicalString()}function gE(t){return Se(t.length>4&&t.get(4)==="documents"),t.popFirst(5)}function Xv(t,e,n){return{name:kp(t,e),fields:n.value.mapValue.fields}}function pN(t,e){let n;if("targetChange"in e){e.targetChange;const r=function(h){return h==="NO_CHANGE"?0:h==="ADD"?1:h==="REMOVE"?2:h==="CURRENT"?3:h==="RESET"?4:ce()}(e.targetChange.targetChangeType||"NO_CHANGE"),i=e.targetChange.targetIds||[],s=function(h,m){return h.useProto3Json?(Se(m===void 0||typeof m=="string"),Ct.fromBase64String(m||"")):(Se(m===void 0||m instanceof Buffer||m instanceof Uint8Array),Ct.fromUint8Array(m||new Uint8Array))}(t,e.targetChange.resumeToken),o=e.targetChange.cause,l=o&&function(h){const m=h.code===void 0?U.UNKNOWN:uE(h.code);return new Z(m,h.message||"")}(o);n=new hE(r,i,s,l||null)}else if("documentChange"in e){e.documentChange;const r=e.documentChange;r.document,r.document.name,r.document.updateTime;const i=tf(t,r.document.name),s=cr(r.document.updateTime),o=r.document.createTime?cr(r.document.createTime):de.min(),l=new tn({mapValue:{fields:r.document.fields}}),u=Mt.newFoundDocument(i,s,o,l),h=r.targetIds||[],m=r.removedTargetIds||[];n=new Au(h,m,u.key,u)}else if("documentDelete"in e){e.documentDelete;const r=e.documentDelete;r.document;const i=tf(t,r.document),s=r.readTime?cr(r.readTime):de.min(),o=Mt.newNoDocument(i,s),l=r.removedTargetIds||[];n=new Au([],l,o.key,o)}else if("documentRemove"in e){e.documentRemove;const r=e.documentRemove;r.document;const i=tf(t,r.document),s=r.removedTargetIds||[];n=new Au([],s,i,null)}else{if(!("filter"in e))return ce();{e.filter;const r=e.filter;r.targetId;const{count:i=0,unchangedNames:s}=r,o=new rN(i,s),l=r.targetId;n=new dE(l,o)}}return n}function mN(t,e){let n;if(e instanceof oc)n={update:Xv(t,e.key,e.value)};else if(e instanceof Gd)n={delete:kp(t,e.key)};else if(e instanceof zi)n={update:Xv(t,e.key,e.data),updateMask:TN(e.fieldMask)};else{if(!(e instanceof eN))return ce();n={verify:kp(t,e.key)}}return e.fieldTransforms.length>0&&(n.updateTransforms=e.fieldTransforms.map(r=>function(s,o){const l=o.transform;if(l instanceof fd)return{fieldPath:o.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(l instanceof $l)return{fieldPath:o.field.canonicalString(),appendMissingElements:{values:l.elements}};if(l instanceof ql)return{fieldPath:o.field.canonicalString(),removeAllFromArray:{values:l.elements}};if(l instanceof pd)return{fieldPath:o.field.canonicalString(),increment:l.Pe};throw ce()}(0,r))),e.precondition.isNone||(n.currentDocument=function(i,s){return s.updateTime!==void 0?{updateTime:hN(i,s.updateTime)}:s.exists!==void 0?{exists:s.exists}:ce()}(t,e.precondition)),n}function gN(t,e){return t&&t.length>0?(Se(e!==void 0),t.map(n=>function(i,s){let o=i.updateTime?cr(i.updateTime):cr(s);return o.isEqual(de.min())&&(o=cr(s)),new JA(o,i.transformResults||[])}(n,e))):[]}function yN(t,e){return{documents:[mE(t,e.path)]}}function vN(t,e){const n={structuredQuery:{}},r=e.path;let i;e.collectionGroup!==null?(i=r,n.structuredQuery.from=[{collectionId:e.collectionGroup,allDescendants:!0}]):(i=r.popLast(),n.structuredQuery.from=[{collectionId:r.lastSegment()}]),n.parent=mE(t,i);const s=function(h){if(h.length!==0)return vE(Bn.create(h,"and"))}(e.filters);s&&(n.structuredQuery.where=s);const o=function(h){if(h.length!==0)return h.map(m=>function(g){return{field:mo(g.field),direction:xN(g.dir)}}(m))}(e.orderBy);o&&(n.structuredQuery.orderBy=o);const l=xp(t,e.limit);return l!==null&&(n.structuredQuery.limit=l),e.startAt&&(n.structuredQuery.startAt=function(h){return{before:h.inclusive,values:h.position}}(e.startAt)),e.endAt&&(n.structuredQuery.endAt=function(h){return{before:!h.inclusive,values:h.position}}(e.endAt)),{_t:n,parent:i}}function wN(t){let e=fN(t.parent);const n=t.structuredQuery,r=n.from?n.from.length:0;let i=null;if(r>0){Se(r===1);const m=n.from[0];m.allDescendants?i=m.collectionId:e=e.child(m.collectionId)}let s=[];n.where&&(s=function(v){const g=yE(v);return g instanceof Bn&&Kx(g)?g.getFilters():[g]}(n.where));let o=[];n.orderBy&&(o=function(v){return v.map(g=>function(j){return new hd(go(j.field),function(B){switch(B){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(j.direction))}(g))}(n.orderBy));let l=null;n.limit&&(l=function(v){let g;return g=typeof v=="object"?v.value:v,Bd(g)?null:g}(n.limit));let u=null;n.startAt&&(u=function(v){const g=!!v.before,N=v.values||[];return new dd(N,g)}(n.startAt));let h=null;return n.endAt&&(h=function(v){const g=!v.before,N=v.values||[];return new dd(N,g)}(n.endAt)),VA(e,i,o,s,l,"F",u,h)}function _N(t,e){const n=function(i){switch(i){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return ce()}}(e.purpose);return n==null?null:{"goog-listen-tags":n}}function yE(t){return t.unaryFilter!==void 0?function(n){switch(n.unaryFilter.op){case"IS_NAN":const r=go(n.unaryFilter.field);return st.create(r,"==",{doubleValue:NaN});case"IS_NULL":const i=go(n.unaryFilter.field);return st.create(i,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":const s=go(n.unaryFilter.field);return st.create(s,"!=",{doubleValue:NaN});case"IS_NOT_NULL":const o=go(n.unaryFilter.field);return st.create(o,"!=",{nullValue:"NULL_VALUE"});default:return ce()}}(t):t.fieldFilter!==void 0?function(n){return st.create(go(n.fieldFilter.field),function(i){switch(i){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";default:return ce()}}(n.fieldFilter.op),n.fieldFilter.value)}(t):t.compositeFilter!==void 0?function(n){return Bn.create(n.compositeFilter.filters.map(r=>yE(r)),function(i){switch(i){case"AND":return"and";case"OR":return"or";default:return ce()}}(n.compositeFilter.op))}(t):ce()}function xN(t){return lN[t]}function EN(t){return cN[t]}function kN(t){return uN[t]}function mo(t){return{fieldPath:t.canonicalString()}}function go(t){return Tt.fromServerFormat(t.fieldPath)}function vE(t){return t instanceof st?function(n){if(n.op==="=="){if(Vv(n.value))return{unaryFilter:{field:mo(n.field),op:"IS_NAN"}};if(Mv(n.value))return{unaryFilter:{field:mo(n.field),op:"IS_NULL"}}}else if(n.op==="!="){if(Vv(n.value))return{unaryFilter:{field:mo(n.field),op:"IS_NOT_NAN"}};if(Mv(n.value))return{unaryFilter:{field:mo(n.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:mo(n.field),op:EN(n.op),value:n.value}}}(t):t instanceof Bn?function(n){const r=n.getFilters().map(i=>vE(i));return r.length===1?r[0]:{compositeFilter:{op:kN(n.op),filters:r}}}(t):ce()}function TN(t){const e=[];return t.fields.forEach(n=>e.push(n.canonicalString())),{fieldPaths:e}}function wE(t){return t.length>=4&&t.get(0)==="projects"&&t.get(2)==="databases"}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2457,7 +2457,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class wi{constructor(e,n,r,i,s=de.min(),o=de.min(),l=Ct.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=u}withSequenceNumber(e){return new wi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new wi(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new wi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new wi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
+ */class xi{constructor(e,n,r,i,s=de.min(),o=de.min(),l=Ct.EMPTY_BYTE_STRING,u=null){this.target=e,this.targetId=n,this.purpose=r,this.sequenceNumber=i,this.snapshotVersion=s,this.lastLimboFreeSnapshotVersion=o,this.resumeToken=l,this.expectedCount=u}withSequenceNumber(e){return new xi(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,n){return new xi(this.target,this.targetId,this.purpose,this.sequenceNumber,n,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new xi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new xi(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2472,7 +2472,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class xN{constructor(e){this.ct=e}}function EN(t){const e=mN({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?wp(e,e.limit,"L"):e}/**
+ */class bN{constructor(e){this.ct=e}}function SN(t){const e=wN({parent:t.parent,structuredQuery:t.structuredQuery});return t.limitType==="LAST"?_p(e,e.limit,"L"):e}/**
* @license
* Copyright 2019 Google LLC
*
@@ -2487,7 +2487,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class kN{constructor(){this.un=new TN}addToCollectionParentIndex(e,n){return this.un.add(n),$.resolve()}getCollectionParents(e,n){return $.resolve(this.un.getEntries(n))}addFieldIndex(e,n){return $.resolve()}deleteFieldIndex(e,n){return $.resolve()}deleteAllFieldIndexes(e){return $.resolve()}createTargetIndexes(e,n){return $.resolve()}getDocumentsMatchingTarget(e,n){return $.resolve(null)}getIndexType(e,n){return $.resolve(0)}getFieldIndexes(e,n){return $.resolve([])}getNextCollectionGroupToUpdate(e){return $.resolve(null)}getMinOffset(e,n){return $.resolve(Ri.min())}getMinOffsetFromCollectionGroup(e,n){return $.resolve(Ri.min())}updateCollectionGroup(e,n,r){return $.resolve()}updateIndexEntries(e,n){return $.resolve()}}class TN{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new St(Le.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new St(Le.comparator)).toArray()}}/**
+ */class IN{constructor(){this.un=new CN}addToCollectionParentIndex(e,n){return this.un.add(n),$.resolve()}getCollectionParents(e,n){return $.resolve(this.un.getEntries(n))}addFieldIndex(e,n){return $.resolve()}deleteFieldIndex(e,n){return $.resolve()}deleteAllFieldIndexes(e){return $.resolve()}createTargetIndexes(e,n){return $.resolve()}getDocumentsMatchingTarget(e,n){return $.resolve(null)}getIndexType(e,n){return $.resolve(0)}getFieldIndexes(e,n){return $.resolve([])}getNextCollectionGroupToUpdate(e){return $.resolve(null)}getMinOffset(e,n){return $.resolve(ji.min())}getMinOffsetFromCollectionGroup(e,n){return $.resolve(ji.min())}updateCollectionGroup(e,n,r){return $.resolve()}updateIndexEntries(e,n){return $.resolve()}}class CN{constructor(){this.index={}}add(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n]||new St(De.comparator),s=!i.has(r);return this.index[n]=i.add(r),s}has(e){const n=e.lastSegment(),r=e.popLast(),i=this.index[n];return i&&i.has(r)}getEntries(e){return(this.index[e]||new St(De.comparator)).toArray()}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2502,7 +2502,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Go{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new Go(0)}static kn(){return new Go(-1)}}/**
+ */class Jo{constructor(e){this.Ln=e}next(){return this.Ln+=2,this.Ln}static Bn(){return new Jo(0)}static kn(){return new Jo(-1)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2517,7 +2517,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class bN{constructor(){this.changes=new ia(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,Mt.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?$.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
+ */class AN{constructor(){this.changes=new aa(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,Mt.newInvalidDocument(e).setReadTime(n))}getEntry(e,n){this.assertNotApplied();const r=this.changes.get(n);return r!==void 0?$.resolve(r):this.getFromCache(e,n)}getEntries(e,n){return this.getAllFromCache(e,n)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2547,7 +2547,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class SN{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
+ */class NN{constructor(e,n){this.overlayedDocument=e,this.mutatedFields=n}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2562,7 +2562,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class IN{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&yl(r.mutation,i,hn.empty(),ft.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,me()).next(()=>r))}getLocalViewOfDocuments(e,n,r=me()){const i=hs();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=tl();return s.forEach((l,u)=>{o=o.insert(l,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=hs();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,me()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,l)=>{n.set(o,l)})})}computeViews(e,n,r,i){let s=zr();const o=gl(),l=function(){return gl()}();return n.forEach((u,h)=>{const m=r.get(h.key);i.has(h.key)&&(m===void 0||m.mutation instanceof Fi)?s=s.insert(h.key,h):m!==void 0?(o.set(h.key,m.mutation.getFieldMask()),yl(m.mutation,h,m.mutation.getFieldMask(),ft.now())):o.set(h.key,hn.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((h,m)=>o.set(h,m)),n.forEach((h,m)=>{var v;return l.set(h,new SN(m,(v=o.get(h))!==null&&v!==void 0?v:null))}),l))}recalculateAndSaveOverlays(e,n){const r=gl();let i=new He((o,l)=>o-l),s=me();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const l of o)l.keys().forEach(u=>{const h=n.get(u);if(h===null)return;let m=r.get(u)||hn.empty();m=l.applyToLocalView(h,m),r.set(u,m);const v=(i.get(l.batchId)||me()).add(u);i=i.insert(l.batchId,v)})}).next(()=>{const o=[],l=i.getReverseIterator();for(;l.hasNext();){const u=l.getNext(),h=u.key,m=u.value,v=Xx();m.forEach(g=>{if(!s.has(g)){const N=iE(n.get(g),r.get(g));N!==null&&v.set(g,N),s=s.add(g)}}),o.push(this.documentOverlayCache.saveOverlays(e,h,v))}return $.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return ie.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Kx(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):$.resolve(hs());let l=-1,u=s;return o.next(h=>$.forEach(h,(m,v)=>(l{u=u.insert(m,g)}))).next(()=>this.populateOverlays(e,h,s)).next(()=>this.computeViews(e,u,h,me())).next(m=>({batchId:l,changes:Jx(m)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new ie(n)).next(r=>{let i=tl();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=tl();return this.indexManager.getCollectionParents(e,s).next(l=>$.forEach(l,u=>{const h=function(v,g){return new ic(g,null,v.explicitOrderBy.slice(),v.filters.slice(),v.limit,v.limitType,v.startAt,v.endAt)}(n,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,h,r,i).next(m=>{m.forEach((v,g)=>{o=o.insert(v,g)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((u,h)=>{const m=h.getKey();o.get(m)===null&&(o=o.insert(m,Mt.newInvalidDocument(m)))});let l=tl();return o.forEach((u,h)=>{const m=s.get(u);m!==void 0&&yl(m.mutation,h,hn.empty(),ft.now()),$d(n,h)&&(l=l.insert(u,h))}),l})}}/**
+ */class PN{constructor(e,n,r,i){this.remoteDocumentCache=e,this.mutationQueue=n,this.documentOverlayCache=r,this.indexManager=i}getDocument(e,n){let r=null;return this.documentOverlayCache.getOverlay(e,n).next(i=>(r=i,this.remoteDocumentCache.getEntry(e,n))).next(i=>(r!==null&&vl(r.mutation,i,dn.empty(),ht.now()),i))}getDocuments(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.getLocalViewOfDocuments(e,r,me()).next(()=>r))}getLocalViewOfDocuments(e,n,r=me()){const i=fs();return this.populateOverlays(e,i,n).next(()=>this.computeViews(e,n,i,r).next(s=>{let o=nl();return s.forEach((l,u)=>{o=o.insert(l,u.overlayedDocument)}),o}))}getOverlayedDocuments(e,n){const r=fs();return this.populateOverlays(e,r,n).next(()=>this.computeViews(e,n,r,me()))}populateOverlays(e,n,r){const i=[];return r.forEach(s=>{n.has(s)||i.push(s)}),this.documentOverlayCache.getOverlays(e,i).next(s=>{s.forEach((o,l)=>{n.set(o,l)})})}computeViews(e,n,r,i){let s=Gr();const o=yl(),l=function(){return yl()}();return n.forEach((u,h)=>{const m=r.get(h.key);i.has(h.key)&&(m===void 0||m.mutation instanceof zi)?s=s.insert(h.key,h):m!==void 0?(o.set(h.key,m.mutation.getFieldMask()),vl(m.mutation,h,m.mutation.getFieldMask(),ht.now())):o.set(h.key,dn.empty())}),this.recalculateAndSaveOverlays(e,s).next(u=>(u.forEach((h,m)=>o.set(h,m)),n.forEach((h,m)=>{var v;return l.set(h,new NN(m,(v=o.get(h))!==null&&v!==void 0?v:null))}),l))}recalculateAndSaveOverlays(e,n){const r=yl();let i=new We((o,l)=>o-l),s=me();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,n).next(o=>{for(const l of o)l.keys().forEach(u=>{const h=n.get(u);if(h===null)return;let m=r.get(u)||dn.empty();m=l.applyToLocalView(h,m),r.set(u,m);const v=(i.get(l.batchId)||me()).add(u);i=i.insert(l.batchId,v)})}).next(()=>{const o=[],l=i.getReverseIterator();for(;l.hasNext();){const u=l.getNext(),h=u.key,m=u.value,v=nE();m.forEach(g=>{if(!s.has(g)){const N=lE(n.get(g),r.get(g));N!==null&&v.set(g,N),s=s.add(g)}}),o.push(this.documentOverlayCache.saveOverlays(e,h,v))}return $.waitFor(o)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,n){return this.remoteDocumentCache.getEntries(e,n).next(r=>this.recalculateAndSaveOverlays(e,r))}getDocumentsMatchingQuery(e,n,r,i){return function(o){return ie.isDocumentKey(o.path)&&o.collectionGroup===null&&o.filters.length===0}(n)?this.getDocumentsMatchingDocumentQuery(e,n.path):Jx(n)?this.getDocumentsMatchingCollectionGroupQuery(e,n,r,i):this.getDocumentsMatchingCollectionQuery(e,n,r,i)}getNextDocuments(e,n,r,i){return this.remoteDocumentCache.getAllFromCollectionGroup(e,n,r,i).next(s=>{const o=i-s.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,n,r.largestBatchId,i-s.size):$.resolve(fs());let l=-1,u=s;return o.next(h=>$.forEach(h,(m,v)=>(l{u=u.insert(m,g)}))).next(()=>this.populateOverlays(e,h,s)).next(()=>this.computeViews(e,u,h,me())).next(m=>({batchId:l,changes:tE(m)})))})}getDocumentsMatchingDocumentQuery(e,n){return this.getDocument(e,new ie(n)).next(r=>{let i=nl();return r.isFoundDocument()&&(i=i.insert(r.key,r)),i})}getDocumentsMatchingCollectionGroupQuery(e,n,r,i){const s=n.collectionGroup;let o=nl();return this.indexManager.getCollectionParents(e,s).next(l=>$.forEach(l,u=>{const h=function(v,g){return new sc(g,null,v.explicitOrderBy.slice(),v.filters.slice(),v.limit,v.limitType,v.startAt,v.endAt)}(n,u.child(s));return this.getDocumentsMatchingCollectionQuery(e,h,r,i).next(m=>{m.forEach((v,g)=>{o=o.insert(v,g)})})}).next(()=>o))}getDocumentsMatchingCollectionQuery(e,n,r,i){let s;return this.documentOverlayCache.getOverlaysForCollection(e,n.path,r.largestBatchId).next(o=>(s=o,this.remoteDocumentCache.getDocumentsMatchingQuery(e,n,r,s,i))).next(o=>{s.forEach((u,h)=>{const m=h.getKey();o.get(m)===null&&(o=o.insert(m,Mt.newInvalidDocument(m)))});let l=nl();return o.forEach((u,h)=>{const m=s.get(u);m!==void 0&&vl(m.mutation,h,dn.empty(),ht.now()),Wd(n,h)&&(l=l.insert(u,h))}),l})}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2577,7 +2577,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class CN{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,n){return $.resolve(this.hr.get(n))}saveBundleMetadata(e,n){return this.hr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:or(i.createTime)}}(n)),$.resolve()}getNamedQuery(e,n){return $.resolve(this.Pr.get(n))}saveNamedQuery(e,n){return this.Pr.set(n.name,function(i){return{name:i.name,query:EN(i.bundledQuery),readTime:or(i.readTime)}}(n)),$.resolve()}}/**
+ */class RN{constructor(e){this.serializer=e,this.hr=new Map,this.Pr=new Map}getBundleMetadata(e,n){return $.resolve(this.hr.get(n))}saveBundleMetadata(e,n){return this.hr.set(n.id,function(i){return{id:i.id,version:i.version,createTime:cr(i.createTime)}}(n)),$.resolve()}getNamedQuery(e,n){return $.resolve(this.Pr.get(n))}saveNamedQuery(e,n){return this.Pr.set(n.name,function(i){return{name:i.name,query:SN(i.bundledQuery),readTime:cr(i.readTime)}}(n)),$.resolve()}}/**
* @license
* Copyright 2022 Google LLC
*
@@ -2592,7 +2592,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class AN{constructor(){this.overlays=new He(ie.comparator),this.Ir=new Map}getOverlay(e,n){return $.resolve(this.overlays.get(n))}getOverlays(e,n){const r=hs();return $.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.ht(e,n,s)}),$.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.Ir.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(r)),$.resolve()}getOverlaysForCollection(e,n,r){const i=hs(),s=n.length+1,o=new ie(n.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){const u=l.getNext().value,h=u.getKey();if(!n.isPrefixOf(h.path))break;h.path.length===s&&u.largestBatchId>r&&i.set(u.getKey(),u)}return $.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new He((h,m)=>h-m);const o=this.overlays.getIterator();for(;o.hasNext();){const h=o.getNext().value;if(h.getKey().getCollectionGroup()===n&&h.largestBatchId>r){let m=s.get(h.largestBatchId);m===null&&(m=hs(),s=s.insert(h.largestBatchId,m)),m.set(h.getKey(),h)}}const l=hs(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((h,m)=>l.set(h,m)),!(l.size()>=i)););return $.resolve(l)}ht(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.Ir.get(i.largestBatchId).delete(r.key);this.Ir.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new XA(n,r));let s=this.Ir.get(n);s===void 0&&(s=me(),this.Ir.set(n,s)),this.Ir.set(n,s.add(r.key))}}/**
+ */class DN{constructor(){this.overlays=new We(ie.comparator),this.Ir=new Map}getOverlay(e,n){return $.resolve(this.overlays.get(n))}getOverlays(e,n){const r=fs();return $.forEach(n,i=>this.getOverlay(e,i).next(s=>{s!==null&&r.set(i,s)})).next(()=>r)}saveOverlays(e,n,r){return r.forEach((i,s)=>{this.ht(e,n,s)}),$.resolve()}removeOverlaysForBatchId(e,n,r){const i=this.Ir.get(r);return i!==void 0&&(i.forEach(s=>this.overlays=this.overlays.remove(s)),this.Ir.delete(r)),$.resolve()}getOverlaysForCollection(e,n,r){const i=fs(),s=n.length+1,o=new ie(n.child("")),l=this.overlays.getIteratorFrom(o);for(;l.hasNext();){const u=l.getNext().value,h=u.getKey();if(!n.isPrefixOf(h.path))break;h.path.length===s&&u.largestBatchId>r&&i.set(u.getKey(),u)}return $.resolve(i)}getOverlaysForCollectionGroup(e,n,r,i){let s=new We((h,m)=>h-m);const o=this.overlays.getIterator();for(;o.hasNext();){const h=o.getNext().value;if(h.getKey().getCollectionGroup()===n&&h.largestBatchId>r){let m=s.get(h.largestBatchId);m===null&&(m=fs(),s=s.insert(h.largestBatchId,m)),m.set(h.getKey(),h)}}const l=fs(),u=s.getIterator();for(;u.hasNext()&&(u.getNext().value.forEach((h,m)=>l.set(h,m)),!(l.size()>=i)););return $.resolve(l)}ht(e,n,r){const i=this.overlays.get(r.key);if(i!==null){const o=this.Ir.get(i.largestBatchId).delete(r.key);this.Ir.set(i.largestBatchId,o)}this.overlays=this.overlays.insert(r.key,new nN(n,r));let s=this.Ir.get(n);s===void 0&&(s=me(),this.Ir.set(n,s)),this.Ir.set(n,s.add(r.key))}}/**
* @license
* Copyright 2024 Google LLC
*
@@ -2607,7 +2607,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class NN{constructor(){this.sessionToken=Ct.EMPTY_BYTE_STRING}getSessionToken(e){return $.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,$.resolve()}}/**
+ */class jN{constructor(){this.sessionToken=Ct.EMPTY_BYTE_STRING}getSessionToken(e){return $.resolve(this.sessionToken)}setSessionToken(e,n){return this.sessionToken=n,$.resolve()}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2622,7 +2622,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Km{constructor(){this.Tr=new St(pt.Er),this.dr=new St(pt.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,n){const r=new pt(e,n);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Vr(new pt(e,n))}mr(e,n){e.forEach(r=>this.removeReference(r,n))}gr(e){const n=new ie(new Le([])),r=new pt(n,e),i=new pt(n,e+1),s=[];return this.dr.forEachInRange([r,i],o=>{this.Vr(o),s.push(o.key)}),s}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const n=new ie(new Le([])),r=new pt(n,e),i=new pt(n,e+1);let s=me();return this.dr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new pt(e,0),r=this.Tr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class pt{constructor(e,n){this.key=e,this.wr=n}static Er(e,n){return ie.comparator(e.key,n.key)||_e(e.wr,n.wr)}static Ar(e,n){return _e(e.wr,n.wr)||ie.comparator(e.key,n.key)}}/**
+ */class Gm{constructor(){this.Tr=new St(pt.Er),this.dr=new St(pt.Ar)}isEmpty(){return this.Tr.isEmpty()}addReference(e,n){const r=new pt(e,n);this.Tr=this.Tr.add(r),this.dr=this.dr.add(r)}Rr(e,n){e.forEach(r=>this.addReference(r,n))}removeReference(e,n){this.Vr(new pt(e,n))}mr(e,n){e.forEach(r=>this.removeReference(r,n))}gr(e){const n=new ie(new De([])),r=new pt(n,e),i=new pt(n,e+1),s=[];return this.dr.forEachInRange([r,i],o=>{this.Vr(o),s.push(o.key)}),s}pr(){this.Tr.forEach(e=>this.Vr(e))}Vr(e){this.Tr=this.Tr.delete(e),this.dr=this.dr.delete(e)}yr(e){const n=new ie(new De([])),r=new pt(n,e),i=new pt(n,e+1);let s=me();return this.dr.forEachInRange([r,i],o=>{s=s.add(o.key)}),s}containsKey(e){const n=new pt(e,0),r=this.Tr.firstAfterOrEqual(n);return r!==null&&e.isEqual(r.key)}}class pt{constructor(e,n){this.key=e,this.wr=n}static Er(e,n){return ie.comparator(e.key,n.key)||xe(e.wr,n.wr)}static Ar(e,n){return xe(e.wr,n.wr)||ie.comparator(e.key,n.key)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2637,7 +2637,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class PN{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Sr=1,this.br=new St(pt.Er)}checkEmpty(e){return $.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new JA(s,n,r,i);this.mutationQueue.push(o);for(const l of i)this.br=this.br.add(new pt(l.key,s)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return $.resolve(o)}lookupMutationBatch(e,n){return $.resolve(this.Dr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.vr(r),s=i<0?0:i;return $.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return $.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return $.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new pt(n,0),i=new pt(n,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([r,i],o=>{const l=this.Dr(o.wr);s.push(l)}),$.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new St(_e);return n.forEach(i=>{const s=new pt(i,0),o=new pt(i,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,o],l=>{r=r.add(l.wr)})}),$.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;ie.isDocumentKey(s)||(s=s.child(""));const o=new pt(new ie(s),0);let l=new St(_e);return this.br.forEachWhile(u=>{const h=u.key.path;return!!r.isPrefixOf(h)&&(h.length===i&&(l=l.add(u.wr)),!0)},o),$.resolve(this.Cr(l))}Cr(e){const n=[];return e.forEach(r=>{const i=this.Dr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Se(this.Fr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return $.forEach(n.mutations,i=>{const s=new pt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,n){const r=new pt(n,0),i=this.br.firstAfterOrEqual(r);return $.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,$.resolve()}Fr(e,n){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const n=this.vr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
+ */class ON{constructor(e,n){this.indexManager=e,this.referenceDelegate=n,this.mutationQueue=[],this.Sr=1,this.br=new St(pt.Er)}checkEmpty(e){return $.resolve(this.mutationQueue.length===0)}addMutationBatch(e,n,r,i){const s=this.Sr;this.Sr++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];const o=new tN(s,n,r,i);this.mutationQueue.push(o);for(const l of i)this.br=this.br.add(new pt(l.key,s)),this.indexManager.addToCollectionParentIndex(e,l.key.path.popLast());return $.resolve(o)}lookupMutationBatch(e,n){return $.resolve(this.Dr(n))}getNextMutationBatchAfterBatchId(e,n){const r=n+1,i=this.vr(r),s=i<0?0:i;return $.resolve(this.mutationQueue.length>s?this.mutationQueue[s]:null)}getHighestUnacknowledgedBatchId(){return $.resolve(this.mutationQueue.length===0?-1:this.Sr-1)}getAllMutationBatches(e){return $.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,n){const r=new pt(n,0),i=new pt(n,Number.POSITIVE_INFINITY),s=[];return this.br.forEachInRange([r,i],o=>{const l=this.Dr(o.wr);s.push(l)}),$.resolve(s)}getAllMutationBatchesAffectingDocumentKeys(e,n){let r=new St(xe);return n.forEach(i=>{const s=new pt(i,0),o=new pt(i,Number.POSITIVE_INFINITY);this.br.forEachInRange([s,o],l=>{r=r.add(l.wr)})}),$.resolve(this.Cr(r))}getAllMutationBatchesAffectingQuery(e,n){const r=n.path,i=r.length+1;let s=r;ie.isDocumentKey(s)||(s=s.child(""));const o=new pt(new ie(s),0);let l=new St(xe);return this.br.forEachWhile(u=>{const h=u.key.path;return!!r.isPrefixOf(h)&&(h.length===i&&(l=l.add(u.wr)),!0)},o),$.resolve(this.Cr(l))}Cr(e){const n=[];return e.forEach(r=>{const i=this.Dr(r);i!==null&&n.push(i)}),n}removeMutationBatch(e,n){Se(this.Fr(n.batchId,"removed")===0),this.mutationQueue.shift();let r=this.br;return $.forEach(n.mutations,i=>{const s=new pt(i.key,n.batchId);return r=r.delete(s),this.referenceDelegate.markPotentiallyOrphaned(e,i.key)}).next(()=>{this.br=r})}On(e){}containsKey(e,n){const r=new pt(n,0),i=this.br.firstAfterOrEqual(r);return $.resolve(n.isEqual(i&&i.key))}performConsistencyCheck(e){return this.mutationQueue.length,$.resolve()}Fr(e,n){return this.vr(e)}vr(e){return this.mutationQueue.length===0?0:e-this.mutationQueue[0].batchId}Dr(e){const n=this.vr(e);return n<0||n>=this.mutationQueue.length?null:this.mutationQueue[n]}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2652,7 +2652,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class RN{constructor(e){this.Mr=e,this.docs=function(){return new He(ie.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.Mr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return $.resolve(r?r.document.mutableCopy():Mt.newInvalidDocument(n))}getEntries(e,n){let r=zr();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():Mt.newInvalidDocument(i))}),$.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=zr();const o=n.path,l=new ie(o.child("")),u=this.docs.getIteratorFrom(l);for(;u.hasNext();){const{key:h,value:{document:m}}=u.getNext();if(!o.isPrefixOf(h.path))break;h.path.length>o.length+1||mA(pA(m),r)<=0||(i.has(m.key)||$d(n,m))&&(s=s.insert(m.key,m.mutableCopy()))}return $.resolve(s)}getAllFromCollectionGroup(e,n,r,i){ce()}Or(e,n){return $.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new DN(this)}getSize(e){return $.resolve(this.size)}}class DN extends bN{constructor(e){super(),this.cr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.cr.addEntry(e,i)):this.cr.removeEntry(r)}),$.waitFor(n)}getFromCache(e,n){return this.cr.getEntry(e,n)}getAllFromCache(e,n){return this.cr.getEntries(e,n)}}/**
+ */class LN{constructor(e){this.Mr=e,this.docs=function(){return new We(ie.comparator)}(),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,n){const r=n.key,i=this.docs.get(r),s=i?i.size:0,o=this.Mr(n);return this.docs=this.docs.insert(r,{document:n.mutableCopy(),size:o}),this.size+=o-s,this.indexManager.addToCollectionParentIndex(e,r.path.popLast())}removeEntry(e){const n=this.docs.get(e);n&&(this.docs=this.docs.remove(e),this.size-=n.size)}getEntry(e,n){const r=this.docs.get(n);return $.resolve(r?r.document.mutableCopy():Mt.newInvalidDocument(n))}getEntries(e,n){let r=Gr();return n.forEach(i=>{const s=this.docs.get(i);r=r.insert(i,s?s.document.mutableCopy():Mt.newInvalidDocument(i))}),$.resolve(r)}getDocumentsMatchingQuery(e,n,r,i){let s=Gr();const o=n.path,l=new ie(o.child("")),u=this.docs.getIteratorFrom(l);for(;u.hasNext();){const{key:h,value:{document:m}}=u.getNext();if(!o.isPrefixOf(h.path))break;h.path.length>o.length+1||wA(vA(m),r)<=0||(i.has(m.key)||Wd(n,m))&&(s=s.insert(m.key,m.mutableCopy()))}return $.resolve(s)}getAllFromCollectionGroup(e,n,r,i){ce()}Or(e,n){return $.forEach(this.docs,r=>n(r))}newChangeBuffer(e){return new MN(this)}getSize(e){return $.resolve(this.size)}}class MN extends AN{constructor(e){super(),this.cr=e}applyChanges(e){const n=[];return this.changes.forEach((r,i)=>{i.isValidDocument()?n.push(this.cr.addEntry(e,i)):this.cr.removeEntry(r)}),$.waitFor(n)}getFromCache(e,n){return this.cr.getEntry(e,n)}getAllFromCache(e,n){return this.cr.getEntries(e,n)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2667,7 +2667,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class jN{constructor(e){this.persistence=e,this.Nr=new ia(n=>zm(n),Bm),this.lastRemoteSnapshotVersion=de.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Km,this.targetCount=0,this.kr=Go.Bn()}forEachTarget(e,n){return this.Nr.forEach((r,i)=>n(i)),$.resolve()}getLastRemoteSnapshotVersion(e){return $.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return $.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),$.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Lr&&(this.Lr=n),$.resolve()}Kn(e){this.Nr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.kr=new Go(n),this.highestTargetId=n),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,n){return this.Kn(n),this.targetCount+=1,$.resolve()}updateTargetData(e,n){return this.Kn(n),$.resolve()}removeTargetData(e,n){return this.Nr.delete(n.target),this.Br.gr(n.targetId),this.targetCount-=1,$.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.Nr.forEach((o,l)=>{l.sequenceNumber<=n&&r.get(l.targetId)===null&&(this.Nr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,l.targetId)),i++)}),$.waitFor(s).next(()=>i)}getTargetCount(e){return $.resolve(this.targetCount)}getTargetData(e,n){const r=this.Nr.get(n)||null;return $.resolve(r)}addMatchingKeys(e,n,r){return this.Br.Rr(n,r),$.resolve()}removeMatchingKeys(e,n,r){this.Br.mr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),$.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this.Br.gr(n),$.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Br.yr(n);return $.resolve(r)}containsKey(e,n){return $.resolve(this.Br.containsKey(n))}}/**
+ */class VN{constructor(e){this.persistence=e,this.Nr=new aa(n=>Bm(n),$m),this.lastRemoteSnapshotVersion=de.min(),this.highestTargetId=0,this.Lr=0,this.Br=new Gm,this.targetCount=0,this.kr=Jo.Bn()}forEachTarget(e,n){return this.Nr.forEach((r,i)=>n(i)),$.resolve()}getLastRemoteSnapshotVersion(e){return $.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return $.resolve(this.Lr)}allocateTargetId(e){return this.highestTargetId=this.kr.next(),$.resolve(this.highestTargetId)}setTargetsMetadata(e,n,r){return r&&(this.lastRemoteSnapshotVersion=r),n>this.Lr&&(this.Lr=n),$.resolve()}Kn(e){this.Nr.set(e.target,e);const n=e.targetId;n>this.highestTargetId&&(this.kr=new Jo(n),this.highestTargetId=n),e.sequenceNumber>this.Lr&&(this.Lr=e.sequenceNumber)}addTargetData(e,n){return this.Kn(n),this.targetCount+=1,$.resolve()}updateTargetData(e,n){return this.Kn(n),$.resolve()}removeTargetData(e,n){return this.Nr.delete(n.target),this.Br.gr(n.targetId),this.targetCount-=1,$.resolve()}removeTargets(e,n,r){let i=0;const s=[];return this.Nr.forEach((o,l)=>{l.sequenceNumber<=n&&r.get(l.targetId)===null&&(this.Nr.delete(o),s.push(this.removeMatchingKeysForTargetId(e,l.targetId)),i++)}),$.waitFor(s).next(()=>i)}getTargetCount(e){return $.resolve(this.targetCount)}getTargetData(e,n){const r=this.Nr.get(n)||null;return $.resolve(r)}addMatchingKeys(e,n,r){return this.Br.Rr(n,r),$.resolve()}removeMatchingKeys(e,n,r){this.Br.mr(n,r);const i=this.persistence.referenceDelegate,s=[];return i&&n.forEach(o=>{s.push(i.markPotentiallyOrphaned(e,o))}),$.waitFor(s)}removeMatchingKeysForTargetId(e,n){return this.Br.gr(n),$.resolve()}getMatchingKeysForTargetId(e,n){const r=this.Br.yr(n);return $.resolve(r)}containsKey(e,n){return $.resolve(this.Br.containsKey(n))}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2682,7 +2682,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ON{constructor(e,n){this.qr={},this.overlays={},this.Qr=new Mm(0),this.Kr=!1,this.Kr=!0,this.$r=new NN,this.referenceDelegate=e(this),this.Ur=new jN(this),this.indexManager=new kN,this.remoteDocumentCache=function(i){return new RN(i)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new xN(n),this.Gr=new CN(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new AN,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.qr[e.toKey()];return r||(r=new PN(n,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,n,r){re("MemoryPersistence","Starting transaction:",e);const i=new LN(this.Qr.next());return this.referenceDelegate.zr(),r(i).next(s=>this.referenceDelegate.jr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Hr(e,n){return $.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,n)))}}class LN extends yA{constructor(e){super(),this.currentSequenceNumber=e}}class Gm{constructor(e){this.persistence=e,this.Jr=new Km,this.Yr=null}static Zr(e){return new Gm(e)}get Xr(){if(this.Yr)return this.Yr;throw ce()}addReference(e,n,r){return this.Jr.addReference(r,n),this.Xr.delete(r.toString()),$.resolve()}removeReference(e,n,r){return this.Jr.removeReference(r,n),this.Xr.add(r.toString()),$.resolve()}markPotentiallyOrphaned(e,n){return this.Xr.add(n.toString()),$.resolve()}removeTarget(e,n){this.Jr.gr(n.targetId).forEach(i=>this.Xr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.Xr.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}zr(){this.Yr=new Set}jr(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return $.forEach(this.Xr,r=>{const i=ie.fromPath(r);return this.ei(e,i).next(s=>{s||n.removeEntry(i,de.min())})}).next(()=>(this.Yr=null,n.apply(e)))}updateLimboDocument(e,n){return this.ei(e,n).next(r=>{r?this.Xr.delete(n.toString()):this.Xr.add(n.toString())})}Wr(e){return 0}ei(e,n){return $.or([()=>$.resolve(this.Jr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Hr(e,n)])}}/**
+ */class FN{constructor(e,n){this.qr={},this.overlays={},this.Qr=new Vm(0),this.Kr=!1,this.Kr=!0,this.$r=new jN,this.referenceDelegate=e(this),this.Ur=new VN(this),this.indexManager=new IN,this.remoteDocumentCache=function(i){return new LN(i)}(r=>this.referenceDelegate.Wr(r)),this.serializer=new bN(n),this.Gr=new RN(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.Kr=!1,Promise.resolve()}get started(){return this.Kr}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let n=this.overlays[e.toKey()];return n||(n=new DN,this.overlays[e.toKey()]=n),n}getMutationQueue(e,n){let r=this.qr[e.toKey()];return r||(r=new ON(n,this.referenceDelegate),this.qr[e.toKey()]=r),r}getGlobalsCache(){return this.$r}getTargetCache(){return this.Ur}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Gr}runTransaction(e,n,r){re("MemoryPersistence","Starting transaction:",e);const i=new UN(this.Qr.next());return this.referenceDelegate.zr(),r(i).next(s=>this.referenceDelegate.jr(i).next(()=>s)).toPromise().then(s=>(i.raiseOnCommittedEvent(),s))}Hr(e,n){return $.or(Object.values(this.qr).map(r=>()=>r.containsKey(e,n)))}}class UN extends xA{constructor(e){super(),this.currentSequenceNumber=e}}class Qm{constructor(e){this.persistence=e,this.Jr=new Gm,this.Yr=null}static Zr(e){return new Qm(e)}get Xr(){if(this.Yr)return this.Yr;throw ce()}addReference(e,n,r){return this.Jr.addReference(r,n),this.Xr.delete(r.toString()),$.resolve()}removeReference(e,n,r){return this.Jr.removeReference(r,n),this.Xr.add(r.toString()),$.resolve()}markPotentiallyOrphaned(e,n){return this.Xr.add(n.toString()),$.resolve()}removeTarget(e,n){this.Jr.gr(n.targetId).forEach(i=>this.Xr.add(i.toString()));const r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,n.targetId).next(i=>{i.forEach(s=>this.Xr.add(s.toString()))}).next(()=>r.removeTargetData(e,n))}zr(){this.Yr=new Set}jr(e){const n=this.persistence.getRemoteDocumentCache().newChangeBuffer();return $.forEach(this.Xr,r=>{const i=ie.fromPath(r);return this.ei(e,i).next(s=>{s||n.removeEntry(i,de.min())})}).next(()=>(this.Yr=null,n.apply(e)))}updateLimboDocument(e,n){return this.ei(e,n).next(r=>{r?this.Xr.delete(n.toString()):this.Xr.add(n.toString())})}Wr(e){return 0}ei(e,n){return $.or([()=>$.resolve(this.Jr.containsKey(n)),()=>this.persistence.getTargetCache().containsKey(e,n),()=>this.persistence.Hr(e,n)])}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2697,7 +2697,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Qm{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.$i=r,this.Ui=i}static Wi(e,n){let r=me(),i=me();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Qm(e,n.fromCache,r,i)}}/**
+ */class Ym{constructor(e,n,r,i){this.targetId=e,this.fromCache=n,this.$i=r,this.Ui=i}static Wi(e,n){let r=me(),i=me();for(const s of n.docChanges)switch(s.type){case 0:r=r.add(s.doc.key);break;case 1:i=i.add(s.doc.key)}return new Ym(e,n.fromCache,r,i)}}/**
* @license
* Copyright 2023 Google LLC
*
@@ -2712,7 +2712,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class MN{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
+ */class zN{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}/**
* @license
* Copyright 2019 Google LLC
*
@@ -2727,7 +2727,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class VN{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return Ib()?8:vA(Ut())>0?6:4}()}initialize(e,n){this.Ji=e,this.indexManager=n,this.Gi=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.Yi(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.Zi(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new MN;return this.Xi(e,n,o).next(l=>{if(s.result=l,this.zi)return this.es(e,n,o,l.size)})}).next(()=>s.result)}es(e,n,r,i){return r.documentReadCountthis.Hi*i?(qa()<=ye.DEBUG&&re("QueryEngine","The SDK decides to create cache indexes for query:",uo(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,sr(n))):$.resolve())}Yi(e,n){if(Vv(n))return $.resolve(null);let r=sr(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=wp(n,null,"F"),r=sr(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=me(...s);return this.Ji.getDocuments(e,o).next(l=>this.indexManager.getMinOffset(e,r).next(u=>{const h=this.ts(n,l);return this.ns(n,h,o,u.readTime)?this.Yi(e,wp(n,null,"F")):this.rs(e,h,n,u)}))})))}Zi(e,n,r,i){return Vv(n)||i.isEqual(de.min())?$.resolve(null):this.Ji.getDocuments(e,r).next(s=>{const o=this.ts(n,s);return this.ns(n,o,r,i)?$.resolve(null):(qa()<=ye.DEBUG&&re("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),uo(n)),this.rs(e,o,n,fA(i,-1)).next(l=>l))})}ts(e,n){let r=new St(Qx(e));return n.forEach((i,s)=>{$d(e,s)&&(r=r.add(s))}),r}ns(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Xi(e,n,r){return qa()<=ye.DEBUG&&re("QueryEngine","Using full collection scan to execute query:",uo(n)),this.Ji.getDocumentsMatchingQuery(e,n,Ri.min(),r)}rs(e,n,r,i){return this.Ji.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
+ */class BN{constructor(){this.Gi=!1,this.zi=!1,this.ji=100,this.Hi=function(){return Pb()?8:EA(Ut())>0?6:4}()}initialize(e,n){this.Ji=e,this.indexManager=n,this.Gi=!0}getDocumentsMatchingQuery(e,n,r,i){const s={result:null};return this.Yi(e,n).next(o=>{s.result=o}).next(()=>{if(!s.result)return this.Zi(e,n,i,r).next(o=>{s.result=o})}).next(()=>{if(s.result)return;const o=new zN;return this.Xi(e,n,o).next(l=>{if(s.result=l,this.zi)return this.es(e,n,o,l.size)})}).next(()=>s.result)}es(e,n,r,i){return r.documentReadCountthis.Hi*i?(Wa()<=ye.DEBUG&&re("QueryEngine","The SDK decides to create cache indexes for query:",po(n),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,lr(n))):$.resolve())}Yi(e,n){if(Bv(n))return $.resolve(null);let r=lr(n);return this.indexManager.getIndexType(e,r).next(i=>i===0?null:(n.limit!==null&&i===1&&(n=_p(n,null,"F"),r=lr(n)),this.indexManager.getDocumentsMatchingTarget(e,r).next(s=>{const o=me(...s);return this.Ji.getDocuments(e,o).next(l=>this.indexManager.getMinOffset(e,r).next(u=>{const h=this.ts(n,l);return this.ns(n,h,o,u.readTime)?this.Yi(e,_p(n,null,"F")):this.rs(e,h,n,u)}))})))}Zi(e,n,r,i){return Bv(n)||i.isEqual(de.min())?$.resolve(null):this.Ji.getDocuments(e,r).next(s=>{const o=this.ts(n,s);return this.ns(n,o,r,i)?$.resolve(null):(Wa()<=ye.DEBUG&&re("QueryEngine","Re-using previous result from %s to execute query: %s",i.toString(),po(n)),this.rs(e,o,n,yA(i,-1)).next(l=>l))})}ts(e,n){let r=new St(Zx(e));return n.forEach((i,s)=>{Wd(e,s)&&(r=r.add(s))}),r}ns(e,n,r,i){if(e.limit===null)return!1;if(r.size!==n.size)return!0;const s=e.limitType==="F"?n.last():n.first();return!!s&&(s.hasPendingWrites||s.version.compareTo(i)>0)}Xi(e,n,r){return Wa()<=ye.DEBUG&&re("QueryEngine","Using full collection scan to execute query:",po(n)),this.Ji.getDocumentsMatchingQuery(e,n,ji.min(),r)}rs(e,n,r,i){return this.Ji.getDocumentsMatchingQuery(e,r,i).next(s=>(n.forEach(o=>{s=s.insert(o.key,o)}),s))}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2742,7 +2742,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class FN{constructor(e,n,r,i){this.persistence=e,this.ss=n,this.serializer=i,this.os=new He(_e),this._s=new ia(s=>zm(s),Bm),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new IN(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.os))}}function UN(t,e,n,r){return new FN(t,e,n,r)}async function gE(t,e){const n=he(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.ls(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],l=[];let u=me();for(const h of i){o.push(h.batchId);for(const m of h.mutations)u=u.add(m.key)}for(const h of s){l.push(h.batchId);for(const m of h.mutations)u=u.add(m.key)}return n.localDocuments.getDocuments(r,u).next(h=>({hs:h,removedBatchIds:o,addedBatchIds:l}))})})}function zN(t,e){const n=he(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.cs.newChangeBuffer({trackRemovals:!0});return function(l,u,h,m){const v=h.batch,g=v.keys();let N=$.resolve();return g.forEach(D=>{N=N.next(()=>m.getEntry(u,D)).next(L=>{const B=h.docVersions.get(D);Se(B!==null),L.version.compareTo(B)<0&&(v.applyToRemoteDocument(L,h),L.isValidDocument()&&(L.setReadTime(h.commitVersion),m.addEntry(L)))})}),N.next(()=>l.mutationQueue.removeMutationBatch(u,v))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(l){let u=me();for(let h=0;h0&&(u=u.add(l.batch.mutations[h].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function yE(t){const e=he(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Ur.getLastRemoteSnapshotVersion(n))}function BN(t,e){const n=he(t),r=e.snapshotVersion;let i=n.os;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.cs.newChangeBuffer({trackRemovals:!0});i=n.os;const l=[];e.targetChanges.forEach((m,v)=>{const g=i.get(v);if(!g)return;l.push(n.Ur.removeMatchingKeys(s,m.removedDocuments,v).next(()=>n.Ur.addMatchingKeys(s,m.addedDocuments,v)));let N=g.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(v)!==null?N=N.withResumeToken(Ct.EMPTY_BYTE_STRING,de.min()).withLastLimboFreeSnapshotVersion(de.min()):m.resumeToken.approximateByteSize()>0&&(N=N.withResumeToken(m.resumeToken,r)),i=i.insert(v,N),function(L,B,I){return L.resumeToken.approximateByteSize()===0||B.snapshotVersion.toMicroseconds()-L.snapshotVersion.toMicroseconds()>=3e8?!0:I.addedDocuments.size+I.modifiedDocuments.size+I.removedDocuments.size>0}(g,N,m)&&l.push(n.Ur.updateTargetData(s,N))});let u=zr(),h=me();if(e.documentUpdates.forEach(m=>{e.resolvedLimboDocuments.has(m)&&l.push(n.persistence.referenceDelegate.updateLimboDocument(s,m))}),l.push($N(s,o,e.documentUpdates).next(m=>{u=m.Ps,h=m.Is})),!r.isEqual(de.min())){const m=n.Ur.getLastRemoteSnapshotVersion(s).next(v=>n.Ur.setTargetsMetadata(s,s.currentSequenceNumber,r));l.push(m)}return $.waitFor(l).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,u,h)).next(()=>u)}).then(s=>(n.os=i,s))}function $N(t,e,n){let r=me(),i=me();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=zr();return n.forEach((l,u)=>{const h=s.get(l);u.isFoundDocument()!==h.isFoundDocument()&&(i=i.add(l)),u.isNoDocument()&&u.version.isEqual(de.min())?(e.removeEntry(l,u.readTime),o=o.insert(l,u)):!h.isValidDocument()||u.version.compareTo(h.version)>0||u.version.compareTo(h.version)===0&&h.hasPendingWrites?(e.addEntry(u),o=o.insert(l,u)):re("LocalStore","Ignoring outdated watch update for ",l,". Current version:",h.version," Watch version:",u.version)}),{Ps:o,Is:i}})}function qN(t,e){const n=he(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function WN(t,e){const n=he(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Ur.getTargetData(r,e).next(s=>s?(i=s,$.resolve(i)):n.Ur.allocateTargetId(r).next(o=>(i=new wi(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Ur.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.os.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.os=n.os.insert(r.targetId,r),n._s.set(e,r.targetId)),r})}async function Tp(t,e,n){const r=he(t),i=r.os.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!rc(o))throw o;re("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.os=r.os.remove(e),r._s.delete(i.target)}function Qv(t,e,n){const r=he(t);let i=de.min(),s=me();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,h,m){const v=he(u),g=v._s.get(m);return g!==void 0?$.resolve(v.os.get(g)):v.Ur.getTargetData(h,m)}(r,o,sr(e)).next(l=>{if(l)return i=l.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(o,l.targetId).next(u=>{s=u})}).next(()=>r.ss.getDocumentsMatchingQuery(o,e,n?i:de.min(),n?s:me())).next(l=>(HN(r,LA(e),l),{documents:l,Ts:s})))}function HN(t,e,n){let r=t.us.get(e)||de.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.us.set(e,r)}class Yv{constructor(){this.activeTargetIds=BA()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class KN{constructor(){this.so=new Yv,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,n,r){this.oo[e]=n}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new Yv,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
+ */class $N{constructor(e,n,r,i){this.persistence=e,this.ss=n,this.serializer=i,this.os=new We(xe),this._s=new aa(s=>Bm(s),$m),this.us=new Map,this.cs=e.getRemoteDocumentCache(),this.Ur=e.getTargetCache(),this.Gr=e.getBundleCache(),this.ls(r)}ls(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new PN(this.cs,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.cs.setIndexManager(this.indexManager),this.ss.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",n=>e.collect(n,this.os))}}function qN(t,e,n,r){return new $N(t,e,n,r)}async function _E(t,e){const n=he(t);return await n.persistence.runTransaction("Handle user change","readonly",r=>{let i;return n.mutationQueue.getAllMutationBatches(r).next(s=>(i=s,n.ls(e),n.mutationQueue.getAllMutationBatches(r))).next(s=>{const o=[],l=[];let u=me();for(const h of i){o.push(h.batchId);for(const m of h.mutations)u=u.add(m.key)}for(const h of s){l.push(h.batchId);for(const m of h.mutations)u=u.add(m.key)}return n.localDocuments.getDocuments(r,u).next(h=>({hs:h,removedBatchIds:o,addedBatchIds:l}))})})}function WN(t,e){const n=he(t);return n.persistence.runTransaction("Acknowledge batch","readwrite-primary",r=>{const i=e.batch.keys(),s=n.cs.newChangeBuffer({trackRemovals:!0});return function(l,u,h,m){const v=h.batch,g=v.keys();let N=$.resolve();return g.forEach(j=>{N=N.next(()=>m.getEntry(u,j)).next(L=>{const B=h.docVersions.get(j);Se(B!==null),L.version.compareTo(B)<0&&(v.applyToRemoteDocument(L,h),L.isValidDocument()&&(L.setReadTime(h.commitVersion),m.addEntry(L)))})}),N.next(()=>l.mutationQueue.removeMutationBatch(u,v))}(n,r,e,s).next(()=>s.apply(r)).next(()=>n.mutationQueue.performConsistencyCheck(r)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(r,i,e.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(r,function(l){let u=me();for(let h=0;h0&&(u=u.add(l.batch.mutations[h].key));return u}(e))).next(()=>n.localDocuments.getDocuments(r,i))})}function xE(t){const e=he(t);return e.persistence.runTransaction("Get last remote snapshot version","readonly",n=>e.Ur.getLastRemoteSnapshotVersion(n))}function HN(t,e){const n=he(t),r=e.snapshotVersion;let i=n.os;return n.persistence.runTransaction("Apply remote event","readwrite-primary",s=>{const o=n.cs.newChangeBuffer({trackRemovals:!0});i=n.os;const l=[];e.targetChanges.forEach((m,v)=>{const g=i.get(v);if(!g)return;l.push(n.Ur.removeMatchingKeys(s,m.removedDocuments,v).next(()=>n.Ur.addMatchingKeys(s,m.addedDocuments,v)));let N=g.withSequenceNumber(s.currentSequenceNumber);e.targetMismatches.get(v)!==null?N=N.withResumeToken(Ct.EMPTY_BYTE_STRING,de.min()).withLastLimboFreeSnapshotVersion(de.min()):m.resumeToken.approximateByteSize()>0&&(N=N.withResumeToken(m.resumeToken,r)),i=i.insert(v,N),function(L,B,I){return L.resumeToken.approximateByteSize()===0||B.snapshotVersion.toMicroseconds()-L.snapshotVersion.toMicroseconds()>=3e8?!0:I.addedDocuments.size+I.modifiedDocuments.size+I.removedDocuments.size>0}(g,N,m)&&l.push(n.Ur.updateTargetData(s,N))});let u=Gr(),h=me();if(e.documentUpdates.forEach(m=>{e.resolvedLimboDocuments.has(m)&&l.push(n.persistence.referenceDelegate.updateLimboDocument(s,m))}),l.push(KN(s,o,e.documentUpdates).next(m=>{u=m.Ps,h=m.Is})),!r.isEqual(de.min())){const m=n.Ur.getLastRemoteSnapshotVersion(s).next(v=>n.Ur.setTargetsMetadata(s,s.currentSequenceNumber,r));l.push(m)}return $.waitFor(l).next(()=>o.apply(s)).next(()=>n.localDocuments.getLocalViewOfDocuments(s,u,h)).next(()=>u)}).then(s=>(n.os=i,s))}function KN(t,e,n){let r=me(),i=me();return n.forEach(s=>r=r.add(s)),e.getEntries(t,r).next(s=>{let o=Gr();return n.forEach((l,u)=>{const h=s.get(l);u.isFoundDocument()!==h.isFoundDocument()&&(i=i.add(l)),u.isNoDocument()&&u.version.isEqual(de.min())?(e.removeEntry(l,u.readTime),o=o.insert(l,u)):!h.isValidDocument()||u.version.compareTo(h.version)>0||u.version.compareTo(h.version)===0&&h.hasPendingWrites?(e.addEntry(u),o=o.insert(l,u)):re("LocalStore","Ignoring outdated watch update for ",l,". Current version:",h.version," Watch version:",u.version)}),{Ps:o,Is:i}})}function GN(t,e){const n=he(t);return n.persistence.runTransaction("Get next mutation batch","readonly",r=>(e===void 0&&(e=-1),n.mutationQueue.getNextMutationBatchAfterBatchId(r,e)))}function QN(t,e){const n=he(t);return n.persistence.runTransaction("Allocate target","readwrite",r=>{let i;return n.Ur.getTargetData(r,e).next(s=>s?(i=s,$.resolve(i)):n.Ur.allocateTargetId(r).next(o=>(i=new xi(e,o,"TargetPurposeListen",r.currentSequenceNumber),n.Ur.addTargetData(r,i).next(()=>i))))}).then(r=>{const i=n.os.get(r.targetId);return(i===null||r.snapshotVersion.compareTo(i.snapshotVersion)>0)&&(n.os=n.os.insert(r.targetId,r),n._s.set(e,r.targetId)),r})}async function bp(t,e,n){const r=he(t),i=r.os.get(e),s=n?"readwrite":"readwrite-primary";try{n||await r.persistence.runTransaction("Release target",s,o=>r.persistence.referenceDelegate.removeTarget(o,i))}catch(o){if(!ic(o))throw o;re("LocalStore",`Failed to update sequence numbers for target ${e}: ${o}`)}r.os=r.os.remove(e),r._s.delete(i.target)}function Zv(t,e,n){const r=he(t);let i=de.min(),s=me();return r.persistence.runTransaction("Execute query","readwrite",o=>function(u,h,m){const v=he(u),g=v._s.get(m);return g!==void 0?$.resolve(v.os.get(g)):v.Ur.getTargetData(h,m)}(r,o,lr(e)).next(l=>{if(l)return i=l.lastLimboFreeSnapshotVersion,r.Ur.getMatchingKeysForTargetId(o,l.targetId).next(u=>{s=u})}).next(()=>r.ss.getDocumentsMatchingQuery(o,e,n?i:de.min(),n?s:me())).next(l=>(YN(r,UA(e),l),{documents:l,Ts:s})))}function YN(t,e,n){let r=t.us.get(e)||de.min();n.forEach((i,s)=>{s.readTime.compareTo(r)>0&&(r=s.readTime)}),t.us.set(e,r)}class e0{constructor(){this.activeTargetIds=HA()}fs(e){this.activeTargetIds=this.activeTargetIds.add(e)}gs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Vs(){const e={activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()};return JSON.stringify(e)}}class JN{constructor(){this.so=new e0,this.oo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,n,r){}addLocalQueryTarget(e,n=!0){return n&&this.so.fs(e),this.oo[e]||"not-current"}updateQueryState(e,n,r){this.oo[e]=n}removeLocalQueryTarget(e){this.so.gs(e)}isLocalQueryTarget(e){return this.so.activeTargetIds.has(e)}clearQueryState(e){delete this.oo[e]}getAllActiveQueryTargets(){return this.so.activeTargetIds}isActiveQueryTarget(e){return this.so.activeTargetIds.has(e)}start(){return this.so=new e0,Promise.resolve()}handleUserChange(e,n,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}/**
* @license
* Copyright 2019 Google LLC
*
@@ -2757,7 +2757,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class GN{_o(e){}shutdown(){}}/**
+ */class XN{_o(e){}shutdown(){}}/**
* @license
* Copyright 2019 Google LLC
*
@@ -2772,7 +2772,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Jv{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){re("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){re("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
+ */class t0{constructor(){this.ao=()=>this.uo(),this.co=()=>this.lo(),this.ho=[],this.Po()}_o(e){this.ho.push(e)}shutdown(){window.removeEventListener("online",this.ao),window.removeEventListener("offline",this.co)}Po(){window.addEventListener("online",this.ao),window.addEventListener("offline",this.co)}uo(){re("ConnectivityMonitor","Network connectivity changed: AVAILABLE");for(const e of this.ho)e(0)}lo(){re("ConnectivityMonitor","Network connectivity changed: UNAVAILABLE");for(const e of this.ho)e(1)}static D(){return typeof window<"u"&&window.addEventListener!==void 0&&window.removeEventListener!==void 0}}/**
* @license
* Copyright 2023 Google LLC
*
@@ -2787,7 +2787,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */let iu=null;function tf(){return iu===null?iu=function(){return 268435456+Math.round(2147483648*Math.random())}():iu++,"0x"+iu.toString(16)}/**
+ */let ou=null;function nf(){return ou===null?ou=function(){return 268435456+Math.round(2147483648*Math.random())}():ou++,"0x"+ou.toString(16)}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2802,7 +2802,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const QN={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
+ */const ZN={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregationQuery:"runAggregationQuery"};/**
* @license
* Copyright 2017 Google LLC
*
@@ -2817,7 +2817,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class YN{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
+ */class e2{constructor(e){this.Io=e.Io,this.To=e.To}Eo(e){this.Ao=e}Ro(e){this.Vo=e}mo(e){this.fo=e}onMessage(e){this.po=e}close(){this.To()}send(e){this.Io(e)}yo(){this.Ao()}wo(){this.Vo()}So(e){this.fo(e)}bo(e){this.po(e)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2832,7 +2832,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const jt="WebChannelConnection";class JN extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+n.host,this.vo=`projects/${i}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get Fo(){return!1}Mo(n,r,i,s,o){const l=tf(),u=this.xo(n,r.toUriEncodedString());re("RestConnection",`Sending RPC '${n}' ${l}:`,u,i);const h={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(h,s,o),this.No(n,u,h,i).then(m=>(re("RestConnection",`Received RPC '${n}' ${l}: `,m),m),m=>{throw qo("RestConnection",`RPC '${n}' ${l} failed with error: `,m,"url: ",u,"request:",i),m})}Lo(n,r,i,s,o,l){return this.Mo(n,r,i,s,o)}Oo(n,r,i){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+ra}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,o)=>n[o]=s),i&&i.headers.forEach((s,o)=>n[o]=s)}xo(n,r){const i=QN[n];return`${this.Do}/v1/${r}:${i}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,n,r,i){const s=tf();return new Promise((o,l)=>{const u=new Px;u.setWithCredentials(!0),u.listenOnce(Rx.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case Tu.NO_ERROR:const m=u.getResponseJson();re(jt,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(m)),o(m);break;case Tu.TIMEOUT:re(jt,`RPC '${e}' ${s} timed out`),l(new Z(U.DEADLINE_EXCEEDED,"Request time out"));break;case Tu.HTTP_ERROR:const v=u.getStatus();if(re(jt,`RPC '${e}' ${s} failed with status:`,v,"response text:",u.getResponseText()),v>0){let g=u.getResponseJson();Array.isArray(g)&&(g=g[0]);const N=g==null?void 0:g.error;if(N&&N.status&&N.message){const D=function(B){const I=B.toLowerCase().replace(/_/g,"-");return Object.values(U).indexOf(I)>=0?I:U.UNKNOWN}(N.status);l(new Z(D,N.message))}else l(new Z(U.UNKNOWN,"Server responded with status "+u.getStatus()))}else l(new Z(U.UNAVAILABLE,"Connection failed."));break;default:ce()}}finally{re(jt,`RPC '${e}' ${s} completed.`)}});const h=JSON.stringify(i);re(jt,`RPC '${e}' ${s} sending request:`,i),u.send(n,"POST",h,r,15)})}Bo(e,n,r){const i=tf(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=Ox(),l=jx(),u={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},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(u.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(u.useFetchStreams=!0),this.Oo(u.initMessageHeaders,n,r),u.encodeInitMessageHeaders=!0;const m=s.join("");re(jt,`Creating RPC '${e}' stream ${i}: ${m}`,u);const v=o.createWebChannel(m,u);let g=!1,N=!1;const D=new YN({Io:B=>{N?re(jt,`Not sending because RPC '${e}' stream ${i} is closed:`,B):(g||(re(jt,`Opening RPC '${e}' stream ${i} transport.`),v.open(),g=!0),re(jt,`RPC '${e}' stream ${i} sending:`,B),v.send(B))},To:()=>v.close()}),L=(B,I,k)=>{B.listen(I,C=>{try{k(C)}catch(V){setTimeout(()=>{throw V},0)}})};return L(v,el.EventType.OPEN,()=>{N||(re(jt,`RPC '${e}' stream ${i} transport opened.`),D.yo())}),L(v,el.EventType.CLOSE,()=>{N||(N=!0,re(jt,`RPC '${e}' stream ${i} transport closed`),D.So())}),L(v,el.EventType.ERROR,B=>{N||(N=!0,qo(jt,`RPC '${e}' stream ${i} transport errored:`,B),D.So(new Z(U.UNAVAILABLE,"The operation could not be completed")))}),L(v,el.EventType.MESSAGE,B=>{var I;if(!N){const k=B.data[0];Se(!!k);const C=k,V=C.error||((I=C[0])===null||I===void 0?void 0:I.error);if(V){re(jt,`RPC '${e}' stream ${i} received error:`,V);const Q=V.status;let H=function(x){const S=nt[x];if(S!==void 0)return oE(S)}(Q),T=V.message;H===void 0&&(H=U.INTERNAL,T="Unknown error status: "+Q+" with message "+V.message),N=!0,D.So(new Z(H,T)),v.close()}else re(jt,`RPC '${e}' stream ${i} received:`,k),D.bo(k)}}),L(l,Dx.STAT_EVENT,B=>{B.stat===fp.PROXY?re(jt,`RPC '${e}' stream ${i} detected buffering proxy`):B.stat===fp.NOPROXY&&re(jt,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{D.wo()},0),D}}function nf(){return typeof document<"u"?document:null}/**
+ */const jt="WebChannelConnection";class t2 extends class{constructor(n){this.databaseInfo=n,this.databaseId=n.databaseId;const r=n.ssl?"https":"http",i=encodeURIComponent(this.databaseId.projectId),s=encodeURIComponent(this.databaseId.database);this.Do=r+"://"+n.host,this.vo=`projects/${i}/databases/${s}`,this.Co=this.databaseId.database==="(default)"?`project_id=${i}`:`project_id=${i}&database_id=${s}`}get Fo(){return!1}Mo(n,r,i,s,o){const l=nf(),u=this.xo(n,r.toUriEncodedString());re("RestConnection",`Sending RPC '${n}' ${l}:`,u,i);const h={"google-cloud-resource-prefix":this.vo,"x-goog-request-params":this.Co};return this.Oo(h,s,o),this.No(n,u,h,i).then(m=>(re("RestConnection",`Received RPC '${n}' ${l}: `,m),m),m=>{throw Ko("RestConnection",`RPC '${n}' ${l} failed with error: `,m,"url: ",u,"request:",i),m})}Lo(n,r,i,s,o,l){return this.Mo(n,r,i,s,o)}Oo(n,r,i){n["X-Goog-Api-Client"]=function(){return"gl-js/ fire/"+oa}(),n["Content-Type"]="text/plain",this.databaseInfo.appId&&(n["X-Firebase-GMPID"]=this.databaseInfo.appId),r&&r.headers.forEach((s,o)=>n[o]=s),i&&i.headers.forEach((s,o)=>n[o]=s)}xo(n,r){const i=ZN[n];return`${this.Do}/v1/${r}:${i}`}terminate(){}}{constructor(e){super(e),this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}No(e,n,r,i){const s=nf();return new Promise((o,l)=>{const u=new Ox;u.setWithCredentials(!0),u.listenOnce(Lx.COMPLETE,()=>{try{switch(u.getLastErrorCode()){case Su.NO_ERROR:const m=u.getResponseJson();re(jt,`XHR for RPC '${e}' ${s} received:`,JSON.stringify(m)),o(m);break;case Su.TIMEOUT:re(jt,`RPC '${e}' ${s} timed out`),l(new Z(U.DEADLINE_EXCEEDED,"Request time out"));break;case Su.HTTP_ERROR:const v=u.getStatus();if(re(jt,`RPC '${e}' ${s} failed with status:`,v,"response text:",u.getResponseText()),v>0){let g=u.getResponseJson();Array.isArray(g)&&(g=g[0]);const N=g==null?void 0:g.error;if(N&&N.status&&N.message){const j=function(B){const I=B.toLowerCase().replace(/_/g,"-");return Object.values(U).indexOf(I)>=0?I:U.UNKNOWN}(N.status);l(new Z(j,N.message))}else l(new Z(U.UNKNOWN,"Server responded with status "+u.getStatus()))}else l(new Z(U.UNAVAILABLE,"Connection failed."));break;default:ce()}}finally{re(jt,`RPC '${e}' ${s} completed.`)}});const h=JSON.stringify(i);re(jt,`RPC '${e}' ${s} sending request:`,i),u.send(n,"POST",h,r,15)})}Bo(e,n,r){const i=nf(),s=[this.Do,"/","google.firestore.v1.Firestore","/",e,"/channel"],o=Fx(),l=Vx(),u={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},h=this.longPollingOptions.timeoutSeconds;h!==void 0&&(u.longPollingTimeout=Math.round(1e3*h)),this.useFetchStreams&&(u.useFetchStreams=!0),this.Oo(u.initMessageHeaders,n,r),u.encodeInitMessageHeaders=!0;const m=s.join("");re(jt,`Creating RPC '${e}' stream ${i}: ${m}`,u);const v=o.createWebChannel(m,u);let g=!1,N=!1;const j=new e2({Io:B=>{N?re(jt,`Not sending because RPC '${e}' stream ${i} is closed:`,B):(g||(re(jt,`Opening RPC '${e}' stream ${i} transport.`),v.open(),g=!0),re(jt,`RPC '${e}' stream ${i} sending:`,B),v.send(B))},To:()=>v.close()}),L=(B,I,k)=>{B.listen(I,C=>{try{k(C)}catch(V){setTimeout(()=>{throw V},0)}})};return L(v,tl.EventType.OPEN,()=>{N||(re(jt,`RPC '${e}' stream ${i} transport opened.`),j.yo())}),L(v,tl.EventType.CLOSE,()=>{N||(N=!0,re(jt,`RPC '${e}' stream ${i} transport closed`),j.So())}),L(v,tl.EventType.ERROR,B=>{N||(N=!0,Ko(jt,`RPC '${e}' stream ${i} transport errored:`,B),j.So(new Z(U.UNAVAILABLE,"The operation could not be completed")))}),L(v,tl.EventType.MESSAGE,B=>{var I;if(!N){const k=B.data[0];Se(!!k);const C=k,V=C.error||((I=C[0])===null||I===void 0?void 0:I.error);if(V){re(jt,`RPC '${e}' stream ${i} received error:`,V);const G=V.status;let H=function(E){const S=rt[E];if(S!==void 0)return uE(S)}(G),T=V.message;H===void 0&&(H=U.INTERNAL,T="Unknown error status: "+G+" with message "+V.message),N=!0,j.So(new Z(H,T)),v.close()}else re(jt,`RPC '${e}' stream ${i} received:`,k),j.bo(k)}}),L(l,Mx.STAT_EVENT,B=>{B.stat===pp.PROXY?re(jt,`RPC '${e}' stream ${i} detected buffering proxy`):B.stat===pp.NOPROXY&&re(jt,`RPC '${e}' stream ${i} detected no buffering proxy`)}),setTimeout(()=>{j.wo()},0),j}}function rf(){return typeof document<"u"?document:null}/**
* @license
* Copyright 2020 Google LLC
*
@@ -2847,7 +2847,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function Gd(t){return new aN(t,!0)}/**
+ */function Yd(t){return new dN(t,!0)}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2862,7 +2862,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class vE{constructor(e,n,r=1e3,i=1.5,s=6e4){this.ui=e,this.timerId=n,this.ko=r,this.qo=i,this.Qo=s,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const n=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),i=Math.max(0,n-r);i>0&&re("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ko} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,i,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Kothis.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
+ */class EE{constructor(e,n,r=1e3,i=1.5,s=6e4){this.ui=e,this.timerId=n,this.ko=r,this.qo=i,this.Qo=s,this.Ko=0,this.$o=null,this.Uo=Date.now(),this.reset()}reset(){this.Ko=0}Wo(){this.Ko=this.Qo}Go(e){this.cancel();const n=Math.floor(this.Ko+this.zo()),r=Math.max(0,Date.now()-this.Uo),i=Math.max(0,n-r);i>0&&re("ExponentialBackoff",`Backing off for ${i} ms (base delay: ${this.Ko} ms, delay with jitter: ${n} ms, last attempt: ${r} ms ago)`),this.$o=this.ui.enqueueAfterDelay(this.timerId,i,()=>(this.Uo=Date.now(),e())),this.Ko*=this.qo,this.Kothis.Qo&&(this.Ko=this.Qo)}jo(){this.$o!==null&&(this.$o.skipDelay(),this.$o=null)}cancel(){this.$o!==null&&(this.$o.cancel(),this.$o=null)}zo(){return(Math.random()-.5)*this.Ko}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2877,7 +2877,7 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class wE{constructor(e,n,r,i,s,o,l,u){this.ui=e,this.Ho=r,this.Jo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=u,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new vE(e,n)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,n){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():n&&n.code===U.RESOURCE_EXHAUSTED?(Ur(n.toString()),Ur("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):n&&n.code===U.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(n)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),n=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.Yo===n&&this.P_(r,i)},r=>{e(()=>{const i=new Z(U.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(i)})})}P_(e,n){const r=this.h_(this.Yo);this.stream=this.T_(e,n),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(i=>{r(()=>this.I_(i))}),this.stream.onMessage(i=>{r(()=>++this.e_==1?this.E_(i):this.onNext(i))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return re("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return n=>{this.ui.enqueueAndForget(()=>this.Yo===e?n():(re("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class XN extends wE{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}T_(e,n){return this.connection.Bo("Listen",e,n)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const n=uN(this.serializer,e),r=function(s){if(!("targetChange"in s))return de.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?de.min():o.readTime?or(o.readTime):de.min()}(e);return this.listener.d_(n,r)}A_(e){const n={};n.database=kp(this.serializer),n.addTarget=function(s,o){let l;const u=o.target;if(l=yp(u)?{documents:fN(s,u)}:{query:pN(s,u)._t},l.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){l.resumeToken=cE(s,o.resumeToken);const h=_p(s,o.expectedCount);h!==null&&(l.expectedCount=h)}else if(o.snapshotVersion.compareTo(de.min())>0){l.readTime=fd(s,o.snapshotVersion.toTimestamp());const h=_p(s,o.expectedCount);h!==null&&(l.expectedCount=h)}return l}(this.serializer,e);const r=gN(this.serializer,e);r&&(n.labels=r),this.a_(n)}R_(e){const n={};n.database=kp(this.serializer),n.removeTarget=e,this.a_(n)}}class ZN extends wE{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,n){return this.connection.Bo("Write",e,n)}E_(e){return Se(!!e.streamToken),this.lastStreamToken=e.streamToken,Se(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){Se(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const n=hN(e.writeResults,e.commitTime),r=or(e.commitTime);return this.listener.g_(r,n)}p_(){const e={};e.database=kp(this.serializer),this.a_(e)}m_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>dN(this.serializer,r))};this.a_(n)}}/**
+ */class kE{constructor(e,n,r,i,s,o,l,u){this.ui=e,this.Ho=r,this.Jo=i,this.connection=s,this.authCredentialsProvider=o,this.appCheckCredentialsProvider=l,this.listener=u,this.state=0,this.Yo=0,this.Zo=null,this.Xo=null,this.stream=null,this.e_=0,this.t_=new EE(e,n)}n_(){return this.state===1||this.state===5||this.r_()}r_(){return this.state===2||this.state===3}start(){this.e_=0,this.state!==4?this.auth():this.i_()}async stop(){this.n_()&&await this.close(0)}s_(){this.state=0,this.t_.reset()}o_(){this.r_()&&this.Zo===null&&(this.Zo=this.ui.enqueueAfterDelay(this.Ho,6e4,()=>this.__()))}a_(e){this.u_(),this.stream.send(e)}async __(){if(this.r_())return this.close(0)}u_(){this.Zo&&(this.Zo.cancel(),this.Zo=null)}c_(){this.Xo&&(this.Xo.cancel(),this.Xo=null)}async close(e,n){this.u_(),this.c_(),this.t_.cancel(),this.Yo++,e!==4?this.t_.reset():n&&n.code===U.RESOURCE_EXHAUSTED?(Kr(n.toString()),Kr("Using maximum backoff delay to prevent overloading the backend."),this.t_.Wo()):n&&n.code===U.UNAUTHENTICATED&&this.state!==3&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),this.stream!==null&&(this.l_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.mo(n)}l_(){}auth(){this.state=1;const e=this.h_(this.Yo),n=this.Yo;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([r,i])=>{this.Yo===n&&this.P_(r,i)},r=>{e(()=>{const i=new Z(U.UNKNOWN,"Fetching auth token failed: "+r.message);return this.I_(i)})})}P_(e,n){const r=this.h_(this.Yo);this.stream=this.T_(e,n),this.stream.Eo(()=>{r(()=>this.listener.Eo())}),this.stream.Ro(()=>{r(()=>(this.state=2,this.Xo=this.ui.enqueueAfterDelay(this.Jo,1e4,()=>(this.r_()&&(this.state=3),Promise.resolve())),this.listener.Ro()))}),this.stream.mo(i=>{r(()=>this.I_(i))}),this.stream.onMessage(i=>{r(()=>++this.e_==1?this.E_(i):this.onNext(i))})}i_(){this.state=5,this.t_.Go(async()=>{this.state=0,this.start()})}I_(e){return re("PersistentStream",`close with error: ${e}`),this.stream=null,this.close(4,e)}h_(e){return n=>{this.ui.enqueueAndForget(()=>this.Yo===e?n():(re("PersistentStream","stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class n2 extends kE{constructor(e,n,r,i,s,o){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}T_(e,n){return this.connection.Bo("Listen",e,n)}E_(e){return this.onNext(e)}onNext(e){this.t_.reset();const n=pN(this.serializer,e),r=function(s){if(!("targetChange"in s))return de.min();const o=s.targetChange;return o.targetIds&&o.targetIds.length?de.min():o.readTime?cr(o.readTime):de.min()}(e);return this.listener.d_(n,r)}A_(e){const n={};n.database=Tp(this.serializer),n.addTarget=function(s,o){let l;const u=o.target;if(l=vp(u)?{documents:yN(s,u)}:{query:vN(s,u)._t},l.targetId=o.targetId,o.resumeToken.approximateByteSize()>0){l.resumeToken=fE(s,o.resumeToken);const h=xp(s,o.expectedCount);h!==null&&(l.expectedCount=h)}else if(o.snapshotVersion.compareTo(de.min())>0){l.readTime=md(s,o.snapshotVersion.toTimestamp());const h=xp(s,o.expectedCount);h!==null&&(l.expectedCount=h)}return l}(this.serializer,e);const r=_N(this.serializer,e);r&&(n.labels=r),this.a_(n)}R_(e){const n={};n.database=Tp(this.serializer),n.removeTarget=e,this.a_(n)}}class r2 extends kE{constructor(e,n,r,i,s,o){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",n,r,i,o),this.serializer=s}get V_(){return this.e_>0}start(){this.lastStreamToken=void 0,super.start()}l_(){this.V_&&this.m_([])}T_(e,n){return this.connection.Bo("Write",e,n)}E_(e){return Se(!!e.streamToken),this.lastStreamToken=e.streamToken,Se(!e.writeResults||e.writeResults.length===0),this.listener.f_()}onNext(e){Se(!!e.streamToken),this.lastStreamToken=e.streamToken,this.t_.reset();const n=gN(e.writeResults,e.commitTime),r=cr(e.commitTime);return this.listener.g_(r,n)}p_(){const e={};e.database=Tp(this.serializer),this.a_(e)}m_(e){const n={streamToken:this.lastStreamToken,writes:e.map(r=>mN(this.serializer,r))};this.a_(n)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2892,8 +2892,8 @@ SPDX-License-Identifier: Apache-2.0
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class e2 extends class{}{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.y_=!1}w_(){if(this.y_)throw new Z(U.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,n,r,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Mo(e,xp(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===U.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new Z(U.UNKNOWN,s.toString())})}Lo(e,n,r,i,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,l])=>this.connection.Lo(e,xp(n,r),i,o,l,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===U.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new Z(U.UNKNOWN,o.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class t2{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const n=`Could not reach Cloud Firestore backend. ${e}
-This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(Ur(n),this.D_=!1):re("OnlineStateTracker",n)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
+ */class i2 extends class{}{constructor(e,n,r,i){super(),this.authCredentials=e,this.appCheckCredentials=n,this.connection=r,this.serializer=i,this.y_=!1}w_(){if(this.y_)throw new Z(U.FAILED_PRECONDITION,"The client has already been terminated.")}Mo(e,n,r,i){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Mo(e,Ep(n,r),i,s,o)).catch(s=>{throw s.name==="FirebaseError"?(s.code===U.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),s):new Z(U.UNKNOWN,s.toString())})}Lo(e,n,r,i,s){return this.w_(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([o,l])=>this.connection.Lo(e,Ep(n,r),i,o,l,s)).catch(o=>{throw o.name==="FirebaseError"?(o.code===U.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),o):new Z(U.UNKNOWN,o.toString())})}terminate(){this.y_=!0,this.connection.terminate()}}class s2{constructor(e,n){this.asyncQueue=e,this.onlineStateHandler=n,this.state="Unknown",this.S_=0,this.b_=null,this.D_=!0}v_(){this.S_===0&&(this.C_("Unknown"),this.b_=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.b_=null,this.F_("Backend didn't respond within 10 seconds."),this.C_("Offline"),Promise.resolve())))}M_(e){this.state==="Online"?this.C_("Unknown"):(this.S_++,this.S_>=1&&(this.x_(),this.F_(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.C_("Offline")))}set(e){this.x_(),this.S_=0,e==="Online"&&(this.D_=!1),this.C_(e)}C_(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}F_(e){const n=`Could not reach Cloud Firestore backend. ${e}
+This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.`;this.D_?(Kr(n),this.D_=!1):re("OnlineStateTracker",n)}x_(){this.b_!==null&&(this.b_.cancel(),this.b_=null)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2908,7 +2908,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class n2{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=s,this.k_._o(o=>{r.enqueueAndForget(async()=>{Ds(this)&&(re("RemoteStore","Restarting streams for network reachability change."),await async function(u){const h=he(u);h.L_.add(4),await ac(h),h.q_.set("Unknown"),h.L_.delete(4),await Qd(h)}(this))})}),this.q_=new t2(r,i)}}async function Qd(t){if(Ds(t))for(const e of t.B_)await e(!0)}async function ac(t){for(const e of t.B_)await e(!1)}function _E(t,e){const n=he(t);n.N_.has(e.targetId)||(n.N_.set(e.targetId,e),Zm(n)?Xm(n):sa(n).r_()&&Jm(n,e))}function Ym(t,e){const n=he(t),r=sa(n);n.N_.delete(e),r.r_()&&xE(n,e),n.N_.size===0&&(r.r_()?r.o_():Ds(n)&&n.q_.set("Unknown"))}function Jm(t,e){if(t.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(de.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}sa(t).A_(e)}function xE(t,e){t.Q_.xe(e),sa(t).R_(e)}function Xm(t){t.Q_=new rN({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>t.N_.get(e)||null,tt:()=>t.datastore.serializer.databaseId}),sa(t).start(),t.q_.v_()}function Zm(t){return Ds(t)&&!sa(t).n_()&&t.N_.size>0}function Ds(t){return he(t).L_.size===0}function EE(t){t.Q_=void 0}async function r2(t){t.q_.set("Online")}async function i2(t){t.N_.forEach((e,n)=>{Jm(t,e)})}async function s2(t,e){EE(t),Zm(t)?(t.q_.M_(e),Xm(t)):t.q_.set("Unknown")}async function o2(t,e,n){if(t.q_.set("Online"),e instanceof lE&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const l of s.targetIds)i.N_.has(l)&&(await i.remoteSyncer.rejectListen(l,o),i.N_.delete(l),i.Q_.removeTarget(l))}(t,e)}catch(r){re("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await pd(t,r)}else if(e instanceof Iu?t.Q_.Ke(e):e instanceof aE?t.Q_.He(e):t.Q_.We(e),!n.isEqual(de.min()))try{const r=await yE(t.localStore);n.compareTo(r)>=0&&await function(s,o){const l=s.Q_.rt(o);return l.targetChanges.forEach((u,h)=>{if(u.resumeToken.approximateByteSize()>0){const m=s.N_.get(h);m&&s.N_.set(h,m.withResumeToken(u.resumeToken,o))}}),l.targetMismatches.forEach((u,h)=>{const m=s.N_.get(u);if(!m)return;s.N_.set(u,m.withResumeToken(Ct.EMPTY_BYTE_STRING,m.snapshotVersion)),xE(s,u);const v=new wi(m.target,u,h,m.sequenceNumber);Jm(s,v)}),s.remoteSyncer.applyRemoteEvent(l)}(t,n)}catch(r){re("RemoteStore","Failed to raise snapshot:",r),await pd(t,r)}}async function pd(t,e,n){if(!rc(e))throw e;t.L_.add(1),await ac(t),t.q_.set("Offline"),n||(n=()=>yE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{re("RemoteStore","Retrying IndexedDB access"),await n(),t.L_.delete(1),await Qd(t)})}function kE(t,e){return e().catch(n=>pd(t,n,e))}async function Yd(t){const e=he(t),n=ji(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;a2(e);)try{const i=await qN(e.localStore,r);if(i===null){e.O_.length===0&&n.o_();break}r=i.batchId,l2(e,i)}catch(i){await pd(e,i)}TE(e)&&bE(e)}function a2(t){return Ds(t)&&t.O_.length<10}function l2(t,e){t.O_.push(e);const n=ji(t);n.r_()&&n.V_&&n.m_(e.mutations)}function TE(t){return Ds(t)&&!ji(t).n_()&&t.O_.length>0}function bE(t){ji(t).start()}async function c2(t){ji(t).p_()}async function u2(t){const e=ji(t);for(const n of t.O_)e.m_(n.mutations)}async function d2(t,e,n){const r=t.O_.shift(),i=qm.from(r,e,n);await kE(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await Yd(t)}async function h2(t,e){e&&ji(t).V_&&await async function(r,i){if(function(o){return eN(o)&&o!==U.ABORTED}(i.code)){const s=r.O_.shift();ji(r).s_(),await kE(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Yd(r)}}(t,e),TE(t)&&bE(t)}async function Xv(t,e){const n=he(t);n.asyncQueue.verifyOperationInProgress(),re("RemoteStore","RemoteStore received new credentials");const r=Ds(n);n.L_.add(3),await ac(n),r&&n.q_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.L_.delete(3),await Qd(n)}async function f2(t,e){const n=he(t);e?(n.L_.delete(2),await Qd(n)):e||(n.L_.add(2),await ac(n),n.q_.set("Unknown"))}function sa(t){return t.K_||(t.K_=function(n,r,i){const s=he(n);return s.w_(),new XN(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:r2.bind(null,t),Ro:i2.bind(null,t),mo:s2.bind(null,t),d_:o2.bind(null,t)}),t.B_.push(async e=>{e?(t.K_.s_(),Zm(t)?Xm(t):t.q_.set("Unknown")):(await t.K_.stop(),EE(t))})),t.K_}function ji(t){return t.U_||(t.U_=function(n,r,i){const s=he(n);return s.w_(),new ZN(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:()=>Promise.resolve(),Ro:c2.bind(null,t),mo:h2.bind(null,t),f_:u2.bind(null,t),g_:d2.bind(null,t)}),t.B_.push(async e=>{e?(t.U_.s_(),await Yd(t)):(await t.U_.stop(),t.O_.length>0&&(re("RemoteStore",`Stopping write stream with ${t.O_.length} pending writes`),t.O_=[]))})),t.U_}/**
+ */class o2{constructor(e,n,r,i,s){this.localStore=e,this.datastore=n,this.asyncQueue=r,this.remoteSyncer={},this.O_=[],this.N_=new Map,this.L_=new Set,this.B_=[],this.k_=s,this.k_._o(o=>{r.enqueueAndForget(async()=>{js(this)&&(re("RemoteStore","Restarting streams for network reachability change."),await async function(u){const h=he(u);h.L_.add(4),await lc(h),h.q_.set("Unknown"),h.L_.delete(4),await Jd(h)}(this))})}),this.q_=new s2(r,i)}}async function Jd(t){if(js(t))for(const e of t.B_)await e(!0)}async function lc(t){for(const e of t.B_)await e(!1)}function TE(t,e){const n=he(t);n.N_.has(e.targetId)||(n.N_.set(e.targetId,e),eg(n)?Zm(n):la(n).r_()&&Xm(n,e))}function Jm(t,e){const n=he(t),r=la(n);n.N_.delete(e),r.r_()&&bE(n,e),n.N_.size===0&&(r.r_()?r.o_():js(n)&&n.q_.set("Unknown"))}function Xm(t,e){if(t.Q_.xe(e.targetId),e.resumeToken.approximateByteSize()>0||e.snapshotVersion.compareTo(de.min())>0){const n=t.remoteSyncer.getRemoteKeysForTarget(e.targetId).size;e=e.withExpectedCount(n)}la(t).A_(e)}function bE(t,e){t.Q_.xe(e),la(t).R_(e)}function Zm(t){t.Q_=new aN({getRemoteKeysForTarget:e=>t.remoteSyncer.getRemoteKeysForTarget(e),ot:e=>t.N_.get(e)||null,tt:()=>t.datastore.serializer.databaseId}),la(t).start(),t.q_.v_()}function eg(t){return js(t)&&!la(t).n_()&&t.N_.size>0}function js(t){return he(t).L_.size===0}function SE(t){t.Q_=void 0}async function a2(t){t.q_.set("Online")}async function l2(t){t.N_.forEach((e,n)=>{Xm(t,e)})}async function c2(t,e){SE(t),eg(t)?(t.q_.M_(e),Zm(t)):t.q_.set("Unknown")}async function u2(t,e,n){if(t.q_.set("Online"),e instanceof hE&&e.state===2&&e.cause)try{await async function(i,s){const o=s.cause;for(const l of s.targetIds)i.N_.has(l)&&(await i.remoteSyncer.rejectListen(l,o),i.N_.delete(l),i.Q_.removeTarget(l))}(t,e)}catch(r){re("RemoteStore","Failed to remove targets %s: %s ",e.targetIds.join(","),r),await gd(t,r)}else if(e instanceof Au?t.Q_.Ke(e):e instanceof dE?t.Q_.He(e):t.Q_.We(e),!n.isEqual(de.min()))try{const r=await xE(t.localStore);n.compareTo(r)>=0&&await function(s,o){const l=s.Q_.rt(o);return l.targetChanges.forEach((u,h)=>{if(u.resumeToken.approximateByteSize()>0){const m=s.N_.get(h);m&&s.N_.set(h,m.withResumeToken(u.resumeToken,o))}}),l.targetMismatches.forEach((u,h)=>{const m=s.N_.get(u);if(!m)return;s.N_.set(u,m.withResumeToken(Ct.EMPTY_BYTE_STRING,m.snapshotVersion)),bE(s,u);const v=new xi(m.target,u,h,m.sequenceNumber);Xm(s,v)}),s.remoteSyncer.applyRemoteEvent(l)}(t,n)}catch(r){re("RemoteStore","Failed to raise snapshot:",r),await gd(t,r)}}async function gd(t,e,n){if(!ic(e))throw e;t.L_.add(1),await lc(t),t.q_.set("Offline"),n||(n=()=>xE(t.localStore)),t.asyncQueue.enqueueRetryable(async()=>{re("RemoteStore","Retrying IndexedDB access"),await n(),t.L_.delete(1),await Jd(t)})}function IE(t,e){return e().catch(n=>gd(t,n,e))}async function Xd(t){const e=he(t),n=Li(e);let r=e.O_.length>0?e.O_[e.O_.length-1].batchId:-1;for(;d2(e);)try{const i=await GN(e.localStore,r);if(i===null){e.O_.length===0&&n.o_();break}r=i.batchId,h2(e,i)}catch(i){await gd(e,i)}CE(e)&&AE(e)}function d2(t){return js(t)&&t.O_.length<10}function h2(t,e){t.O_.push(e);const n=Li(t);n.r_()&&n.V_&&n.m_(e.mutations)}function CE(t){return js(t)&&!Li(t).n_()&&t.O_.length>0}function AE(t){Li(t).start()}async function f2(t){Li(t).p_()}async function p2(t){const e=Li(t);for(const n of t.O_)e.m_(n.mutations)}async function m2(t,e,n){const r=t.O_.shift(),i=Wm.from(r,e,n);await IE(t,()=>t.remoteSyncer.applySuccessfulWrite(i)),await Xd(t)}async function g2(t,e){e&&Li(t).V_&&await async function(r,i){if(function(o){return iN(o)&&o!==U.ABORTED}(i.code)){const s=r.O_.shift();Li(r).s_(),await IE(r,()=>r.remoteSyncer.rejectFailedWrite(s.batchId,i)),await Xd(r)}}(t,e),CE(t)&&AE(t)}async function n0(t,e){const n=he(t);n.asyncQueue.verifyOperationInProgress(),re("RemoteStore","RemoteStore received new credentials");const r=js(n);n.L_.add(3),await lc(n),r&&n.q_.set("Unknown"),await n.remoteSyncer.handleCredentialChange(e),n.L_.delete(3),await Jd(n)}async function y2(t,e){const n=he(t);e?(n.L_.delete(2),await Jd(n)):e||(n.L_.add(2),await lc(n),n.q_.set("Unknown"))}function la(t){return t.K_||(t.K_=function(n,r,i){const s=he(n);return s.w_(),new n2(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:a2.bind(null,t),Ro:l2.bind(null,t),mo:c2.bind(null,t),d_:u2.bind(null,t)}),t.B_.push(async e=>{e?(t.K_.s_(),eg(t)?Zm(t):t.q_.set("Unknown")):(await t.K_.stop(),SE(t))})),t.K_}function Li(t){return t.U_||(t.U_=function(n,r,i){const s=he(n);return s.w_(),new r2(r,s.connection,s.authCredentials,s.appCheckCredentials,s.serializer,i)}(t.datastore,t.asyncQueue,{Eo:()=>Promise.resolve(),Ro:f2.bind(null,t),mo:g2.bind(null,t),f_:p2.bind(null,t),g_:m2.bind(null,t)}),t.B_.push(async e=>{e?(t.U_.s_(),await Xd(t)):(await t.U_.stop(),t.O_.length>0&&(re("RemoteStore",`Stopping write stream with ${t.O_.length} pending writes`),t.O_=[]))})),t.U_}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2923,7 +2923,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class eg{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new Dr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,l=new eg(e,n,o,i,s);return l.start(r),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new Z(U.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 tg(t,e){if(Ur("AsyncQueue",`${e}: ${t}`),rc(t))return new Z(U.UNAVAILABLE,`${e}: ${t}`);throw t}/**
+ */class tg{constructor(e,n,r,i,s){this.asyncQueue=e,this.timerId=n,this.targetTimeMs=r,this.op=i,this.removalCallback=s,this.deferred=new Ur,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(o=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,n,r,i,s){const o=Date.now()+r,l=new tg(e,n,o,i,s);return l.start(r),l}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){this.timerHandle!==null&&(this.clearTimeout(),this.deferred.reject(new Z(U.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 ng(t,e){if(Kr("AsyncQueue",`${e}: ${t}`),ic(t))return new Z(U.UNAVAILABLE,`${e}: ${t}`);throw t}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2938,10 +2938,10 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Lo{constructor(e){this.comparator=e?(n,r)=>e(n,r)||ie.comparator(n.key,r.key):(n,r)=>ie.comparator(n.key,r.key),this.keyedMap=tl(),this.sortedSet=new He(this.comparator)}static emptySet(e){return new Lo(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof Lo)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
+ */class Fo{constructor(e){this.comparator=e?(n,r)=>e(n,r)||ie.comparator(n.key,r.key):(n,r)=>ie.comparator(n.key,r.key),this.keyedMap=nl(),this.sortedSet=new We(this.comparator)}static emptySet(e){return new Fo(e.comparator)}has(e){return this.keyedMap.get(e)!=null}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){const n=this.keyedMap.get(e);return n?this.sortedSet.indexOf(n):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((n,r)=>(e(n),!1))}add(e){const n=this.delete(e.key);return n.copy(n.keyedMap.insert(e.key,e),n.sortedSet.insert(e,null))}delete(e){const n=this.get(e);return n?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(n)):this}isEqual(e){if(!(e instanceof Fo)||this.size!==e.size)return!1;const n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;n.hasNext();){const i=n.getNext().key,s=r.getNext().key;if(!i.isEqual(s))return!1}return!0}toString(){const e=[];return this.forEach(n=>{e.push(n.toString())}),e.length===0?"DocumentSet ()":`DocumentSet (
`+e.join(`
`)+`
-)`}copy(e,n){const r=new Lo;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
+)`}copy(e,n){const r=new Fo;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2956,7 +2956,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Zv{constructor(){this.W_=new He(ie.comparator)}track(e){const n=e.doc.key,r=this.W_.get(n);r?e.type!==0&&r.type===3?this.W_=this.W_.insert(n,e):e.type===3&&r.type!==1?this.W_=this.W_.insert(n,{type:r.type,doc:e.doc}):e.type===2&&r.type===2?this.W_=this.W_.insert(n,{type:2,doc:e.doc}):e.type===2&&r.type===0?this.W_=this.W_.insert(n,{type:0,doc:e.doc}):e.type===1&&r.type===0?this.W_=this.W_.remove(n):e.type===1&&r.type===2?this.W_=this.W_.insert(n,{type:1,doc:r.doc}):e.type===0&&r.type===1?this.W_=this.W_.insert(n,{type:2,doc:e.doc}):ce():this.W_=this.W_.insert(n,e)}G_(){const e=[];return this.W_.inorderTraversal((n,r)=>{e.push(r)}),e}}class Qo{constructor(e,n,r,i,s,o,l,u,h){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(l=>{o.push({type:0,doc:l})}),new Qo(e,n,Lo.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&Bd(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;i{e.push(r)}),e}}class Xo{constructor(e,n,r,i,s,o,l,u,h){this.query=e,this.docs=n,this.oldDocs=r,this.docChanges=i,this.mutatedKeys=s,this.fromCache=o,this.syncStateChanged=l,this.excludesMetadataChanges=u,this.hasCachedResults=h}static fromInitialDocuments(e,n,r,i,s){const o=[];return n.forEach(l=>{o.push({type:0,doc:l})}),new Xo(e,n,Fo.emptySet(n),o,r,i,!0,!1,s)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&qd(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;const n=this.docChanges,r=e.docChanges;if(n.length!==r.length)return!1;for(let i=0;ie.J_())}}class m2{constructor(){this.queries=e0(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(n,r){const i=he(n),s=i.queries;i.queries=e0(),s.forEach((o,l)=>{for(const u of l.j_)u.onError(r)})})(this,new Z(U.ABORTED,"Firestore shutting down"))}}function e0(){return new ia(t=>Gx(t),Bd)}async function ng(t,e){const n=he(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.H_()&&e.J_()&&(r=2):(s=new p2,r=e.J_()?0:1);try{switch(r){case 0:s.z_=await n.onListen(i,!0);break;case 1:s.z_=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const l=tg(o,`Initialization of query '${uo(e.query)}' failed`);return void e.onError(l)}n.queries.set(i,s),s.j_.push(e),e.Z_(n.onlineState),s.z_&&e.X_(s.z_)&&ig(n)}async function rg(t,e){const n=he(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.j_.indexOf(e);o>=0&&(s.j_.splice(o,1),s.j_.length===0?i=e.J_()?0:1:!s.H_()&&e.J_()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function g2(t,e){const n=he(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const l of o.j_)l.X_(i)&&(r=!0);o.z_=i}}r&&ig(n)}function y2(t,e,n){const r=he(t),i=r.queries.get(e);if(i)for(const s of i.j_)s.onError(n);r.queries.delete(e)}function ig(t){t.Y_.forEach(e=>{e.next()})}var bp,t0;(t0=bp||(bp={})).ea="default",t0.Cache="cache";class sg{constructor(e,n,r){this.query=e,this.ta=n,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Qo(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.na?this.ia(e)&&(this.ta.next(e),n=!0):this.sa(e,this.onlineState)&&(this.oa(e),n=!0),this.ra=e,n}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let n=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),n=!0),n}sa(e,n){if(!e.fromCache||!this.J_())return!0;const r=n!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const n=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}oa(e){e=Qo.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==bp.Cache}}/**
+ */class v2{constructor(){this.z_=void 0,this.j_=[]}H_(){return this.j_.some(e=>e.J_())}}class w2{constructor(){this.queries=i0(),this.onlineState="Unknown",this.Y_=new Set}terminate(){(function(n,r){const i=he(n),s=i.queries;i.queries=i0(),s.forEach((o,l)=>{for(const u of l.j_)u.onError(r)})})(this,new Z(U.ABORTED,"Firestore shutting down"))}}function i0(){return new aa(t=>Xx(t),qd)}async function rg(t,e){const n=he(t);let r=3;const i=e.query;let s=n.queries.get(i);s?!s.H_()&&e.J_()&&(r=2):(s=new v2,r=e.J_()?0:1);try{switch(r){case 0:s.z_=await n.onListen(i,!0);break;case 1:s.z_=await n.onListen(i,!1);break;case 2:await n.onFirstRemoteStoreListen(i)}}catch(o){const l=ng(o,`Initialization of query '${po(e.query)}' failed`);return void e.onError(l)}n.queries.set(i,s),s.j_.push(e),e.Z_(n.onlineState),s.z_&&e.X_(s.z_)&&sg(n)}async function ig(t,e){const n=he(t),r=e.query;let i=3;const s=n.queries.get(r);if(s){const o=s.j_.indexOf(e);o>=0&&(s.j_.splice(o,1),s.j_.length===0?i=e.J_()?0:1:!s.H_()&&e.J_()&&(i=2))}switch(i){case 0:return n.queries.delete(r),n.onUnlisten(r,!0);case 1:return n.queries.delete(r),n.onUnlisten(r,!1);case 2:return n.onLastRemoteStoreUnlisten(r);default:return}}function _2(t,e){const n=he(t);let r=!1;for(const i of e){const s=i.query,o=n.queries.get(s);if(o){for(const l of o.j_)l.X_(i)&&(r=!0);o.z_=i}}r&&sg(n)}function x2(t,e,n){const r=he(t),i=r.queries.get(e);if(i)for(const s of i.j_)s.onError(n);r.queries.delete(e)}function sg(t){t.Y_.forEach(e=>{e.next()})}var Sp,s0;(s0=Sp||(Sp={})).ea="default",s0.Cache="cache";class og{constructor(e,n,r){this.query=e,this.ta=n,this.na=!1,this.ra=null,this.onlineState="Unknown",this.options=r||{}}X_(e){if(!this.options.includeMetadataChanges){const r=[];for(const i of e.docChanges)i.type!==3&&r.push(i);e=new Xo(e.query,e.docs,e.oldDocs,r,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let n=!1;return this.na?this.ia(e)&&(this.ta.next(e),n=!0):this.sa(e,this.onlineState)&&(this.oa(e),n=!0),this.ra=e,n}onError(e){this.ta.error(e)}Z_(e){this.onlineState=e;let n=!1;return this.ra&&!this.na&&this.sa(this.ra,e)&&(this.oa(this.ra),n=!0),n}sa(e,n){if(!e.fromCache||!this.J_())return!0;const r=n!=="Offline";return(!this.options._a||!r)&&(!e.docs.isEmpty()||e.hasCachedResults||n==="Offline")}ia(e){if(e.docChanges.length>0)return!0;const n=this.ra&&this.ra.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!n)&&this.options.includeMetadataChanges===!0}oa(e){e=Xo.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.na=!0,this.ta.next(e)}J_(){return this.options.source!==Sp.Cache}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -2986,7 +2986,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class SE{constructor(e){this.key=e}}class IE{constructor(e){this.key=e}}class v2{constructor(e,n){this.query=e,this.Ta=n,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=me(),this.mutatedKeys=me(),this.Aa=Qx(e),this.Ra=new Lo(this.Aa)}get Va(){return this.Ta}ma(e,n){const r=n?n.fa:new Zv,i=n?n.Ra:this.Ra;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,l=!1;const u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,h=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((m,v)=>{const g=i.get(m),N=$d(this.query,v)?v:null,D=!!g&&this.mutatedKeys.has(g.key),L=!!N&&(N.hasLocalMutations||this.mutatedKeys.has(N.key)&&N.hasCommittedMutations);let B=!1;g&&N?g.data.isEqual(N.data)?D!==L&&(r.track({type:3,doc:N}),B=!0):this.ga(g,N)||(r.track({type:2,doc:N}),B=!0,(u&&this.Aa(N,u)>0||h&&this.Aa(N,h)<0)&&(l=!0)):!g&&N?(r.track({type:0,doc:N}),B=!0):g&&!N&&(r.track({type:1,doc:g}),B=!0,(u||h)&&(l=!0)),B&&(N?(o=o.add(N),s=L?s.add(m):s.delete(m)):(o=o.delete(m),s=s.delete(m)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const m=this.query.limitType==="F"?o.last():o.first();o=o.delete(m.key),s=s.delete(m.key),r.track({type:1,doc:m})}return{Ra:o,fa:r,ns:l,mutatedKeys:s}}ga(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const o=e.fa.G_();o.sort((m,v)=>function(N,D){const L=B=>{switch(B){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ce()}};return L(N)-L(D)}(m.type,v.type)||this.Aa(m.doc,v.doc)),this.pa(r),i=i!=null&&i;const l=n&&!i?this.ya():[],u=this.da.size===0&&this.current&&!i?1:0,h=u!==this.Ea;return this.Ea=u,o.length!==0||h?{snapshot:new Qo(this.query,e.Ra,s,o,e.mutatedKeys,u===0,h,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:l}:{wa:l}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new Zv,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(n=>this.Ta=this.Ta.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ta=this.Ta.delete(n)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=me(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const n=[];return e.forEach(r=>{this.da.has(r)||n.push(new IE(r))}),this.da.forEach(r=>{e.has(r)||n.push(new SE(r))}),n}ba(e){this.Ta=e.Ts,this.da=me();const n=this.ma(e.documents);return this.applyChanges(n,!0)}Da(){return Qo.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class w2{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class _2{constructor(e){this.key=e,this.va=!1}}class x2{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Ca={},this.Fa=new ia(l=>Gx(l),Bd),this.Ma=new Map,this.xa=new Set,this.Oa=new He(ie.comparator),this.Na=new Map,this.La=new Km,this.Ba={},this.ka=new Map,this.qa=Go.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function E2(t,e,n=!0){const r=DE(t);let i;const s=r.Fa.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.Da()):i=await CE(r,e,n,!0),i}async function k2(t,e){const n=DE(t);await CE(n,e,!0,!1)}async function CE(t,e,n,r){const i=await WN(t.localStore,sr(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let l;return r&&(l=await T2(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&_E(t.remoteStore,i),l}async function T2(t,e,n,r,i){t.Ka=(v,g,N)=>async function(L,B,I,k){let C=B.view.ma(I);C.ns&&(C=await Qv(L.localStore,B.query,!1).then(({documents:T})=>B.view.ma(T,C)));const V=k&&k.targetChanges.get(B.targetId),Q=k&&k.targetMismatches.get(B.targetId)!=null,H=B.view.applyChanges(C,L.isPrimaryClient,V,Q);return r0(L,B.targetId,H.wa),H.snapshot}(t,v,g,N);const s=await Qv(t.localStore,e,!0),o=new v2(e,s.Ts),l=o.ma(s.documents),u=oc.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),h=o.applyChanges(l,t.isPrimaryClient,u);r0(t,n,h.wa);const m=new w2(e,n,o);return t.Fa.set(e,m),t.Ma.has(n)?t.Ma.get(n).push(e):t.Ma.set(n,[e]),h.snapshot}async function b2(t,e,n){const r=he(t),i=r.Fa.get(e),s=r.Ma.get(i.targetId);if(s.length>1)return r.Ma.set(i.targetId,s.filter(o=>!Bd(o,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await Tp(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&Ym(r.remoteStore,i.targetId),Sp(r,i.targetId)}).catch(nc)):(Sp(r,i.targetId),await Tp(r.localStore,i.targetId,!0))}async function S2(t,e){const n=he(t),r=n.Fa.get(e),i=n.Ma.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Ym(n.remoteStore,r.targetId))}async function I2(t,e,n){const r=j2(t);try{const i=await function(o,l){const u=he(o),h=ft.now(),m=l.reduce((N,D)=>N.add(D.key),me());let v,g;return u.persistence.runTransaction("Locally write mutations","readwrite",N=>{let D=zr(),L=me();return u.cs.getEntries(N,m).next(B=>{D=B,D.forEach((I,k)=>{k.isValidDocument()||(L=L.add(I))})}).next(()=>u.localDocuments.getOverlayedDocuments(N,D)).next(B=>{v=B;const I=[];for(const k of l){const C=QA(k,v.get(k.key).overlayedDocument);C!=null&&I.push(new Fi(k.key,C,Ux(C.value.mapValue),$t.exists(!0)))}return u.mutationQueue.addMutationBatch(N,h,I,l)}).next(B=>{g=B;const I=B.applyToLocalDocumentSet(v,L);return u.documentOverlayCache.saveOverlays(N,B.batchId,I)})}).then(()=>({batchId:g.batchId,changes:Jx(v)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,l,u){let h=o.Ba[o.currentUser.toKey()];h||(h=new He(_e)),h=h.insert(l,u),o.Ba[o.currentUser.toKey()]=h}(r,i.batchId,n),await lc(r,i.changes),await Yd(r.remoteStore)}catch(i){const s=tg(i,"Failed to persist write");n.reject(s)}}async function AE(t,e){const n=he(t);try{const r=await BN(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Na.get(s);o&&(Se(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?o.va=!0:i.modifiedDocuments.size>0?Se(o.va):i.removedDocuments.size>0&&(Se(o.va),o.va=!1))}),await lc(n,r,e)}catch(r){await nc(r)}}function n0(t,e,n){const r=he(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Fa.forEach((s,o)=>{const l=o.view.Z_(e);l.snapshot&&i.push(l.snapshot)}),function(o,l){const u=he(o);u.onlineState=l;let h=!1;u.queries.forEach((m,v)=>{for(const g of v.j_)g.Z_(l)&&(h=!0)}),h&&ig(u)}(r.eventManager,e),i.length&&r.Ca.d_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function C2(t,e,n){const r=he(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Na.get(e),s=i&&i.key;if(s){let o=new He(ie.comparator);o=o.insert(s,Mt.newNoDocument(s,de.min()));const l=me().add(s),u=new Kd(de.min(),new Map,new He(_e),o,l);await AE(r,u),r.Oa=r.Oa.remove(s),r.Na.delete(e),og(r)}else await Tp(r.localStore,e,!1).then(()=>Sp(r,e,n)).catch(nc)}async function A2(t,e){const n=he(t),r=e.batch.batchId;try{const i=await zN(n.localStore,e);PE(n,r,null),NE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await lc(n,i)}catch(i){await nc(i)}}async function N2(t,e,n){const r=he(t);try{const i=await function(o,l){const u=he(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",h=>{let m;return u.mutationQueue.lookupMutationBatch(h,l).next(v=>(Se(v!==null),m=v.keys(),u.mutationQueue.removeMutationBatch(h,v))).next(()=>u.mutationQueue.performConsistencyCheck(h)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(h,m,l)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,m)).next(()=>u.localDocuments.getDocuments(h,m))})}(r.localStore,e);PE(r,e,n),NE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await lc(r,i)}catch(i){await nc(i)}}function NE(t,e){(t.ka.get(e)||[]).forEach(n=>{n.resolve()}),t.ka.delete(e)}function PE(t,e,n){const r=he(t);let i=r.Ba[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Ba[r.currentUser.toKey()]=i}}function Sp(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Ma.get(e))t.Fa.delete(r),n&&t.Ca.$a(r,n);t.Ma.delete(e),t.isPrimaryClient&&t.La.gr(e).forEach(r=>{t.La.containsKey(r)||RE(t,r)})}function RE(t,e){t.xa.delete(e.path.canonicalString());const n=t.Oa.get(e);n!==null&&(Ym(t.remoteStore,n),t.Oa=t.Oa.remove(e),t.Na.delete(n),og(t))}function r0(t,e,n){for(const r of n)r instanceof SE?(t.La.addReference(r.key,e),P2(t,r)):r instanceof IE?(re("SyncEngine","Document no longer in limbo: "+r.key),t.La.removeReference(r.key,e),t.La.containsKey(r.key)||RE(t,r.key)):ce()}function P2(t,e){const n=e.key,r=n.path.canonicalString();t.Oa.get(n)||t.xa.has(r)||(re("SyncEngine","New document in limbo: "+n),t.xa.add(r),og(t))}function og(t){for(;t.xa.size>0&&t.Oa.size{o.push(r.Ka(u,e,n).then(h=>{var m;if((h||n)&&r.isPrimaryClient){const v=h?!h.fromCache:(m=n==null?void 0:n.targetChanges.get(u.targetId))===null||m===void 0?void 0:m.current;r.sharedClientState.updateQueryState(u.targetId,v?"current":"not-current")}if(h){i.push(h);const v=Qm.Wi(u.targetId,h);s.push(v)}}))}),await Promise.all(o),r.Ca.d_(i),await async function(u,h){const m=he(u);try{await m.persistence.runTransaction("notifyLocalViewChanges","readwrite",v=>$.forEach(h,g=>$.forEach(g.$i,N=>m.persistence.referenceDelegate.addReference(v,g.targetId,N)).next(()=>$.forEach(g.Ui,N=>m.persistence.referenceDelegate.removeReference(v,g.targetId,N)))))}catch(v){if(!rc(v))throw v;re("LocalStore","Failed to update sequence numbers: "+v)}for(const v of h){const g=v.targetId;if(!v.fromCache){const N=m.os.get(g),D=N.snapshotVersion,L=N.withLastLimboFreeSnapshotVersion(D);m.os=m.os.insert(g,L)}}}(r.localStore,s))}async function R2(t,e){const n=he(t);if(!n.currentUser.isEqual(e)){re("SyncEngine","User change. New user:",e.toKey());const r=await gE(n.localStore,e);n.currentUser=e,function(s,o){s.ka.forEach(l=>{l.forEach(u=>{u.reject(new Z(U.CANCELLED,o))})}),s.ka.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await lc(n,r.hs)}}function D2(t,e){const n=he(t),r=n.Na.get(e);if(r&&r.va)return me().add(r.key);{let i=me();const s=n.Ma.get(e);if(!s)return i;for(const o of s){const l=n.Fa.get(o);i=i.unionWith(l.view.Va)}return i}}function DE(t){const e=he(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=AE.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=D2.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=C2.bind(null,e),e.Ca.d_=g2.bind(null,e.eventManager),e.Ca.$a=y2.bind(null,e.eventManager),e}function j2(t){const e=he(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=A2.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=N2.bind(null,e),e}class md{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Gd(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,n){return null}Ha(e,n){return null}za(e){return UN(this.persistence,new VN,e.initialUser,this.serializer)}Ga(e){return new ON(Gm.Zr,this.serializer)}Wa(e){return new KN}async terminate(){var e,n;(e=this.gcScheduler)===null||e===void 0||e.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}md.provider={build:()=>new md};class Ip{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>n0(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=R2.bind(null,this.syncEngine),await f2(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new m2}()}createDatastore(e){const n=Gd(e.databaseInfo.databaseId),r=function(s){return new JN(s)}(e.databaseInfo);return function(s,o,l,u){return new e2(s,o,l,u)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,l){return new n2(r,i,s,o,l)}(this.localStore,this.datastore,e.asyncQueue,n=>n0(this.syncEngine,n,0),function(){return Jv.D()?new Jv:new GN}())}createSyncEngine(e,n){return function(i,s,o,l,u,h,m){const v=new x2(i,s,o,l,u,h);return m&&(v.Qa=!0),v}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=he(i);re("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await ac(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(n=this.eventManager)===null||n===void 0||n.terminate()}}Ip.provider={build:()=>new Ip};/**
+ */class NE{constructor(e){this.key=e}}class PE{constructor(e){this.key=e}}class E2{constructor(e,n){this.query=e,this.Ta=n,this.Ea=null,this.hasCachedResults=!1,this.current=!1,this.da=me(),this.mutatedKeys=me(),this.Aa=Zx(e),this.Ra=new Fo(this.Aa)}get Va(){return this.Ta}ma(e,n){const r=n?n.fa:new r0,i=n?n.Ra:this.Ra;let s=n?n.mutatedKeys:this.mutatedKeys,o=i,l=!1;const u=this.query.limitType==="F"&&i.size===this.query.limit?i.last():null,h=this.query.limitType==="L"&&i.size===this.query.limit?i.first():null;if(e.inorderTraversal((m,v)=>{const g=i.get(m),N=Wd(this.query,v)?v:null,j=!!g&&this.mutatedKeys.has(g.key),L=!!N&&(N.hasLocalMutations||this.mutatedKeys.has(N.key)&&N.hasCommittedMutations);let B=!1;g&&N?g.data.isEqual(N.data)?j!==L&&(r.track({type:3,doc:N}),B=!0):this.ga(g,N)||(r.track({type:2,doc:N}),B=!0,(u&&this.Aa(N,u)>0||h&&this.Aa(N,h)<0)&&(l=!0)):!g&&N?(r.track({type:0,doc:N}),B=!0):g&&!N&&(r.track({type:1,doc:g}),B=!0,(u||h)&&(l=!0)),B&&(N?(o=o.add(N),s=L?s.add(m):s.delete(m)):(o=o.delete(m),s=s.delete(m)))}),this.query.limit!==null)for(;o.size>this.query.limit;){const m=this.query.limitType==="F"?o.last():o.first();o=o.delete(m.key),s=s.delete(m.key),r.track({type:1,doc:m})}return{Ra:o,fa:r,ns:l,mutatedKeys:s}}ga(e,n){return e.hasLocalMutations&&n.hasCommittedMutations&&!n.hasLocalMutations}applyChanges(e,n,r,i){const s=this.Ra;this.Ra=e.Ra,this.mutatedKeys=e.mutatedKeys;const o=e.fa.G_();o.sort((m,v)=>function(N,j){const L=B=>{switch(B){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return ce()}};return L(N)-L(j)}(m.type,v.type)||this.Aa(m.doc,v.doc)),this.pa(r),i=i!=null&&i;const l=n&&!i?this.ya():[],u=this.da.size===0&&this.current&&!i?1:0,h=u!==this.Ea;return this.Ea=u,o.length!==0||h?{snapshot:new Xo(this.query,e.Ra,s,o,e.mutatedKeys,u===0,h,!1,!!r&&r.resumeToken.approximateByteSize()>0),wa:l}:{wa:l}}Z_(e){return this.current&&e==="Offline"?(this.current=!1,this.applyChanges({Ra:this.Ra,fa:new r0,mutatedKeys:this.mutatedKeys,ns:!1},!1)):{wa:[]}}Sa(e){return!this.Ta.has(e)&&!!this.Ra.has(e)&&!this.Ra.get(e).hasLocalMutations}pa(e){e&&(e.addedDocuments.forEach(n=>this.Ta=this.Ta.add(n)),e.modifiedDocuments.forEach(n=>{}),e.removedDocuments.forEach(n=>this.Ta=this.Ta.delete(n)),this.current=e.current)}ya(){if(!this.current)return[];const e=this.da;this.da=me(),this.Ra.forEach(r=>{this.Sa(r.key)&&(this.da=this.da.add(r.key))});const n=[];return e.forEach(r=>{this.da.has(r)||n.push(new PE(r))}),this.da.forEach(r=>{e.has(r)||n.push(new NE(r))}),n}ba(e){this.Ta=e.Ts,this.da=me();const n=this.ma(e.documents);return this.applyChanges(n,!0)}Da(){return Xo.fromInitialDocuments(this.query,this.Ra,this.mutatedKeys,this.Ea===0,this.hasCachedResults)}}class k2{constructor(e,n,r){this.query=e,this.targetId=n,this.view=r}}class T2{constructor(e){this.key=e,this.va=!1}}class b2{constructor(e,n,r,i,s,o){this.localStore=e,this.remoteStore=n,this.eventManager=r,this.sharedClientState=i,this.currentUser=s,this.maxConcurrentLimboResolutions=o,this.Ca={},this.Fa=new aa(l=>Xx(l),qd),this.Ma=new Map,this.xa=new Set,this.Oa=new We(ie.comparator),this.Na=new Map,this.La=new Gm,this.Ba={},this.ka=new Map,this.qa=Jo.kn(),this.onlineState="Unknown",this.Qa=void 0}get isPrimaryClient(){return this.Qa===!0}}async function S2(t,e,n=!0){const r=ME(t);let i;const s=r.Fa.get(e);return s?(r.sharedClientState.addLocalQueryTarget(s.targetId),i=s.view.Da()):i=await RE(r,e,n,!0),i}async function I2(t,e){const n=ME(t);await RE(n,e,!0,!1)}async function RE(t,e,n,r){const i=await QN(t.localStore,lr(e)),s=i.targetId,o=t.sharedClientState.addLocalQueryTarget(s,n);let l;return r&&(l=await C2(t,e,s,o==="current",i.resumeToken)),t.isPrimaryClient&&n&&TE(t.remoteStore,i),l}async function C2(t,e,n,r,i){t.Ka=(v,g,N)=>async function(L,B,I,k){let C=B.view.ma(I);C.ns&&(C=await Zv(L.localStore,B.query,!1).then(({documents:T})=>B.view.ma(T,C)));const V=k&&k.targetChanges.get(B.targetId),G=k&&k.targetMismatches.get(B.targetId)!=null,H=B.view.applyChanges(C,L.isPrimaryClient,V,G);return a0(L,B.targetId,H.wa),H.snapshot}(t,v,g,N);const s=await Zv(t.localStore,e,!0),o=new E2(e,s.Ts),l=o.ma(s.documents),u=ac.createSynthesizedTargetChangeForCurrentChange(n,r&&t.onlineState!=="Offline",i),h=o.applyChanges(l,t.isPrimaryClient,u);a0(t,n,h.wa);const m=new k2(e,n,o);return t.Fa.set(e,m),t.Ma.has(n)?t.Ma.get(n).push(e):t.Ma.set(n,[e]),h.snapshot}async function A2(t,e,n){const r=he(t),i=r.Fa.get(e),s=r.Ma.get(i.targetId);if(s.length>1)return r.Ma.set(i.targetId,s.filter(o=>!qd(o,e))),void r.Fa.delete(e);r.isPrimaryClient?(r.sharedClientState.removeLocalQueryTarget(i.targetId),r.sharedClientState.isActiveQueryTarget(i.targetId)||await bp(r.localStore,i.targetId,!1).then(()=>{r.sharedClientState.clearQueryState(i.targetId),n&&Jm(r.remoteStore,i.targetId),Ip(r,i.targetId)}).catch(rc)):(Ip(r,i.targetId),await bp(r.localStore,i.targetId,!0))}async function N2(t,e){const n=he(t),r=n.Fa.get(e),i=n.Ma.get(r.targetId);n.isPrimaryClient&&i.length===1&&(n.sharedClientState.removeLocalQueryTarget(r.targetId),Jm(n.remoteStore,r.targetId))}async function P2(t,e,n){const r=V2(t);try{const i=await function(o,l){const u=he(o),h=ht.now(),m=l.reduce((N,j)=>N.add(j.key),me());let v,g;return u.persistence.runTransaction("Locally write mutations","readwrite",N=>{let j=Gr(),L=me();return u.cs.getEntries(N,m).next(B=>{j=B,j.forEach((I,k)=>{k.isValidDocument()||(L=L.add(I))})}).next(()=>u.localDocuments.getOverlayedDocuments(N,j)).next(B=>{v=B;const I=[];for(const k of l){const C=ZA(k,v.get(k.key).overlayedDocument);C!=null&&I.push(new zi(k.key,C,qx(C.value.mapValue),qt.exists(!0)))}return u.mutationQueue.addMutationBatch(N,h,I,l)}).next(B=>{g=B;const I=B.applyToLocalDocumentSet(v,L);return u.documentOverlayCache.saveOverlays(N,B.batchId,I)})}).then(()=>({batchId:g.batchId,changes:tE(v)}))}(r.localStore,e);r.sharedClientState.addPendingMutation(i.batchId),function(o,l,u){let h=o.Ba[o.currentUser.toKey()];h||(h=new We(xe)),h=h.insert(l,u),o.Ba[o.currentUser.toKey()]=h}(r,i.batchId,n),await cc(r,i.changes),await Xd(r.remoteStore)}catch(i){const s=ng(i,"Failed to persist write");n.reject(s)}}async function DE(t,e){const n=he(t);try{const r=await HN(n.localStore,e);e.targetChanges.forEach((i,s)=>{const o=n.Na.get(s);o&&(Se(i.addedDocuments.size+i.modifiedDocuments.size+i.removedDocuments.size<=1),i.addedDocuments.size>0?o.va=!0:i.modifiedDocuments.size>0?Se(o.va):i.removedDocuments.size>0&&(Se(o.va),o.va=!1))}),await cc(n,r,e)}catch(r){await rc(r)}}function o0(t,e,n){const r=he(t);if(r.isPrimaryClient&&n===0||!r.isPrimaryClient&&n===1){const i=[];r.Fa.forEach((s,o)=>{const l=o.view.Z_(e);l.snapshot&&i.push(l.snapshot)}),function(o,l){const u=he(o);u.onlineState=l;let h=!1;u.queries.forEach((m,v)=>{for(const g of v.j_)g.Z_(l)&&(h=!0)}),h&&sg(u)}(r.eventManager,e),i.length&&r.Ca.d_(i),r.onlineState=e,r.isPrimaryClient&&r.sharedClientState.setOnlineState(e)}}async function R2(t,e,n){const r=he(t);r.sharedClientState.updateQueryState(e,"rejected",n);const i=r.Na.get(e),s=i&&i.key;if(s){let o=new We(ie.comparator);o=o.insert(s,Mt.newNoDocument(s,de.min()));const l=me().add(s),u=new Qd(de.min(),new Map,new We(xe),o,l);await DE(r,u),r.Oa=r.Oa.remove(s),r.Na.delete(e),ag(r)}else await bp(r.localStore,e,!1).then(()=>Ip(r,e,n)).catch(rc)}async function D2(t,e){const n=he(t),r=e.batch.batchId;try{const i=await WN(n.localStore,e);OE(n,r,null),jE(n,r),n.sharedClientState.updateMutationState(r,"acknowledged"),await cc(n,i)}catch(i){await rc(i)}}async function j2(t,e,n){const r=he(t);try{const i=await function(o,l){const u=he(o);return u.persistence.runTransaction("Reject batch","readwrite-primary",h=>{let m;return u.mutationQueue.lookupMutationBatch(h,l).next(v=>(Se(v!==null),m=v.keys(),u.mutationQueue.removeMutationBatch(h,v))).next(()=>u.mutationQueue.performConsistencyCheck(h)).next(()=>u.documentOverlayCache.removeOverlaysForBatchId(h,m,l)).next(()=>u.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(h,m)).next(()=>u.localDocuments.getDocuments(h,m))})}(r.localStore,e);OE(r,e,n),jE(r,e),r.sharedClientState.updateMutationState(e,"rejected",n),await cc(r,i)}catch(i){await rc(i)}}function jE(t,e){(t.ka.get(e)||[]).forEach(n=>{n.resolve()}),t.ka.delete(e)}function OE(t,e,n){const r=he(t);let i=r.Ba[r.currentUser.toKey()];if(i){const s=i.get(e);s&&(n?s.reject(n):s.resolve(),i=i.remove(e)),r.Ba[r.currentUser.toKey()]=i}}function Ip(t,e,n=null){t.sharedClientState.removeLocalQueryTarget(e);for(const r of t.Ma.get(e))t.Fa.delete(r),n&&t.Ca.$a(r,n);t.Ma.delete(e),t.isPrimaryClient&&t.La.gr(e).forEach(r=>{t.La.containsKey(r)||LE(t,r)})}function LE(t,e){t.xa.delete(e.path.canonicalString());const n=t.Oa.get(e);n!==null&&(Jm(t.remoteStore,n),t.Oa=t.Oa.remove(e),t.Na.delete(n),ag(t))}function a0(t,e,n){for(const r of n)r instanceof NE?(t.La.addReference(r.key,e),O2(t,r)):r instanceof PE?(re("SyncEngine","Document no longer in limbo: "+r.key),t.La.removeReference(r.key,e),t.La.containsKey(r.key)||LE(t,r.key)):ce()}function O2(t,e){const n=e.key,r=n.path.canonicalString();t.Oa.get(n)||t.xa.has(r)||(re("SyncEngine","New document in limbo: "+n),t.xa.add(r),ag(t))}function ag(t){for(;t.xa.size>0&&t.Oa.size{o.push(r.Ka(u,e,n).then(h=>{var m;if((h||n)&&r.isPrimaryClient){const v=h?!h.fromCache:(m=n==null?void 0:n.targetChanges.get(u.targetId))===null||m===void 0?void 0:m.current;r.sharedClientState.updateQueryState(u.targetId,v?"current":"not-current")}if(h){i.push(h);const v=Ym.Wi(u.targetId,h);s.push(v)}}))}),await Promise.all(o),r.Ca.d_(i),await async function(u,h){const m=he(u);try{await m.persistence.runTransaction("notifyLocalViewChanges","readwrite",v=>$.forEach(h,g=>$.forEach(g.$i,N=>m.persistence.referenceDelegate.addReference(v,g.targetId,N)).next(()=>$.forEach(g.Ui,N=>m.persistence.referenceDelegate.removeReference(v,g.targetId,N)))))}catch(v){if(!ic(v))throw v;re("LocalStore","Failed to update sequence numbers: "+v)}for(const v of h){const g=v.targetId;if(!v.fromCache){const N=m.os.get(g),j=N.snapshotVersion,L=N.withLastLimboFreeSnapshotVersion(j);m.os=m.os.insert(g,L)}}}(r.localStore,s))}async function L2(t,e){const n=he(t);if(!n.currentUser.isEqual(e)){re("SyncEngine","User change. New user:",e.toKey());const r=await _E(n.localStore,e);n.currentUser=e,function(s,o){s.ka.forEach(l=>{l.forEach(u=>{u.reject(new Z(U.CANCELLED,o))})}),s.ka.clear()}(n,"'waitForPendingWrites' promise is rejected due to a user change."),n.sharedClientState.handleUserChange(e,r.removedBatchIds,r.addedBatchIds),await cc(n,r.hs)}}function M2(t,e){const n=he(t),r=n.Na.get(e);if(r&&r.va)return me().add(r.key);{let i=me();const s=n.Ma.get(e);if(!s)return i;for(const o of s){const l=n.Fa.get(o);i=i.unionWith(l.view.Va)}return i}}function ME(t){const e=he(t);return e.remoteStore.remoteSyncer.applyRemoteEvent=DE.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=M2.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=R2.bind(null,e),e.Ca.d_=_2.bind(null,e.eventManager),e.Ca.$a=x2.bind(null,e.eventManager),e}function V2(t){const e=he(t);return e.remoteStore.remoteSyncer.applySuccessfulWrite=D2.bind(null,e),e.remoteStore.remoteSyncer.rejectFailedWrite=j2.bind(null,e),e}class yd{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=Yd(e.databaseInfo.databaseId),this.sharedClientState=this.Wa(e),this.persistence=this.Ga(e),await this.persistence.start(),this.localStore=this.za(e),this.gcScheduler=this.ja(e,this.localStore),this.indexBackfillerScheduler=this.Ha(e,this.localStore)}ja(e,n){return null}Ha(e,n){return null}za(e){return qN(this.persistence,new BN,e.initialUser,this.serializer)}Ga(e){return new FN(Qm.Zr,this.serializer)}Wa(e){return new JN}async terminate(){var e,n;(e=this.gcScheduler)===null||e===void 0||e.stop(),(n=this.indexBackfillerScheduler)===null||n===void 0||n.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}yd.provider={build:()=>new yd};class Cp{async initialize(e,n){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(n),this.remoteStore=this.createRemoteStore(n),this.eventManager=this.createEventManager(n),this.syncEngine=this.createSyncEngine(n,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=r=>o0(this.syncEngine,r,1),this.remoteStore.remoteSyncer.handleCredentialChange=L2.bind(null,this.syncEngine),await y2(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return function(){return new w2}()}createDatastore(e){const n=Yd(e.databaseInfo.databaseId),r=function(s){return new t2(s)}(e.databaseInfo);return function(s,o,l,u){return new i2(s,o,l,u)}(e.authCredentials,e.appCheckCredentials,r,n)}createRemoteStore(e){return function(r,i,s,o,l){return new o2(r,i,s,o,l)}(this.localStore,this.datastore,e.asyncQueue,n=>o0(this.syncEngine,n,0),function(){return t0.D()?new t0:new XN}())}createSyncEngine(e,n){return function(i,s,o,l,u,h,m){const v=new b2(i,s,o,l,u,h);return m&&(v.Qa=!0),v}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,n)}async terminate(){var e,n;await async function(i){const s=he(i);re("RemoteStore","RemoteStore shutting down."),s.L_.add(5),await lc(s),s.k_.shutdown(),s.q_.set("Unknown")}(this.remoteStore),(e=this.datastore)===null||e===void 0||e.terminate(),(n=this.eventManager)===null||n===void 0||n.terminate()}}Cp.provider={build:()=>new Cp};/**
* @license
* Copyright 2020 Google LLC
*
@@ -3016,7 +3016,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ag{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):Ur("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/**
+ */class lg{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Ya(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Ya(this.observer.error,e):Kr("Uncaught Error in snapshot listener:",e.toString()))}Za(){this.muted=!0}Ya(e,n){setTimeout(()=>{this.muted||e(n)},0)}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -3031,7 +3031,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class O2{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=Ot.UNAUTHENTICATED,this.clientId=Mx.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{re("FirestoreClient","Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(re("FirestoreClient","Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Dr;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=tg(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function rf(t,e){t.asyncQueue.verifyOperationInProgress(),re("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await gE(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function i0(t,e){t.asyncQueue.verifyOperationInProgress();const n=await L2(t);re("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>Xv(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>Xv(e.remoteStore,i)),t._onlineComponents=e}async function L2(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){re("FirestoreClient","Using user provided OfflineComponentProvider");try{await rf(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===U.FAILED_PRECONDITION||i.code===U.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;qo("Error using user provided cache. Falling back to memory cache: "+n),await rf(t,new md)}}else re("FirestoreClient","Using default OfflineComponentProvider"),await rf(t,new md);return t._offlineComponents}async function jE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(re("FirestoreClient","Using user provided OnlineComponentProvider"),await i0(t,t._uninitializedComponentsProvider._online)):(re("FirestoreClient","Using default OnlineComponentProvider"),await i0(t,new Ip))),t._onlineComponents}function M2(t){return jE(t).then(e=>e.syncEngine)}async function gd(t){const e=await jE(t),n=e.eventManager;return n.onListen=E2.bind(null,e.syncEngine),n.onUnlisten=b2.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=k2.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=S2.bind(null,e.syncEngine),n}function V2(t,e,n={}){const r=new Dr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,l,u,h){const m=new ag({next:g=>{m.Za(),o.enqueueAndForget(()=>rg(s,v));const N=g.docs.has(l);!N&&g.fromCache?h.reject(new Z(U.UNAVAILABLE,"Failed to get document because the client is offline.")):N&&g.fromCache&&u&&u.source==="server"?h.reject(new Z(U.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):h.resolve(g)},error:g=>h.reject(g)}),v=new sg(zd(l.path),m,{includeMetadataChanges:!0,_a:!0});return ng(s,v)}(await gd(t),t.asyncQueue,e,n,r)),r.promise}function F2(t,e,n={}){const r=new Dr;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,l,u,h){const m=new ag({next:g=>{m.Za(),o.enqueueAndForget(()=>rg(s,v)),g.fromCache&&u.source==="server"?h.reject(new Z(U.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):h.resolve(g)},error:g=>h.reject(g)}),v=new sg(l,m,{includeMetadataChanges:!0,_a:!0});return ng(s,v)}(await gd(t),t.asyncQueue,e,n,r)),r.promise}/**
+ */class F2{constructor(e,n,r,i,s){this.authCredentials=e,this.appCheckCredentials=n,this.asyncQueue=r,this.databaseInfo=i,this.user=Ot.UNAUTHENTICATED,this.clientId=zx.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=s,this.authCredentials.start(r,async o=>{re("FirestoreClient","Received user=",o.uid),await this.authCredentialListener(o),this.user=o}),this.appCheckCredentials.start(r,o=>(re("FirestoreClient","Received new app check token=",o),this.appCheckCredentialListener(o,this.user)))}get configuration(){return{asyncQueue:this.asyncQueue,databaseInfo:this.databaseInfo,clientId:this.clientId,authCredentials:this.authCredentials,appCheckCredentials:this.appCheckCredentials,initialUser:this.user,maxConcurrentLimboResolutions:100}}setCredentialChangeListener(e){this.authCredentialListener=e}setAppCheckTokenChangeListener(e){this.appCheckCredentialListener=e}terminate(){this.asyncQueue.enterRestrictedMode();const e=new Ur;return this.asyncQueue.enqueueAndForgetEvenWhileRestricted(async()=>{try{this._onlineComponents&&await this._onlineComponents.terminate(),this._offlineComponents&&await this._offlineComponents.terminate(),this.authCredentials.shutdown(),this.appCheckCredentials.shutdown(),e.resolve()}catch(n){const r=ng(n,"Failed to shutdown persistence");e.reject(r)}}),e.promise}}async function sf(t,e){t.asyncQueue.verifyOperationInProgress(),re("FirestoreClient","Initializing OfflineComponentProvider");const n=t.configuration;await e.initialize(n);let r=n.initialUser;t.setCredentialChangeListener(async i=>{r.isEqual(i)||(await _E(e.localStore,i),r=i)}),e.persistence.setDatabaseDeletedListener(()=>t.terminate()),t._offlineComponents=e}async function l0(t,e){t.asyncQueue.verifyOperationInProgress();const n=await U2(t);re("FirestoreClient","Initializing OnlineComponentProvider"),await e.initialize(n,t.configuration),t.setCredentialChangeListener(r=>n0(e.remoteStore,r)),t.setAppCheckTokenChangeListener((r,i)=>n0(e.remoteStore,i)),t._onlineComponents=e}async function U2(t){if(!t._offlineComponents)if(t._uninitializedComponentsProvider){re("FirestoreClient","Using user provided OfflineComponentProvider");try{await sf(t,t._uninitializedComponentsProvider._offline)}catch(e){const n=e;if(!function(i){return i.name==="FirebaseError"?i.code===U.FAILED_PRECONDITION||i.code===U.UNIMPLEMENTED:!(typeof DOMException<"u"&&i instanceof DOMException)||i.code===22||i.code===20||i.code===11}(n))throw n;Ko("Error using user provided cache. Falling back to memory cache: "+n),await sf(t,new yd)}}else re("FirestoreClient","Using default OfflineComponentProvider"),await sf(t,new yd);return t._offlineComponents}async function VE(t){return t._onlineComponents||(t._uninitializedComponentsProvider?(re("FirestoreClient","Using user provided OnlineComponentProvider"),await l0(t,t._uninitializedComponentsProvider._online)):(re("FirestoreClient","Using default OnlineComponentProvider"),await l0(t,new Cp))),t._onlineComponents}function z2(t){return VE(t).then(e=>e.syncEngine)}async function vd(t){const e=await VE(t),n=e.eventManager;return n.onListen=S2.bind(null,e.syncEngine),n.onUnlisten=A2.bind(null,e.syncEngine),n.onFirstRemoteStoreListen=I2.bind(null,e.syncEngine),n.onLastRemoteStoreUnlisten=N2.bind(null,e.syncEngine),n}function B2(t,e,n={}){const r=new Ur;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,l,u,h){const m=new lg({next:g=>{m.Za(),o.enqueueAndForget(()=>ig(s,v));const N=g.docs.has(l);!N&&g.fromCache?h.reject(new Z(U.UNAVAILABLE,"Failed to get document because the client is offline.")):N&&g.fromCache&&u&&u.source==="server"?h.reject(new Z(U.UNAVAILABLE,'Failed to get document from server. (However, this document does exist in the local cache. Run again without setting source to "server" to retrieve the cached document.)')):h.resolve(g)},error:g=>h.reject(g)}),v=new og($d(l.path),m,{includeMetadataChanges:!0,_a:!0});return rg(s,v)}(await vd(t),t.asyncQueue,e,n,r)),r.promise}function $2(t,e,n={}){const r=new Ur;return t.asyncQueue.enqueueAndForget(async()=>function(s,o,l,u,h){const m=new lg({next:g=>{m.Za(),o.enqueueAndForget(()=>ig(s,v)),g.fromCache&&u.source==="server"?h.reject(new Z(U.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):h.resolve(g)},error:g=>h.reject(g)}),v=new og(l,m,{includeMetadataChanges:!0,_a:!0});return rg(s,v)}(await vd(t),t.asyncQueue,e,n,r)),r.promise}/**
* @license
* Copyright 2023 Google LLC
*
@@ -3046,7 +3046,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function OE(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
+ */function FE(t){const e={};return t.timeoutSeconds!==void 0&&(e.timeoutSeconds=t.timeoutSeconds),e}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3061,7 +3061,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const s0=new Map;/**
+ */const c0=new Map;/**
* @license
* Copyright 2017 Google LLC
*
@@ -3076,7 +3076,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function LE(t,e,n){if(!n)throw new Z(U.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function U2(t,e,n,r){if(e===!0&&r===!0)throw new Z(U.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function o0(t){if(!ie.isDocumentKey(t))throw new Z(U.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function a0(t){if(ie.isDocumentKey(t))throw new Z(U.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Jd(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":ce()}function qt(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Z(U.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Jd(t);throw new Z(U.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/**
+ */function UE(t,e,n){if(!n)throw new Z(U.INVALID_ARGUMENT,`Function ${t}() cannot be called with an empty ${e}.`)}function q2(t,e,n,r){if(e===!0&&r===!0)throw new Z(U.INVALID_ARGUMENT,`${t} and ${n} cannot be used together.`)}function u0(t){if(!ie.isDocumentKey(t))throw new Z(U.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${t} has ${t.length}.`)}function d0(t){if(ie.isDocumentKey(t))throw new Z(U.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${t} has ${t.length}.`)}function Zd(t){if(t===void 0)return"undefined";if(t===null)return"null";if(typeof t=="string")return t.length>20&&(t=`${t.substring(0,20)}...`),JSON.stringify(t);if(typeof t=="number"||typeof t=="boolean")return""+t;if(typeof t=="object"){if(t instanceof Array)return"an array";{const e=function(r){return r.constructor?r.constructor.name:null}(t);return e?`a custom ${e} object`:"an object"}}return typeof t=="function"?"a function":ce()}function Wt(t,e){if("_delegate"in t&&(t=t._delegate),!(t instanceof e)){if(e.name===t.constructor.name)throw new Z(U.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{const n=Zd(t);throw new Z(U.INVALID_ARGUMENT,`Expected type '${e.name}', but it was: ${n}`)}}return t}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3091,7 +3091,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class l0{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new Z(U.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new Z(U.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}U2("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=OE((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class Xd{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new l0({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Z(U.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 Z(U.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 l0(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new iA;switch(r.type){case"firstParty":return new lA(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new Z(U.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=s0.get(n);r&&(re("ComponentProvider","Removing Datastore"),s0.delete(n),r.terminate())}(this),Promise.resolve()}}function z2(t,e,n,r={}){var i;const s=(t=qt(t,Xd))._getSettings(),o=`${e}:${n}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&qo("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),r.mockUserToken){let l,u;if(typeof r.mockUserToken=="string")l=r.mockUserToken,u=Ot.MOCK_USER;else{l=_b(r.mockUserToken,(i=t._app)===null||i===void 0?void 0:i.options.projectId);const h=r.mockUserToken.sub||r.mockUserToken.user_id;if(!h)throw new Z(U.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");u=new Ot(h)}t._authCredentials=new sA(new Lx(l,u))}}/**
+ */class h0{constructor(e){var n,r;if(e.host===void 0){if(e.ssl!==void 0)throw new Z(U.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host="firestore.googleapis.com",this.ssl=!0}else this.host=e.host,this.ssl=(n=e.ssl)===null||n===void 0||n;if(this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,e.cacheSizeBytes===void 0)this.cacheSizeBytes=41943040;else{if(e.cacheSizeBytes!==-1&&e.cacheSizeBytes<1048576)throw new Z(U.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}q2("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=FE((r=e.experimentalLongPollingOptions)!==null&&r!==void 0?r:{}),function(s){if(s.timeoutSeconds!==void 0){if(isNaN(s.timeoutSeconds))throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (must not be NaN)`);if(s.timeoutSeconds<5)throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (minimum allowed value is 5)`);if(s.timeoutSeconds>30)throw new Z(U.INVALID_ARGUMENT,`invalid long polling timeout: ${s.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){return this.host===e.host&&this.ssl===e.ssl&&this.credentials===e.credentials&&this.cacheSizeBytes===e.cacheSizeBytes&&this.experimentalForceLongPolling===e.experimentalForceLongPolling&&this.experimentalAutoDetectLongPolling===e.experimentalAutoDetectLongPolling&&function(r,i){return r.timeoutSeconds===i.timeoutSeconds}(this.experimentalLongPollingOptions,e.experimentalLongPollingOptions)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class eh{constructor(e,n,r,i){this._authCredentials=e,this._appCheckCredentials=n,this._databaseId=r,this._app=i,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new h0({}),this._settingsFrozen=!1,this._terminateTask="notTerminated"}get app(){if(!this._app)throw new Z(U.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 Z(U.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 h0(e),e.credentials!==void 0&&(this._authCredentials=function(r){if(!r)return new lA;switch(r.type){case"firstParty":return new hA(r.sessionIndex||"0",r.iamToken||null,r.authTokenFactory||null);case"provider":return r.client;default:throw new Z(U.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invalid credential type")}}(e.credentials))}_getSettings(){return this._settings}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return this._terminateTask==="notTerminated"&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){this._terminateTask==="notTerminated"?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(n){const r=c0.get(n);r&&(re("ComponentProvider","Removing Datastore"),c0.delete(n),r.terminate())}(this),Promise.resolve()}}function W2(t,e,n,r={}){var i;const s=(t=Wt(t,eh))._getSettings(),o=`${e}:${n}`;if(s.host!=="firestore.googleapis.com"&&s.host!==o&&Ko("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used."),t._setSettings(Object.assign(Object.assign({},s),{host:o,ssl:!1})),r.mockUserToken){let l,u;if(typeof r.mockUserToken=="string")l=r.mockUserToken,u=Ot.MOCK_USER;else{l=Tb(r.mockUserToken,(i=t._app)===null||i===void 0?void 0:i.options.projectId);const h=r.mockUserToken.sub||r.mockUserToken.user_id;if(!h)throw new Z(U.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");u=new Ot(h)}t._authCredentials=new cA(new Ux(l,u))}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3106,7 +3106,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class js{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new js(this.firestore,e,this._query)}}class Vt{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Ai(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Vt(this.firestore,e,this._key)}}class Ai extends js{constructor(e,n,r){super(e,n,zd(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Vt(this.firestore,null,new ie(e))}withConverter(e){return new Ai(this.firestore,e,this._path)}}function tt(t,e,...n){if(t=We(t),LE("collection","path",e),t instanceof Xd){const r=Le.fromString(e,...n);return a0(r),new Ai(t,null,r)}{if(!(t instanceof Vt||t instanceof Ai))throw new Z(U.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Le.fromString(e,...n));return a0(r),new Ai(t.firestore,null,r)}}function De(t,e,...n){if(t=We(t),arguments.length===1&&(e=Mx.newId()),LE("doc","path",e),t instanceof Xd){const r=Le.fromString(e,...n);return o0(r),new Vt(t,null,new ie(r))}{if(!(t instanceof Vt||t instanceof Ai))throw new Z(U.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(Le.fromString(e,...n));return o0(r),new Vt(t.firestore,t instanceof Ai?t.converter:null,new ie(r))}}/**
+ */class Os{constructor(e,n,r){this.converter=n,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new Os(this.firestore,e,this._query)}}class Vt{constructor(e,n,r){this.converter=n,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new Pi(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new Vt(this.firestore,e,this._key)}}class Pi extends Os{constructor(e,n,r){super(e,n,$d(r)),this._path=r,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){const e=this._path.popLast();return e.isEmpty()?null:new Vt(this.firestore,null,new ie(e))}withConverter(e){return new Pi(this.firestore,e,this._path)}}function nt(t,e,...n){if(t=qe(t),UE("collection","path",e),t instanceof eh){const r=De.fromString(e,...n);return d0(r),new Pi(t,null,r)}{if(!(t instanceof Vt||t instanceof Pi))throw new Z(U.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(De.fromString(e,...n));return d0(r),new Pi(t.firestore,null,r)}}function Ne(t,e,...n){if(t=qe(t),arguments.length===1&&(e=zx.newId()),UE("doc","path",e),t instanceof eh){const r=De.fromString(e,...n);return u0(r),new Vt(t,null,new ie(r))}{if(!(t instanceof Vt||t instanceof Pi))throw new Z(U.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");const r=t._path.child(De.fromString(e,...n));return u0(r),new Vt(t.firestore,t instanceof Pi?t.converter:null,new ie(r))}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3121,8 +3121,8 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class c0{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new vE(this,"async_queue_retry"),this.Vu=()=>{const r=nf();r&&re("AsyncQueue","Visibility state changed to "+r.visibilityState),this.t_.jo()},this.mu=e;const n=nf();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;const n=nf();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const n=new Dr;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(this.Pu.length!==0){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!rc(e))throw e;re("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){const n=this.mu.then(()=>(this.du=!0,e().catch(r=>{this.Eu=r,this.du=!1;const i=function(o){let l=o.message||"";return o.stack&&(l=o.stack.includes(o.message)?o.stack:o.message+`
-`+o.stack),l}(r);throw Ur("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.du=!1,r))));return this.mu=n,n}enqueueAfterDelay(e,n,r){this.fu(),this.Ru.indexOf(e)>-1&&(n=0);const i=eg.createAndSchedule(this,e,n,r,s=>this.yu(s));return this.Tu.push(i),i}fu(){this.Eu&&ce()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(const n of this.Tu)if(n.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{this.Tu.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.Tu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){const n=this.Tu.indexOf(e);this.Tu.splice(n,1)}}function u0(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class cr extends Xd{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new c0,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new c0(e),this._firestoreClient=void 0,await e}}}function B2(t,e){const n=typeof t=="object"?t:Sm(),r=typeof t=="string"?t:"(default)",i=ea(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=vb("firestore");s&&z2(i,...s)}return i}function cc(t){if(t._terminated)throw new Z(U.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||$2(t),t._firestoreClient}function $2(t){var e,n,r;const i=t._freezeSettings(),s=function(l,u,h,m){return new xA(l,u,h,m.host,m.ssl,m.experimentalForceLongPolling,m.experimentalAutoDetectLongPolling,OE(m.experimentalLongPollingOptions),m.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,i);t._componentsProvider||!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),t._firestoreClient=new O2(t._authCredentials,t._appCheckCredentials,t._queue,s,t._componentsProvider&&function(l){const u=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(u),_online:u}}(t._componentsProvider))}/**
+ */class f0{constructor(e=Promise.resolve()){this.Pu=[],this.Iu=!1,this.Tu=[],this.Eu=null,this.du=!1,this.Au=!1,this.Ru=[],this.t_=new EE(this,"async_queue_retry"),this.Vu=()=>{const r=rf();r&&re("AsyncQueue","Visibility state changed to "+r.visibilityState),this.t_.jo()},this.mu=e;const n=rf();n&&typeof n.addEventListener=="function"&&n.addEventListener("visibilitychange",this.Vu)}get isShuttingDown(){return this.Iu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.fu(),this.gu(e)}enterRestrictedMode(e){if(!this.Iu){this.Iu=!0,this.Au=e||!1;const n=rf();n&&typeof n.removeEventListener=="function"&&n.removeEventListener("visibilitychange",this.Vu)}}enqueue(e){if(this.fu(),this.Iu)return new Promise(()=>{});const n=new Ur;return this.gu(()=>this.Iu&&this.Au?Promise.resolve():(e().then(n.resolve,n.reject),n.promise)).then(()=>n.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Pu.push(e),this.pu()))}async pu(){if(this.Pu.length!==0){try{await this.Pu[0](),this.Pu.shift(),this.t_.reset()}catch(e){if(!ic(e))throw e;re("AsyncQueue","Operation failed with retryable error: "+e)}this.Pu.length>0&&this.t_.Go(()=>this.pu())}}gu(e){const n=this.mu.then(()=>(this.du=!0,e().catch(r=>{this.Eu=r,this.du=!1;const i=function(o){let l=o.message||"";return o.stack&&(l=o.stack.includes(o.message)?o.stack:o.message+`
+`+o.stack),l}(r);throw Kr("INTERNAL UNHANDLED ERROR: ",i),r}).then(r=>(this.du=!1,r))));return this.mu=n,n}enqueueAfterDelay(e,n,r){this.fu(),this.Ru.indexOf(e)>-1&&(n=0);const i=tg.createAndSchedule(this,e,n,r,s=>this.yu(s));return this.Tu.push(i),i}fu(){this.Eu&&ce()}verifyOperationInProgress(){}async wu(){let e;do e=this.mu,await e;while(e!==this.mu)}Su(e){for(const n of this.Tu)if(n.timerId===e)return!0;return!1}bu(e){return this.wu().then(()=>{this.Tu.sort((n,r)=>n.targetTimeMs-r.targetTimeMs);for(const n of this.Tu)if(n.skipDelay(),e!=="all"&&n.timerId===e)break;return this.wu()})}Du(e){this.Ru.push(e)}yu(e){const n=this.Tu.indexOf(e);this.Tu.splice(n,1)}}function p0(t){return function(n,r){if(typeof n!="object"||n===null)return!1;const i=n;for(const s of r)if(s in i&&typeof i[s]=="function")return!0;return!1}(t,["next","error","complete"])}class hr extends eh{constructor(e,n,r,i){super(e,n,r,i),this.type="firestore",this._queue=new f0,this._persistenceKey=(i==null?void 0:i.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){const e=this._firestoreClient.terminate();this._queue=new f0(e),this._firestoreClient=void 0,await e}}}function H2(t,e){const n=typeof t=="object"?t:Im(),r=typeof t=="string"?t:"(default)",i=ra(n,"firestore").getImmediate({identifier:r});if(!i._initialized){const s=Eb("firestore");s&&W2(i,...s)}return i}function uc(t){if(t._terminated)throw new Z(U.FAILED_PRECONDITION,"The client has already been terminated.");return t._firestoreClient||K2(t),t._firestoreClient}function K2(t){var e,n,r;const i=t._freezeSettings(),s=function(l,u,h,m){return new bA(l,u,h,m.host,m.ssl,m.experimentalForceLongPolling,m.experimentalAutoDetectLongPolling,FE(m.experimentalLongPollingOptions),m.useFetchStreams)}(t._databaseId,((e=t._app)===null||e===void 0?void 0:e.options.appId)||"",t._persistenceKey,i);t._componentsProvider||!((n=i.localCache)===null||n===void 0)&&n._offlineComponentProvider&&(!((r=i.localCache)===null||r===void 0)&&r._onlineComponentProvider)&&(t._componentsProvider={_offline:i.localCache._offlineComponentProvider,_online:i.localCache._onlineComponentProvider}),t._firestoreClient=new F2(t._authCredentials,t._appCheckCredentials,t._queue,s,t._componentsProvider&&function(l){const u=l==null?void 0:l._online.build();return{_offline:l==null?void 0:l._offline.build(u),_online:u}}(t._componentsProvider))}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3137,7 +3137,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Yo{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Yo(Ct.fromBase64String(e))}catch(n){throw new Z(U.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Yo(Ct.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)}}/**
+ */class Zo{constructor(e){this._byteString=e}static fromBase64String(e){try{return new Zo(Ct.fromBase64String(e))}catch(n){throw new Z(U.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+n)}}static fromUint8Array(e){return new Zo(Ct.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3152,7 +3152,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class uc{constructor(...e){for(let n=0;n90)throw new Z(U.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new Z(U.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return _e(this._lat,e._lat)||_e(this._long,e._long)}}/**
+ */class ug{constructor(e,n){if(!isFinite(e)||e<-90||e>90)throw new Z(U.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(n)||n<-180||n>180)throw new Z(U.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+n);this._lat=e,this._long=n}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}toJSON(){return{latitude:this._lat,longitude:this._long}}_compareTo(e){return xe(this._lat,e._lat)||xe(this._long,e._long)}}/**
* @license
* Copyright 2024 Google LLC
*
@@ -3197,7 +3197,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class ug{constructor(e){this._values=(e||[]).map(n=>n)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;sn)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(r,i){if(r.length!==i.length)return!1;for(let s=0;se.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}vu(){if(this.path)for(let e=0;eu.covers(v.field))}else u=null,h=o.fieldTransforms;return new W2(new tn(l),u,h)}class Zd extends lg{_toFieldTransform(e){if(e.Cu!==2)throw e.Cu===1?e.Bu(`${this._methodName}() can only appear at the top level of your update data`):e.Bu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof Zd}}function FE(t,e,n,r){const i=t.Qu(1,e,n);fg("Data must be an object, but it was:",i,r);const s=[],o=tn.empty();Rs(r,(u,h)=>{const m=pg(e,u,n);h=We(h);const v=i.Nu(m);if(h instanceof Zd)s.push(m);else{const g=hc(h,v);g!=null&&(s.push(m),o.set(m,g))}});const l=new hn(s);return new ME(o,l,i.fieldTransforms)}function UE(t,e,n,r,i,s){const o=t.Qu(1,e,n),l=[Cp(e,r,n)],u=[i];if(s.length%2!=0)throw new Z(U.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g=0;--g)if(!$E(h,l[g])){const N=l[g];let D=u[g];D=We(D);const L=o.Nu(N);if(D instanceof Zd)h.push(N);else{const B=hc(D,L);B!=null&&(h.push(N),m.set(N,B))}}const v=new hn(h);return new ME(m,v,o.fieldTransforms)}function K2(t,e,n,r=!1){return hc(n,t.Qu(r?4:3,e))}function hc(t,e){if(BE(t=We(t)))return fg("Unsupported field value:",e,t),zE(t,e);if(t instanceof lg)return function(r,i){if(!VE(i.Cu))throw i.Bu(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Bu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.xu&&e.Cu!==4)throw e.Bu("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const l of r){let u=hc(l,i.Lu(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=We(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return $A(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=ft.fromDate(r);return{timestampValue:fd(i.serializer,s)}}if(r instanceof ft){const s=new ft(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:fd(i.serializer,s)}}if(r instanceof cg)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Yo)return{bytesValue:cE(i.serializer,r._byteString)};if(r instanceof Vt){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Bu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Hm(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof ug)return function(o,l){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:o.toArray().map(u=>{if(typeof u!="number")throw l.Bu("VectorValues must only contain numeric values.");return $m(l.serializer,u)})}}}}}}(r,i);throw i.Bu(`Unsupported field value: ${Jd(r)}`)}(t,e)}function zE(t,e){const n={};return Vx(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Rs(t,(r,i)=>{const s=hc(i,e.Mu(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function BE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof ft||t instanceof cg||t instanceof Yo||t instanceof Vt||t instanceof lg||t instanceof ug)}function fg(t,e,n){if(!BE(n)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(n)){const r=Jd(n);throw r==="an object"?e.Bu(t+" a custom object"):e.Bu(t+" "+r)}}function Cp(t,e,n){if((e=We(e))instanceof uc)return e._internalPath;if(typeof e=="string")return pg(t,e);throw yd("Field path arguments must be of type string or ",t,!1,void 0,n)}const G2=new RegExp("[~\\*/\\[\\]]");function pg(t,e,n){if(e.search(G2)>=0)throw yd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new uc(...e.split("."))._internalPath}catch{throw yd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function yd(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let l=`Function ${e}() called with invalid data`;n&&(l+=" (via `toFirestore()`)"),l+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${r}`),o&&(u+=` in document ${i}`),u+=")"),new Z(U.INVALID_ARGUMENT,l+t+u)}function $E(t,e){return t.some(n=>n.isEqual(e))}/**
+ */const G2=/^__.*__$/;class Q2{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return this.fieldMask!==null?new zi(e,this.data,this.fieldMask,n,this.fieldTransforms):new oc(e,this.data,n,this.fieldTransforms)}}class zE{constructor(e,n,r){this.data=e,this.fieldMask=n,this.fieldTransforms=r}toMutation(e,n){return new zi(e,this.data,this.fieldMask,n,this.fieldTransforms)}}function BE(t){switch(t){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw ce()}}class hg{constructor(e,n,r,i,s,o){this.settings=e,this.databaseId=n,this.serializer=r,this.ignoreUndefinedProperties=i,s===void 0&&this.vu(),this.fieldTransforms=s||[],this.fieldMask=o||[]}get path(){return this.settings.path}get Cu(){return this.settings.Cu}Fu(e){return new hg(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Mu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Fu({path:r,xu:!1});return i.Ou(e),i}Nu(e){var n;const r=(n=this.path)===null||n===void 0?void 0:n.child(e),i=this.Fu({path:r,xu:!1});return i.vu(),i}Lu(e){return this.Fu({path:void 0,xu:!0})}Bu(e){return wd(e,this.settings.methodName,this.settings.ku||!1,this.path,this.settings.qu)}contains(e){return this.fieldMask.find(n=>e.isPrefixOf(n))!==void 0||this.fieldTransforms.find(n=>e.isPrefixOf(n.field))!==void 0}vu(){if(this.path)for(let e=0;eu.covers(v.field))}else u=null,h=o.fieldTransforms;return new Q2(new tn(l),u,h)}class th extends cg{_toFieldTransform(e){if(e.Cu!==2)throw e.Cu===1?e.Bu(`${this._methodName}() can only appear at the top level of your update data`):e.Bu(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof th}}function $E(t,e,n,r){const i=t.Qu(1,e,n);pg("Data must be an object, but it was:",i,r);const s=[],o=tn.empty();Ds(r,(u,h)=>{const m=mg(e,u,n);h=qe(h);const v=i.Nu(m);if(h instanceof th)s.push(m);else{const g=fc(h,v);g!=null&&(s.push(m),o.set(m,g))}});const l=new dn(s);return new zE(o,l,i.fieldTransforms)}function qE(t,e,n,r,i,s){const o=t.Qu(1,e,n),l=[Ap(e,r,n)],u=[i];if(s.length%2!=0)throw new Z(U.INVALID_ARGUMENT,`Function ${e}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let g=0;g=0;--g)if(!KE(h,l[g])){const N=l[g];let j=u[g];j=qe(j);const L=o.Nu(N);if(j instanceof th)h.push(N);else{const B=fc(j,L);B!=null&&(h.push(N),m.set(N,B))}}const v=new dn(h);return new zE(m,v,o.fieldTransforms)}function J2(t,e,n,r=!1){return fc(n,t.Qu(r?4:3,e))}function fc(t,e){if(HE(t=qe(t)))return pg("Unsupported field value:",e,t),WE(t,e);if(t instanceof cg)return function(r,i){if(!BE(i.Cu))throw i.Bu(`${r._methodName}() can only be used with update() and set()`);if(!i.path)throw i.Bu(`${r._methodName}() is not currently supported inside arrays`);const s=r._toFieldTransform(i);s&&i.fieldTransforms.push(s)}(t,e),null;if(t===void 0&&e.ignoreUndefinedProperties)return null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.settings.xu&&e.Cu!==4)throw e.Bu("Nested arrays are not supported");return function(r,i){const s=[];let o=0;for(const l of r){let u=fc(l,i.Lu(o));u==null&&(u={nullValue:"NULL_VALUE"}),s.push(u),o++}return{arrayValue:{values:s}}}(t,e)}return function(r,i){if((r=qe(r))===null)return{nullValue:"NULL_VALUE"};if(typeof r=="number")return KA(i.serializer,r);if(typeof r=="boolean")return{booleanValue:r};if(typeof r=="string")return{stringValue:r};if(r instanceof Date){const s=ht.fromDate(r);return{timestampValue:md(i.serializer,s)}}if(r instanceof ht){const s=new ht(r.seconds,1e3*Math.floor(r.nanoseconds/1e3));return{timestampValue:md(i.serializer,s)}}if(r instanceof ug)return{geoPointValue:{latitude:r.latitude,longitude:r.longitude}};if(r instanceof Zo)return{bytesValue:fE(i.serializer,r._byteString)};if(r instanceof Vt){const s=i.databaseId,o=r.firestore._databaseId;if(!o.isEqual(s))throw i.Bu(`Document reference is for database ${o.projectId}/${o.database} but should be for database ${s.projectId}/${s.database}`);return{referenceValue:Km(r.firestore._databaseId||i.databaseId,r._key.path)}}if(r instanceof dg)return function(o,l){return{mapValue:{fields:{__type__:{stringValue:"__vector__"},value:{arrayValue:{values:o.toArray().map(u=>{if(typeof u!="number")throw l.Bu("VectorValues must only contain numeric values.");return qm(l.serializer,u)})}}}}}}(r,i);throw i.Bu(`Unsupported field value: ${Zd(r)}`)}(t,e)}function WE(t,e){const n={};return Bx(t)?e.path&&e.path.length>0&&e.fieldMask.push(e.path):Ds(t,(r,i)=>{const s=fc(i,e.Mu(r));s!=null&&(n[r]=s)}),{mapValue:{fields:n}}}function HE(t){return!(typeof t!="object"||t===null||t instanceof Array||t instanceof Date||t instanceof ht||t instanceof ug||t instanceof Zo||t instanceof Vt||t instanceof cg||t instanceof dg)}function pg(t,e,n){if(!HE(n)||!function(i){return typeof i=="object"&&i!==null&&(Object.getPrototypeOf(i)===Object.prototype||Object.getPrototypeOf(i)===null)}(n)){const r=Zd(n);throw r==="an object"?e.Bu(t+" a custom object"):e.Bu(t+" "+r)}}function Ap(t,e,n){if((e=qe(e))instanceof dc)return e._internalPath;if(typeof e=="string")return mg(t,e);throw wd("Field path arguments must be of type string or ",t,!1,void 0,n)}const X2=new RegExp("[~\\*/\\[\\]]");function mg(t,e,n){if(e.search(X2)>=0)throw wd(`Invalid field path (${e}). Paths must not contain '~', '*', '/', '[', or ']'`,t,!1,void 0,n);try{return new dc(...e.split("."))._internalPath}catch{throw wd(`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,t,!1,void 0,n)}}function wd(t,e,n,r,i){const s=r&&!r.isEmpty(),o=i!==void 0;let l=`Function ${e}() called with invalid data`;n&&(l+=" (via `toFirestore()`)"),l+=". ";let u="";return(s||o)&&(u+=" (found",s&&(u+=` in field ${r}`),o&&(u+=` in document ${i}`),u+=")"),new Z(U.INVALID_ARGUMENT,l+t+u)}function KE(t,e){return t.some(n=>n.isEqual(e))}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3227,7 +3227,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class qE{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Vt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Q2(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(mg("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class Q2 extends qE{data(){return super.data()}}function mg(t,e){return typeof e=="string"?pg(t,e):e instanceof uc?e._internalPath:e._delegate._internalPath}/**
+ */class GE{constructor(e,n,r,i,s){this._firestore=e,this._userDataWriter=n,this._key=r,this._document=i,this._converter=s}get id(){return this._key.path.lastSegment()}get ref(){return new Vt(this._firestore,this._converter,this._key)}exists(){return this._document!==null}data(){if(this._document){if(this._converter){const e=new Z2(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}get(e){if(this._document){const n=this._document.data.field(gg("DocumentSnapshot.get",e));if(n!==null)return this._userDataWriter.convertValue(n)}}}class Z2 extends GE{data(){return super.data()}}function gg(t,e){return typeof e=="string"?mg(t,e):e instanceof dc?e._internalPath:e._delegate._internalPath}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3242,7 +3242,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function WE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new Z(U.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class gg{}class Y2 extends gg{}function d0(t,e,...n){let r=[];e instanceof gg&&r.push(e),r=r.concat(n),function(s){const o=s.filter(u=>u instanceof yg).length,l=s.filter(u=>u instanceof eh).length;if(o>1||o>0&&l>0)throw new Z(U.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class eh extends Y2{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new eh(e,n,r)}_apply(e){const n=this._parse(e);return HE(e._query,n),new js(e.firestore,e.converter,vp(e._query,n))}_parse(e){const n=dc(e.firestore);return function(s,o,l,u,h,m,v){let g;if(h.isKeyField()){if(m==="array-contains"||m==="array-contains-any")throw new Z(U.INVALID_ARGUMENT,`Invalid Query. You can't perform '${m}' queries on documentId().`);if(m==="in"||m==="not-in"){p0(v,m);const N=[];for(const D of v)N.push(f0(u,s,D));g={arrayValue:{values:N}}}else g=f0(u,s,v)}else m!=="in"&&m!=="not-in"&&m!=="array-contains-any"||p0(v,m),g=K2(l,o,v,m==="in"||m==="not-in");return it.create(h,m,g)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function h0(t,e,n){const r=e,i=mg("where",t);return eh._create(i,r,n)}class yg extends gg{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new yg(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:$n.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const l=s.getFlattenedFilters();for(const u of l)HE(o,u),o=vp(o,u)}(e._query,n),new js(e.firestore,e.converter,vp(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function f0(t,e,n){if(typeof(n=We(n))=="string"){if(n==="")throw new Z(U.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Kx(e)&&n.indexOf("/")!==-1)throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(Le.fromString(n));if(!ie.isDocumentKey(r))throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Rv(t,new ie(r))}if(n instanceof Vt)return Rv(t,n._key);throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Jd(n)}.`)}function p0(t,e){if(!Array.isArray(t)||t.length===0)throw new Z(U.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function HE(t,e){const n=function(i,s){for(const o of i)for(const l of o.getFlattenedFilters())if(s.indexOf(l.op)>=0)return l.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new Z(U.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Z(U.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class J2{convertValue(e,n="none"){switch(Ss(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ye(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(bs(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 ce()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Rs(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var n,r,i;const s=(i=(r=(n=e.fields)===null||n===void 0?void 0:n.value.arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.map(o=>Ye(o.doubleValue));return new ug(s)}convertGeoPoint(e){return new cg(Ye(e.latitude),Ye(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Fm(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Fl(e));default:return null}}convertTimestamp(e){const n=Di(e);return new ft(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=Le.fromString(e);Se(mE(r));const i=new Ul(r.get(1),r.get(3)),s=new ie(r.popFirst(5));return i.isEqual(n)||Ur(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/**
+ */function QE(t){if(t.limitType==="L"&&t.explicitOrderBy.length===0)throw new Z(U.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class yg{}class eP extends yg{}function m0(t,e,...n){let r=[];e instanceof yg&&r.push(e),r=r.concat(n),function(s){const o=s.filter(u=>u instanceof vg).length,l=s.filter(u=>u instanceof nh).length;if(o>1||o>0&&l>0)throw new Z(U.INVALID_ARGUMENT,"InvalidQuery. When using composite filters, you cannot use more than one filter at the top level. Consider nesting the multiple filters within an `and(...)` statement. For example: change `query(query, where(...), or(...))` to `query(query, and(where(...), or(...)))`.")}(r);for(const i of r)t=i._apply(t);return t}class nh extends eP{constructor(e,n,r){super(),this._field=e,this._op=n,this._value=r,this.type="where"}static _create(e,n,r){return new nh(e,n,r)}_apply(e){const n=this._parse(e);return YE(e._query,n),new Os(e.firestore,e.converter,wp(e._query,n))}_parse(e){const n=hc(e.firestore);return function(s,o,l,u,h,m,v){let g;if(h.isKeyField()){if(m==="array-contains"||m==="array-contains-any")throw new Z(U.INVALID_ARGUMENT,`Invalid Query. You can't perform '${m}' queries on documentId().`);if(m==="in"||m==="not-in"){v0(v,m);const N=[];for(const j of v)N.push(y0(u,s,j));g={arrayValue:{values:N}}}else g=y0(u,s,v)}else m!=="in"&&m!=="not-in"&&m!=="array-contains-any"||v0(v,m),g=J2(l,o,v,m==="in"||m==="not-in");return st.create(h,m,g)}(e._query,"where",n,e.firestore._databaseId,this._field,this._op,this._value)}}function g0(t,e,n){const r=e,i=gg("where",t);return nh._create(i,r,n)}class vg extends yg{constructor(e,n){super(),this.type=e,this._queryConstraints=n}static _create(e,n){return new vg(e,n)}_parse(e){const n=this._queryConstraints.map(r=>r._parse(e)).filter(r=>r.getFilters().length>0);return n.length===1?n[0]:Bn.create(n,this._getOperator())}_apply(e){const n=this._parse(e);return n.getFilters().length===0?e:(function(i,s){let o=i;const l=s.getFlattenedFilters();for(const u of l)YE(o,u),o=wp(o,u)}(e._query,n),new Os(e.firestore,e.converter,wp(e._query,n)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return this.type==="and"?"and":"or"}}function y0(t,e,n){if(typeof(n=qe(n))=="string"){if(n==="")throw new Z(U.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!Jx(e)&&n.indexOf("/")!==-1)throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);const r=e.path.child(De.fromString(n));if(!ie.isDocumentKey(r))throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${r}' is not because it has an odd number of segments (${r.length}).`);return Lv(t,new ie(r))}if(n instanceof Vt)return Lv(t,n._key);throw new Z(U.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${Zd(n)}.`)}function v0(t,e){if(!Array.isArray(t)||t.length===0)throw new Z(U.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${e.toString()}' filters.`)}function YE(t,e){const n=function(i,s){for(const o of i)for(const l of o.getFlattenedFilters())if(s.indexOf(l.op)>=0)return l.op;return null}(t.filters,function(i){switch(i){case"!=":return["!=","not-in"];case"array-contains-any":case"in":return["not-in"];case"not-in":return["array-contains-any","in","not-in","!="];default:return[]}}(e.op));if(n!==null)throw n===e.op?new Z(U.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${e.op.toString()}' filter.`):new Z(U.INVALID_ARGUMENT,`Invalid query. You cannot use '${e.op.toString()}' filters with '${n.toString()}' filters.`)}class tP{convertValue(e,n="none"){switch(Is(e)){case 0:return null;case 1:return e.booleanValue;case 2:return Ye(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(Ss(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 ce()}}convertObject(e,n){return this.convertObjectMap(e.fields,n)}convertObjectMap(e,n="none"){const r={};return Ds(e,(i,s)=>{r[i]=this.convertValue(s,n)}),r}convertVectorValue(e){var n,r,i;const s=(i=(r=(n=e.fields)===null||n===void 0?void 0:n.value.arrayValue)===null||r===void 0?void 0:r.values)===null||i===void 0?void 0:i.map(o=>Ye(o.doubleValue));return new dg(s)}convertGeoPoint(e){return new ug(Ye(e.latitude),Ye(e.longitude))}convertArray(e,n){return(e.values||[]).map(r=>this.convertValue(r,n))}convertServerTimestamp(e,n){switch(n){case"previous":const r=Um(e);return r==null?null:this.convertValue(r,n);case"estimate":return this.convertTimestamp(Ul(e));default:return null}}convertTimestamp(e){const n=Oi(e);return new ht(n.seconds,n.nanos)}convertDocumentKey(e,n){const r=De.fromString(e);Se(wE(r));const i=new zl(r.get(1),r.get(3)),s=new ie(r.popFirst(5));return i.isEqual(n)||Kr(`Document ${s} contains a document reference within a different database (${i.projectId}/${i.database}) which is not supported. It will be treated as a reference in the current database (${n.projectId}/${n.database}) instead.`),s}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3257,7 +3257,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function vg(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}/**
+ */function wg(t,e,n){let r;return r=t?n&&(n.merge||n.mergeFields)?t.toFirestore(e,n):t.toFirestore(e):e,r}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3272,7 +3272,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class rl{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class KE extends qE{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Cu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(mg("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}}class Cu extends KE{data(e={}){return super.data(e)}}class GE{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new rl(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Cu(this._firestore,this._userDataWriter,r.key,r,new rl(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new Z(U.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(l=>{const u=new Cu(i._firestore,i._userDataWriter,l.doc.key,l.doc,new rl(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);return l.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(l=>s||l.type!==3).map(l=>{const u=new Cu(i._firestore,i._userDataWriter,l.doc.key,l.doc,new rl(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);let h=-1,m=-1;return l.type!==0&&(h=o.indexOf(l.doc.key),o=o.delete(l.doc.key)),l.type!==1&&(o=o.add(l.doc),m=o.indexOf(l.doc.key)),{type:X2(l.type),doc:u,oldIndex:h,newIndex:m}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}}function X2(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ce()}}/**
+ */class il{constructor(e,n){this.hasPendingWrites=e,this.fromCache=n}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class JE extends GE{constructor(e,n,r,i,s,o){super(e,n,r,i,o),this._firestore=e,this._firestoreImpl=e,this.metadata=s}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){const n=new Nu(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(n,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,n={}){if(this._document){const r=this._document.data.field(gg("DocumentSnapshot.get",e));if(r!==null)return this._userDataWriter.convertValue(r,n.serverTimestamps)}}}class Nu extends JE{data(e={}){return super.data(e)}}class XE{constructor(e,n,r,i){this._firestore=e,this._userDataWriter=n,this._snapshot=i,this.metadata=new il(i.hasPendingWrites,i.fromCache),this.query=r}get docs(){const e=[];return this.forEach(n=>e.push(n)),e}get size(){return this._snapshot.docs.size}get empty(){return this.size===0}forEach(e,n){this._snapshot.docs.forEach(r=>{e.call(n,new Nu(this._firestore,this._userDataWriter,r.key,r,new il(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){const n=!!e.includeMetadataChanges;if(n&&this._snapshot.excludesMetadataChanges)throw new Z(U.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===n||(this._cachedChanges=function(i,s){if(i._snapshot.oldDocs.isEmpty()){let o=0;return i._snapshot.docChanges.map(l=>{const u=new Nu(i._firestore,i._userDataWriter,l.doc.key,l.doc,new il(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);return l.doc,{type:"added",doc:u,oldIndex:-1,newIndex:o++}})}{let o=i._snapshot.oldDocs;return i._snapshot.docChanges.filter(l=>s||l.type!==3).map(l=>{const u=new Nu(i._firestore,i._userDataWriter,l.doc.key,l.doc,new il(i._snapshot.mutatedKeys.has(l.doc.key),i._snapshot.fromCache),i.query.converter);let h=-1,m=-1;return l.type!==0&&(h=o.indexOf(l.doc.key),o=o.delete(l.doc.key)),l.type!==1&&(o=o.add(l.doc),m=o.indexOf(l.doc.key)),{type:nP(l.type),doc:u,oldIndex:h,newIndex:m}})}}(this,n),this._cachedChangesIncludeMetadataChanges=n),this._cachedChanges}}function nP(t){switch(t){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return ce()}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3287,7 +3287,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function sf(t){t=qt(t,Vt);const e=qt(t.firestore,cr);return V2(cc(e),t._key).then(n=>QE(e,t,n))}class wg extends J2{constructor(e){super(),this.firestore=e}convertBytes(e){return new Yo(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Vt(this.firestore,null,n)}}function su(t){t=qt(t,js);const e=qt(t.firestore,cr),n=cc(e),r=new wg(e);return WE(t._query),F2(n,t._query).then(i=>new GE(e,r,t,i))}function ss(t,e,n){t=qt(t,Vt);const r=qt(t.firestore,cr),i=vg(t.converter,e,n);return fc(r,[hg(dc(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,$t.none())])}function Yn(t,e,n,...r){t=qt(t,Vt);const i=qt(t.firestore,cr),s=dc(i);let o;return o=typeof(e=We(e))=="string"||e instanceof uc?UE(s,"updateDoc",t._key,e,n,r):FE(s,"updateDoc",t._key,e),fc(i,[o.toMutation(t._key,$t.exists(!0))])}function Wa(t){return fc(qt(t.firestore,cr),[new Hd(t._key,$t.none())])}function Jn(t,e){const n=qt(t.firestore,cr),r=De(t),i=vg(t.converter,e);return fc(n,[hg(dc(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,$t.exists(!1))]).then(()=>r)}function co(t,...e){var n,r,i;t=We(t);let s={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||u0(e[o])||(s=e[o],o++);const l={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(u0(e[o])){const v=e[o];e[o]=(n=v.next)===null||n===void 0?void 0:n.bind(v),e[o+1]=(r=v.error)===null||r===void 0?void 0:r.bind(v),e[o+2]=(i=v.complete)===null||i===void 0?void 0:i.bind(v)}let u,h,m;if(t instanceof Vt)h=qt(t.firestore,cr),m=zd(t._key.path),u={next:v=>{e[o]&&e[o](QE(h,t,v))},error:e[o+1],complete:e[o+2]};else{const v=qt(t,js);h=qt(v.firestore,cr),m=v._query;const g=new wg(h);u={next:N=>{e[o]&&e[o](new GE(h,g,v,N))},error:e[o+1],complete:e[o+2]},WE(t._query)}return function(g,N,D,L){const B=new ag(L),I=new sg(N,B,D);return g.asyncQueue.enqueueAndForget(async()=>ng(await gd(g),I)),()=>{B.Za(),g.asyncQueue.enqueueAndForget(async()=>rg(await gd(g),I))}}(cc(h),m,l,u)}function fc(t,e){return function(r,i){const s=new Dr;return r.asyncQueue.enqueueAndForget(async()=>I2(await M2(r),i,s)),s.promise}(cc(t),e)}function QE(t,e,n){const r=n.docs.get(e._key),i=new wg(t);return new KE(t,i,e._key,r,new rl(n.hasPendingWrites,n.fromCache),e.converter)}/**
+ */function of(t){t=Wt(t,Vt);const e=Wt(t.firestore,hr);return B2(uc(e),t._key).then(n=>ZE(e,t,n))}class _g extends tP{constructor(e){super(),this.firestore=e}convertBytes(e){return new Zo(e)}convertReference(e){const n=this.convertDocumentKey(e,this.firestore._databaseId);return new Vt(this.firestore,null,n)}}function au(t){t=Wt(t,Os);const e=Wt(t.firestore,hr),n=uc(e),r=new _g(e);return QE(t._query),$2(n,t._query).then(i=>new XE(e,r,t,i))}function os(t,e,n){t=Wt(t,Vt);const r=Wt(t.firestore,hr),i=wg(t.converter,e,n);return pc(r,[fg(hc(r),"setDoc",t._key,i,t.converter!==null,n).toMutation(t._key,qt.none())])}function Zn(t,e,n,...r){t=Wt(t,Vt);const i=Wt(t.firestore,hr),s=hc(i);let o;return o=typeof(e=qe(e))=="string"||e instanceof dc?qE(s,"updateDoc",t._key,e,n,r):$E(s,"updateDoc",t._key,e),pc(i,[o.toMutation(t._key,qt.exists(!0))])}function Ha(t){return pc(Wt(t.firestore,hr),[new Gd(t._key,qt.none())])}function er(t,e){const n=Wt(t.firestore,hr),r=Ne(t),i=wg(t.converter,e);return pc(n,[fg(hc(t.firestore),"addDoc",r._key,i,t.converter!==null,{}).toMutation(r._key,qt.exists(!1))]).then(()=>r)}function fo(t,...e){var n,r,i;t=qe(t);let s={includeMetadataChanges:!1,source:"default"},o=0;typeof e[o]!="object"||p0(e[o])||(s=e[o],o++);const l={includeMetadataChanges:s.includeMetadataChanges,source:s.source};if(p0(e[o])){const v=e[o];e[o]=(n=v.next)===null||n===void 0?void 0:n.bind(v),e[o+1]=(r=v.error)===null||r===void 0?void 0:r.bind(v),e[o+2]=(i=v.complete)===null||i===void 0?void 0:i.bind(v)}let u,h,m;if(t instanceof Vt)h=Wt(t.firestore,hr),m=$d(t._key.path),u={next:v=>{e[o]&&e[o](ZE(h,t,v))},error:e[o+1],complete:e[o+2]};else{const v=Wt(t,Os);h=Wt(v.firestore,hr),m=v._query;const g=new _g(h);u={next:N=>{e[o]&&e[o](new XE(h,g,v,N))},error:e[o+1],complete:e[o+2]},QE(t._query)}return function(g,N,j,L){const B=new lg(L),I=new og(N,B,j);return g.asyncQueue.enqueueAndForget(async()=>rg(await vd(g),I)),()=>{B.Za(),g.asyncQueue.enqueueAndForget(async()=>ig(await vd(g),I))}}(uc(h),m,l,u)}function pc(t,e){return function(r,i){const s=new Ur;return r.asyncQueue.enqueueAndForget(async()=>P2(await z2(r),i,s)),s.promise}(uc(t),e)}function ZE(t,e,n){const r=n.docs.get(e._key),i=new _g(t);return new JE(t,i,e._key,r,new il(n.hasPendingWrites,n.fromCache),e.converter)}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3302,7 +3302,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class Z2{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=dc(e)}set(e,n,r){this._verifyNotCommitted();const i=of(e,this._firestore),s=vg(i.converter,n,r),o=hg(this._dataReader,"WriteBatch.set",i._key,s,i.converter!==null,r);return this._mutations.push(o.toMutation(i._key,$t.none())),this}update(e,n,r,...i){this._verifyNotCommitted();const s=of(e,this._firestore);let o;return o=typeof(n=We(n))=="string"||n instanceof uc?UE(this._dataReader,"WriteBatch.update",s._key,n,r,i):FE(this._dataReader,"WriteBatch.update",s._key,n),this._mutations.push(o.toMutation(s._key,$t.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=of(e,this._firestore);return this._mutations=this._mutations.concat(new Hd(n._key,$t.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new Z(U.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function of(t,e){if((t=We(t)).firestore!==e)throw new Z(U.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/**
+ */class rP{constructor(e,n){this._firestore=e,this._commitHandler=n,this._mutations=[],this._committed=!1,this._dataReader=hc(e)}set(e,n,r){this._verifyNotCommitted();const i=af(e,this._firestore),s=wg(i.converter,n,r),o=fg(this._dataReader,"WriteBatch.set",i._key,s,i.converter!==null,r);return this._mutations.push(o.toMutation(i._key,qt.none())),this}update(e,n,r,...i){this._verifyNotCommitted();const s=af(e,this._firestore);let o;return o=typeof(n=qe(n))=="string"||n instanceof dc?qE(this._dataReader,"WriteBatch.update",s._key,n,r,i):$E(this._dataReader,"WriteBatch.update",s._key,n),this._mutations.push(o.toMutation(s._key,qt.exists(!0))),this}delete(e){this._verifyNotCommitted();const n=af(e,this._firestore);return this._mutations=this._mutations.concat(new Gd(n._key,qt.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new Z(U.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function af(t,e){if((t=qe(t)).firestore!==e)throw new Z(U.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return t}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3317,7 +3317,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function Ha(t){return cc(t=qt(t,cr)),new Z2(t,e=>fc(t,e))}(function(e,n=!0){(function(i){ra=i})(ta),ar(new zn("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),l=new cr(new oA(r.getProvider("auth-internal")),new uA(r.getProvider("app-check-internal")),function(h,m){if(!Object.prototype.hasOwnProperty.apply(h.options,["projectId"]))throw new Z(U.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new Ul(h.options.projectId,m)}(o,i),o);return s=Object.assign({useFetchStreams:n},s),l._setSettings(s),l},"PUBLIC").setMultipleInstances(!0)),kn(Iv,"4.7.3",e),kn(Iv,"4.7.3","esm2017")})();var eP="firebase",tP="10.14.1";/**
+ */function Ka(t){return uc(t=Wt(t,hr)),new rP(t,e=>pc(t,e))}(function(e,n=!0){(function(i){oa=i})(ia),ur(new Un("firestore",(r,{instanceIdentifier:i,options:s})=>{const o=r.getProvider("app").getImmediate(),l=new hr(new uA(r.getProvider("auth-internal")),new pA(r.getProvider("app-check-internal")),function(h,m){if(!Object.prototype.hasOwnProperty.apply(h.options,["projectId"]))throw new Z(U.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new zl(h.options.projectId,m)}(o,i),o);return s=Object.assign({useFetchStreams:n},s),l._setSettings(s),l},"PUBLIC").setMultipleInstances(!0)),Sn(Pv,"4.7.3",e),Sn(Pv,"4.7.3","esm2017")})();var iP="firebase",sP="10.14.1";/**
* @license
* Copyright 2020 Google LLC
*
@@ -3332,7 +3332,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */kn(eP,tP,"app");const YE="@firebase/installations",_g="0.6.9";/**
+ */Sn(iP,sP,"app");const ek="@firebase/installations",xg="0.6.9";/**
* @license
* Copyright 2019 Google LLC
*
@@ -3347,7 +3347,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const JE=1e4,XE=`w:${_g}`,ZE="FIS_v2",nP="https://firebaseinstallations.googleapis.com/v1",rP=60*60*1e3,iP="installations",sP="Installations";/**
+ */const tk=1e4,nk=`w:${xg}`,rk="FIS_v2",oP="https://firebaseinstallations.googleapis.com/v1",aP=60*60*1e3,lP="installations",cP="Installations";/**
* @license
* Copyright 2019 Google LLC
*
@@ -3362,7 +3362,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const oP={"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."},Is=new Ps(iP,sP,oP);function ek(t){return t instanceof ur&&t.code.includes("request-failed")}/**
+ */const uP={"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."},Cs=new Rs(lP,cP,uP);function ik(t){return t instanceof fr&&t.code.includes("request-failed")}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3377,7 +3377,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function tk({projectId:t}){return`${nP}/projects/${t}/installations`}function nk(t){return{token:t.token,requestStatus:2,expiresIn:lP(t.expiresIn),creationTime:Date.now()}}async function rk(t,e){const r=(await e.json()).error;return Is.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function ik({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function aP(t,{refreshToken:e}){const n=ik(t);return n.append("Authorization",cP(e)),n}async function sk(t){const e=await t();return e.status>=500&&e.status<600?t():e}function lP(t){return Number(t.replace("s","000"))}function cP(t){return`${ZE} ${t}`}/**
+ */function sk({projectId:t}){return`${oP}/projects/${t}/installations`}function ok(t){return{token:t.token,requestStatus:2,expiresIn:hP(t.expiresIn),creationTime:Date.now()}}async function ak(t,e){const r=(await e.json()).error;return Cs.create("request-failed",{requestName:t,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function lk({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function dP(t,{refreshToken:e}){const n=lk(t);return n.append("Authorization",fP(e)),n}async function ck(t){const e=await t();return e.status>=500&&e.status<600?t():e}function hP(t){return Number(t.replace("s","000"))}function fP(t){return`${rk} ${t}`}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3392,7 +3392,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function uP({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=tk(t),i=ik(t),s=e.getImmediate({optional:!0});if(s){const h=await s.getHeartbeatsHeader();h&&i.append("x-firebase-client",h)}const o={fid:n,authVersion:ZE,appId:t.appId,sdkVersion:XE},l={method:"POST",headers:i,body:JSON.stringify(o)},u=await sk(()=>fetch(r,l));if(u.ok){const h=await u.json();return{fid:h.fid||n,registrationStatus:2,refreshToken:h.refreshToken,authToken:nk(h.authToken)}}else throw await rk("Create Installation",u)}/**
+ */async function pP({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=sk(t),i=lk(t),s=e.getImmediate({optional:!0});if(s){const h=await s.getHeartbeatsHeader();h&&i.append("x-firebase-client",h)}const o={fid:n,authVersion:rk,appId:t.appId,sdkVersion:nk},l={method:"POST",headers:i,body:JSON.stringify(o)},u=await ck(()=>fetch(r,l));if(u.ok){const h=await u.json();return{fid:h.fid||n,registrationStatus:2,refreshToken:h.refreshToken,authToken:ok(h.authToken)}}else throw await ak("Create Installation",u)}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3407,7 +3407,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function ok(t){return new Promise(e=>{setTimeout(e,t)})}/**
+ */function uk(t){return new Promise(e=>{setTimeout(e,t)})}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3422,7 +3422,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function dP(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")}/**
+ */function mP(t){return btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3437,7 +3437,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const hP=/^[cdef][\w-]{21}$/,Ap="";function fP(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const n=pP(t);return hP.test(n)?n:Ap}catch{return Ap}}function pP(t){return dP(t).substr(0,22)}/**
+ */const gP=/^[cdef][\w-]{21}$/,Np="";function yP(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const n=vP(t);return gP.test(n)?n:Np}catch{return Np}}function vP(t){return mP(t).substr(0,22)}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3452,7 +3452,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function th(t){return`${t.appName}!${t.appId}`}/**
+ */function rh(t){return`${t.appName}!${t.appId}`}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3467,7 +3467,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const ak=new Map;function lk(t,e){const n=th(t);ck(n,e),mP(n,e)}function ck(t,e){const n=ak.get(t);if(n)for(const r of n)r(e)}function mP(t,e){const n=gP();n&&n.postMessage({key:t,fid:e}),yP()}let fs=null;function gP(){return!fs&&"BroadcastChannel"in self&&(fs=new BroadcastChannel("[Firebase] FID Change"),fs.onmessage=t=>{ck(t.data.key,t.data.fid)}),fs}function yP(){ak.size===0&&fs&&(fs.close(),fs=null)}/**
+ */const dk=new Map;function hk(t,e){const n=rh(t);fk(n,e),wP(n,e)}function fk(t,e){const n=dk.get(t);if(n)for(const r of n)r(e)}function wP(t,e){const n=_P();n&&n.postMessage({key:t,fid:e}),xP()}let ps=null;function _P(){return!ps&&"BroadcastChannel"in self&&(ps=new BroadcastChannel("[Firebase] FID Change"),ps.onmessage=t=>{fk(t.data.key,t.data.fid)}),ps}function xP(){dk.size===0&&ps&&(ps.close(),ps=null)}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3482,7 +3482,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const vP="firebase-installations-database",wP=1,Cs="firebase-installations-store";let af=null;function xg(){return af||(af=Ld(vP,wP,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Cs)}}})),af}async function vd(t,e){const n=th(t),i=(await xg()).transaction(Cs,"readwrite"),s=i.objectStore(Cs),o=await s.get(n);return await s.put(e,n),await i.done,(!o||o.fid!==e.fid)&&lk(t,e.fid),e}async function uk(t){const e=th(t),r=(await xg()).transaction(Cs,"readwrite");await r.objectStore(Cs).delete(e),await r.done}async function nh(t,e){const n=th(t),i=(await xg()).transaction(Cs,"readwrite"),s=i.objectStore(Cs),o=await s.get(n),l=e(o);return l===void 0?await s.delete(n):await s.put(l,n),await i.done,l&&(!o||o.fid!==l.fid)&&lk(t,l.fid),l}/**
+ */const EP="firebase-installations-database",kP=1,As="firebase-installations-store";let lf=null;function Eg(){return lf||(lf=Vd(EP,kP,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(As)}}})),lf}async function _d(t,e){const n=rh(t),i=(await Eg()).transaction(As,"readwrite"),s=i.objectStore(As),o=await s.get(n);return await s.put(e,n),await i.done,(!o||o.fid!==e.fid)&&hk(t,e.fid),e}async function pk(t){const e=rh(t),r=(await Eg()).transaction(As,"readwrite");await r.objectStore(As).delete(e),await r.done}async function ih(t,e){const n=rh(t),i=(await Eg()).transaction(As,"readwrite"),s=i.objectStore(As),o=await s.get(n),l=e(o);return l===void 0?await s.delete(n):await s.put(l,n),await i.done,l&&(!o||o.fid!==l.fid)&&hk(t,l.fid),l}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3497,7 +3497,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function Eg(t){let e;const n=await nh(t.appConfig,r=>{const i=_P(r),s=xP(t,i);return e=s.registrationPromise,s.installationEntry});return n.fid===Ap?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}function _P(t){const e=t||{fid:fP(),registrationStatus:0};return dk(e)}function xP(t,e){if(e.registrationStatus===0){if(!navigator.onLine){const i=Promise.reject(Is.create("app-offline"));return{installationEntry:e,registrationPromise:i}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=EP(t,n);return{installationEntry:n,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:kP(t)}:{installationEntry:e}}async function EP(t,e){try{const n=await uP(t,e);return vd(t.appConfig,n)}catch(n){throw ek(n)&&n.customData.serverCode===409?await uk(t.appConfig):await vd(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}async function kP(t){let e=await m0(t.appConfig);for(;e.registrationStatus===1;)await ok(100),e=await m0(t.appConfig);if(e.registrationStatus===0){const{installationEntry:n,registrationPromise:r}=await Eg(t);return r||n}return e}function m0(t){return nh(t,e=>{if(!e)throw Is.create("installation-not-found");return dk(e)})}function dk(t){return TP(t)?{fid:t.fid,registrationStatus:0}:t}function TP(t){return t.registrationStatus===1&&t.registrationTime+JE{const i=TP(r),s=bP(t,i);return e=s.registrationPromise,s.installationEntry});return n.fid===Np?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}function TP(t){const e=t||{fid:yP(),registrationStatus:0};return mk(e)}function bP(t,e){if(e.registrationStatus===0){if(!navigator.onLine){const i=Promise.reject(Cs.create("app-offline"));return{installationEntry:e,registrationPromise:i}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=SP(t,n);return{installationEntry:n,registrationPromise:r}}else return e.registrationStatus===1?{installationEntry:e,registrationPromise:IP(t)}:{installationEntry:e}}async function SP(t,e){try{const n=await pP(t,e);return _d(t.appConfig,n)}catch(n){throw ik(n)&&n.customData.serverCode===409?await pk(t.appConfig):await _d(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}async function IP(t){let e=await w0(t.appConfig);for(;e.registrationStatus===1;)await uk(100),e=await w0(t.appConfig);if(e.registrationStatus===0){const{installationEntry:n,registrationPromise:r}=await kg(t);return r||n}return e}function w0(t){return ih(t,e=>{if(!e)throw Cs.create("installation-not-found");return mk(e)})}function mk(t){return CP(t)?{fid:t.fid,registrationStatus:0}:t}function CP(t){return t.registrationStatus===1&&t.registrationTime+tkfetch(r,l));if(u.ok){const h=await u.json();return nk(h)}else throw await rk("Generate Auth Token",u)}function SP(t,{fid:e}){return`${tk(t)}/${e}/authTokens:generate`}/**
+ */async function AP({appConfig:t,heartbeatServiceProvider:e},n){const r=NP(t,n),i=dP(t,n),s=e.getImmediate({optional:!0});if(s){const h=await s.getHeartbeatsHeader();h&&i.append("x-firebase-client",h)}const o={installation:{sdkVersion:nk,appId:t.appId}},l={method:"POST",headers:i,body:JSON.stringify(o)},u=await ck(()=>fetch(r,l));if(u.ok){const h=await u.json();return ok(h)}else throw await ak("Generate Auth Token",u)}function NP(t,{fid:e}){return`${sk(t)}/${e}/authTokens:generate`}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3527,7 +3527,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function kg(t,e=!1){let n;const r=await nh(t.appConfig,s=>{if(!hk(s))throw Is.create("not-registered");const o=s.authToken;if(!e&&AP(o))return s;if(o.requestStatus===1)return n=IP(t,e),s;{if(!navigator.onLine)throw Is.create("app-offline");const l=PP(s);return n=CP(t,l),l}});return n?await n:r.authToken}async function IP(t,e){let n=await g0(t.appConfig);for(;n.authToken.requestStatus===1;)await ok(100),n=await g0(t.appConfig);const r=n.authToken;return r.requestStatus===0?kg(t,e):r}function g0(t){return nh(t,e=>{if(!hk(e))throw Is.create("not-registered");const n=e.authToken;return RP(n)?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}async function CP(t,e){try{const n=await bP(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await vd(t.appConfig,r),n}catch(n){if(ek(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await uk(t.appConfig);else{const r=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await vd(t.appConfig,r)}throw n}}function hk(t){return t!==void 0&&t.registrationStatus===2}function AP(t){return t.requestStatus===2&&!NP(t)}function NP(t){const e=Date.now();return e{if(!gk(s))throw Cs.create("not-registered");const o=s.authToken;if(!e&&DP(o))return s;if(o.requestStatus===1)return n=PP(t,e),s;{if(!navigator.onLine)throw Cs.create("app-offline");const l=OP(s);return n=RP(t,l),l}});return n?await n:r.authToken}async function PP(t,e){let n=await _0(t.appConfig);for(;n.authToken.requestStatus===1;)await uk(100),n=await _0(t.appConfig);const r=n.authToken;return r.requestStatus===0?Tg(t,e):r}function _0(t){return ih(t,e=>{if(!gk(e))throw Cs.create("not-registered");const n=e.authToken;return LP(n)?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}async function RP(t,e){try{const n=await AP(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await _d(t.appConfig,r),n}catch(n){if(ik(n)&&(n.customData.serverCode===401||n.customData.serverCode===404))await pk(t.appConfig);else{const r=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await _d(t.appConfig,r)}throw n}}function gk(t){return t!==void 0&&t.registrationStatus===2}function DP(t){return t.requestStatus===2&&!jP(t)}function jP(t){const e=Date.now();return e{const e=t.getProvider("app").getImmediate(),n=LP(e),r=ea(e,"heartbeat");return{app:e,appConfig:n,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},FP=t=>{const e=t.getProvider("app").getImmediate(),n=ea(e,fk).getImmediate();return{getId:()=>DP(n),getToken:i=>jP(n,i)}};function UP(){ar(new zn(fk,VP,"PUBLIC")),ar(new zn(MP,FP,"PRIVATE"))}UP();kn(YE,_g);kn(YE,_g,"esm2017");/**
+ */const yk="installations",zP="installations-internal",BP=t=>{const e=t.getProvider("app").getImmediate(),n=UP(e),r=ra(e,"heartbeat");return{app:e,appConfig:n,heartbeatServiceProvider:r,_delete:()=>Promise.resolve()}},$P=t=>{const e=t.getProvider("app").getImmediate(),n=ra(e,yk).getImmediate();return{getId:()=>MP(n),getToken:i=>VP(n,i)}};function qP(){ur(new Un(yk,BP,"PUBLIC")),ur(new Un(zP,$P,"PRIVATE"))}qP();Sn(ek,xg);Sn(ek,xg,"esm2017");/**
* @license
* Copyright 2019 Google LLC
*
@@ -3602,7 +3602,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const zP="/firebase-messaging-sw.js",BP="/firebase-cloud-messaging-push-scope",pk="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",$P="https://fcmregistrations.googleapis.com/v1",mk="google.c.a.c_id",qP="google.c.a.c_l",WP="google.c.a.ts",HP="google.c.a.e";var y0;(function(t){t[t.DATA_MESSAGE=1]="DATA_MESSAGE",t[t.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(y0||(y0={}));/**
+ */const WP="/firebase-messaging-sw.js",HP="/firebase-cloud-messaging-push-scope",vk="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",KP="https://fcmregistrations.googleapis.com/v1",wk="google.c.a.c_id",GP="google.c.a.c_l",QP="google.c.a.ts",YP="google.c.a.e";var x0;(function(t){t[t.DATA_MESSAGE=1]="DATA_MESSAGE",t[t.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"})(x0||(x0={}));/**
* @license
* Copyright 2018 Google LLC
*
@@ -3615,7 +3615,7 @@ This typically indicates that your device does not have a healthy Internet conne
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
- */var ql;(function(t){t.PUSH_RECEIVED="push-received",t.NOTIFICATION_CLICKED="notification-clicked"})(ql||(ql={}));/**
+ */var Wl;(function(t){t.PUSH_RECEIVED="push-received",t.NOTIFICATION_CLICKED="notification-clicked"})(Wl||(Wl={}));/**
* @license
* Copyright 2017 Google LLC
*
@@ -3630,7 +3630,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function kr(t){const e=new Uint8Array(t);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function KP(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(n),i=new Uint8Array(r.length);for(let s=0;ss.name).includes(cf))return null;let e=null;return(await Ld(cf,GP,{upgrade:async(r,i,s,o)=>{var l;if(i<2||!r.objectStoreNames.contains(v0))return;const u=o.objectStore(v0),h=await u.index("fcmSenderId").get(t);if(await u.clear(),!!h){if(i===2){const m=h;if(!m.auth||!m.p256dh||!m.endpoint)return;e={token:m.fcmToken,createTime:(l=m.createTime)!==null&&l!==void 0?l:Date.now(),subscriptionOptions:{auth:m.auth,p256dh:m.p256dh,endpoint:m.endpoint,swScope:m.swScope,vapidKey:typeof m.vapidKey=="string"?m.vapidKey:kr(m.vapidKey)}}}else if(i===3){const m=h;e={token:m.fcmToken,createTime:m.createTime,subscriptionOptions:{auth:kr(m.auth),p256dh:kr(m.p256dh),endpoint:m.endpoint,swScope:m.swScope,vapidKey:kr(m.vapidKey)}}}else if(i===4){const m=h;e={token:m.fcmToken,createTime:m.createTime,subscriptionOptions:{auth:kr(m.auth),p256dh:kr(m.p256dh),endpoint:m.endpoint,swScope:m.swScope,vapidKey:kr(m.vapidKey)}}}}}})).close(),await Qh(cf),await Qh("fcm_vapid_details_db"),await Qh("undefined"),YP(e)?e:null}function YP(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}/**
+ */const uf="fcm_token_details_db",XP=5,E0="fcm_token_object_Store";async function ZP(t){if("databases"in indexedDB&&!(await indexedDB.databases()).map(s=>s.name).includes(uf))return null;let e=null;return(await Vd(uf,XP,{upgrade:async(r,i,s,o)=>{var l;if(i<2||!r.objectStoreNames.contains(E0))return;const u=o.objectStore(E0),h=await u.index("fcmSenderId").get(t);if(await u.clear(),!!h){if(i===2){const m=h;if(!m.auth||!m.p256dh||!m.endpoint)return;e={token:m.fcmToken,createTime:(l=m.createTime)!==null&&l!==void 0?l:Date.now(),subscriptionOptions:{auth:m.auth,p256dh:m.p256dh,endpoint:m.endpoint,swScope:m.swScope,vapidKey:typeof m.vapidKey=="string"?m.vapidKey:Nr(m.vapidKey)}}}else if(i===3){const m=h;e={token:m.fcmToken,createTime:m.createTime,subscriptionOptions:{auth:Nr(m.auth),p256dh:Nr(m.p256dh),endpoint:m.endpoint,swScope:m.swScope,vapidKey:Nr(m.vapidKey)}}}else if(i===4){const m=h;e={token:m.fcmToken,createTime:m.createTime,subscriptionOptions:{auth:Nr(m.auth),p256dh:Nr(m.p256dh),endpoint:m.endpoint,swScope:m.swScope,vapidKey:Nr(m.vapidKey)}}}}}})).close(),await Yh(uf),await Yh("fcm_vapid_details_db"),await Yh("undefined"),eR(e)?e:null}function eR(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}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3660,7 +3660,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const JP="firebase-messaging-database",XP=1,Wl="firebase-messaging-store";let uf=null;function gk(){return uf||(uf=Ld(JP,XP,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Wl)}}})),uf}async function ZP(t){const e=yk(t),r=await(await gk()).transaction(Wl).objectStore(Wl).get(e);if(r)return r;{const i=await QP(t.appConfig.senderId);if(i)return await Tg(t,i),i}}async function Tg(t,e){const n=yk(t),i=(await gk()).transaction(Wl,"readwrite");return await i.objectStore(Wl).put(e,n),await i.done,e}function yk({appConfig:t}){return t.appId}/**
+ */const tR="firebase-messaging-database",nR=1,Hl="firebase-messaging-store";let df=null;function _k(){return df||(df=Vd(tR,nR,{upgrade:(t,e)=>{switch(e){case 0:t.createObjectStore(Hl)}}})),df}async function rR(t){const e=xk(t),r=await(await _k()).transaction(Hl).objectStore(Hl).get(e);if(r)return r;{const i=await ZP(t.appConfig.senderId);if(i)return await bg(t,i),i}}async function bg(t,e){const n=xk(t),i=(await _k()).transaction(Hl,"readwrite");return await i.objectStore(Hl).put(e,n),await i.done,e}function xk({appConfig:t}){return t.appId}/**
* @license
* Copyright 2017 Google LLC
*
@@ -3675,7 +3675,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const eR={"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."},Wt=new Ps("messaging","Messaging",eR);/**
+ */const iR={"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."},Ht=new Rs("messaging","Messaging",iR);/**
* @license
* Copyright 2019 Google LLC
*
@@ -3690,7 +3690,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function tR(t,e){const n=await Sg(t),r=vk(e),i={method:"POST",headers:n,body:JSON.stringify(r)};let s;try{s=await(await fetch(bg(t.appConfig),i)).json()}catch(o){throw Wt.create("token-subscribe-failed",{errorInfo:o==null?void 0:o.toString()})}if(s.error){const o=s.error.message;throw Wt.create("token-subscribe-failed",{errorInfo:o})}if(!s.token)throw Wt.create("token-subscribe-no-token");return s.token}async function nR(t,e){const n=await Sg(t),r=vk(e.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)};let s;try{s=await(await fetch(`${bg(t.appConfig)}/${e.token}`,i)).json()}catch(o){throw Wt.create("token-update-failed",{errorInfo:o==null?void 0:o.toString()})}if(s.error){const o=s.error.message;throw Wt.create("token-update-failed",{errorInfo:o})}if(!s.token)throw Wt.create("token-update-no-token");return s.token}async function rR(t,e){const r={method:"DELETE",headers:await Sg(t)};try{const s=await(await fetch(`${bg(t.appConfig)}/${e}`,r)).json();if(s.error){const o=s.error.message;throw Wt.create("token-unsubscribe-failed",{errorInfo:o})}}catch(i){throw Wt.create("token-unsubscribe-failed",{errorInfo:i==null?void 0:i.toString()})}}function bg({projectId:t}){return`${$P}/projects/${t}/registrations`}async function Sg({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 vk({p256dh:t,auth:e,endpoint:n,vapidKey:r}){const i={web:{endpoint:n,auth:e,p256dh:t}};return r!==pk&&(i.web.applicationPubKey=r),i}/**
+ */async function sR(t,e){const n=await Ig(t),r=Ek(e),i={method:"POST",headers:n,body:JSON.stringify(r)};let s;try{s=await(await fetch(Sg(t.appConfig),i)).json()}catch(o){throw Ht.create("token-subscribe-failed",{errorInfo:o==null?void 0:o.toString()})}if(s.error){const o=s.error.message;throw Ht.create("token-subscribe-failed",{errorInfo:o})}if(!s.token)throw Ht.create("token-subscribe-no-token");return s.token}async function oR(t,e){const n=await Ig(t),r=Ek(e.subscriptionOptions),i={method:"PATCH",headers:n,body:JSON.stringify(r)};let s;try{s=await(await fetch(`${Sg(t.appConfig)}/${e.token}`,i)).json()}catch(o){throw Ht.create("token-update-failed",{errorInfo:o==null?void 0:o.toString()})}if(s.error){const o=s.error.message;throw Ht.create("token-update-failed",{errorInfo:o})}if(!s.token)throw Ht.create("token-update-no-token");return s.token}async function aR(t,e){const r={method:"DELETE",headers:await Ig(t)};try{const s=await(await fetch(`${Sg(t.appConfig)}/${e}`,r)).json();if(s.error){const o=s.error.message;throw Ht.create("token-unsubscribe-failed",{errorInfo:o})}}catch(i){throw Ht.create("token-unsubscribe-failed",{errorInfo:i==null?void 0:i.toString()})}}function Sg({projectId:t}){return`${KP}/projects/${t}/registrations`}async function Ig({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 Ek({p256dh:t,auth:e,endpoint:n,vapidKey:r}){const i={web:{endpoint:n,auth:e,p256dh:t}};return r!==vk&&(i.web.applicationPubKey=r),i}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3705,7 +3705,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const iR=7*24*60*60*1e3;async function sR(t){const e=await aR(t.swRegistration,t.vapidKey),n={vapidKey:t.vapidKey,swScope:t.swRegistration.scope,endpoint:e.endpoint,auth:kr(e.getKey("auth")),p256dh:kr(e.getKey("p256dh"))},r=await ZP(t.firebaseDependencies);if(r){if(lR(r.subscriptionOptions,n))return Date.now()>=r.createTime+iR?oR(t,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await rR(t.firebaseDependencies,r.token)}catch(i){console.warn(i)}return w0(t.firebaseDependencies,n)}else return w0(t.firebaseDependencies,n)}async function oR(t,e){try{const n=await nR(t.firebaseDependencies,e),r=Object.assign(Object.assign({},e),{token:n,createTime:Date.now()});return await Tg(t.firebaseDependencies,r),n}catch(n){throw n}}async function w0(t,e){const r={token:await tR(t,e),createTime:Date.now(),subscriptionOptions:e};return await Tg(t,r),r.token}async function aR(t,e){const n=await t.pushManager.getSubscription();return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:KP(e)})}function lR(t,e){const n=e.vapidKey===t.vapidKey,r=e.endpoint===t.endpoint,i=e.auth===t.auth,s=e.p256dh===t.p256dh;return n&&r&&i&&s}/**
+ */const lR=7*24*60*60*1e3;async function cR(t){const e=await dR(t.swRegistration,t.vapidKey),n={vapidKey:t.vapidKey,swScope:t.swRegistration.scope,endpoint:e.endpoint,auth:Nr(e.getKey("auth")),p256dh:Nr(e.getKey("p256dh"))},r=await rR(t.firebaseDependencies);if(r){if(hR(r.subscriptionOptions,n))return Date.now()>=r.createTime+lR?uR(t,{token:r.token,createTime:Date.now(),subscriptionOptions:n}):r.token;try{await aR(t.firebaseDependencies,r.token)}catch(i){console.warn(i)}return k0(t.firebaseDependencies,n)}else return k0(t.firebaseDependencies,n)}async function uR(t,e){try{const n=await oR(t.firebaseDependencies,e),r=Object.assign(Object.assign({},e),{token:n,createTime:Date.now()});return await bg(t.firebaseDependencies,r),n}catch(n){throw n}}async function k0(t,e){const r={token:await sR(t,e),createTime:Date.now(),subscriptionOptions:e};return await bg(t,r),r.token}async function dR(t,e){const n=await t.pushManager.getSubscription();return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:JP(e)})}function hR(t,e){const n=e.vapidKey===t.vapidKey,r=e.endpoint===t.endpoint,i=e.auth===t.auth,s=e.p256dh===t.p256dh;return n&&r&&i&&s}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3720,7 +3720,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function _0(t){const e={from:t.from,collapseKey:t.collapse_key,messageId:t.fcmMessageId};return cR(e,t),uR(e,t),dR(e,t),e}function cR(t,e){if(!e.notification)return;t.notification={};const n=e.notification.title;n&&(t.notification.title=n);const r=e.notification.body;r&&(t.notification.body=r);const i=e.notification.image;i&&(t.notification.image=i);const s=e.notification.icon;s&&(t.notification.icon=s)}function uR(t,e){e.data&&(t.data=e.data)}function dR(t,e){var n,r,i,s,o;if(!e.fcmOptions&&!(!((n=e.notification)===null||n===void 0)&&n.click_action))return;t.fcmOptions={};const l=(i=(r=e.fcmOptions)===null||r===void 0?void 0:r.link)!==null&&i!==void 0?i:(s=e.notification)===null||s===void 0?void 0:s.click_action;l&&(t.fcmOptions.link=l);const u=(o=e.fcmOptions)===null||o===void 0?void 0:o.analytics_label;u&&(t.fcmOptions.analyticsLabel=u)}/**
+ */function T0(t){const e={from:t.from,collapseKey:t.collapse_key,messageId:t.fcmMessageId};return fR(e,t),pR(e,t),mR(e,t),e}function fR(t,e){if(!e.notification)return;t.notification={};const n=e.notification.title;n&&(t.notification.title=n);const r=e.notification.body;r&&(t.notification.body=r);const i=e.notification.image;i&&(t.notification.image=i);const s=e.notification.icon;s&&(t.notification.icon=s)}function pR(t,e){e.data&&(t.data=e.data)}function mR(t,e){var n,r,i,s,o;if(!e.fcmOptions&&!(!((n=e.notification)===null||n===void 0)&&n.click_action))return;t.fcmOptions={};const l=(i=(r=e.fcmOptions)===null||r===void 0?void 0:r.link)!==null&&i!==void 0?i:(s=e.notification)===null||s===void 0?void 0:s.click_action;l&&(t.fcmOptions.link=l);const u=(o=e.fcmOptions)===null||o===void 0?void 0:o.analytics_label;u&&(t.fcmOptions.analyticsLabel=u)}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3735,7 +3735,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function hR(t){return typeof t=="object"&&!!t&&mk in t}/**
+ */function gR(t){return typeof t=="object"&&!!t&&wk in t}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3750,7 +3750,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function fR(t){if(!t||!t.options)throw df("App Configuration Object");if(!t.name)throw df("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:n}=t;for(const r of e)if(!n[r])throw df(r);return{appName:t.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}function df(t){return Wt.create("missing-app-config-values",{valueName:t})}/**
+ */function yR(t){if(!t||!t.options)throw hf("App Configuration Object");if(!t.name)throw hf("App Name");const e=["projectId","apiKey","appId","messagingSenderId"],{options:n}=t;for(const r of e)if(!n[r])throw hf(r);return{appName:t.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}function hf(t){return Ht.create("missing-app-config-values",{valueName:t})}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3765,7 +3765,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */class pR{constructor(e,n,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=fR(e);this.firebaseDependencies={app:e,appConfig:i,installations:n,analyticsProvider:r}}_delete(){return Promise.resolve()}}/**
+ */class vR{constructor(e,n,r){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=yR(e);this.firebaseDependencies={app:e,appConfig:i,installations:n,analyticsProvider:r}}_delete(){return Promise.resolve()}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3780,7 +3780,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function mR(t){try{t.swRegistration=await navigator.serviceWorker.register(zP,{scope:BP}),t.swRegistration.update().catch(()=>{})}catch(e){throw Wt.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}/**
+ */async function wR(t){try{t.swRegistration=await navigator.serviceWorker.register(WP,{scope:HP}),t.swRegistration.update().catch(()=>{})}catch(e){throw Ht.create("failed-service-worker-registration",{browserErrorMessage:e==null?void 0:e.message})}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3795,7 +3795,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function gR(t,e){if(!e&&!t.swRegistration&&await mR(t),!(!e&&t.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw Wt.create("invalid-sw-registration");t.swRegistration=e}}/**
+ */async function _R(t,e){if(!e&&!t.swRegistration&&await wR(t),!(!e&&t.swRegistration)){if(!(e instanceof ServiceWorkerRegistration))throw Ht.create("invalid-sw-registration");t.swRegistration=e}}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3810,7 +3810,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function yR(t,e){e?t.vapidKey=e:t.vapidKey||(t.vapidKey=pk)}/**
+ */async function xR(t,e){e?t.vapidKey=e:t.vapidKey||(t.vapidKey=vk)}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3825,7 +3825,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function wk(t,e){if(!navigator)throw Wt.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw Wt.create("permission-blocked");return await yR(t,e==null?void 0:e.vapidKey),await gR(t,e==null?void 0:e.serviceWorkerRegistration),sR(t)}/**
+ */async function kk(t,e){if(!navigator)throw Ht.create("only-available-in-window");if(Notification.permission==="default"&&await Notification.requestPermission(),Notification.permission!=="granted")throw Ht.create("permission-blocked");return await xR(t,e==null?void 0:e.vapidKey),await _R(t,e==null?void 0:e.serviceWorkerRegistration),cR(t)}/**
* @license
* Copyright 2019 Google LLC
*
@@ -3840,7 +3840,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function vR(t,e,n){const r=wR(e);(await t.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[mk],message_name:n[qP],message_time:n[WP],message_device_time:Math.floor(Date.now()/1e3)})}function wR(t){switch(t){case ql.NOTIFICATION_CLICKED:return"notification_open";case ql.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
+ */async function ER(t,e,n){const r=kR(e);(await t.firebaseDependencies.analyticsProvider.get()).logEvent(r,{message_id:n[wk],message_name:n[GP],message_time:n[QP],message_device_time:Math.floor(Date.now()/1e3)})}function kR(t){switch(t){case Wl.NOTIFICATION_CLICKED:return"notification_open";case Wl.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}/**
* @license
* Copyright 2017 Google LLC
*
@@ -3855,7 +3855,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function _R(t,e){const n=e.data;if(!n.isFirebaseMessaging)return;t.onMessageHandler&&n.messageType===ql.PUSH_RECEIVED&&(typeof t.onMessageHandler=="function"?t.onMessageHandler(_0(n)):t.onMessageHandler.next(_0(n)));const r=n.data;hR(r)&&r[HP]==="1"&&await vR(t,n.messageType,r)}const x0="@firebase/messaging",E0="0.12.12";/**
+ */async function TR(t,e){const n=e.data;if(!n.isFirebaseMessaging)return;t.onMessageHandler&&n.messageType===Wl.PUSH_RECEIVED&&(typeof t.onMessageHandler=="function"?t.onMessageHandler(T0(n)):t.onMessageHandler.next(T0(n)));const r=n.data;gR(r)&&r[YP]==="1"&&await ER(t,n.messageType,r)}const b0="@firebase/messaging",S0="0.12.12";/**
* @license
* Copyright 2020 Google LLC
*
@@ -3870,7 +3870,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */const xR=t=>{const e=new pR(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),t.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",n=>_R(e,n)),e},ER=t=>{const e=t.getProvider("messaging").getImmediate();return{getToken:r=>wk(e,r)}};function kR(){ar(new zn("messaging",xR,"PUBLIC")),ar(new zn("messaging-internal",ER,"PRIVATE")),kn(x0,E0),kn(x0,E0,"esm2017")}/**
+ */const bR=t=>{const e=new vR(t.getProvider("app").getImmediate(),t.getProvider("installations-internal").getImmediate(),t.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",n=>TR(e,n)),e},SR=t=>{const e=t.getProvider("messaging").getImmediate();return{getToken:r=>kk(e,r)}};function IR(){ur(new Un("messaging",bR,"PUBLIC")),ur(new Un("messaging-internal",SR,"PRIVATE")),Sn(b0,S0),Sn(b0,S0,"esm2017")}/**
* @license
* Copyright 2020 Google LLC
*
@@ -3885,7 +3885,7 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */async function TR(){try{await q_()}catch{return!1}return typeof window<"u"&&$_()&&Cb()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
+ */async function CR(){try{await G_()}catch{return!1}return typeof window<"u"&&K_()&&Rb()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}/**
* @license
* Copyright 2017 Google LLC
*
@@ -3900,8 +3900,8 @@ This typically indicates that your device does not have a healthy Internet conne
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */function bR(t=Sm()){return TR().then(e=>{if(!e)throw Wt.create("unsupported-browser")},e=>{throw Wt.create("indexed-db-unsupported")}),ea(We(t),"messaging").getImmediate()}async function SR(t,e){return t=We(t),wk(t,e)}kR();const IR={apiKey:"AIzaSyBBitFgNKnJ_3B0aqJgbbhGL_erufKd9lk",authDomain:"mycloset1-864c4.firebaseapp.com",projectId:"mycloset1-864c4",storageBucket:"mycloset1-864c4.firebasestorage.app",messagingSenderId:"219982610263",appId:"1:219982610263:web:0ebe67d9cf0e7d2753c812"},Ig=K_(IR),Ka=nA(Ig),oe=B2(Ig),k0=typeof window<"u"?bR(Ig):null,ue="my-closet-app",Ue=({children:t,className:e="",darkMode:n,...r})=>c.jsx("div",{className:`rounded-[2rem] border transition-all duration-300 ${n?"bg-gray-800/40 border-gray-700/50 backdrop-blur-md":"bg-white/80 border-gray-200/50 backdrop-blur-md shadow-sm"} ${e}`,...r,children:t}),ou=({children:t,variant:e="default"})=>{const n={default:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300",success:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",danger:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",warning:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300"};return c.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest whitespace-nowrap ${n[e]}`,children:t})},au=({label:t,type:e="text",value:n,onChange:r,placeholder:i,required:s=!1,name:o,minLength:l,defaultValue:u})=>{const h=n!==void 0;return c.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[t&&c.jsx("label",{className:"text-sm font-black uppercase tracking-widest opacity-40 ml-1",children:t}),c.jsx("input",{type:e,name:o,...h?{value:n}:{defaultValue:u},onChange:m=>r?r(m.target.value):null,placeholder:i,required:s,minLength:l,className:"w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-indigo-500/10 font-bold bg-gray-100 dark:bg-gray-700 text-inherit transition-all"})]})},T0={PT:{loginModeIntro:"O Futuro do Teu Estilo",emailPlaceholder:"E-mail",passwordPlaceholder:"Palavra-passe",loginBtn:"ENTRAR",registerBtn:"REGISTAR",createAccount:"Criar Conta",haveAccount:"Já tenho conta",authErrorDisabled:"Este método de login está desativado na base de dados.",forgotPassword:"Esqueceu-se da palavra-passe?",forgotPasswordPrompt:"Introduza o seu e-mail para recuperar a palavra-passe:",passwordResetSent:"E-mail de recuperação enviado! Verifique a sua caixa de entrada.",sendEmailBtn:"Enviar Email",dashboard:"Painel",closet:"Armário",laundry:"Lavandaria",outfits:"Outfits",settings:"Definições",online:"Online",away:"Ausente",offline:"Offline",dailyOutfit:"Outfit Diário",noOutfitPlanned:"Nenhum Outfit Planeado",goToPlanning:"Vá ao planeamento para adicionar",onlyFavorites:"Apenas Favoritos",logout:"Sair",overview:"Visão Geral",myCloset:"O Meu Armário",outfitsAndStyle:"Outfits",readyClothes:"Roupas Prontas",inLaundry:"Na Lavandaria",myLooks:"Meus Outfits",favorites:"Favoritos",todayIn:"Hoje em Portugal",weatherUpdate:"22°C - Ensolarado",weatherCurrentAvg:"{current}°C Atual • Média {avg}°C",weatherForecastDesc:"O dia de hoje tem máximas de {max}°C e mínimas de {min}°C.",weatherMsg:"Está um dia fantástico! Recomendamos as tuas peças leves. Que tal um visual casual com as tuas sapatilhas favoritas?",exploreSuggestions:"Explorar Sugestões",topColors:"Top Cores",searchPlaceholder:"Procurar no meu guarda-roupa...",all:"Todos",tops:"Tops",bottoms:"Bottoms",footwear:"Calçado",coats:"Casacos",accessories:"Acessórios",edit:"Editar",makeDirty:"Lavar",moveToTrash:"Mover para Lixo",laundryBasket:"Cesto da Roupa",lookSentToLaundry:"Peças enviadas para a lavandaria!",laundryMsg:"Aqui encontras as peças que marcaste como sujas. Lava-as para que voltem ao armário principal.",washing:"A lavar",emptyBasket:"Cesto Vazio",createNewLook:"Criar Novo Outfit",lookName:"Nome do Outfit",selectedPieces:"Peças Selecionadas",selectPieces:"Seleciona peças...",saveLook:"Guardar Outfit",closetLabel:"Armário",lookHistory:"Histórico de Outfits",pieces:"Peças",newItem:"Novo Item",preview:"Preview",name:"Nome",category:"Categoria",color:"Cor",imageUrl:"URL da Imagem",cancel:"Cancelar",save:"Guardar",register:"Registar",yourAccount:"A Tua Conta",papMode:"Modo PAP",preferences:"Preferências",darkMode:"Modo Escuro",interfaceAppearance:"Aparência da interface",notifications:"Notificações",lookReminders:"Lembretes de outfits",weatherAlerts:"Alertas de Clima",weatherSuggestions:"Sugestões pelo tempo",systemAndData:"Sistema e Dados",appLanguage:"Idioma da Aplicação",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exportar Dados (JSON)",exportDataAlert:"Os teus dados seriam exportados agora em formato JSON.",privacyPolicy:"Política de Privacidade",recycleBin:"Reciclagem",empty:"Esvaziar",deleted:"Eliminado",criticalZone:"Zona Crítica",fullCleanActions:"Ações de limpeza total do armário.",clearAll:"Limpar Tudo",confirmDeletePerm:"Apagar permanentemente?",confirmDeleteLook:"Apagar este Outfit?",confirmEmptyTrash:"Esvaziar o lixo permanentemente?",confirmClearAll:"Mover todas as peças ativas para o lixo?",colorBlack:"Preto",colorWhite:"Branco",colorBlue:"Azul",colorRed:"Vermelho",colorGreen:"Verde",colorYellow:"Amarelo",colorPink:"Rosa",colorPurple:"Roxo",colorOrange:"Laranja",colorBrown:"Marrom",colorBeige:"Bege",colorGray:"Cinza",userTitle:"Utilizador",themeColor:"Cor do Tema",personalizeColor:"Personalizar a cor",advancedFilters:"Filtros",filterByColor:"Cor",filterByAge:"Idade da Peça",anyAge:"Qualquer Idade",lessThanMonth:"Menos de 1 Mês",lessThan6Months:"Menos de 6 Meses",lessThanYear:"Menos de 1 Ano",older:"Mais antigo",applyFilters:"Aplicar Filtros",profileInfo:"Informações da Conta",username:"Nome de Utilizador",fullName:"Nome Completo",dob:"Data de Nascimento",bio:"Bio / Sobre mim",optional:"(Opcional)",saving:"A guardar...",sections:"Secções",manageSections:"Gerir Secções",newSection:"Nova Secção",sectionName:"Nome da Secção",sectionEmoji:"Emoji",noSections:"Nenhuma secção criada ainda.",addSection:"Adicionar Secção",deleteSection:"Apagar",assignSections:"Atribuir a Secções",allSections:"Todas",confirmDeleteSection:"Apagar esta secção?",sectionPlaceholder:"Ex: Trabalho, Festa...",emojiPlaceholder:"Ex: 💼",createSection:"Criar Secção",noSectionsCreated:"Ainda não tem secções criadas",linkCopied:"Link copiado!",share:"Partilhar",piecesInLaundry:"peça(s) na lavandaria",toBeWashed:"A ser lavados",unavailable:"Indisponíveis",availableLooks:"Disponíveis",noLooksAvailable:"Nenhum outfit disponível",location:"Localidade",locationEx:"Ex: Lisboa, Portugal",ideaSuggestion:"Ideia / Sugestão",bugError:"Bug / Erro",writeMessage:"Escreva aqui a sua mensagem...",sendMessage:"Enviar Mensagem",notificationsModal:"Notificações",noNotifications:"Sem Notificações",markAllRead:"Marcar todas como lidas",lookCopiedBy:"copiou o seu outfit",userSavedLook:"guardou o seu outfit",inTheirCloset:"no armário dele!",sharedLookTitle:"Outfit Partilhado",sharedBy:"Partilhado por",includedPieces:"Peças incluídas",ignore:"Ignorar",copying:"A copiar...",copyToMyCloset:"Copiar para o meu armário",msgSentSuccess:"Mensagem enviada com sucesso!",msgSendError:"Erro ao enviar mensagem. Verifica a tua ligação.",wishlist:"Carrinho",addFuturePurchase:"Adicionar peça como compra futura",wishlistDesc:"Carrinho",someone:"alguém",feedbackTitle:"Suporte e Feedback",feedbackDesc:"Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!",themeColorTitle:"Cor do Tema",personalizeColorDesc:"Personalize a cor",saveChanges:"Guardar Alterações",pasteLink:"Colar Link",pasteSharedLookLink:"Cole o link do outfit partilhado:",invalidSharedLink:"Link inválido. Certifique-se de copiar o link completo.",planning:"Planeamento",today:"Hoje",monthLabel:"Mês",weekLabel:"Semana",chooseOutfit:"Escolher Outfit",removeOutfitDay:"Remover Outfit deste Dia",noOutfitCreated:"Nenhum outfit criado",piecesShort:"peças",editLook:"Editar Outfit",uploadGallery:"Upload da Galeria / Ficheiros",selectOneColor:"Selecione pelo menos uma cor",addColorsToItems:"Adicione cores aos seus itens.",or:"OU",cardSize:"Tamanho dos itens",cardSizeDesc:"Tamanho no armário/carrinho",small:"Pequeno",medium:"Médio",large:"Grande",defaultPage:"Página Inicial",defaultPageDesc:"Página que aparece após o login",community:"Comunidade",searchUsers:"Procurar por @username...",privateProfile:"Perfil Privado",privateProfileDesc:"Ocultar armário de outros utilizadores",viewProfile:"Ver Perfil",noUsersFound:"Nenhum utilizador encontrado",isPrivateUser:"Este perfil é privado.",userOutfits:"Outfits do Utilizador",userCloset:"Armário",usernameTaken:"Este nome de utilizador já está em uso."},EN:{loginModeIntro:"The Future of Your Style",emailPlaceholder:"Email",passwordPlaceholder:"Password",loginBtn:"LOGIN",registerBtn:"REGISTER",createAccount:"Create Account",haveAccount:"I already have an account",authErrorDisabled:"This login method is disabled in the database.",forgotPassword:"Forgot password?",forgotPasswordPrompt:"Enter your email to reset your password:",passwordResetSent:"Password reset email sent! Check your inbox.",sendEmailBtn:"Send Email",dashboard:"Dashboard",closet:"Closet",laundry:"Laundry",outfits:"Outfits",settings:"Settings",online:"Online",away:"Away",offline:"Offline",dailyOutfit:"Daily Outfit",noOutfitPlanned:"No Outfit Planned",goToPlanning:"Go to planning to add one",onlyFavorites:"Favorites Only",logout:"Logout",overview:"Overview",myCloset:"My Closet",outfitsAndStyle:"Outfits & Style",readyClothes:"Ready Clothes",inLaundry:"In Laundry",myLooks:"My Outfits",favorites:"Favorites",todayIn:"Today in Portugal",weatherUpdate:"22°C - Sunny",weatherCurrentAvg:"{current}°C Current • Average {avg}°C",weatherForecastDesc:"Today has highs of {max}°C and lows of {min}°C.",weatherMsg:"It's a fantastic day! We recommend your light pieces. How about a casual look with your favorite sneakers?",exploreSuggestions:"Explore Suggestions",topColors:"Top Colors",searchPlaceholder:"Search my wardrobe...",all:"All",tops:"Tops",bottoms:"Bottoms",footwear:"Footwear",coats:"Coats",accessories:"Accessories",edit:"Edit",makeDirty:"Make Dirty",moveToTrash:"Move to Trash",laundryBasket:"Laundry Basket",lookSentToLaundry:"Pieces sent to the laundry!",laundryMsg:"Here you find the pieces you marked as dirty. Wash them to return them to the main closet.",washing:"Washing",emptyBasket:"Empty Basket",createNewLook:"Create New Outfit",lookName:"Outfit Name",selectedPieces:"Selected Pieces",selectPieces:"Select pieces...",saveLook:"Save Outfit",closetLabel:"Closet",lookHistory:"Outfit History",pieces:"Pieces",newItem:"New Item",preview:"Preview",name:"Name",category:"Category",color:"Color",imageUrl:"Image URL",cancel:"Cancel",save:"Save",register:"Register",yourAccount:"Your Account",papMode:"PAP Mode",preferences:"Preferences",darkMode:"Dark Mode",interfaceAppearance:"Interface Appearance",notifications:"Notifications",lookReminders:"Outfit reminders",weatherAlerts:"Weather Alerts",weatherSuggestions:"Weather-based suggestions",systemAndData:"System and Data",appLanguage:"App Language",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Export Data (JSON)",exportDataAlert:"Your data would be exported now in JSON format.",privacyPolicy:"Privacy Policy",recycleBin:"Recycle Bin",empty:"Empty",deleted:"Deleted",criticalZone:"Critical Zone",fullCleanActions:"Full closet wipe actions.",clearAll:"Clear All",confirmDeletePerm:"Delete permanently?",confirmDeleteLook:"Delete this Outfit?",confirmEmptyTrash:"Empty trash permanently?",confirmClearAll:"Move all active pieces to trash?",colorBlack:"Black",colorWhite:"White",colorBlue:"Blue",colorRed:"Red",colorGreen:"Green",colorYellow:"Yellow",colorPink:"Pink",colorPurple:"Purple",colorOrange:"Orange",colorBrown:"Brown",colorBeige:"Beige",colorGray:"Gray",userTitle:"User",themeColor:"Theme Color",personalizeColor:"Personalize the color",advancedFilters:"Filters",filterByColor:"Color",filterByAge:"Item Age",anyAge:"Any Age",lessThanMonth:"Less than 1 Month",lessThan6Months:"Less than 6 Months",lessThanYear:"Less than 1 Year",older:"Older",applyFilters:"Apply Filters",profileInfo:"Account Information",username:"Username",fullName:"Full Name",dob:"Date of Birth",bio:"Bio / About me",optional:"(Optional)",saving:"Saving...",sections:"Sections",manageSections:"Manage Sections",newSection:"New Section",sectionName:"Section Name",sectionEmoji:"Emoji",noSections:"No sections created yet.",addSection:"Add Section",deleteSection:"Delete",assignSections:"Assign to Sections",allSections:"All",confirmDeleteSection:"Delete this section?",sectionPlaceholder:"E.g.: Work, Party...",emojiPlaceholder:"E.g.: 💼",createSection:"Create Section",noSectionsCreated:"No sections created yet",linkCopied:"Link copied!",share:"Share",piecesInLaundry:"piece(s) in laundry",toBeWashed:"To be washed",unavailable:"Unavailable",availableLooks:"Available",noLooksAvailable:"No outfit available",location:"Location",locationEx:"E.g.: Lisbon, Portugal",ideaSuggestion:"Idea / Suggestion",bugError:"Bug / Error",writeMessage:"Write your message here...",sendMessage:"Send Message",notificationsModal:"Notifications",noNotifications:"No Notifications",markAllRead:"Mark all as read",lookCopiedBy:"copied your outfit",userSavedLook:"saved your outfit",inTheirCloset:"in their closet!",sharedLookTitle:"Shared Outfit",sharedBy:"Shared by",includedPieces:"Included Pieces",ignore:"Ignore",copying:"Copying...",copyToMyCloset:"Copy to my closet",msgSentSuccess:"Message sent successfully!",msgSendError:"Error sending message. Check your connection.",addFuturePurchase:"Add piece as future purchase",wishlist:"Wishlist",wishlistDesc:"Wishlist",someone:"someone",feedbackTitle:"Support and Feedback",feedbackDesc:"Do you have any ideas, suggestions, or found a problem? Send a message directly to us!",themeColorTitle:"Theme Color",personalizeColorDesc:"Personalize the color",saveChanges:"Save Changes",pasteLink:"Paste Link",pasteSharedLookLink:"Paste the shared outfit link:",invalidSharedLink:"Invalid link. Make sure you copied the full link.",planning:"Planning",today:"Today",monthLabel:"Month",weekLabel:"Week",chooseOutfit:"Choose Outfit",removeOutfitDay:"Remove Outfit from this Day",noOutfitCreated:"No outfit created",piecesShort:"pieces",editLook:"Edit Outfit",uploadGallery:"Upload from Gallery / Files",selectOneColor:"Select at least one color",addColorsToItems:"Add colors to your items.",or:"OR",cardSize:"Item Size",cardSizeDesc:"Size in closet/cart",small:"Small",medium:"Medium",large:"Large",defaultPage:"Home Page",defaultPageDesc:"Page that appears after login",community:"Community",searchUsers:"Search by @username...",privateProfile:"Private Profile",privateProfileDesc:"Hide closet from other users",viewProfile:"View Profile",noUsersFound:"No users found",isPrivateUser:"This profile is private.",userOutfits:"User's Outfits",userCloset:"Closet",usernameTaken:"This username is already taken."},ES:{loginModeIntro:"El Futuro de Tu Estilo",emailPlaceholder:"Correo electrónico",passwordPlaceholder:"Contraseña",loginBtn:"ENTRAR",registerBtn:"REGISTRAR",createAccount:"Crear Cuenta",haveAccount:"Ya tengo cuenta",authErrorDisabled:"Este método de inicio de sesión está desactivado en la base de datos.",forgotPassword:"¿Olvidaste tu contraseña?",forgotPasswordPrompt:"Introduce tu correo electrónico para recuperar la contraseña:",passwordResetSent:"¡Correo de recuperación enviado! Revisa tu bandeja de entrada.",sendEmailBtn:"Enviar Correo",dashboard:"Panel",closet:"Armario",laundry:"Lavandería",outfits:"Outfits",settings:"Ajustes",online:"En línea",away:"Ausente",offline:"Desconectado",dailyOutfit:"Outfit Diario",noOutfitPlanned:"Sin Outfit Planeado",goToPlanning:"Ve a planificación para añadir",onlyFavorites:"Solo Favoritos",logout:"Cerrar Sesión",overview:"Visión General",myCloset:"Mi Armario",outfitsAndStyle:"Outfits y Estilo",readyClothes:"Ropa Lista",inLaundry:"En la Lavandería",myLooks:"Mis Outfits",favorites:"Favoritos",todayIn:"Hoy en Portugal",weatherUpdate:"22°C - Soleado",weatherCurrentAvg:"{current}°C Actual • Media {avg}°C",weatherForecastDesc:"El día de hoy tiene máximas de {max}°C y mínimas de {min}°C.",weatherMsg:"¡Es un día fantástico! Recomendamos tus piezas ligeras. ¿Qué tal un look casual con tus zapatillas favoritas?",exploreSuggestions:"Explorar Sugerencias",topColors:"Colores Principales",searchPlaceholder:"Buscar en mi guardarropa...",all:"Todos",tops:"Tops",bottoms:"Partes Inferiores",footwear:"Calzado",coats:"Abrigos",accessories:"Accesorios",edit:"Editar",makeDirty:"Ensuciar",moveToTrash:"Mover a la Papelera",laundryBasket:"Cesto de Ropa",lookSentToLaundry:"¡Piezas enviadas a la lavandería!",laundryMsg:"Aquí encuentras las piezas que marcaste como sucias. Lávalas para que vuelvan al armario principal.",washing:"Lavando",emptyBasket:"Cesto Vacío",createNewLook:"Crear Nuevo Outfit",lookName:"Nombre del Outfit",selectedPieces:"Piezas Seleccionadas",selectPieces:"Elige piezas...",saveLook:"Guardar Outfit",closetLabel:"Armario",lookHistory:"Historial de Outfits",pieces:"Piezas",newItem:"Nuevo Artículo",preview:"Vista Previa",name:"Nombre",category:"Categoría",color:"Color",imageUrl:"URL de la Imagen",cancel:"Cancelar",save:"Guardar",register:"Registrar",yourAccount:"Tu Cuenta",papMode:"Modo PAP",preferences:"Preferencias",darkMode:"Modo Oscuro",interfaceAppearance:"Apariencia de la interfaz",notifications:"Notificaciones",lookReminders:"Recordatorios de looks",weatherAlerts:"Alertas del Clima",weatherSuggestions:"Sugerencias por clima",systemAndData:"Sistema y Datos",appLanguage:"Idioma de la Aplicación",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exportar Datos (JSON)",exportDataAlert:"Tus datos se exportarían ahora en formato JSON.",privacyPolicy:"Política de Privacidad",recycleBin:"Papelera de Reciclaje",empty:"Vaciar",deleted:"Eliminado",criticalZone:"Zona Crítica",fullCleanActions:"Acciones de limpieza total.",clearAll:"Limpiar Todo",confirmDeletePerm:"¿Borrar permanentemente?",confirmDeleteLook:"¿Borrar este Outfit?",confirmEmptyTrash:"¿Vaciar la papelera permanentemente?",confirmClearAll:"¿Mover todas las piezas activas a la papelera?",colorBlack:"Negro",colorWhite:"Blanco",colorBlue:"Azul",colorRed:"Rojo",colorGreen:"Verde",colorYellow:"Amarillo",colorPink:"Rosa",colorPurple:"Morado",colorOrange:"Naranja",colorBrown:"Marrón",colorBeige:"Beige",colorGray:"Gris",userTitle:"Usuario",themeColor:"Color del Tema",personalizeColor:"Personaliza el color",advancedFilters:"Filtros",filterByColor:"Color",filterByAge:"Edad de la Prenda",anyAge:"Cualquier Edad",lessThanMonth:"Menos de 1 Mes",lessThan6Months:"Menos de 6 Meses",lessThanYear:"Menos de 1 Año",older:"Más Antiguo",applyFilters:"Aplicar Filtros",profileInfo:"Información de la Cuenta",username:"Nombre de Usuario",fullName:"Nombre Completo",dob:"Fecha de Nacimiento",bio:"Bio / Sobre mí",optional:"(Opcional)",saving:"Guardando...",sections:"Secciones",manageSections:"Gestionar Secciones",newSection:"Nueva Sección",sectionName:"Nombre de la Sección",sectionEmoji:"Emoji",noSections:"Aún no hay secciones creadas.",addSection:"Añadir Sección",deleteSection:"Eliminar",assignSections:"Asignar a Secciones",allSections:"Todas",confirmDeleteSection:"¿Eliminar esta sección?",sectionPlaceholder:"Ej: Trabajo, Fiesta...",emojiPlaceholder:"Ej: 💼",createSection:"Crear Sección",noSectionsCreated:"Aún no hay secciones creadas",linkCopied:"¡Enlace copiado!",share:"Compartir",piecesInLaundry:"pieza(s) en la lavandería",toBeWashed:"Por lavar",unavailable:"No disponibles",availableLooks:"Disponibles",noLooksAvailable:"Ningún outfit disponible",location:"Ubicación",locationEx:"Ej: Lisboa, Portugal",ideaSuggestion:"Idea / Sugerencia",bugError:"Error / Fallo",writeMessage:"Escribe aquí tu mensaje...",sendMessage:"Enviar Mensaje",notificationsModal:"Notificaciones",noNotifications:"Sin Notificaciones",markAllRead:"Marcar todas como leídas",lookCopiedBy:"copió tu outfit",userSavedLook:"guardó tu outfit",inTheirCloset:"en su armario!",sharedLookTitle:"Outfit Compartido",sharedBy:"Compartido por",includedPieces:"Piezas incluidas",ignore:"Ignorar",copying:"Copiando...",copyToMyCloset:"Copiar a mi armario",msgSentSuccess:"¡Mensaje enviado con éxito!",msgSendError:"Error al enviar. Revisa tu conexión.",addFuturePurchase:"Añadir pieza como compra futura",wishlist:"Lista de Deseos",wishlistDesc:"Lista de Deseos",someone:"alguien",feedbackTitle:"Soporte y Comentarios",feedbackDesc:"¿Tienes alguna idea, sugerencia o encontraste un problema? ¡Envíanos un mensaje directamente!",themeColorTitle:"Color del Tema",personalizeColorDesc:"Personaliza el color",saveChanges:"Guardar Cambios",pasteLink:"Pegar Enlace",pasteSharedLookLink:"Pega el enlace del outfit compartido:",invalidSharedLink:"Enlace no válido. Asegúrate de copiar el enlace completo.",planning:"Planificación",today:"Hoy",monthLabel:"Mes",weekLabel:"Semana",chooseOutfit:"Elegir Outfit",removeOutfitDay:"Quitar Outfit de este Día",noOutfitCreated:"Ningún outfit creado",piecesShort:"piezas",editLook:"Editar Outfit",uploadGallery:"Subir desde la Galería / Archivos",selectOneColor:"Selecciona al menos un color",addColorsToItems:"Añade colores a tus artículos.",or:"O",cardSize:"Tamaño de los ítems",cardSizeDesc:"Tamaño en armario/carrito",small:"Pequeño",medium:"Medio",large:"Grande",defaultPage:"Página de Inicio",defaultPageDesc:"Página que aparece después de iniciar sesión",community:"Comunidad",searchUsers:"Buscar por @username...",privateProfile:"Perfil Privado",privateProfileDesc:"Ocultar armario de otros usuarios",viewProfile:"Ver Perfil",noUsersFound:"Ningún usuario encontrado",isPrivateUser:"Este perfil es privado.",userOutfits:"Outfits del Usuario",userCloset:"Armario",usernameTaken:"Este nombre de usuario ya está en uso."},FR:{loginModeIntro:"Le Futur de Ton Style",emailPlaceholder:"E-mail",passwordPlaceholder:"Mot de passe",loginBtn:"CONNEXION",registerBtn:"S'INSCRIRE",createAccount:"Créer un Compte",haveAccount:"J'ai déjà un compte",authErrorDisabled:"Cette méthode de connexion est désactivée dans la base de données.",forgotPassword:"Mot de passe oublié ?",forgotPasswordPrompt:"Entrez votre e-mail pour réinitialiser votre mot de passe :",passwordResetSent:"E-mail de réinitialisation envoyé ! Vérifiez votre boîte de réception.",sendEmailBtn:"Envoyer l'E-mail",dashboard:"Tableau de bord",closet:"Placard",laundry:"Blanchisserie",outfits:"Tenues",settings:"Paramètres",online:"En ligne",away:"Absent",offline:"Hors ligne",dailyOutfit:"Tenue du Jour",noOutfitPlanned:"Aucune Tenue Prévue",goToPlanning:"Allez dans planification pour ajouter",onlyFavorites:"Favoris Uniquement",logout:"Déconnexion",overview:"Vue d'ensemble",myCloset:"Mon Placard",outfitsAndStyle:"Tenues & Style",readyClothes:"Vêtements Prêts",inLaundry:"À la Blanchisserie",myLooks:"Mes Outfits",favorites:"Favoris",todayIn:"Aujourd'hui au Portugal",weatherUpdate:"22°C - Ensoleillé",weatherCurrentAvg:"{current}°C Actuel • Moyenne {avg}°C",weatherForecastDesc:"Aujourd'hui a des maximales de {max}°C et des minimales de {min}°C.",weatherMsg:"C'est une journée fantastique ! Nous recommandons vos pièces légères. Que diriez-vous d'un look décontracté avec vos baskets préférées ?",exploreSuggestions:"Explorer les Suggestions",topColors:"Couleurs Principales",searchPlaceholder:"Chercher dans ma garde-robe...",all:"Tout",tops:"Hauts",bottoms:"Bas",footwear:"Chaussures",coats:"Manteaux",accessories:"Accessoires",edit:"Modifier",makeDirty:"Salir",moveToTrash:"Mettre à la corbeille",laundryBasket:"Panier à linge",lookSentToLaundry:"Pièces envoyées à la blanchisserie !",laundryMsg:"Ici vous trouvez les pièces que vous avez marquées comme sales. Lavez-les pour les remettre dans le placard principal.",washing:"En lavage",emptyBasket:"Panier Vide",createNewLook:"Créer un Nouvel Outfit",lookName:"Nom de l'Outfit",selectedPieces:"Pièces Sélectionnées",selectPieces:"Sélectionnez des pièces...",saveLook:"Enregistrer l'Outfit",closetLabel:"Placard",lookHistory:"Historique des Outfits",pieces:"Pièces",newItem:"Nouvel Article",preview:"Aperçu",name:"Nom",category:"Catégorie",color:"Couleur",imageUrl:"URL de l'image",cancel:"Annuler",save:"Enregistrer",register:"S'inscrire",yourAccount:"Votre Compte",papMode:"Mode PAP",preferences:"Préférences",darkMode:"Mode Sombre",interfaceAppearance:"Apparence de l'interface",notifications:"Notifications",lookReminders:"Rappels d'outfits",weatherAlerts:"Alertes Météo",weatherSuggestions:"Suggestions selon la météo",systemAndData:"Système et Données",appLanguage:"Langue de l'application",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exporter les Données (JSON)",exportDataAlert:"Vos données seraient exportées maintenant au format JSON.",privacyPolicy:"Politique de Confidentialité",recycleBin:"Corbeille",empty:"Vider",deleted:"Supprimé",criticalZone:"Zone Critique",fullCleanActions:"Actions de nettoyage total.",clearAll:"Tout Effacer",confirmDeletePerm:"Supprimer définitivement ?",confirmDeleteLook:"Supprimer cet Outfit ?",confirmEmptyTrash:"Vider la corbeille définitivement ?",confirmClearAll:"Déplacer toutes les pièces actives vers la corbeille ?",colorBlack:"Noir",colorWhite:"Blanc",colorBlue:"Bleu",colorRed:"Rouge",colorGreen:"Vert",colorYellow:"Jaune",colorPink:"Rose",colorPurple:"Violet",colorOrange:"Orange",colorBrown:"Marron",colorBeige:"Beige",colorGray:"Gris",userTitle:"Utilisateur",themeColor:"Couleur du Thème",personalizeColor:"Personnaliser la couleur",advancedFilters:"Filtres",filterByColor:"Couleur",filterByAge:"Âge de l'article",anyAge:"Tout âge",lessThanMonth:"Moins d'un mois",lessThan6Months:"Moins de 6 mois",lessThanYear:"Moins d'un an",older:"Plus ancien",applyFilters:"Appliquer les filtres",profileInfo:"Informations du Compte",username:"Nom d'utilisateur",fullName:"Nom Complet",dob:"Date de Naissance",bio:"Bio / À propos",optional:"(Optionnel)",saving:"Enregistrement...",sections:"Sections",manageSections:"Gérer les Sections",newSection:"Nouvelle Section",sectionName:"Nom de la Section",sectionEmoji:"Emoji",noSections:"Aucune section créée pour l'instant.",addSection:"Ajouter une Section",deleteSection:"Supprimer",assignSections:"Attribuer aux Sections",allSections:"Toutes",confirmDeleteSection:"Supprimer cette section ?",sectionPlaceholder:"Ex: Travail, Fête...",emojiPlaceholder:"Ex: 💼",createSection:"Créer une Section",noSectionsCreated:"Aucune section créée",linkCopied:"Lien copié !",share:"Partager",piecesInLaundry:"pièce(s) à la blanchisserie",toBeWashed:"À laver",unavailable:"Indisponibles",availableLooks:"Disponibles",noLooksAvailable:"Aucun outfit disponible",location:"Emplacement",locationEx:"Ex: Lisbonne, Portugal",ideaSuggestion:"Idée / Suggestion",bugError:"Bug / Erreur",writeMessage:"Écrivez votre message ici...",sendMessage:"Envoyer le Message",notificationsModal:"Notifications",noNotifications:"Aucune Notification",markAllRead:"Tout marquer comme lu",lookCopiedBy:"a copié votre outfit",userSavedLook:"a sauvegardé votre outfit",inTheirCloset:"dans son placard !",sharedLookTitle:"Outfit Partagé",sharedBy:"Partagé par",includedPieces:"Pièces incluses",ignore:"Ignorer",copying:"Copie en cours...",copyToMyCloset:"Copier dans mon placard",msgSentSuccess:"Message envoyé avec succès !",msgSendError:"Erreur d'envoi. Vérifiez votre connexion.",addFuturePurchase:"Ajouter comme achat futur",wishlist:"Liste de Souhaits",wishlistDesc:"Liste de Souhaits",someone:"quelqu'un",feedbackTitle:"Support et Commentaires",feedbackDesc:"Avez-vous des idées, des suggestions ou trouvé un problème ? Envoyez-nous un message directement !",themeColorTitle:"Couleur du Thème",personalizeColorDesc:"Personnaliser la couleur",saveChanges:"Enregistrer les Modifications",pasteLink:"Coller le Lien",pasteSharedLookLink:"Collez le lien de l'outfit partagé :",invalidSharedLink:"Lien invalide. Assurez-vous d'avoir copié le lien complet.",planning:"Planification",today:"Aujourd'hui",monthLabel:"Mois",weekLabel:"Semaine",chooseOutfit:"Choisir un Outfit",removeOutfitDay:"Retirer l'Outfit de ce Jour",noOutfitCreated:"Aucun outfit créé",piecesShort:"pièces",editLook:"Modifier l'Outfit",uploadGallery:"Télécharger depuis la Galerie / Fichiers",selectOneColor:"Sélectionnez au moins une couleur",addColorsToItems:"Ajoutez des couleurs à vos articles.",or:"OU",cardSize:"Taille des articles",cardSizeDesc:"Taille dans placard/panier",small:"Petit",medium:"Moyen",large:"Grand",defaultPage:"Page d'Accueil",defaultPageDesc:"Page qui apparaît après la connexion",community:"Communauté",searchUsers:"Rechercher par @username...",privateProfile:"Profil Privé",privateProfileDesc:"Cacher le placard aux autres utilisateurs",viewProfile:"Voir le Profil",noUsersFound:"Aucun utilisateur trouvé",isPrivateUser:"Ce profil est privé.",userOutfits:"Outfits de l'Utilisateur",userCloset:"Placard",usernameTaken:"Ce nom d'utilisateur est déjà utilisé."},DE:{loginModeIntro:"Die Zukunft deines Stils",emailPlaceholder:"E-Mail",passwordPlaceholder:"Passwort",loginBtn:"ANMELDEN",registerBtn:"REGISTRIEREN",createAccount:"Konto Erstellen",haveAccount:"Ich habe bereits ein Konto",authErrorDisabled:"Diese Anmeldemethode ist in der Datenbank deaktiviert.",forgotPassword:"Passwort vergessen?",forgotPasswordPrompt:"Gib deine E-Mail-Adresse ein, um dein Passwort zurückzusetzen:",passwordResetSent:"E-mail zum Zurücksetzen des Passworts gesendet! Überprüfe deinen Posteingang.",sendEmailBtn:"E-Mail Senden",dashboard:"Startseite",closet:"Schrank",laundry:"Wäsche",outfits:"Outfits",settings:"Einstellungen",online:"Online",away:"Abwesend",offline:"Offline",dailyOutfit:"Tägliches Outfit",noOutfitPlanned:"Kein Outfit Geplant",goToPlanning:"Gehen Sie zur Planung, um eins hinzuzufügen",onlyFavorites:"Nur Favoriten",logout:"Abmelden",overview:"Übersicht",myCloset:"Mein Schrank",outfitsAndStyle:"Outfits & Stil",readyClothes:"Fertige Kleidung",inLaundry:"In der Wäsche",myLooks:"Meine Outfits",favorites:"Favoriten",todayIn:"Heute in Portugal",weatherUpdate:"22°C - Sonnig",weatherCurrentAvg:"{current}°C Aktuell • Durchschnitt {avg}°C",weatherForecastDesc:"Der heutige Tag hat Höchstwerte von {max}°C und Tiefstwerte von {min}°C.",weatherMsg:"Es ist ein fantastischer Tag! Wir empfehlen leichte Stücke. Wie wäre es mit einem lässigen Look mit deinen Lieblings-Sneakern?",exploreSuggestions:"Vorschläge entdecken",topColors:"Top Farben",searchPlaceholder:"In meiner Garderobe suchen...",all:"Alle",tops:"Oberteile",bottoms:"Unterteile",footwear:"Schuhe",coats:"Mäntel",accessories:"Accessoires",edit:"Bearbeiten",makeDirty:"Schmutzig machen",moveToTrash:"In den Papierkorb verschieben",laundryBasket:"Wäschekorb",lookSentToLaundry:"Stücke in die Wäsche geschickt!",laundryMsg:"Hier findest du die Stücke, die du als schmutzig markiert hast. Wasche sie, um sie in den Hauptschrank zurückzulegen.",washing:"Waschen",emptyBasket:"Leerer Korb",createNewLook:"Neues Outfit erstellen",lookName:"Outfit Name",selectedPieces:"Ausgewählte Stücke",selectPieces:"Stücke auswählen...",saveLook:"Outfit speichern",closetLabel:"Schrank",lookHistory:"Outfit-Verlauf",pieces:"Stücke",newItem:"Neuer Artikel",preview:"Vorschau",name:"Name",category:"Kategorie",color:"Farbe",imageUrl:"Bild-URL",cancel:"Abbrechen",save:"Speichern",register:"Registrieren",yourAccount:"Dein Konto",papMode:"PAP-Modus",preferences:"Präferenzen",darkMode:"Dunkelmodus",interfaceAppearance:"Erscheinungsbild der Schnittstelle",notifications:"Benachrichtigungen",lookReminders:"Outfit-Erinnerungen",weatherAlerts:"Wetterwarnungen",weatherSuggestions:"Wetterbasierte Vorschläge",systemAndData:"System und Daten",appLanguage:"App-Sprache",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Daten exportieren (JSON)",exportDataAlert:"Deine Daten würden jetzt im JSON-Format exportiert werden.",privacyPolicy:"Datenschutzrichtlinie",recycleBin:"Papierkorb",empty:"Leeren",deleted:"Gelöscht",criticalZone:"Kritische Zone",fullCleanActions:"Aktionen zur vollständigen Bereinigung.",clearAll:"Alles löschen",confirmDeletePerm:"Dauerhaft löschen?",confirmDeleteLook:"Dieses Outfit löschen?",confirmEmptyTrash:"Papierkorb dauerhaft leeren?",confirmClearAll:"Alle aktiven Stücke in den Papierkorb verschieben?",colorBlack:"Schwarz",colorWhite:"Weiß",colorBlue:"Blau",colorRed:"Rot",colorGreen:"Grün",colorYellow:"Gelb",colorPink:"Rosa",colorPurple:"Lila",colorOrange:"Orange",colorBrown:"Braun",colorBeige:"Beige",colorGray:"Grau",userTitle:"Benutzer",themeColor:"Themenfarbe",personalizeColor:"Farbe anpassen",advancedFilters:"Filter",filterByColor:"Farbe",filterByAge:"Artikelalter",anyAge:"Jedes Alter",lessThanMonth:"Weniger als 1 Monat",lessThan6Months:"Weniger als 6 Monate",lessThanYear:"Weniger als 1 Jahr",older:"Älter",applyFilters:"Filter anwenden",profileInfo:"Kontoinformationen",username:"Benutzername",fullName:"Vollständiger Name",dob:"Geburtsdatum",bio:"Biografie / Über mich",optional:"(Optional)",saving:"Speichern...",sections:"Bereiche",manageSections:"Bereiche verwalten",newSection:"Neuer Bereich",sectionName:"Bereichsname",sectionEmoji:"Emoji",noSections:"Noch keine Bereiche erstellt.",addSection:"Bereich hinzufügen",deleteSection:"Löschen",assignSections:"Bereichen zuweisen",allSections:"Alle",confirmDeleteSection:"Diesen Bereich löschen?",sectionPlaceholder:"Zb: Arbeit, Party...",emojiPlaceholder:"Zb: 💼",createSection:"Bereich erstellen",noSectionsCreated:"Noch keine Bereiche erstellt",linkCopied:"Link kopiert!",share:"Teilen",piecesInLaundry:"Stück(e) in der Wäsche",toBeWashed:"Zum Waschen",unavailable:"Nicht verfügbar",availableLooks:"Verfügbar",noLooksAvailable:"Kein Outfit verfügbar",location:"Ort",locationEx:"Z.B.: Lissabon, Portugal",ideaSuggestion:"Idee / Vorschlag",bugError:"Fehler / Bug",writeMessage:"Schreibe hier deine Nachricht...",sendMessage:"Nachricht Senden",notificationsModal:"Benachrichtigungen",noNotifications:"Keine Benachrichtigungen",markAllRead:"Alle als gelesen markieren",lookCopiedBy:"hat dein Outfit kopiert",userSavedLook:"hat dein Outfit gespeichert",inTheirCloset:"in seinem Schrank!",sharedLookTitle:"Geteiltes Outfit",sharedBy:"Geteilt von",includedPieces:"Enthaltene Stücke",ignore:"Ignorieren",copying:"Kopieren...",copyToMyCloset:"In meinen Schrank kopieren",msgSentSuccess:"Nachricht erfolgreich gesendet!",msgSendError:"Fehler beim Senden. Überprüfe deine Verbindung.",addFuturePurchase:"Als zukünftigen Kauf hinzufügen",wishlist:"Wunschzettel",wishlistDesc:"Wunschzettel",someone:"jemand",feedbackTitle:"Support und Feedback",feedbackDesc:"Hast du Ideen, Vorschläge oder ein Problem gefunden? Sende uns direkt eine Nachricht!",themeColorTitle:"Themenfarbe",personalizeColorDesc:"Farbe anpassen",saveChanges:"Änderungen Speichern",pasteLink:"Link Einfügen",pasteSharedLookLink:"Fügen Sie den Link zum geteilten Outfit ein:",invalidSharedLink:"Ungültiger Link. Stellen Sie sicher, dass Sie den vollständigen Link kopiert haben.",planning:"Planung",today:"Heute",monthLabel:"Monat",weekLabel:"Woche",chooseOutfit:"Outfit Wählen",removeOutfitDay:"Outfit von diesem Tag entfernen",noOutfitCreated:"Kein Outfit erstellt",piecesShort:"Stücke",editLook:"Outfit bearbeiten",uploadGallery:"Aus Galerie / Dateien hochladen",selectOneColor:"Wählen Sie mindestens eine Farbe",addColorsToItems:"Fügen Sie Ihren Artikeln Farben hinzu.",or:"ODER",cardSize:"Artikelgröße",cardSizeDesc:"Größe in Schrank/Warenkorb",small:"Klein",medium:"Mittel",large:"Groß",defaultPage:"Startseite",defaultPageDesc:"Seite, die nach der Anmeldung angezeigt wird",community:"Gemeinschaft",searchUsers:"Nach @username suchen...",privateProfile:"Privates Profil",privateProfileDesc:"Kleiderschrank vor anderen Benutzern verbergen",viewProfile:"Profil anzeigen",noUsersFound:"Keine Benutzer gefunden",isPrivateUser:"Dieses Profil ist privat.",userOutfits:"Outfits des Benutzers",userCloset:"Kleiderschrank",usernameTaken:"Dieser Benutzername ist bereits vergeben."}};function CR(){var Nt,Aa,Na,vr,a,d,f,y,P,O,G,Ee,et,ge,at,lt,wr,Zt,ns;const[t,e]=q.useState("auth"),[n,r]=q.useState(null),[i,s]=q.useState(!0),[o,l]=q.useState([]),[u,h]=q.useState([]),[m,v]=q.useState(null),[g,N]=q.useState(!1),[D,L]=q.useState(""),[B,I]=q.useState(""),[k,C]=q.useState([]),[V,Q]=q.useState(window.innerWidth>768),[H,T]=q.useState("login"),[w,x]=q.useState(""),[S,A]=q.useState(!1),[R,b]=q.useState(""),[Xe,Sn]=q.useState("Todos"),[Gt,Qt]=q.useState(""),[Y,ae]=q.useState("any"),[se,Ce]=q.useState(!1),[Te,Ae]=q.useState(!1),[Qe,At]=q.useState([]),[Ve,Yt]=q.useState(null),[F,oa]=q.useState({}),[Ui,Wr]=q.useState(!1),[zi,Bi]=q.useState(!0),[qn,Os]=q.useState("08:00"),[dr,pc]=q.useState(!1),[aa,Ls]=q.useState(""),[Hr,Ms]=q.useState(!0),[yt,Kr]=q.useState("PT"),[la,$i]=q.useState(!1),[Ke,Ze]=q.useState("theme-indigo"),[In,ca]=q.useState("large"),[mc,ua]=q.useState("dashboard"),[vt,da]=q.useState(null),[Vs,Fs]=q.useState(!1),[Us,gc]=q.useState("online"),[Gr,ha]=q.useState(""),[Qr,Yr]=q.useState(!1),[zs,Jr]=q.useState([]),[Ne,fa]=q.useState(null),[st,Bs]=q.useState(null),[qi,Wi]=q.useState(!1),[Fe,pa]=q.useState([]),[hr,Xr]=q.useState([]),[Zr,$s]=q.useState(null),[an,qs]=q.useState(null),yc=q.useRef(""),[ot,Hi]=q.useState(null),[ma,fr]=q.useState(!1),[Cn,ga]=q.useState(!1),[Ws,Hs]=q.useState(null),[ln,ya]=q.useState([]),[Jt,va]=q.useState("all"),[Ks,pr]=q.useState(!1),[ei,ti]=q.useState(""),[mr,wa]=q.useState(""),[ni,Gs]=q.useState([]),[gr,Qs]=q.useState([]),[Ki,Gi]=q.useState(null),[Qi,Ys]=q.useState(""),[rh,vc]=q.useState(""),[Wn,wc]=q.useState([]),[ih,An]=q.useState(!1),[yn,Pe]=q.useState(null),[Nn,_c]=q.useState("month"),[xe,ri]=q.useState(new Date),[Pn,Yi]=q.useState([]),[sh,Js]=q.useState(!1),[oh,Xs]=q.useState(!1),[ii,ah]=q.useState(null),_=p=>{var E;return((E=T0[yt])==null?void 0:E[p])||T0.PT[p]||p},Hn={Vermelho:"#ef4444",Azul:"#3b82f6",Amarelo:"#eab308",Verde:"#22c55e",Laranja:"#f97316",Roxo:"#a855f7",Branco:"#f8fafc",Preto:"#0f172a",Cinzento:"#6b7280",Bege:"#d4b896"},xc=p=>{if(!p)return{backgroundColor:"#e5e7eb"};const j=p.split(",").map(z=>z.trim()).filter(Boolean).map(z=>Hn[z]||z.toLowerCase());return j.length===1?{backgroundColor:j[0]}:{background:`linear-gradient(135deg, ${j.join(", ")})`}},wt=async(p,E)=>{if(n)try{const j=De(oe,"artifacts",ue,"users",n.uid,"profile","data");if(await ss(j,{settings:{[p]:E}},{merge:!0}),p==="isPrivate"){const z=De(oe,"artifacts",ue,"publicProfiles",n.uid);await ss(z,{isPrivate:E,uid:n.uid},{merge:!0})}}catch(j){console.error("Error saving setting:",j)}},Zs=p=>{N(p),wt("darkMode",p)},si=p=>{Ze(p),wt("theme",p)},lh=p=>{Kr(p),wt("language",p),$i(!1)},ch=p=>{Bi(p),wt("notificationsEnabled",p)},uh=async p=>{if(p)if("Notification"in window){if(await Notification.requestPermission()!=="granted"){alert("Permissão recusada. Ative as notificações no browser para usar esta funcionalidade.");return}if(k0)try{const j="BM55REBdX3g7x4JT7C6sN0uBDLATqsCnvgvx3mJnVmgU2dFvZL1przcV-V-Kl50Ao6-i8OA-5PZFWTuhETL9-v4";if(j){const z=await SR(k0,{vapidKey:j});z&&wt("fcmToken",z)}}catch(j){console.error("Erro ao obter token FCM:",j)}}else{alert("O seu browser não suporta notificações.");return}pc(p),wt("dailyOutfitNotifEnabled",p)},Kn=p=>{Ms(p),wt("weatherAlerts",p)},dh=p=>{ca(p),wt("cardSize",p)},hh=p=>{ua(p),wt("defaultPage",p)},eo=p=>{Fs(p),wt("isPrivate",p)},to=p=>{p.stopPropagation(),p.preventDefault();const E=["online","away","offline"],j=E.indexOf(Us),z=E[(j+1)%E.length];gc(z),wt("status",z)},_a=async p=>{if(p)try{const E=De(oe,"artifacts",ue,"sharedLooks",p),j=await sf(E);j.exists()&&(Hi({id:j.id,...j.data()}),fr(!0),window.history.replaceState({},"",window.location.pathname))}catch(E){console.error("Erro ao buscar look partilhado:",E)}},Ji=()=>{const p=window.prompt(_("pasteSharedLookLink")||"Cole o link do look partilhado:");if(p)try{const j=new URL(p).searchParams.get("shared");j?_a(j):alert(_("invalidSharedLink")||"Link inválido. Certifique-se de copiar o link completo.")}catch{alert(_("invalidSharedLink")||"Link inválido. Certifique-se de copiar o link completo.")}};q.useEffect(()=>{m&&m.color?C(m.color.split(",").map(p=>p.trim()).filter(Boolean)):C([]),Gs((m==null?void 0:m.sections)||[])},[m]),q.useEffect(()=>{const p=()=>{window.innerWidth<768?Q(!1):Q(!0)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]),q.useEffect(()=>{Qs((Ve==null?void 0:Ve.sections)||[])},[Ve]),q.useEffect(()=>{document.documentElement.classList.remove("theme-indigo","theme-rose","theme-emerald","theme-amber","theme-slate");const p=t==="auth"?"theme-indigo":Ke;document.documentElement.classList.add(p),t!=="auth"&&(n!=null&&n.uid)&&localStorage.setItem(`app-theme-${n.uid}`,Ke)},[Ke,t,n==null?void 0:n.uid]),q.useEffect(()=>{(async()=>{})();const E=qI(Ka,async j=>{if(!j)r(null),l([]),h([]),ya([]),oa({}),N(!1),Ze("theme-indigo"),Kr("PT"),Bi(!0),Ms(!0),da(null),e("auth"),s(!1);else{const z=localStorage.getItem(`app-theme-${j.uid}`)||"theme-indigo";Ze(z),r(j);try{const J=De(oe,"artifacts",ue,"users",j.uid,"profile","data"),te=await sf(J);let X="dashboard";if(te.exists()){const ne=te.data();ne.settings&&ne.settings.defaultPage&&(X=ne.settings.defaultPage==="planning"?"planner":ne.settings.defaultPage,ua(X))}e(X)}catch{e("dashboard")}const M=yc.current||new URLSearchParams(window.location.search).get("shared");yc.current="",M&&_a(M),s(!1)}});return()=>E()},[]),q.useEffect(()=>{if(!n)return;const p=tt(oe,"artifacts",ue,"users",n.uid,"clothes"),E=co(p,Ie=>{l(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),j=tt(oe,"artifacts",ue,"users",n.uid,"looks"),z=co(j,Ie=>{h(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),M=tt(oe,"artifacts",ue,"users",n.uid,"sections"),J=co(M,Ie=>{ya(Ie.docs.map(K=>({id:K.id,...K.data()})).sort((K,Pt)=>K.createdAt-Pt.createdAt))},Ie=>console.error(Ie)),te=tt(oe,"artifacts",ue,"users",n.uid,"outfitPlans"),X=co(te,Ie=>{Yi(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),ne=De(oe,"artifacts",ue,"users",n.uid,"profile","data"),ke=co(ne,Ie=>{if(Ie.exists()){const K=Ie.data();oa(K),K.settings&&(K.settings.language!==void 0&&Kr(K.settings.language),K.settings.darkMode!==void 0&&N(K.settings.darkMode),K.settings.theme!==void 0&&Ze(K.settings.theme),K.settings.notificationsEnabled!==void 0&&Bi(K.settings.notificationsEnabled),K.settings.dailyOutfitTime!==void 0&&Os(K.settings.dailyOutfitTime),K.settings.dailyOutfitNotifEnabled!==void 0&&pc(K.settings.dailyOutfitNotifEnabled),K.settings.lastNotifiedDate!==void 0&&Ls(K.settings.lastNotifiedDate),K.settings.weatherAlerts!==void 0&&Ms(K.settings.weatherAlerts),K.settings.cardSize!==void 0&&ca(K.settings.cardSize),K.settings.defaultPage!==void 0&&ua(K.settings.defaultPage==="planning"?"planner":K.settings.defaultPage),K.settings.isPrivate!==void 0&&Fs(K.settings.isPrivate),K.settings.status!==void 0&&gc(K.settings.status))}else oa({})},Ie=>console.error(Ie)),_t=tt(oe,"artifacts",ue,"inboxNotifications"),ct=d0(_t,h0("recipientUid","==",n.uid)),xt=co(ct,Ie=>{wc(Ie.docs.map(K=>({id:K.id,...K.data()})).sort((K,Pt)=>Pt.createdAt-K.createdAt))},Ie=>console.error("Notif listener error:",Ie));return()=>{E(),z(),J(),ke(),xt(),X()}},[n]);const Xi=p=>p===0?"☀️":[1,2,3].includes(p)?"⛅":[45,48].includes(p)?"🌫️":[51,53,55,56,57,61,63,65,66,67].includes(p)?"🌧️":[71,73,75,77,85,86].includes(p)?"❄️":[80,81,82].includes(p)?"🌦️":[95,96,99].includes(p)?"⛈️":"☀️";q.useEffect(()=>{if(!n)return;(async()=>{try{const E=(F==null?void 0:F.location)||"Lisboa, Portugal",z=await(await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(E)}&count=1&language=pt&format=json`)).json();if(z.results&&z.results.length>0){const{latitude:M,longitude:J,name:te,country:X}=z.results[0],ke=await(await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${M}&longitude=${J}¤t_weather=true&daily=temperature_2m_max,temperature_2m_min,weathercode&timezone=auto`)).json();if(ke.current_weather&&ke.daily){const _t=ke.daily.time.map((ct,xt)=>({date:ct,min:Math.round(ke.daily.temperature_2m_min[xt]),max:Math.round(ke.daily.temperature_2m_max[xt]),weathercode:ke.daily.weathercode[xt]}));da({name:`${te}, ${X||""}`.replace(/,\s*$/,""),currentTemp:Math.round(ke.current_weather.temperature),minTemp:Math.round(ke.daily.temperature_2m_min[0]),maxTemp:Math.round(ke.daily.temperature_2m_max[0]),avgTemp:Math.round((ke.daily.temperature_2m_min[0]+ke.daily.temperature_2m_max[0])/2),forecast:_t})}}}catch(E){console.error("Error fetching weather",E)}})()},[F==null?void 0:F.location,n]),q.useEffect(()=>{var p;if(n&&F){const E=De(oe,"artifacts",ue,"publicProfiles",n.uid);ss(E,{uid:n.uid,username:F.username||"",fullName:F.fullName||"",avatar:F.avatar||null,isPrivate:((p=F.settings)==null?void 0:p.isPrivate)||!1,location:F.location||""},{merge:!0}).catch(j=>{console.error("Erro ao sincronizar perfil público:",j),j.code==="permission-denied"&&alert("Aviso: O seu perfil não ficou visível na comunidade devido a regras de segurança do Firebase (permission-denied).")})}},[n,F==null?void 0:F.username,F==null?void 0:F.fullName,F==null?void 0:F.avatar,(Nt=F==null?void 0:F.settings)==null?void 0:Nt.isPrivate,F==null?void 0:F.location]),q.useEffect(()=>{if(t!=="community")return;(async()=>{try{const E=tt(oe,"artifacts",ue,"publicProfiles"),z=(await su(E)).docs.map(M=>M.data()).filter(M=>M.uid!==(n==null?void 0:n.uid));if(Qr){const M=te=>te?te.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim():"",J=M(F==null?void 0:F.location);Jr(J?z.filter(te=>M(te.location)===J):[])}else if(Gr.trim()){let M=Gr.trim().toLowerCase();M.startsWith("@")&&(M=M.substring(1)),Jr(z.filter(J=>(J.username?J.username.toLowerCase():"").includes(M)))}else Jr([])}catch(E){console.error("Erro ao buscar comunidade",E),alert("Erro ao carregar comunidade: "+E.message)}})()},[t,Gr,Qr,n==null?void 0:n.uid,F==null?void 0:F.location]);const Ec=async p=>{if(fa(p),p.isPrivate){pa([]),Xr([]),Bs(null);return}try{const E=tt(oe,"artifacts",ue,"users",p.uid,"clothes"),j=await su(E);pa(j.docs.map(X=>({id:X.id,...X.data()})).filter(X=>X.status!=="trash"));const z=tt(oe,"artifacts",ue,"users",p.uid,"looks"),M=await su(z);Xr(M.docs.map(X=>({id:X.id,...X.data()})));const J=De(oe,"artifacts",ue,"users",p.uid,"profile","data"),te=await sf(J);te.exists()?Bs(te.data()):Bs({})}catch(E){console.error("Erro ao carregar perfil do utilizador",E)}},Rn=q.useMemo(()=>o.filter(p=>p.status==="active"),[o]),Re=q.useMemo(()=>o.filter(p=>p.status==="laundry"),[o]),xa=q.useMemo(()=>o.filter(p=>p.status==="trash"),[o]),fh=q.useMemo(()=>o.filter(p=>p.status==="wishlist"),[o]),kc=q.useMemo(()=>o.filter(p=>{const E=p.status!=="trash",j=Jt==="all"||p.sections&&p.sections.includes(Jt);return E&&j}),[o,Jt]),Ea=async()=>{if(!Qi.trim()||!n||!Ki)return;const p=De(oe,"artifacts",ue,"users",n.uid,"sections",Ki);await Yn(p,{name:Qi.trim(),emoji:rh.trim()||"💼"}),Gi(null),Ys(""),vc("")},ka=async()=>{if(!ei.trim()||!n)return;const p=tt(oe,"artifacts",ue,"users",n.uid,"sections");await Jn(p,{name:ei.trim(),emoji:mr.trim()||"💼",createdAt:new Date().getTime()}),ti(""),wa("")},no=async p=>{if(!window.confirm(_("confirmDeleteSection")))return;const E=De(oe,"artifacts",ue,"users",n.uid,"sections",p);await Wa(E);const j=Ha(oe);o.forEach(z=>{if(z.sections&&z.sections.includes(p)){const M=De(oe,"artifacts",ue,"users",n.uid,"clothes",z.id);j.update(M,{sections:z.sections.filter(J=>J!==p)})}}),u.forEach(z=>{if(z.sections&&z.sections.includes(p)){const M=De(oe,"artifacts",ue,"users",n.uid,"looks",z.id);j.update(M,{sections:z.sections.filter(J=>J!==p)})}}),await j.commit(),Jt===p&&va("all")},Ta=async(p,E)=>{if(!n)return;const j=De(oe,"artifacts",ue,"users",n.uid,"outfitPlans",p),z=Pn.find(J=>J.date===p);let M=[];if(z&&(M=z.lookIds||(z.lookId?[z.lookId]:[])),E===null){await Wa(j);return}M.includes(E)?M=M.filter(J=>J!==E):M=[...M,E],M.length>0?await ss(j,{date:p,lookIds:M,updatedAt:new Date().getTime()},{merge:!0}):await Wa(j)},Xt=new Date;Xt.setHours(0,0,0,0);const ba=`${Xt.getFullYear()}-${String(Xt.getMonth()+1).padStart(2,"0")}-${String(Xt.getDate()).padStart(2,"0")}`,Sa=p=>{const E=Pn.find(z=>z.date===p);return E?(E.lookIds||(E.lookId?[E.lookId]:[])).map(z=>u.find(M=>M.id===z)).filter(Boolean):[]},oi=Sa(ba);q.useEffect(()=>{if(!n||!dr||!qn)return;console.log("[Daily Outfit] Notification system initialized. Scheduled for:",qn);const p=setInterval(()=>{var z;const E=new Date,j=`${E.getFullYear()}-${String(E.getMonth()+1).padStart(2,"0")}-${String(E.getDate()).padStart(2,"0")}`;if(console.log(`[Daily Outfit] Checking... Time now: ${E.getHours()}:${E.getMinutes()}, Scheduled: ${qn}. Last notified: ${aa}`),aa!==j){const M=E.getHours()*60+E.getMinutes(),[J,te]=qn.split(":").map(Number),X=J*60+te;if(M>=X){console.log("[Daily Outfit] Time matched! Checking for outfits today...");const ne=Sa(j);if(ne.length>0){const ke=ne[0];if(console.log(`[Daily Outfit] Found outfit: ${ke.name}. Attempting to send notification...`),"Notification"in window)if(Notification.permission==="granted"){const _t="MyCloset - Outfit Diário",ct={body:`O seu outfit planeado "${ke.name}" está pronto para hoje!`,icon:"/favicon.ico"};try{(z=navigator.serviceWorker)==null||z.getRegistration().then(xt=>{xt&&xt.showNotification?(console.log("[Daily Outfit] Using Service Worker to show notification."),xt.showNotification(_t,ct)):(console.log("[Daily Outfit] Using standard Notification API."),new Notification(_t,ct))}).catch(xt=>{console.error("[Daily Outfit] Service Worker registration failed, using standard API.",xt),new Notification(_t,ct)})}catch(xt){console.error("[Daily Outfit] Fallback notification error:",xt),new Notification(_t,ct)}Ls(j),wt("lastNotifiedDate",j)}else console.log("[Daily Outfit] Permission not granted. Current state:",Notification.permission);else console.log("[Daily Outfit] Notifications API not supported in this browser.")}else console.log("[Daily Outfit] No outfits planned for today.")}}else console.log("[Daily Outfit] Already notified today.")},3e4);return()=>clearInterval(p)},[n,dr,qn,aa,Pn,u]);const Zi=t==="wishlist"?fh:Rn,Ia=q.useMemo(()=>{const p=new Set(Zi.map(E=>E.color).filter(Boolean));return Array.from(p)},[Zi]),es=q.useMemo(()=>{if(!Rn.length)return[];const p={};let E=0;return Rn.forEach(j=>{j.color&&(p[j.color]=(p[j.color]||0)+1,E++)}),E===0?[]:Object.entries(p).sort((j,z)=>z[1]-j[1]).slice(0,3).map(([j,z])=>({color:j,count:z,percentage:Math.round(z/E*100)}))},[Rn]),Tc=q.useMemo(()=>Zi.filter(p=>{const E=(p.name||"").toLowerCase().includes(D.toLowerCase())||(p.color||"").toLowerCase().includes(D.toLowerCase()),j=Xe==="Todos"||Xe===_("all")||p.category===Xe,z=!Gt||p.color&&p.color.includes(Gt),M=Jt==="all"||p.sections&&p.sections.includes(Jt);let J=!0;if(Y!=="any"){const ne=(new Date().getTime()-(p.createdAt||new Date().getTime()))/(1e3*60*60*24);Y==="month"?J=ne<=30:Y==="6months"?J=ne<=180:Y==="1year"?J=ne<=365:Y==="older"&&(J=ne>365)}const te=!se||p.favorite;return E&&j&&z&&J&&M&&te}),[Zi,D,Xe,Gt,Y,_,Jt,se]),Dn=async(p,E)=>{if(!n)return;const j=De(oe,"artifacts",ue,"users",n.uid,"clothes",E.id||E);switch(p){case"favorite":await Yn(j,{favorite:!E.favorite});break;case"trash":await Yn(j,{status:"trash",trashedAt:new Date().getTime()});break;case"restore":await Yn(j,{status:"active",trashedAt:null});break;case"laundry":await Yn(j,{status:"laundry"});break;case"clean":await Yn(j,{status:"active"});break;case"delete":window.confirm(_("confirmDeletePerm"))&&await Wa(j);break}},ph=async(p,E)=>{if(!n)return;const j=De(oe,"artifacts",ue,"users",n.uid,"looks",E.id||E);switch(p){case"favorite":await Yn(j,{favorite:!E.favorite});break}},bc=async p=>{if(p.preventDefault(),!n)return;const E=new FormData(p.target),j=E.get("color");if(!j||j.trim()===""){alert("Por favor selecione pelo menos uma cor.");return}s(!0);const z={name:E.get("name"),category:E.get("category"),color:E.get("color"),imageUrl:E.get("imageUrl")||"https://images.unsplash.com/photo-1521572267360-ee0c2909d518?q=80&w=500&auto=format&fit=crop",status:E.get("isWishlist")?"wishlist":m&&m.status==="wishlist"?"active":m?m.status:"active",favorite:m&&m.favorite||!1,sections:ni,updatedAt:new Date().getTime()};try{const M=m?m.id:null;if(v(null),I(""),Sn("Todos"),Qt(""),ae("any"),L(""),e(E.get("isWishlist")?"wishlist":"closet"),M){const J=De(oe,"artifacts",ue,"users",n.uid,"clothes",M);await Yn(J,z)}else{z.createdAt=new Date().getTime();const J=tt(oe,"artifacts",ue,"users",n.uid,"clothes");await Jn(J,z)}}catch(M){console.error(M)}finally{s(!1)}},ts=async p=>{if(p.preventDefault(),Qe.length<2)return;s(!0);const j={name:new FormData(p.target).get("lookName"),items:Qe,sections:gr,updatedAt:new Date().getTime()};try{if(Ve){const z=De(oe,"artifacts",ue,"users",n.uid,"looks",Ve.id);await Yn(z,j)}else{j.createdAt=new Date().getTime();const z=tt(oe,"artifacts",ue,"users",n.uid,"looks");await Jn(z,j)}At([]),Yt(null),e("outfits")}catch(z){console.error(z)}finally{s(!1)}},Sc=async p=>{if(!window.confirm(_("confirmDeleteLook")))return;const E=De(oe,"artifacts",ue,"users",n.uid,"looks",p);await Wa(E)},Ic=async p=>{if(n)try{const E=p.items.map(X=>{const ne=o.find(ke=>ke.id===X);return ne?{name:ne.name,category:ne.category,color:ne.color,imageUrl:ne.imageUrl}:null}).filter(Boolean),j=tt(oe,"artifacts",ue,"sharedLooks"),z=De(j),J=`${window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"https://mycloset.epvc.pt":window.location.origin}${window.location.pathname}?shared=${z.id}`;let te=!1;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(J),te=!0;else throw new Error("Clipboard API indisponível")}catch{try{const ne=document.createElement("textarea");ne.value=J,ne.style.position="fixed",ne.style.left="-9999px",document.body.appendChild(ne),ne.focus(),ne.select(),te=document.execCommand("copy"),document.body.removeChild(ne)}catch(ne){console.error("Erro no fallback de clipboard:",ne)}}await ss(z,{lookName:p.name,ownerUid:n.uid,ownerEmail:n.email||"",items:E,createdAt:new Date().getTime()}),te?(Hs(p.id),setTimeout(()=>Hs(null),3e3)):alert("Link de partilha: "+J)}catch(E){console.error("Erro ao partilhar look:",E),alert("Erro ao gerar link de partilha.")}},ro=async p=>{if(n){Pe(_("copying")||"A copiar...");try{const E=tt(oe,"artifacts",ue,"users",n.uid,"clothes");await Jn(E,{name:p.name,category:p.category,color:p.color,imageUrl:p.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()}),Pe(_("itemCopied")||"Peça copiada para o seu armário!"),setTimeout(()=>Pe(null),3e3)}catch(E){console.error("Erro ao copiar peça:",E),Pe("Erro ao copiar peça."),setTimeout(()=>Pe(null),3e3)}}},Ca=async p=>{if(!(!n||!Ne)){Pe(_("copying")||"A copiar...");try{const E=[];for(const z of p.items){const M=Fe.find(J=>J.id===z);if(M){const J=tt(oe,"artifacts",ue,"users",n.uid,"clothes"),te=await Jn(J,{name:M.name,category:M.category,color:M.color,imageUrl:M.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});E.push(te.id)}}const j=tt(oe,"artifacts",ue,"users",n.uid,"looks");await Jn(j,{name:p.name,items:E,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});try{const z=tt(oe,"artifacts",ue,"inboxNotifications");await Jn(z,{type:"look_copied",recipientUid:Ne.uid,lookName:p.name,copiedByEmail:(F==null?void 0:F.username)||n.email||"Alguém",createdAt:new Date().getTime(),read:!1})}catch(z){console.error("Não foi possível enviar notificação ao dono do look:",z)}Pe(_("lookCopied")||"Look copiado para o seu armário!"),setTimeout(()=>Pe(null),3e3)}catch(E){console.error("Erro ao copiar look:",E),Pe("Erro ao copiar look."),setTimeout(()=>Pe(null),3e3)}}},Cc=async()=>{if(!(!n||!ot)){ga(!0);try{const p=[];for(const j of ot.items){const z=tt(oe,"artifacts",ue,"users",n.uid,"clothes"),M=await Jn(z,{name:j.name,category:j.category,color:j.color,imageUrl:j.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});p.push(M.id)}const E=tt(oe,"artifacts",ue,"users",n.uid,"looks");if(await Jn(E,{name:ot.lookName,items:p,createdAt:new Date().getTime(),updatedAt:new Date().getTime()}),ot.ownerUid&&ot.ownerUid!==n.uid)try{const j=tt(oe,"artifacts",ue,"inboxNotifications");await Jn(j,{type:"look_copied",recipientUid:ot.ownerUid,lookName:ot.lookName,copiedByEmail:(F==null?void 0:F.username)||n.email||"Alguém",createdAt:new Date().getTime(),read:!1})}catch(j){console.error("Não foi possível enviar notificação ao dono do look:",j)}fr(!1),Hi(null),e("outfits")}catch(p){console.error("Erro ao copiar look:",p),alert("Erro ao copiar look.")}finally{ga(!1)}}},io=async p=>{s(!0);try{const E=Ha(oe);p.items.forEach(j=>{const z=De(oe,"artifacts",ue,"users",n.uid,"clothes",j);E.update(z,{status:"laundry"})}),await E.commit(),Pe(_("lookSentToLaundry")||"Peças enviadas para a lavandaria!"),setTimeout(()=>Pe(null),3e3)}catch(E){console.error(E)}finally{s(!1)}},Ac=async p=>{p.preventDefault(),x(""),s(!0);const E=new FormData(p.target),j=E.get("email"),z=E.get("password");try{H==="login"?await zI(Ka,j,z):await UI(Ka,j,z)}catch(M){console.error(M),M.code==="auth/operation-not-allowed"?x(_("authErrorDisabled")):x(M.message)}finally{s(!1)}},Nc=()=>{x(""),A(!0)},yr=async p=>{p.preventDefault();const E=R;if(E){s(!0),x("");try{await FI(Ka,E),A(!1),b(""),Pe(_("passwordResetSent")||"E-mail de recuperação enviado! Verifique a sua caixa de entrada.")}catch(j){console.error(j),x(j.message)}finally{s(!1)}}},Pc=async()=>{if(!(!n||!window.confirm(_("confirmEmptyTrash")))){s(!0);try{const p=Ha(oe);xa.forEach(E=>{const j=De(oe,"artifacts",ue,"users",n.uid,"clothes",E.id);p.delete(j)}),await p.commit()}catch(p){console.error(p)}finally{s(!1)}}},Rc=async()=>{if(!(!n||!window.confirm(_("confirmClearAll")))){s(!0);try{const p=Ha(oe);Rn.forEach(E=>{const j=De(oe,"artifacts",ue,"users",n.uid,"clothes",E.id);p.update(j,{status:"trash",trashedAt:new Date().getTime()})}),await p.commit()}catch(p){console.error(p)}finally{s(!1)}}},Dc=p=>{const E=p.target.files[0];if(!E||!n)return;const j=new FileReader;j.onload=z=>{const M=new Image;M.onload=async()=>{const J=document.createElement("canvas"),te=400;let X=M.width,ne=M.height;X>ne?X>te&&(ne*=te/X,X=te):ne>te&&(X*=te/ne,ne=te),J.width=X,J.height=ne,J.getContext("2d").drawImage(M,0,0,X,ne);const _t=J.toDataURL("image/jpeg",.8);try{const ct=De(oe,"artifacts",ue,"users",n.uid,"profile","data");await ss(ct,{avatar:_t},{merge:!0})}catch(ct){console.error("Error uploading image:",ct)}},M.src=z.target.result},j.readAsDataURL(E)},jc=p=>{const E=p.target.files[0];if(!E)return;const j=new FileReader;j.onload=z=>{const M=new Image;M.onload=()=>{const J=document.createElement("canvas"),te=800;let X=M.width,ne=M.height;X>ne?X>te&&(ne*=te/X,X=te):ne>te&&(X*=te/ne,ne=te),J.width=X,J.height=ne,J.getContext("2d").drawImage(M,0,0,X,ne);const _t=J.toDataURL("image/jpeg",.8);I(_t)},M.src=z.target.result},j.readAsDataURL(E)},so=async p=>{p.preventDefault(),Wr(!0);const E=new FormData(p.target);try{let j=(E.get("username")||"").trim();if(j.startsWith("@")&&(j=j.substring(1)),j){const ne=tt(oe,"artifacts",ue,"publicProfiles"),ke=d0(ne,h0("username","==",j));if((await su(ke)).docs.some(xt=>xt.data().uid!==n.uid)){alert(_("usernameTaken")||"Este nome de utilizador já está em uso."),Wr(!1);return}}const z=De(oe,"artifacts",ue,"users",n.uid,"profile","data"),M=E.get("dobDay"),J=E.get("dobMonth"),te=E.get("dobYear");let X=E.get("dob")||"";M&&J&&te&&(X=`${te}-${J}-${M}`),ss(z,{username:j,fullName:E.get("fullName")||"",dob:X,bio:E.get("bio")||"",location:E.get("location")||"",createdAt:(F==null?void 0:F.createdAt)||new Date().getTime()},{merge:!0}).catch(ne=>{console.error(ne)})}catch(j){console.error(j)}finally{setTimeout(()=>{Wr(!1)},600)}};return i&&!n?c.jsx("div",{className:"h-screen flex items-center justify-center bg-primary-50 dark:bg-gray-950",children:c.jsx(Wy,{className:"animate-spin text-primary-600",size:40})}):t==="auth"?c.jsxs("div",{className:`min-h-screen bg-gradient-to-br from-primary-100 via-white to-purple-50 dark:from-gray-950 dark:to-gray-900 flex items-center justify-center p-6 text-gray-900 ${g?"dark":""}`,children:[c.jsx(Ue,{className:"max-w-md w-full p-6 md:p-12 border-none shadow-2xl overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"animate-custom-zoom",children:[c.jsxs("div",{className:"text-center mb-6 md:mb-10",children:[c.jsx("div",{className:"inline-flex p-5 bg-primary-600 rounded-3xl md:rounded-[2rem] shadow-2xl shadow-primary-600/40 mb-6 transition-all duration-300",children:H==="login"?c.jsx(Ba,{className:"text-white w-12 h-12"}):c.jsx(By,{className:"text-white w-12 h-12"})}),c.jsx("h1",{className:"text-5xl font-black tracking-tighter italic",children:"MyCloset"})]}),w&&c.jsxs("div",{className:"mb-6 p-4 bg-red-50 text-red-600 text-[10px] rounded-2xl flex items-center gap-2 font-black uppercase tracking-widest border border-red-100",children:[c.jsx(J1,{size:16})," ",w]}),c.jsxs("form",{onSubmit:Ac,className:"space-y-4",children:[c.jsx("input",{name:"email",type:"email",placeholder:_("emailPlaceholder"),required:!0,className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold"}),c.jsx("input",{name:"password",type:"password",placeholder:_("passwordPlaceholder"),required:!0,className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold"}),H==="login"&&c.jsx("div",{className:"text-right",children:c.jsx("button",{type:"button",onClick:Nc,className:"text-[10px] font-black text-primary-500 hover:text-primary-600 uppercase tracking-widest transition-colors",children:_("forgotPassword")||"Esqueceu-se da palavra-passe?"})}),c.jsx("button",{className:"w-full py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black text-lg shadow-2xl hover:scale-[1.02] active:scale-95 transition-all",children:_(H==="login"?"loginBtn":"registerBtn")})]}),c.jsx("div",{className:"mt-6 md:mt-10 text-center",children:c.jsx("button",{type:"button",onClick:()=>T(H==="login"?"register":"login"),className:"text-gray-400 font-black text-[10px] uppercase tracking-[0.3em] hover:text-primary-600 transition-colors text-inherit",children:_(H==="login"?"createAccount":"haveAccount")})}),c.jsx("div",{className:"mt-6 md:mt-12 flex justify-center gap-5 pt-8 border-t border-gray-100 dark:border-gray-800/50",children:[{id:"PT",flag:"🇵🇹"},{id:"EN",flag:"🇬🇧"},{id:"ES",flag:"🇪🇸"},{id:"FR",flag:"🇫🇷"},{id:"DE",flag:"🇩🇪"}].map(p=>c.jsx("button",{type:"button",onClick:()=>Kr(p.id),className:`text-2xl transition-all duration-500 hover:scale-150 active:scale-95 ${yt===p.id?"scale-125 drop-shadow-[0_0_8px_rgba(79,70,229,0.3)]":"grayscale opacity-30 hover:grayscale-0 hover:opacity-100"}`,title:p.id,children:p.flag},p.id))})]},H)}),S&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>A(!1),children:c.jsxs(Ue,{className:"w-full max-w-md p-5 md:p-8 animate-in zoom-in-95",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("h3",{className:"text-2xl font-black mb-4 text-center text-inherit",children:_("forgotPassword")}),c.jsx("p",{className:"text-center opacity-70 mb-5 md:mb-8 text-sm text-inherit",children:_("forgotPasswordPrompt")}),c.jsxs("form",{onSubmit:yr,className:"space-y-4",children:[c.jsx("input",{name:"resetEmail",type:"email",placeholder:_("emailPlaceholder"),required:!0,value:R,onChange:p=>b(p.target.value),className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold text-inherit"}),c.jsx("button",{type:"submit",disabled:i,className:"w-full py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black text-lg shadow-2xl hover:scale-[1.02] active:scale-95 transition-all disabled:opacity-50",children:_(i?"saving":"sendEmailBtn")})]}),c.jsx("button",{type:"button",onClick:()=>A(!1),className:"w-full mt-6 py-4 uppercase font-black text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})})]}):c.jsxs("div",{className:`min-h-screen flex transition-all duration-700 ${g?"bg-gray-950 text-white dark":"bg-[#FDFDFF] text-gray-900"}`,children:[c.jsx("aside",{className:`
+ */function AR(t=Im()){return CR().then(e=>{if(!e)throw Ht.create("unsupported-browser")},e=>{throw Ht.create("indexed-db-unsupported")}),ra(qe(t),"messaging").getImmediate()}async function NR(t,e){return t=qe(t),kk(t,e)}IR();const PR={apiKey:"AIzaSyBBitFgNKnJ_3B0aqJgbbhGL_erufKd9lk",authDomain:"mycloset1-864c4.firebaseapp.com",projectId:"mycloset1-864c4",storageBucket:"mycloset1-864c4.firebasestorage.app",messagingSenderId:"219982610263",appId:"1:219982610263:web:0ebe67d9cf0e7d2753c812"},Cg=J_(PR),Ga=oA(Cg),oe=H2(Cg),I0=typeof window<"u"?AR(Cg):null,ue="my-closet-app",Ve=({children:t,className:e="",darkMode:n,...r})=>c.jsx("div",{className:`rounded-[2rem] border transition-all duration-300 ${n?"bg-gray-800/40 border-gray-700/50 backdrop-blur-md":"bg-white/80 border-gray-200/50 backdrop-blur-md shadow-sm"} ${e}`,...r,children:t}),lu=({children:t,variant:e="default"})=>{const n={default:"bg-indigo-100 text-indigo-700 dark:bg-indigo-900/30 dark:text-indigo-300",success:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",danger:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",warning:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-300"};return c.jsx("span",{className:`px-3 py-1 rounded-full text-[10px] font-black uppercase tracking-widest whitespace-nowrap ${n[e]}`,children:t})},cu=({label:t,type:e="text",value:n,onChange:r,placeholder:i,required:s=!1,name:o,minLength:l,defaultValue:u})=>{const h=n!==void 0;return c.jsxs("div",{className:"flex flex-col gap-1 w-full",children:[t&&c.jsx("label",{className:"text-sm font-black uppercase tracking-widest opacity-40 ml-1",children:t}),c.jsx("input",{type:e,name:o,...h?{value:n}:{defaultValue:u},onChange:m=>r?r(m.target.value):null,placeholder:i,required:s,minLength:l,className:"w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-indigo-500/10 font-bold bg-gray-100 dark:bg-gray-700 text-inherit transition-all"})]})},C0={PT:{loginModeIntro:"O Futuro do Teu Estilo",emailPlaceholder:"E-mail",passwordPlaceholder:"Palavra-passe",loginBtn:"ENTRAR",registerBtn:"REGISTAR",createAccount:"Criar Conta",haveAccount:"Já tenho conta",authErrorDisabled:"Este método de login está desativado na base de dados.",forgotPassword:"Esqueceu-se da palavra-passe?",forgotPasswordPrompt:"Introduza o seu e-mail para recuperar a palavra-passe:",passwordResetSent:"E-mail de recuperação enviado! Verifique a sua caixa de entrada.",sendEmailBtn:"Enviar Email",dashboard:"Painel",closet:"Armário",laundry:"Lavandaria",outfits:"Outfits",settings:"Definições",online:"Online",away:"Ausente",offline:"Offline",dailyOutfit:"Outfit Diário",noOutfitPlanned:"Nenhum Outfit Planeado",goToPlanning:"Vá ao planeamento para adicionar",onlyFavorites:"Apenas Favoritos",logout:"Sair",overview:"Visão Geral",myCloset:"O Meu Armário",outfitsAndStyle:"Outfits",readyClothes:"Roupas Prontas",inLaundry:"Na Lavandaria",myLooks:"Meus Outfits",favorites:"Favoritos",todayIn:"Hoje em Portugal",weatherUpdate:"22°C - Ensolarado",weatherCurrentAvg:"{current}°C Atual • Média {avg}°C",registeredPieces:"Peças Registadas",createdOutfits:"Outfits Criados",accountRegistrationDate:"Data de Registo da Conta",keyboardShortcuts:"Atalhos de Teclado",enableNavigationQE:"Ativar navegação com Q e E",dailyOutfitNotification:"Notificação do Outfit Diário",receiveNotificationAtScheduledTime:"Receber notificação com o outfit planeado à hora marcada",up:"Cima",down:"Baixo",weatherForecastDesc:"O dia de hoje tem máximas de {max}°C e mínimas de {min}°C.",weatherMsg:"Está um dia fantástico! Recomendamos as tuas peças leves. Que tal um visual casual com as tuas sapatilhas favoritas?",exploreSuggestions:"Explorar Sugestões",topColors:"Top Cores",searchPlaceholder:"Procurar no meu guarda-roupa...",all:"Todos",tops:"Tops",bottoms:"Bottoms",footwear:"Calçado",coats:"Casacos",accessories:"Acessórios",edit:"Editar",makeDirty:"Lavar",moveToTrash:"Mover para Lixo",laundryBasket:"Cesto da Roupa",lookSentToLaundry:"Peças enviadas para a lavandaria!",laundryMsg:"Aqui encontras as peças que marcaste como sujas. Lava-as para que voltem ao armário principal.",washing:"A lavar",emptyBasket:"Cesto Vazio",createNewLook:"Criar Novo Outfit",lookName:"Nome do Outfit",selectedPieces:"Peças Selecionadas",selectPieces:"Seleciona peças...",saveLook:"Guardar Outfit",closetLabel:"Armário",lookHistory:"Histórico de Outfits",pieces:"Peças",newItem:"Novo Item",preview:"Preview",name:"Nome",category:"Categoria",color:"Cor",imageUrl:"URL da Imagem",cancel:"Cancelar",save:"Guardar",register:"Registar",yourAccount:"A Tua Conta",papMode:"Modo PAP",preferences:"Preferências",darkMode:"Modo Escuro",interfaceAppearance:"Aparência da interface",notifications:"Notificações",lookReminders:"Lembretes de outfits",weatherAlerts:"Alertas de Clima",weatherSuggestions:"Sugestões pelo tempo",systemAndData:"Sistema e Dados",appLanguage:"Idioma da Aplicação",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exportar Dados (JSON)",exportDataAlert:"Os teus dados seriam exportados agora em formato JSON.",privacyPolicy:"Política de Privacidade",recycleBin:"Reciclagem",empty:"Esvaziar",deleted:"Eliminado",criticalZone:"Zona Crítica",fullCleanActions:"Ações de limpeza total do armário.",clearAll:"Limpar Tudo",confirmDeletePerm:"Apagar permanentemente?",confirmDeleteLook:"Apagar este Outfit?",confirmEmptyTrash:"Esvaziar o lixo permanentemente?",confirmClearAll:"Mover todas as peças ativas para o lixo?",colorBlack:"Preto",colorWhite:"Branco",colorBlue:"Azul",colorRed:"Vermelho",colorGreen:"Verde",colorYellow:"Amarelo",colorPink:"Rosa",colorPurple:"Roxo",colorOrange:"Laranja",colorBrown:"Marrom",colorBeige:"Bege",colorGray:"Cinza",userTitle:"Utilizador",themeColor:"Cor do Tema",personalizeColor:"Personalizar a cor",advancedFilters:"Filtros",filterByColor:"Cor",filterByAge:"Idade da Peça",anyAge:"Qualquer Idade",lessThanMonth:"Menos de 1 Mês",lessThan6Months:"Menos de 6 Meses",lessThanYear:"Menos de 1 Ano",older:"Mais antigo",applyFilters:"Aplicar Filtros",profileInfo:"Informações da Conta",username:"Nome de Utilizador",fullName:"Nome Completo",dob:"Data de Nascimento",bio:"Bio / Sobre mim",optional:"(Opcional)",saving:"A guardar...",sections:"Secções",manageSections:"Gerir Secções",newSection:"Nova Secção",sectionName:"Nome da Secção",sectionEmoji:"Emoji",noSections:"Nenhuma secção criada ainda.",addSection:"Adicionar Secção",deleteSection:"Apagar",assignSections:"Atribuir a Secções",allSections:"Todas",confirmDeleteSection:"Apagar esta secção?",sectionPlaceholder:"Ex: Trabalho, Festa...",emojiPlaceholder:"Ex: 💼",createSection:"Criar Secção",noSectionsCreated:"Ainda não tem secções criadas",linkCopied:"Link copiado!",share:"Partilhar",piecesInLaundry:"peça(s) na lavandaria",toBeWashed:"A ser lavados",unavailable:"Indisponíveis",availableLooks:"Disponíveis",noLooksAvailable:"Nenhum outfit disponível",location:"Localidade",locationEx:"Ex: Lisboa, Portugal",ideaSuggestion:"Ideia / Sugestão",bugError:"Bug / Erro",writeMessage:"Escreva aqui a sua mensagem...",sendMessage:"Enviar Mensagem",notificationsModal:"Notificações",noNotifications:"Sem Notificações",markAllRead:"Marcar todas como lidas",lookCopiedBy:"copiou o seu outfit",userSavedLook:"guardou o seu outfit",inTheirCloset:"no armário dele!",sharedLookTitle:"Outfit Partilhado",sharedBy:"Partilhado por",includedPieces:"Peças incluídas",ignore:"Ignorar",copying:"A copiar...",copyToMyCloset:"Copiar para o meu armário",msgSentSuccess:"Mensagem enviada com sucesso!",msgSendError:"Erro ao enviar mensagem. Verifica a tua ligação.",wishlist:"Carrinho",addFuturePurchase:"Adicionar peça como compra futura",wishlistDesc:"Carrinho",someone:"alguém",feedbackTitle:"Suporte e Feedback",feedbackDesc:"Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!",themeColorTitle:"Cor do Tema",personalizeColorDesc:"Personalize a cor",saveChanges:"Guardar Alterações",pasteLink:"Colar Link",pasteSharedLookLink:"Cole o link do outfit partilhado:",invalidSharedLink:"Link inválido. Certifique-se de copiar o link completo.",planning:"Planeamento",today:"Hoje",monthLabel:"Mês",weekLabel:"Semana",chooseOutfit:"Escolher Outfit",removeOutfitDay:"Remover Outfit deste Dia",noOutfitCreated:"Nenhum outfit criado",piecesShort:"peças",editLook:"Editar Outfit",uploadGallery:"Upload da Galeria / Ficheiros",selectOneColor:"Selecione pelo menos uma cor",addColorsToItems:"Adicione cores aos seus itens.",or:"OU",cardSize:"Tamanho dos itens",cardSizeDesc:"Tamanho no armário/carrinho",small:"Pequeno",medium:"Médio",large:"Grande",defaultPage:"Página Inicial",defaultPageDesc:"Página que aparece após o login",community:"Comunidade",searchUsers:"Procurar por @username...",privateProfile:"Perfil Privado",privateProfileDesc:"Ocultar armário de outros utilizadores",viewProfile:"Ver Perfil",noUsersFound:"Nenhum utilizador encontrado",isPrivateUser:"Este perfil é privado.",userOutfits:"Outfits do Utilizador",userCloset:"Armário",usernameTaken:"Este nome de utilizador já está em uso."},EN:{loginModeIntro:"The Future of Your Style",emailPlaceholder:"Email",passwordPlaceholder:"Password",loginBtn:"LOGIN",registerBtn:"REGISTER",createAccount:"Create Account",haveAccount:"I already have an account",authErrorDisabled:"This login method is disabled in the database.",forgotPassword:"Forgot password?",forgotPasswordPrompt:"Enter your email to reset your password:",passwordResetSent:"Password reset email sent! Check your inbox.",sendEmailBtn:"Send Email",dashboard:"Dashboard",closet:"Closet",laundry:"Laundry",outfits:"Outfits",settings:"Settings",online:"Online",away:"Away",offline:"Offline",dailyOutfit:"Daily Outfit",noOutfitPlanned:"No Outfit Planned",goToPlanning:"Go to planning to add one",onlyFavorites:"Favorites Only",logout:"Logout",overview:"Overview",myCloset:"My Closet",outfitsAndStyle:"Outfits & Style",readyClothes:"Ready Clothes",inLaundry:"In Laundry",myLooks:"My Outfits",favorites:"Favorites",todayIn:"Today in Portugal",weatherUpdate:"22°C - Sunny",weatherCurrentAvg:"{current}°C Current • Average {avg}°C",registeredPieces:"Registered Pieces",createdOutfits:"Created Outfits",accountRegistrationDate:"Account Registration Date",keyboardShortcuts:"Keyboard Shortcuts",enableNavigationQE:"Enable navigation with Q and E",dailyOutfitNotification:"Daily Outfit Notification",receiveNotificationAtScheduledTime:"Receive notification with the planned outfit at the scheduled time",up:"Up",down:"Down",weatherForecastDesc:"Today has highs of {max}°C and lows of {min}°C.",weatherMsg:"It's a fantastic day! We recommend your light pieces. How about a casual look with your favorite sneakers?",exploreSuggestions:"Explore Suggestions",topColors:"Top Colors",searchPlaceholder:"Search my wardrobe...",all:"All",tops:"Tops",bottoms:"Bottoms",footwear:"Footwear",coats:"Coats",accessories:"Accessories",edit:"Edit",makeDirty:"Make Dirty",moveToTrash:"Move to Trash",laundryBasket:"Laundry Basket",lookSentToLaundry:"Pieces sent to the laundry!",laundryMsg:"Here you find the pieces you marked as dirty. Wash them to return them to the main closet.",washing:"Washing",emptyBasket:"Empty Basket",createNewLook:"Create New Outfit",lookName:"Outfit Name",selectedPieces:"Selected Pieces",selectPieces:"Select pieces...",saveLook:"Save Outfit",closetLabel:"Closet",lookHistory:"Outfit History",pieces:"Pieces",newItem:"New Item",preview:"Preview",name:"Name",category:"Category",color:"Color",imageUrl:"Image URL",cancel:"Cancel",save:"Save",register:"Register",yourAccount:"Your Account",papMode:"PAP Mode",preferences:"Preferences",darkMode:"Dark Mode",interfaceAppearance:"Interface Appearance",notifications:"Notifications",lookReminders:"Outfit reminders",weatherAlerts:"Weather Alerts",weatherSuggestions:"Weather-based suggestions",systemAndData:"System and Data",appLanguage:"App Language",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Export Data (JSON)",exportDataAlert:"Your data would be exported now in JSON format.",privacyPolicy:"Privacy Policy",recycleBin:"Recycle Bin",empty:"Empty",deleted:"Deleted",criticalZone:"Critical Zone",fullCleanActions:"Full closet wipe actions.",clearAll:"Clear All",confirmDeletePerm:"Delete permanently?",confirmDeleteLook:"Delete this Outfit?",confirmEmptyTrash:"Empty trash permanently?",confirmClearAll:"Move all active pieces to trash?",colorBlack:"Black",colorWhite:"White",colorBlue:"Blue",colorRed:"Red",colorGreen:"Green",colorYellow:"Yellow",colorPink:"Pink",colorPurple:"Purple",colorOrange:"Orange",colorBrown:"Brown",colorBeige:"Beige",colorGray:"Gray",userTitle:"User",themeColor:"Theme Color",personalizeColor:"Personalize the color",advancedFilters:"Filters",filterByColor:"Color",filterByAge:"Item Age",anyAge:"Any Age",lessThanMonth:"Less than 1 Month",lessThan6Months:"Less than 6 Months",lessThanYear:"Less than 1 Year",older:"Older",applyFilters:"Apply Filters",profileInfo:"Account Information",username:"Username",fullName:"Full Name",dob:"Date of Birth",bio:"Bio / About me",optional:"(Optional)",saving:"Saving...",sections:"Sections",manageSections:"Manage Sections",newSection:"New Section",sectionName:"Section Name",sectionEmoji:"Emoji",noSections:"No sections created yet.",addSection:"Add Section",deleteSection:"Delete",assignSections:"Assign to Sections",allSections:"All",confirmDeleteSection:"Delete this section?",sectionPlaceholder:"E.g.: Work, Party...",emojiPlaceholder:"E.g.: 💼",createSection:"Create Section",noSectionsCreated:"No sections created yet",linkCopied:"Link copied!",share:"Share",piecesInLaundry:"piece(s) in laundry",toBeWashed:"To be washed",unavailable:"Unavailable",availableLooks:"Available",noLooksAvailable:"No outfit available",location:"Location",locationEx:"E.g.: Lisbon, Portugal",ideaSuggestion:"Idea / Suggestion",bugError:"Bug / Error",writeMessage:"Write your message here...",sendMessage:"Send Message",notificationsModal:"Notifications",noNotifications:"No Notifications",markAllRead:"Mark all as read",lookCopiedBy:"copied your outfit",userSavedLook:"saved your outfit",inTheirCloset:"in their closet!",sharedLookTitle:"Shared Outfit",sharedBy:"Shared by",includedPieces:"Included Pieces",ignore:"Ignore",copying:"Copying...",copyToMyCloset:"Copy to my closet",msgSentSuccess:"Message sent successfully!",msgSendError:"Error sending message. Check your connection.",addFuturePurchase:"Add piece as future purchase",wishlist:"Wishlist",wishlistDesc:"Wishlist",someone:"someone",feedbackTitle:"Support and Feedback",feedbackDesc:"Do you have any ideas, suggestions, or found a problem? Send a message directly to us!",themeColorTitle:"Theme Color",personalizeColorDesc:"Personalize the color",saveChanges:"Save Changes",pasteLink:"Paste Link",pasteSharedLookLink:"Paste the shared outfit link:",invalidSharedLink:"Invalid link. Make sure you copied the full link.",planning:"Planning",today:"Today",monthLabel:"Month",weekLabel:"Week",chooseOutfit:"Choose Outfit",removeOutfitDay:"Remove Outfit from this Day",noOutfitCreated:"No outfit created",piecesShort:"pieces",editLook:"Edit Outfit",uploadGallery:"Upload from Gallery / Files",selectOneColor:"Select at least one color",addColorsToItems:"Add colors to your items.",or:"OR",cardSize:"Item Size",cardSizeDesc:"Size in closet/cart",small:"Small",medium:"Medium",large:"Large",defaultPage:"Home Page",defaultPageDesc:"Page that appears after login",community:"Community",searchUsers:"Search by @username...",privateProfile:"Private Profile",privateProfileDesc:"Hide closet from other users",viewProfile:"View Profile",noUsersFound:"No users found",isPrivateUser:"This profile is private.",userOutfits:"User's Outfits",userCloset:"Closet",usernameTaken:"This username is already taken."},ES:{loginModeIntro:"El Futuro de Tu Estilo",emailPlaceholder:"Correo electrónico",passwordPlaceholder:"Contraseña",loginBtn:"ENTRAR",registerBtn:"REGISTRAR",createAccount:"Crear Cuenta",haveAccount:"Ya tengo cuenta",authErrorDisabled:"Este método de inicio de sesión está desactivado en la base de datos.",forgotPassword:"¿Olvidaste tu contraseña?",forgotPasswordPrompt:"Introduce tu correo electrónico para recuperar la contraseña:",passwordResetSent:"¡Correo de recuperación enviado! Revisa tu bandeja de entrada.",sendEmailBtn:"Enviar Correo",dashboard:"Panel",closet:"Armario",laundry:"Lavandería",outfits:"Outfits",settings:"Ajustes",online:"En línea",away:"Ausente",offline:"Desconectado",dailyOutfit:"Outfit Diario",noOutfitPlanned:"Sin Outfit Planeado",goToPlanning:"Ve a planificación para añadir",onlyFavorites:"Solo Favoritos",logout:"Cerrar Sesión",overview:"Visión General",myCloset:"Mi Armario",outfitsAndStyle:"Outfits y Estilo",readyClothes:"Ropa Lista",inLaundry:"En la Lavandería",myLooks:"Mis Outfits",favorites:"Favoritos",todayIn:"Hoy en Portugal",weatherUpdate:"22°C - Soleado",weatherCurrentAvg:"{current}°C Actual • Media {avg}°C",registeredPieces:"Piezas Registradas",createdOutfits:"Outfits Creados",accountRegistrationDate:"Fecha de Registro de la Cuenta",keyboardShortcuts:"Atajos de Teclado",enableNavigationQE:"Habilitar navegación con Q y E",dailyOutfitNotification:"Notificación del Outfit Diario",receiveNotificationAtScheduledTime:"Recibir notificación con el outfit planeado a la hora programada",up:"Arriba",down:"Abajo",weatherForecastDesc:"El día de hoy tiene máximas de {max}°C y mínimas de {min}°C.",weatherMsg:"¡Es un día fantástico! Recomendamos tus piezas ligeras. ¿Qué tal un look casual con tus zapatillas favoritas?",exploreSuggestions:"Explorar Sugerencias",topColors:"Colores Principales",searchPlaceholder:"Buscar en mi guardarropa...",all:"Todos",tops:"Tops",bottoms:"Partes Inferiores",footwear:"Calzado",coats:"Abrigos",accessories:"Accesorios",edit:"Editar",makeDirty:"Ensuciar",moveToTrash:"Mover a la Papelera",laundryBasket:"Cesto de Ropa",lookSentToLaundry:"¡Piezas enviadas a la lavandería!",laundryMsg:"Aquí encuentras las piezas que marcaste como sucias. Lávalas para que vuelvan al armario principal.",washing:"Lavando",emptyBasket:"Cesto Vacío",createNewLook:"Crear Nuevo Outfit",lookName:"Nombre del Outfit",selectedPieces:"Piezas Seleccionadas",selectPieces:"Elige piezas...",saveLook:"Guardar Outfit",closetLabel:"Armario",lookHistory:"Historial de Outfits",pieces:"Piezas",newItem:"Nuevo Artículo",preview:"Vista Previa",name:"Nombre",category:"Categoría",color:"Color",imageUrl:"URL de la Imagen",cancel:"Cancelar",save:"Guardar",register:"Registrar",yourAccount:"Tu Cuenta",papMode:"Modo PAP",preferences:"Preferencias",darkMode:"Modo Oscuro",interfaceAppearance:"Apariencia de la interfaz",notifications:"Notificaciones",lookReminders:"Recordatorios de looks",weatherAlerts:"Alertas del Clima",weatherSuggestions:"Sugerencias por clima",systemAndData:"Sistema y Datos",appLanguage:"Idioma de la Aplicación",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exportar Datos (JSON)",exportDataAlert:"Tus datos se exportarían ahora en formato JSON.",privacyPolicy:"Política de Privacidad",recycleBin:"Papelera de Reciclaje",empty:"Vaciar",deleted:"Eliminado",criticalZone:"Zona Crítica",fullCleanActions:"Acciones de limpieza total.",clearAll:"Limpiar Todo",confirmDeletePerm:"¿Borrar permanentemente?",confirmDeleteLook:"¿Borrar este Outfit?",confirmEmptyTrash:"¿Vaciar la papelera permanentemente?",confirmClearAll:"¿Mover todas las piezas activas a la papelera?",colorBlack:"Negro",colorWhite:"Blanco",colorBlue:"Azul",colorRed:"Rojo",colorGreen:"Verde",colorYellow:"Amarillo",colorPink:"Rosa",colorPurple:"Morado",colorOrange:"Naranja",colorBrown:"Marrón",colorBeige:"Beige",colorGray:"Gris",userTitle:"Usuario",themeColor:"Color del Tema",personalizeColor:"Personaliza el color",advancedFilters:"Filtros",filterByColor:"Color",filterByAge:"Edad de la Prenda",anyAge:"Cualquier Edad",lessThanMonth:"Menos de 1 Mes",lessThan6Months:"Menos de 6 Meses",lessThanYear:"Menos de 1 Año",older:"Más Antiguo",applyFilters:"Aplicar Filtros",profileInfo:"Información de la Cuenta",username:"Nombre de Usuario",fullName:"Nombre Completo",dob:"Fecha de Nacimiento",bio:"Bio / Sobre mí",optional:"(Opcional)",saving:"Guardando...",sections:"Secciones",manageSections:"Gestionar Secciones",newSection:"Nueva Sección",sectionName:"Nombre de la Sección",sectionEmoji:"Emoji",noSections:"Aún no hay secciones creadas.",addSection:"Añadir Sección",deleteSection:"Eliminar",assignSections:"Asignar a Secciones",allSections:"Todas",confirmDeleteSection:"¿Eliminar esta sección?",sectionPlaceholder:"Ej: Trabajo, Fiesta...",emojiPlaceholder:"Ej: 💼",createSection:"Crear Sección",noSectionsCreated:"Aún no hay secciones creadas",linkCopied:"¡Enlace copiado!",share:"Compartir",piecesInLaundry:"pieza(s) en la lavandería",toBeWashed:"Por lavar",unavailable:"No disponibles",availableLooks:"Disponibles",noLooksAvailable:"Ningún outfit disponible",location:"Ubicación",locationEx:"Ej: Lisboa, Portugal",ideaSuggestion:"Idea / Sugerencia",bugError:"Error / Fallo",writeMessage:"Escribe aquí tu mensaje...",sendMessage:"Enviar Mensaje",notificationsModal:"Notificaciones",noNotifications:"Sin Notificaciones",markAllRead:"Marcar todas como leídas",lookCopiedBy:"copió tu outfit",userSavedLook:"guardó tu outfit",inTheirCloset:"en su armario!",sharedLookTitle:"Outfit Compartido",sharedBy:"Compartido por",includedPieces:"Piezas incluidas",ignore:"Ignorar",copying:"Copiando...",copyToMyCloset:"Copiar a mi armario",msgSentSuccess:"¡Mensaje enviado con éxito!",msgSendError:"Error al enviar. Revisa tu conexión.",addFuturePurchase:"Añadir pieza como compra futura",wishlist:"Lista de Deseos",wishlistDesc:"Lista de Deseos",someone:"alguien",feedbackTitle:"Soporte y Comentarios",feedbackDesc:"¿Tienes alguna idea, sugerencia o encontraste un problema? ¡Envíanos un mensaje directamente!",themeColorTitle:"Color del Tema",personalizeColorDesc:"Personaliza el color",saveChanges:"Guardar Cambios",pasteLink:"Pegar Enlace",pasteSharedLookLink:"Pega el enlace del outfit compartido:",invalidSharedLink:"Enlace no válido. Asegúrate de copiar el enlace completo.",planning:"Planificación",today:"Hoy",monthLabel:"Mes",weekLabel:"Semana",chooseOutfit:"Elegir Outfit",removeOutfitDay:"Quitar Outfit de este Día",noOutfitCreated:"Ningún outfit creado",piecesShort:"piezas",editLook:"Editar Outfit",uploadGallery:"Subir desde la Galería / Archivos",selectOneColor:"Selecciona al menos un color",addColorsToItems:"Añade colores a tus artículos.",or:"O",cardSize:"Tamaño de los ítems",cardSizeDesc:"Tamaño en armario/carrito",small:"Pequeño",medium:"Medio",large:"Grande",defaultPage:"Página de Inicio",defaultPageDesc:"Página que aparece después de iniciar sesión",community:"Comunidad",searchUsers:"Buscar por @username...",privateProfile:"Perfil Privado",privateProfileDesc:"Ocultar armario de otros usuarios",viewProfile:"Ver Perfil",noUsersFound:"Ningún usuario encontrado",isPrivateUser:"Este perfil es privado.",userOutfits:"Outfits del Usuario",userCloset:"Armario",usernameTaken:"Este nombre de usuario ya está en uso."},FR:{loginModeIntro:"Le Futur de Ton Style",emailPlaceholder:"E-mail",passwordPlaceholder:"Mot de passe",loginBtn:"CONNEXION",registerBtn:"S'INSCRIRE",createAccount:"Créer un Compte",haveAccount:"J'ai déjà un compte",authErrorDisabled:"Cette méthode de connexion est désactivée dans la base de données.",forgotPassword:"Mot de passe oublié ?",forgotPasswordPrompt:"Entrez votre e-mail pour réinitialiser votre mot de passe :",passwordResetSent:"E-mail de réinitialisation envoyé ! Vérifiez votre boîte de réception.",sendEmailBtn:"Envoyer l'E-mail",dashboard:"Tableau de bord",closet:"Placard",laundry:"Blanchisserie",outfits:"Tenues",settings:"Paramètres",online:"En ligne",away:"Absent",offline:"Hors ligne",dailyOutfit:"Tenue du Jour",noOutfitPlanned:"Aucune Tenue Prévue",goToPlanning:"Allez dans planification pour ajouter",onlyFavorites:"Favoris Uniquement",logout:"Déconnexion",overview:"Vue d'ensemble",myCloset:"Mon Placard",outfitsAndStyle:"Tenues & Style",readyClothes:"Vêtements Prêts",inLaundry:"À la Blanchisserie",myLooks:"Mes Outfits",favorites:"Favoris",todayIn:"Aujourd'hui au Portugal",weatherUpdate:"22°C - Ensoleillé",weatherCurrentAvg:"{current}°C Actuel • Moyenne {avg}°C",registeredPieces:"Pièces Enregistrées",createdOutfits:"Outfits Créés",accountRegistrationDate:"Date d'Inscription du Compte",keyboardShortcuts:"Raccourcis Clavier",enableNavigationQE:"Activer la navigation avec Q et E",dailyOutfitNotification:"Notification de Tenue Quotidienne",receiveNotificationAtScheduledTime:"Recevoir une notification avec la tenue prévue à l'heure programmée",up:"Haut",down:"Bas",weatherForecastDesc:"Aujourd'hui a des maximales de {max}°C et des minimales de {min}°C.",weatherMsg:"C'est une journée fantastique ! Nous recommandons vos pièces légères. Que diriez-vous d'un look décontracté avec vos baskets préférées ?",exploreSuggestions:"Explorer les Suggestions",topColors:"Couleurs Principales",searchPlaceholder:"Chercher dans ma garde-robe...",all:"Tout",tops:"Hauts",bottoms:"Bas",footwear:"Chaussures",coats:"Manteaux",accessories:"Accessoires",edit:"Modifier",makeDirty:"Salir",moveToTrash:"Mettre à la corbeille",laundryBasket:"Panier à linge",lookSentToLaundry:"Pièces envoyées à la blanchisserie !",laundryMsg:"Ici vous trouvez les pièces que vous avez marquées comme sales. Lavez-les pour les remettre dans le placard principal.",washing:"En lavage",emptyBasket:"Panier Vide",createNewLook:"Créer un Nouvel Outfit",lookName:"Nom de l'Outfit",selectedPieces:"Pièces Sélectionnées",selectPieces:"Sélectionnez des pièces...",saveLook:"Enregistrer l'Outfit",closetLabel:"Placard",lookHistory:"Historique des Outfits",pieces:"Pièces",newItem:"Nouvel Article",preview:"Aperçu",name:"Nom",category:"Catégorie",color:"Couleur",imageUrl:"URL de l'image",cancel:"Annuler",save:"Enregistrer",register:"S'inscrire",yourAccount:"Votre Compte",papMode:"Mode PAP",preferences:"Préférences",darkMode:"Mode Sombre",interfaceAppearance:"Apparence de l'interface",notifications:"Notifications",lookReminders:"Rappels d'outfits",weatherAlerts:"Alertes Météo",weatherSuggestions:"Suggestions selon la météo",systemAndData:"Système et Données",appLanguage:"Langue de l'application",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Exporter les Données (JSON)",exportDataAlert:"Vos données seraient exportées maintenant au format JSON.",privacyPolicy:"Politique de Confidentialité",recycleBin:"Corbeille",empty:"Vider",deleted:"Supprimé",criticalZone:"Zone Critique",fullCleanActions:"Actions de nettoyage total.",clearAll:"Tout Effacer",confirmDeletePerm:"Supprimer définitivement ?",confirmDeleteLook:"Supprimer cet Outfit ?",confirmEmptyTrash:"Vider la corbeille définitivement ?",confirmClearAll:"Déplacer toutes les pièces actives vers la corbeille ?",colorBlack:"Noir",colorWhite:"Blanc",colorBlue:"Bleu",colorRed:"Rouge",colorGreen:"Vert",colorYellow:"Jaune",colorPink:"Rose",colorPurple:"Violet",colorOrange:"Orange",colorBrown:"Marron",colorBeige:"Beige",colorGray:"Gris",userTitle:"Utilisateur",themeColor:"Couleur du Thème",personalizeColor:"Personnaliser la couleur",advancedFilters:"Filtres",filterByColor:"Couleur",filterByAge:"Âge de l'article",anyAge:"Tout âge",lessThanMonth:"Moins d'un mois",lessThan6Months:"Moins de 6 mois",lessThanYear:"Moins d'un an",older:"Plus ancien",applyFilters:"Appliquer les filtres",profileInfo:"Informations du Compte",username:"Nom d'utilisateur",fullName:"Nom Complet",dob:"Date de Naissance",bio:"Bio / À propos",optional:"(Optionnel)",saving:"Enregistrement...",sections:"Sections",manageSections:"Gérer les Sections",newSection:"Nouvelle Section",sectionName:"Nom de la Section",sectionEmoji:"Emoji",noSections:"Aucune section créée pour l'instant.",addSection:"Ajouter une Section",deleteSection:"Supprimer",assignSections:"Attribuer aux Sections",allSections:"Toutes",confirmDeleteSection:"Supprimer cette section ?",sectionPlaceholder:"Ex: Travail, Fête...",emojiPlaceholder:"Ex: 💼",createSection:"Créer une Section",noSectionsCreated:"Aucune section créée",linkCopied:"Lien copié !",share:"Partager",piecesInLaundry:"pièce(s) à la blanchisserie",toBeWashed:"À laver",unavailable:"Indisponibles",availableLooks:"Disponibles",noLooksAvailable:"Aucun outfit disponible",location:"Emplacement",locationEx:"Ex: Lisbonne, Portugal",ideaSuggestion:"Idée / Suggestion",bugError:"Bug / Erreur",writeMessage:"Écrivez votre message ici...",sendMessage:"Envoyer le Message",notificationsModal:"Notifications",noNotifications:"Aucune Notification",markAllRead:"Tout marquer comme lu",lookCopiedBy:"a copié votre outfit",userSavedLook:"a sauvegardé votre outfit",inTheirCloset:"dans son placard !",sharedLookTitle:"Outfit Partagé",sharedBy:"Partagé par",includedPieces:"Pièces incluses",ignore:"Ignorer",copying:"Copie en cours...",copyToMyCloset:"Copier dans mon placard",msgSentSuccess:"Message envoyé avec succès !",msgSendError:"Erreur d'envoi. Vérifiez votre connexion.",addFuturePurchase:"Ajouter comme achat futur",wishlist:"Liste de Souhaits",wishlistDesc:"Liste de Souhaits",someone:"quelqu'un",feedbackTitle:"Support et Commentaires",feedbackDesc:"Avez-vous des idées, des suggestions ou trouvé un problème ? Envoyez-nous un message directement !",themeColorTitle:"Couleur du Thème",personalizeColorDesc:"Personnaliser la couleur",saveChanges:"Enregistrer les Modifications",pasteLink:"Coller le Lien",pasteSharedLookLink:"Collez le lien de l'outfit partagé :",invalidSharedLink:"Lien invalide. Assurez-vous d'avoir copié le lien complet.",planning:"Planification",today:"Aujourd'hui",monthLabel:"Mois",weekLabel:"Semaine",chooseOutfit:"Choisir un Outfit",removeOutfitDay:"Retirer l'Outfit de ce Jour",noOutfitCreated:"Aucun outfit créé",piecesShort:"pièces",editLook:"Modifier l'Outfit",uploadGallery:"Télécharger depuis la Galerie / Fichiers",selectOneColor:"Sélectionnez au moins une couleur",addColorsToItems:"Ajoutez des couleurs à vos articles.",or:"OU",cardSize:"Taille des articles",cardSizeDesc:"Taille dans placard/panier",small:"Petit",medium:"Moyen",large:"Grand",defaultPage:"Page d'Accueil",defaultPageDesc:"Page qui apparaît après la connexion",community:"Communauté",searchUsers:"Rechercher par @username...",privateProfile:"Profil Privé",privateProfileDesc:"Cacher le placard aux autres utilisateurs",viewProfile:"Voir le Profil",noUsersFound:"Aucun utilisateur trouvé",isPrivateUser:"Ce profil est privé.",userOutfits:"Outfits de l'Utilisateur",userCloset:"Placard",usernameTaken:"Ce nom d'utilisateur est déjà utilisé."},DE:{loginModeIntro:"Die Zukunft deines Stils",emailPlaceholder:"E-Mail",passwordPlaceholder:"Passwort",loginBtn:"ANMELDEN",registerBtn:"REGISTRIEREN",createAccount:"Konto Erstellen",haveAccount:"Ich habe bereits ein Konto",authErrorDisabled:"Diese Anmeldemethode ist in der Datenbank deaktiviert.",forgotPassword:"Passwort vergessen?",forgotPasswordPrompt:"Gib deine E-Mail-Adresse ein, um dein Passwort zurückzusetzen:",passwordResetSent:"E-mail zum Zurücksetzen des Passworts gesendet! Überprüfe deinen Posteingang.",sendEmailBtn:"E-Mail Senden",dashboard:"Startseite",closet:"Schrank",laundry:"Wäsche",outfits:"Outfits",settings:"Einstellungen",online:"Online",away:"Abwesend",offline:"Offline",dailyOutfit:"Tägliches Outfit",noOutfitPlanned:"Kein Outfit Geplant",goToPlanning:"Gehen Sie zur Planung, um eins hinzuzufügen",onlyFavorites:"Nur Favoriten",logout:"Abmelden",overview:"Übersicht",myCloset:"Mein Schrank",outfitsAndStyle:"Outfits & Stil",readyClothes:"Fertige Kleidung",inLaundry:"In der Wäsche",myLooks:"Meine Outfits",favorites:"Favoriten",todayIn:"Heute in Portugal",weatherUpdate:"22°C - Sonnig",weatherCurrentAvg:"{current}°C Aktuell • Durchschnitt {avg}°C",registeredPieces:"Registrierte Stücke",createdOutfits:"Erstellte Outfits",accountRegistrationDate:"Konto-Registrierungsdatum",keyboardShortcuts:"Tastenkombinationen",enableNavigationQE:"Navigation mit Q und E aktivieren",dailyOutfitNotification:"Tägliche Outfit-Benachrichtigung",receiveNotificationAtScheduledTime:"Benachrichtigung mit dem geplanten Outfit zur geplanten Zeit erhalten",up:"Oben",down:"Unten",weatherForecastDesc:"Der heutige Tag hat Höchstwerte von {max}°C und Tiefstwerte von {min}°C.",weatherMsg:"Es ist ein fantastischer Tag! Wir empfehlen leichte Stücke. Wie wäre es mit einem lässigen Look mit deinen Lieblings-Sneakern?",exploreSuggestions:"Vorschläge entdecken",topColors:"Top Farben",searchPlaceholder:"In meiner Garderobe suchen...",all:"Alle",tops:"Oberteile",bottoms:"Unterteile",footwear:"Schuhe",coats:"Mäntel",accessories:"Accessoires",edit:"Bearbeiten",makeDirty:"Schmutzig machen",moveToTrash:"In den Papierkorb verschieben",laundryBasket:"Wäschekorb",lookSentToLaundry:"Stücke in die Wäsche geschickt!",laundryMsg:"Hier findest du die Stücke, die du als schmutzig markiert hast. Wasche sie, um sie in den Hauptschrank zurückzulegen.",washing:"Waschen",emptyBasket:"Leerer Korb",createNewLook:"Neues Outfit erstellen",lookName:"Outfit Name",selectedPieces:"Ausgewählte Stücke",selectPieces:"Stücke auswählen...",saveLook:"Outfit speichern",closetLabel:"Schrank",lookHistory:"Outfit-Verlauf",pieces:"Stücke",newItem:"Neuer Artikel",preview:"Vorschau",name:"Name",category:"Kategorie",color:"Farbe",imageUrl:"Bild-URL",cancel:"Abbrechen",save:"Speichern",register:"Registrieren",yourAccount:"Dein Konto",papMode:"PAP-Modus",preferences:"Präferenzen",darkMode:"Dunkelmodus",interfaceAppearance:"Erscheinungsbild der Schnittstelle",notifications:"Benachrichtigungen",lookReminders:"Outfit-Erinnerungen",weatherAlerts:"Wetterwarnungen",weatherSuggestions:"Wetterbasierte Vorschläge",systemAndData:"System und Daten",appLanguage:"App-Sprache",portuguese:"Português (PT)",english:"English (EN)",spanish:"Español (ES)",french:"Français (FR)",german:"Deutsch (DE)",exportData:"Daten exportieren (JSON)",exportDataAlert:"Deine Daten würden jetzt im JSON-Format exportiert werden.",privacyPolicy:"Datenschutzrichtlinie",recycleBin:"Papierkorb",empty:"Leeren",deleted:"Gelöscht",criticalZone:"Kritische Zone",fullCleanActions:"Aktionen zur vollständigen Bereinigung.",clearAll:"Alles löschen",confirmDeletePerm:"Dauerhaft löschen?",confirmDeleteLook:"Dieses Outfit löschen?",confirmEmptyTrash:"Papierkorb dauerhaft leeren?",confirmClearAll:"Alle aktiven Stücke in den Papierkorb verschieben?",colorBlack:"Schwarz",colorWhite:"Weiß",colorBlue:"Blau",colorRed:"Rot",colorGreen:"Grün",colorYellow:"Gelb",colorPink:"Rosa",colorPurple:"Lila",colorOrange:"Orange",colorBrown:"Braun",colorBeige:"Beige",colorGray:"Grau",userTitle:"Benutzer",themeColor:"Themenfarbe",personalizeColor:"Farbe anpassen",advancedFilters:"Filter",filterByColor:"Farbe",filterByAge:"Artikelalter",anyAge:"Jedes Alter",lessThanMonth:"Weniger als 1 Monat",lessThan6Months:"Weniger als 6 Monate",lessThanYear:"Weniger als 1 Jahr",older:"Älter",applyFilters:"Filter anwenden",profileInfo:"Kontoinformationen",username:"Benutzername",fullName:"Vollständiger Name",dob:"Geburtsdatum",bio:"Biografie / Über mich",optional:"(Optional)",saving:"Speichern...",sections:"Bereiche",manageSections:"Bereiche verwalten",newSection:"Neuer Bereich",sectionName:"Bereichsname",sectionEmoji:"Emoji",noSections:"Noch keine Bereiche erstellt.",addSection:"Bereich hinzufügen",deleteSection:"Löschen",assignSections:"Bereichen zuweisen",allSections:"Alle",confirmDeleteSection:"Diesen Bereich löschen?",sectionPlaceholder:"Zb: Arbeit, Party...",emojiPlaceholder:"Zb: 💼",createSection:"Bereich erstellen",noSectionsCreated:"Noch keine Bereiche erstellt",linkCopied:"Link kopiert!",share:"Teilen",piecesInLaundry:"Stück(e) in der Wäsche",toBeWashed:"Zum Waschen",unavailable:"Nicht verfügbar",availableLooks:"Verfügbar",noLooksAvailable:"Kein Outfit verfügbar",location:"Ort",locationEx:"Z.B.: Lissabon, Portugal",ideaSuggestion:"Idee / Vorschlag",bugError:"Fehler / Bug",writeMessage:"Schreibe hier deine Nachricht...",sendMessage:"Nachricht Senden",notificationsModal:"Benachrichtigungen",noNotifications:"Keine Benachrichtigungen",markAllRead:"Alle als gelesen markieren",lookCopiedBy:"hat dein Outfit kopiert",userSavedLook:"hat dein Outfit gespeichert",inTheirCloset:"in seinem Schrank!",sharedLookTitle:"Geteiltes Outfit",sharedBy:"Geteilt von",includedPieces:"Enthaltene Stücke",ignore:"Ignorieren",copying:"Kopieren...",copyToMyCloset:"In meinen Schrank kopieren",msgSentSuccess:"Nachricht erfolgreich gesendet!",msgSendError:"Fehler beim Senden. Überprüfe deine Verbindung.",addFuturePurchase:"Als zukünftigen Kauf hinzufügen",wishlist:"Wunschzettel",wishlistDesc:"Wunschzettel",someone:"jemand",feedbackTitle:"Support und Feedback",feedbackDesc:"Hast du Ideen, Vorschläge oder ein Problem gefunden? Sende uns direkt eine Nachricht!",themeColorTitle:"Themenfarbe",personalizeColorDesc:"Farbe anpassen",saveChanges:"Änderungen Speichern",pasteLink:"Link Einfügen",pasteSharedLookLink:"Fügen Sie den Link zum geteilten Outfit ein:",invalidSharedLink:"Ungültiger Link. Stellen Sie sicher, dass Sie den vollständigen Link kopiert haben.",planning:"Planung",today:"Heute",monthLabel:"Monat",weekLabel:"Woche",chooseOutfit:"Outfit Wählen",removeOutfitDay:"Outfit von diesem Tag entfernen",noOutfitCreated:"Kein Outfit erstellt",piecesShort:"Stücke",editLook:"Outfit bearbeiten",uploadGallery:"Aus Galerie / Dateien hochladen",selectOneColor:"Wählen Sie mindestens eine Farbe",addColorsToItems:"Fügen Sie Ihren Artikeln Farben hinzu.",or:"ODER",cardSize:"Artikelgröße",cardSizeDesc:"Größe in Schrank/Warenkorb",small:"Klein",medium:"Mittel",large:"Groß",defaultPage:"Startseite",defaultPageDesc:"Seite, die nach der Anmeldung angezeigt wird",community:"Gemeinschaft",searchUsers:"Nach @username suchen...",privateProfile:"Privates Profil",privateProfileDesc:"Kleiderschrank vor anderen Benutzern verbergen",viewProfile:"Profil anzeigen",noUsersFound:"Keine Benutzer gefunden",isPrivateUser:"Dieses Profil ist privat.",userOutfits:"Outfits des Benutzers",userCloset:"Kleiderschrank",usernameTaken:"Dieser Benutzername ist bereits vergeben."}};function RR(){var a,d,f,y,P,O,Q,Ee,tt,ge,ot,at,Sr,Zt,rs,lo,Ag,Ng,Pg;const[t,e]=q.useState("auth"),[n,r]=q.useState(null),[i,s]=q.useState(!0),[o,l]=q.useState([]),[u,h]=q.useState([]),[m,v]=q.useState(null),[g,N]=q.useState(!1),[j,L]=q.useState(""),[B,I]=q.useState(""),[k,C]=q.useState([]),[V,G]=q.useState(window.innerWidth>768),[H,T]=q.useState("login"),[w,E]=q.useState(""),[S,A]=q.useState(!1),[R,b]=q.useState(""),[Xe,An]=q.useState("Todos"),[Qt,Yt]=q.useState(""),[Y,ae]=q.useState("any"),[se,Ce]=q.useState(!1),[Te,Ae]=q.useState(!1),[Qe,At]=q.useState([]),[Oe,Jt]=q.useState(null),[F,ca]=q.useState({}),[Bi,Xr]=q.useState(!1),[$i,qi]=q.useState(!0),[$n,Ls]=q.useState("08:00"),[pr,mc]=q.useState(!1),[ua,Ms]=q.useState(""),[Zr,Vs]=q.useState(!0),[yt,ei]=q.useState("PT"),[da,Wi]=q.useState(!1),[He,Ze]=q.useState("theme-indigo"),[Nn,ha]=q.useState("large"),[gc,fa]=q.useState("dashboard"),[vt,pa]=q.useState(null),[Fs,Us]=q.useState(!1),[mr,yc]=q.useState(!1),[ti,ma]=q.useState("online"),[Hi,ni]=q.useState(""),[gr,zs]=q.useState(!1),[qn,Ki]=q.useState([]),[Ue,ga]=q.useState(null),[et,Bs]=q.useState(null),[wt,Gi]=q.useState(!1),[Xt,ri]=q.useState([]),[ya,vc]=q.useState([]),[an,$s]=q.useState(null),[ii,yr]=q.useState(null),va=q.useRef(""),[ft,vr]=q.useState(null),[Wn,Qi]=q.useState(!1),[wa,qs]=q.useState(!1),[Yi,_a]=q.useState(null),[gn,wc]=q.useState([]),[Nt,Ws]=q.useState("all"),[xa,yn]=q.useState(!1),[vn,Hs]=q.useState(""),[sh,_c]=q.useState(""),[wr,Ks]=q.useState([]),[Hn,Ji]=q.useState([]),[Gs,Qs]=q.useState(null),[Ys,Ea]=q.useState(""),[xc,ka]=q.useState(""),[_r,xr]=q.useState([]),[Pn,si]=q.useState(!1),[Xi,Le]=q.useState(null),[_e,Js]=q.useState("month"),[Rn,Er]=q.useState(new Date),[Zi,Ec]=q.useState([]),[oh,Ta]=q.useState(!1),[ah,Xs]=q.useState(!1),[wn,Kn]=q.useState(null),_=p=>{var x;return((x=C0[yt])==null?void 0:x[p])||C0.PT[p]||p},kc={Vermelho:"#ef4444",Azul:"#3b82f6",Amarelo:"#eab308",Verde:"#22c55e",Laranja:"#f97316",Roxo:"#a855f7",Branco:"#f8fafc",Preto:"#0f172a",Cinzento:"#6b7280",Bege:"#d4b896"},Tc=p=>{if(!p)return{backgroundColor:"#e5e7eb"};const D=p.split(",").map(z=>z.trim()).filter(Boolean).map(z=>kc[z]||z.toLowerCase());return D.length===1?{backgroundColor:D[0]}:{background:`linear-gradient(135deg, ${D.join(", ")})`}},Ke=async(p,x)=>{if(n)try{const D=Ne(oe,"artifacts",ue,"users",n.uid,"profile","data");if(await os(D,{settings:{[p]:x}},{merge:!0}),p==="isPrivate"){const z=Ne(oe,"artifacts",ue,"publicProfiles",n.uid);await os(z,{isPrivate:x,uid:n.uid},{merge:!0})}}catch(D){console.error("Error saving setting:",D)}},ba=p=>{N(p),Ke("darkMode",p)},lh=p=>{Ze(p),Ke("theme",p)},ch=p=>{ei(p),Ke("language",p),Wi(!1)},Gn=p=>{qi(p),Ke("notificationsEnabled",p)},uh=async p=>{if(p)if("Notification"in window){if(await Notification.requestPermission()!=="granted"){alert("Permissão recusada. Ative as notificações no browser para usar esta funcionalidade.");return}if(I0)try{const D="BM55REBdX3g7x4JT7C6sN0uBDLATqsCnvgvx3mJnVmgU2dFvZL1przcV-V-Kl50Ao6-i8OA-5PZFWTuhETL9-v4";if(D){const z=await NR(I0,{vapidKey:D});z&&Ke("fcmToken",z)}}catch(D){console.error("Erro ao obter token FCM:",D)}}else{alert("O seu browser não suporta notificações.");return}mc(p),Ke("dailyOutfitNotifEnabled",p)},dh=p=>{Vs(p),Ke("weatherAlerts",p)},Zs=p=>{ha(p),Ke("cardSize",p)},eo=p=>{fa(p),Ke("defaultPage",p)},bc=p=>{Us(p),Ke("isPrivate",p)},es=p=>{yc(p),Ke("shortcutsEnabled",p)},Qn=p=>{const x=["dashboard","closet","wishlist","laundry","outfits","planner","community","settings"],D=x.indexOf(t);if(D===-1)return;let z;p==="up"?z=D===0?x.length-1:D-1:z=D===x.length-1?0:D+1,e(x[z]),window.innerWidth<768&&G(!1)},Sc=p=>{p.stopPropagation(),p.preventDefault();const x=["online","away","offline"],D=x.indexOf(ti),z=x[(D+1)%x.length];ma(z),Ke("status",z)},to=async p=>{if(p)try{const x=Ne(oe,"artifacts",ue,"sharedLooks",p),D=await of(x);D.exists()&&(vr({id:D.id,...D.data()}),Qi(!0),window.history.replaceState({},"",window.location.pathname))}catch(x){console.error("Erro ao buscar look partilhado:",x)}},Me=()=>{const p=window.prompt(_("pasteSharedLookLink")||"Cole o link do look partilhado:");if(p)try{const D=new URL(p).searchParams.get("shared");D?to(D):alert(_("invalidSharedLink")||"Link inválido. Certifique-se de copiar o link completo.")}catch{alert(_("invalidSharedLink")||"Link inválido. Certifique-se de copiar o link completo.")}};q.useEffect(()=>{if(!mr)return;const p=x=>{x.target.tagName==="INPUT"||x.target.tagName==="TEXTAREA"||(x.key.toLowerCase()==="q"?Qn("up"):x.key.toLowerCase()==="e"&&Qn("down"))};return window.addEventListener("keydown",p),()=>window.removeEventListener("keydown",p)},[mr,t]),q.useEffect(()=>{m&&m.color?C(m.color.split(",").map(p=>p.trim()).filter(Boolean)):C([]),Ks((m==null?void 0:m.sections)||[])},[m]),q.useEffect(()=>{const p=()=>{window.innerWidth<768?G(!1):G(!0)};return window.addEventListener("resize",p),()=>window.removeEventListener("resize",p)},[]),q.useEffect(()=>{Ji((Oe==null?void 0:Oe.sections)||[])},[Oe]),q.useEffect(()=>{document.documentElement.classList.remove("theme-indigo","theme-rose","theme-emerald","theme-amber","theme-slate");const p=t==="auth"?"theme-indigo":He;document.documentElement.classList.add(p),t!=="auth"&&(n!=null&&n.uid)&&localStorage.setItem(`app-theme-${n.uid}`,He)},[He,t,n==null?void 0:n.uid]),q.useEffect(()=>{(async()=>{})();const x=GI(Ga,async D=>{if(!D)r(null),l([]),h([]),wc([]),ca({}),N(!1),Ze("theme-indigo"),ei("PT"),qi(!0),Vs(!0),pa(null),e("auth"),s(!1);else{const z=localStorage.getItem(`app-theme-${D.uid}`)||"theme-indigo";Ze(z),r(D);try{const J=Ne(oe,"artifacts",ue,"users",D.uid,"profile","data"),te=await of(J);let X="dashboard";if(te.exists()){const ne=te.data();ne.settings&&ne.settings.defaultPage&&(X=ne.settings.defaultPage==="planning"?"planner":ne.settings.defaultPage,fa(X))}e(X)}catch{e("dashboard")}const M=va.current||new URLSearchParams(window.location.search).get("shared");va.current="",M&&to(M),s(!1)}});return()=>x()},[]),q.useEffect(()=>{if(!n)return;const p=nt(oe,"artifacts",ue,"users",n.uid,"clothes"),x=fo(p,Ie=>{l(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),D=nt(oe,"artifacts",ue,"users",n.uid,"looks"),z=fo(D,Ie=>{h(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),M=nt(oe,"artifacts",ue,"users",n.uid,"sections"),J=fo(M,Ie=>{wc(Ie.docs.map(K=>({id:K.id,...K.data()})).sort((K,Pt)=>K.createdAt-Pt.createdAt))},Ie=>console.error(Ie)),te=nt(oe,"artifacts",ue,"users",n.uid,"outfitPlans"),X=fo(te,Ie=>{Ec(Ie.docs.map(K=>({id:K.id,...K.data()})))},Ie=>console.error(Ie)),ne=Ne(oe,"artifacts",ue,"users",n.uid,"profile","data"),ke=fo(ne,Ie=>{if(Ie.exists()){const K=Ie.data();ca(K),K.settings&&(K.settings.language!==void 0&&ei(K.settings.language),K.settings.darkMode!==void 0&&N(K.settings.darkMode),K.settings.theme!==void 0&&Ze(K.settings.theme),K.settings.notificationsEnabled!==void 0&&qi(K.settings.notificationsEnabled),K.settings.dailyOutfitTime!==void 0&&Ls(K.settings.dailyOutfitTime),K.settings.dailyOutfitNotifEnabled!==void 0&&mc(K.settings.dailyOutfitNotifEnabled),K.settings.lastNotifiedDate!==void 0&&Ms(K.settings.lastNotifiedDate),K.settings.weatherAlerts!==void 0&&Vs(K.settings.weatherAlerts),K.settings.cardSize!==void 0&&ha(K.settings.cardSize),K.settings.defaultPage!==void 0&&fa(K.settings.defaultPage==="planning"?"planner":K.settings.defaultPage),K.settings.isPrivate!==void 0&&Us(K.settings.isPrivate),K.settings.shortcutsEnabled!==void 0&&yc(K.settings.shortcutsEnabled),K.settings.status!==void 0&&ma(K.settings.status))}else ca({})},Ie=>console.error(Ie)),_t=nt(oe,"artifacts",ue,"inboxNotifications"),lt=m0(_t,g0("recipientUid","==",n.uid)),xt=fo(lt,Ie=>{xr(Ie.docs.map(K=>({id:K.id,...K.data()})).sort((K,Pt)=>Pt.createdAt-K.createdAt))},Ie=>console.error("Notif listener error:",Ie));return()=>{x(),z(),J(),ke(),xt(),X()}},[n]);const hh=p=>p===0?"☀️":[1,2,3].includes(p)?"⛅":[45,48].includes(p)?"🌫️":[51,53,55,56,57,61,63,65,66,67].includes(p)?"🌧️":[71,73,75,77,85,86].includes(p)?"❄️":[80,81,82].includes(p)?"🌦️":[95,96,99].includes(p)?"⛈️":"☀️";q.useEffect(()=>{if(!n)return;(async()=>{try{const x=(F==null?void 0:F.location)||"Lisboa, Portugal",z=await(await fetch(`https://geocoding-api.open-meteo.com/v1/search?name=${encodeURIComponent(x)}&count=1&language=pt&format=json`)).json();if(z.results&&z.results.length>0){const{latitude:M,longitude:J,name:te,country:X}=z.results[0],ke=await(await fetch(`https://api.open-meteo.com/v1/forecast?latitude=${M}&longitude=${J}¤t_weather=true&daily=temperature_2m_max,temperature_2m_min,weathercode&timezone=auto`)).json();if(ke.current_weather&&ke.daily){const _t=ke.daily.time.map((lt,xt)=>({date:lt,min:Math.round(ke.daily.temperature_2m_min[xt]),max:Math.round(ke.daily.temperature_2m_max[xt]),weathercode:ke.daily.weathercode[xt]}));pa({name:`${te}, ${X||""}`.replace(/,\s*$/,""),currentTemp:Math.round(ke.current_weather.temperature),minTemp:Math.round(ke.daily.temperature_2m_min[0]),maxTemp:Math.round(ke.daily.temperature_2m_max[0]),avgTemp:Math.round((ke.daily.temperature_2m_min[0]+ke.daily.temperature_2m_max[0])/2),forecast:_t})}}}catch(x){console.error("Error fetching weather",x)}})()},[F==null?void 0:F.location,n]),q.useEffect(()=>{var p;if(n&&F){const x=Ne(oe,"artifacts",ue,"publicProfiles",n.uid);os(x,{uid:n.uid,username:F.username||"",fullName:F.fullName||"",avatar:F.avatar||null,isPrivate:((p=F.settings)==null?void 0:p.isPrivate)||!1,location:F.location||""},{merge:!0}).catch(D=>{console.error("Erro ao sincronizar perfil público:",D),D.code==="permission-denied"&&alert("Aviso: O seu perfil não ficou visível na comunidade devido a regras de segurança do Firebase (permission-denied).")})}},[n,F==null?void 0:F.username,F==null?void 0:F.fullName,F==null?void 0:F.avatar,(a=F==null?void 0:F.settings)==null?void 0:a.isPrivate,F==null?void 0:F.location]),q.useEffect(()=>{if(t!=="community")return;(async()=>{try{const x=nt(oe,"artifacts",ue,"publicProfiles"),z=(await au(x)).docs.map(M=>M.data()).filter(M=>M.uid!==(n==null?void 0:n.uid));if(gr){const M=te=>te?te.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase().trim():"",J=M(F==null?void 0:F.location);Ki(J?z.filter(te=>M(te.location)===J):[])}else if(Hi.trim()){let M=Hi.trim().toLowerCase();M.startsWith("@")&&(M=M.substring(1)),Ki(z.filter(J=>(J.username?J.username.toLowerCase():"").includes(M)))}else Ki([])}catch(x){console.error("Erro ao buscar comunidade",x),alert("Erro ao carregar comunidade: "+x.message)}})()},[t,Hi,gr,n==null?void 0:n.uid,F==null?void 0:F.location]);const fh=async p=>{if(ga(p),p.isPrivate){ri([]),vc([]),Bs(null);return}try{const x=nt(oe,"artifacts",ue,"users",p.uid,"clothes"),D=await au(x);ri(D.docs.map(X=>({id:X.id,...X.data()})).filter(X=>X.status!=="trash"));const z=nt(oe,"artifacts",ue,"users",p.uid,"looks"),M=await au(z);vc(M.docs.map(X=>({id:X.id,...X.data()})));const J=Ne(oe,"artifacts",ue,"users",p.uid,"profile","data"),te=await of(J);te.exists()?Bs(te.data()):Bs({})}catch(x){console.error("Erro ao carregar perfil do utilizador",x)}},Yn=q.useMemo(()=>o.filter(p=>p.status==="active"),[o]),no=q.useMemo(()=>o.filter(p=>p.status==="laundry"),[o]),ro=q.useMemo(()=>o.filter(p=>p.status==="trash"),[o]),io=q.useMemo(()=>o.filter(p=>p.status==="wishlist"),[o]),Ic=q.useMemo(()=>o.filter(p=>{const x=p.status!=="trash",D=Nt==="all"||p.sections&&p.sections.includes(Nt);return x&&D}),[o,Nt]),_n=async()=>{if(!Ys.trim()||!n||!Gs)return;const p=Ne(oe,"artifacts",ue,"users",n.uid,"sections",Gs);await Zn(p,{name:Ys.trim(),emoji:xc.trim()||"💼"}),Qs(null),Ea(""),ka("")},Sa=async()=>{if(!vn.trim()||!n)return;const p=nt(oe,"artifacts",ue,"users",n.uid,"sections");await er(p,{name:vn.trim(),emoji:sh.trim()||"💼",createdAt:new Date().getTime()}),Hs(""),_c("")},ph=async p=>{if(!window.confirm(_("confirmDeleteSection")))return;const x=Ne(oe,"artifacts",ue,"users",n.uid,"sections",p);await Ha(x);const D=Ka(oe);o.forEach(z=>{if(z.sections&&z.sections.includes(p)){const M=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",z.id);D.update(M,{sections:z.sections.filter(J=>J!==p)})}}),u.forEach(z=>{if(z.sections&&z.sections.includes(p)){const M=Ne(oe,"artifacts",ue,"users",n.uid,"looks",z.id);D.update(M,{sections:z.sections.filter(J=>J!==p)})}}),await D.commit(),Nt===p&&Ws("all")},oi=async(p,x)=>{if(!n)return;const D=Ne(oe,"artifacts",ue,"users",n.uid,"outfitPlans",p),z=Zi.find(J=>J.date===p);let M=[];if(z&&(M=z.lookIds||(z.lookId?[z.lookId]:[])),x===null){await Ha(D);return}M.includes(x)?M=M.filter(J=>J!==x):M=[...M,x],M.length>0?await os(D,{date:p,lookIds:M,updatedAt:new Date().getTime()},{merge:!0}):await Ha(D)},ts=new Date;ts.setHours(0,0,0,0);const so=`${ts.getFullYear()}-${String(ts.getMonth()+1).padStart(2,"0")}-${String(ts.getDate()).padStart(2,"0")}`,ai=p=>{const x=Zi.find(z=>z.date===p);return x?(x.lookIds||(x.lookId?[x.lookId]:[])).map(z=>u.find(M=>M.id===z)).filter(Boolean):[]},Ia=ai(so);q.useEffect(()=>{if(!n||!pr||!$n)return;console.log("[Daily Outfit] Notification system initialized. Scheduled for:",$n);const p=setInterval(()=>{var z;const x=new Date,D=`${x.getFullYear()}-${String(x.getMonth()+1).padStart(2,"0")}-${String(x.getDate()).padStart(2,"0")}`;if(console.log(`[Daily Outfit] Checking... Time now: ${x.getHours()}:${x.getMinutes()}, Scheduled: ${$n}. Last notified: ${ua}`),ua!==D){const M=x.getHours()*60+x.getMinutes(),[J,te]=$n.split(":").map(Number),X=J*60+te;if(M>=X){console.log("[Daily Outfit] Time matched! Checking for outfits today...");const ne=ai(D);if(ne.length>0){const ke=ne[0];if(console.log(`[Daily Outfit] Found outfit: ${ke.name}. Attempting to send notification...`),"Notification"in window)if(Notification.permission==="granted"){const _t="MyCloset - Outfit Diário",lt={body:`O seu outfit planeado "${ke.name}" está pronto para hoje!`,icon:"/favicon.ico"};try{(z=navigator.serviceWorker)==null||z.getRegistration().then(xt=>{xt&&xt.showNotification?(console.log("[Daily Outfit] Using Service Worker to show notification."),xt.showNotification(_t,lt)):(console.log("[Daily Outfit] Using standard Notification API."),new Notification(_t,lt))}).catch(xt=>{console.error("[Daily Outfit] Service Worker registration failed, using standard API.",xt),new Notification(_t,lt)})}catch(xt){console.error("[Daily Outfit] Fallback notification error:",xt),new Notification(_t,lt)}Ms(D),Ke("lastNotifiedDate",D)}else console.log("[Daily Outfit] Permission not granted. Current state:",Notification.permission);else console.log("[Daily Outfit] Notifications API not supported in this browser.")}else console.log("[Daily Outfit] No outfits planned for today.")}}else console.log("[Daily Outfit] Already notified today.")},3e4);return()=>clearInterval(p)},[n,pr,$n,ua,Zi,u]);const kr=t==="wishlist"?io:Yn,mh=q.useMemo(()=>{const p=new Set(kr.map(x=>x.color).filter(Boolean));return Array.from(p)},[kr]),Ca=q.useMemo(()=>{if(!Yn.length)return[];const p={};let x=0;return Yn.forEach(D=>{D.color&&(p[D.color]=(p[D.color]||0)+1,x++)}),x===0?[]:Object.entries(p).sort((D,z)=>z[1]-D[1]).slice(0,3).map(([D,z])=>({color:D,count:z,percentage:Math.round(z/x*100)}))},[Yn]),ns=q.useMemo(()=>kr.filter(p=>{const x=(p.name||"").toLowerCase().includes(j.toLowerCase())||(p.color||"").toLowerCase().includes(j.toLowerCase()),D=Xe==="Todos"||Xe===_("all")||p.category===Xe,z=!Qt||p.color&&p.color.includes(Qt),M=Nt==="all"||p.sections&&p.sections.includes(Nt);let J=!0;if(Y!=="any"){const ne=(new Date().getTime()-(p.createdAt||new Date().getTime()))/(1e3*60*60*24);Y==="month"?J=ne<=30:Y==="6months"?J=ne<=180:Y==="1year"?J=ne<=365:Y==="older"&&(J=ne>365)}const te=!se||p.favorite;return x&&D&&z&&J&&M&&te}),[kr,j,Xe,Qt,Y,_,Nt,se]),Tr=async(p,x)=>{if(!n)return;const D=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",x.id||x);switch(p){case"favorite":await Zn(D,{favorite:!x.favorite});break;case"trash":await Zn(D,{status:"trash",trashedAt:new Date().getTime()});break;case"restore":await Zn(D,{status:"active",trashedAt:null});break;case"laundry":await Zn(D,{status:"laundry"});break;case"clean":await Zn(D,{status:"active"});break;case"delete":window.confirm(_("confirmDeletePerm"))&&await Ha(D);break}},Cc=async(p,x)=>{if(!n)return;const D=Ne(oe,"artifacts",ue,"users",n.uid,"looks",x.id||x);switch(p){case"favorite":await Zn(D,{favorite:!x.favorite});break}},Aa=async p=>{if(p.preventDefault(),!n)return;const x=new FormData(p.target),D=x.get("color");if(!D||D.trim()===""){alert("Por favor selecione pelo menos uma cor.");return}s(!0);const z={name:x.get("name"),category:x.get("category"),color:x.get("color"),imageUrl:x.get("imageUrl")||"https://images.unsplash.com/photo-1521572267360-ee0c2909d518?q=80&w=500&auto=format&fit=crop",status:x.get("isWishlist")?"wishlist":m&&m.status==="wishlist"?"active":m?m.status:"active",favorite:m&&m.favorite||!1,sections:wr,updatedAt:new Date().getTime()};try{const M=m?m.id:null;if(v(null),I(""),An("Todos"),Yt(""),ae("any"),L(""),e(x.get("isWishlist")?"wishlist":"closet"),M){const J=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",M);await Zn(J,z)}else{z.createdAt=new Date().getTime();const J=nt(oe,"artifacts",ue,"users",n.uid,"clothes");await er(J,z)}}catch(M){console.error(M)}finally{s(!1)}},Na=async p=>{if(p.preventDefault(),Qe.length<2)return;s(!0);const D={name:new FormData(p.target).get("lookName"),items:Qe,sections:Hn,updatedAt:new Date().getTime()};try{if(Oe){const z=Ne(oe,"artifacts",ue,"users",n.uid,"looks",Oe.id);await Zn(z,D)}else{D.createdAt=new Date().getTime();const z=nt(oe,"artifacts",ue,"users",n.uid,"looks");await er(z,D)}At([]),Jt(null),e("outfits")}catch(z){console.error(z)}finally{s(!1)}},Ac=async p=>{if(!window.confirm(_("confirmDeleteLook")))return;const x=Ne(oe,"artifacts",ue,"users",n.uid,"looks",p);await Ha(x)},oo=async p=>{if(n)try{const x=p.items.map(X=>{const ne=o.find(ke=>ke.id===X);return ne?{name:ne.name,category:ne.category,color:ne.color,imageUrl:ne.imageUrl}:null}).filter(Boolean),D=nt(oe,"artifacts",ue,"sharedLooks"),z=Ne(D),J=`${window.location.hostname==="localhost"||window.location.hostname==="127.0.0.1"?"https://mycloset.epvc.pt":window.location.origin}${window.location.pathname}?shared=${z.id}`;let te=!1;try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(J),te=!0;else throw new Error("Clipboard API indisponível")}catch{try{const ne=document.createElement("textarea");ne.value=J,ne.style.position="fixed",ne.style.left="-9999px",document.body.appendChild(ne),ne.focus(),ne.select(),te=document.execCommand("copy"),document.body.removeChild(ne)}catch(ne){console.error("Erro no fallback de clipboard:",ne)}}await os(z,{lookName:p.name,ownerUid:n.uid,ownerEmail:n.email||"",items:x,createdAt:new Date().getTime()}),te?(_a(p.id),setTimeout(()=>_a(null),3e3)):alert("Link de partilha: "+J)}catch(x){console.error("Erro ao partilhar look:",x),alert("Erro ao gerar link de partilha.")}},Pa=async p=>{if(n){Le(_("copying")||"A copiar...");try{const x=nt(oe,"artifacts",ue,"users",n.uid,"clothes");await er(x,{name:p.name,category:p.category,color:p.color,imageUrl:p.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()}),Le(_("itemCopied")||"Peça copiada para o seu armário!"),setTimeout(()=>Le(null),3e3)}catch(x){console.error("Erro ao copiar peça:",x),Le("Erro ao copiar peça."),setTimeout(()=>Le(null),3e3)}}},Nc=async p=>{if(!(!n||!Ue)){Le(_("copying")||"A copiar...");try{const x=[];for(const z of p.items){const M=Xt.find(J=>J.id===z);if(M){const J=nt(oe,"artifacts",ue,"users",n.uid,"clothes"),te=await er(J,{name:M.name,category:M.category,color:M.color,imageUrl:M.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});x.push(te.id)}}const D=nt(oe,"artifacts",ue,"users",n.uid,"looks");await er(D,{name:p.name,items:x,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});try{const z=nt(oe,"artifacts",ue,"inboxNotifications");await er(z,{type:"look_copied",recipientUid:Ue.uid,lookName:p.name,copiedByEmail:(F==null?void 0:F.username)||n.email||"Alguém",createdAt:new Date().getTime(),read:!1})}catch(z){console.error("Não foi possível enviar notificação ao dono do look:",z)}Le(_("lookCopied")||"Look copiado para o seu armário!"),setTimeout(()=>Le(null),3e3)}catch(x){console.error("Erro ao copiar look:",x),Le("Erro ao copiar look."),setTimeout(()=>Le(null),3e3)}}},br=async()=>{if(!(!n||!ft)){qs(!0);try{const p=[];for(const D of ft.items){const z=nt(oe,"artifacts",ue,"users",n.uid,"clothes"),M=await er(z,{name:D.name,category:D.category,color:D.color,imageUrl:D.imageUrl,status:"active",favorite:!1,createdAt:new Date().getTime(),updatedAt:new Date().getTime()});p.push(M.id)}const x=nt(oe,"artifacts",ue,"users",n.uid,"looks");if(await er(x,{name:ft.lookName,items:p,createdAt:new Date().getTime(),updatedAt:new Date().getTime()}),ft.ownerUid&&ft.ownerUid!==n.uid)try{const D=nt(oe,"artifacts",ue,"inboxNotifications");await er(D,{type:"look_copied",recipientUid:ft.ownerUid,lookName:ft.lookName,copiedByEmail:(F==null?void 0:F.username)||n.email||"Alguém",createdAt:new Date().getTime(),read:!1})}catch(D){console.error("Não foi possível enviar notificação ao dono do look:",D)}Qi(!1),vr(null),e("outfits")}catch(p){console.error("Erro ao copiar look:",p),alert("Erro ao copiar look.")}finally{qs(!1)}}},Pc=async p=>{s(!0);try{const x=Ka(oe);p.items.forEach(D=>{const z=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",D);x.update(z,{status:"laundry"})}),await x.commit(),Le(_("lookSentToLaundry")||"Peças enviadas para a lavandaria!"),setTimeout(()=>Le(null),3e3)}catch(x){console.error(x)}finally{s(!1)}},Rc=async p=>{p.preventDefault(),E(""),s(!0);const x=new FormData(p.target),D=x.get("email"),z=x.get("password");try{H==="login"?await WI(Ga,D,z):await qI(Ga,D,z)}catch(M){console.error(M),M.code==="auth/operation-not-allowed"?E(_("authErrorDisabled")):E(M.message)}finally{s(!1)}},Dc=()=>{E(""),A(!0)},jc=async p=>{p.preventDefault();const x=R;if(x){s(!0),E("");try{await $I(Ga,x),A(!1),b(""),Le(_("passwordResetSent")||"E-mail de recuperação enviado! Verifique a sua caixa de entrada.")}catch(D){console.error(D),E(D.message)}finally{s(!1)}}},ao=async()=>{if(!(!n||!window.confirm(_("confirmEmptyTrash")))){s(!0);try{const p=Ka(oe);ro.forEach(x=>{const D=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",x.id);p.delete(D)}),await p.commit()}catch(p){console.error(p)}finally{s(!1)}}},zt=async()=>{if(!(!n||!window.confirm(_("confirmClearAll")))){s(!0);try{const p=Ka(oe);Yn.forEach(x=>{const D=Ne(oe,"artifacts",ue,"users",n.uid,"clothes",x.id);p.update(D,{status:"trash",trashedAt:new Date().getTime()})}),await p.commit()}catch(p){console.error(p)}finally{s(!1)}}},Oc=p=>{const x=p.target.files[0];if(!x||!n)return;const D=new FileReader;D.onload=z=>{const M=new Image;M.onload=async()=>{const J=document.createElement("canvas"),te=400;let X=M.width,ne=M.height;X>ne?X>te&&(ne*=te/X,X=te):ne>te&&(X*=te/ne,ne=te),J.width=X,J.height=ne,J.getContext("2d").drawImage(M,0,0,X,ne);const _t=J.toDataURL("image/jpeg",.8);try{const lt=Ne(oe,"artifacts",ue,"users",n.uid,"profile","data");await os(lt,{avatar:_t},{merge:!0})}catch(lt){console.error("Error uploading image:",lt)}},M.src=z.target.result},D.readAsDataURL(x)},Lc=p=>{const x=p.target.files[0];if(!x)return;const D=new FileReader;D.onload=z=>{const M=new Image;M.onload=()=>{const J=document.createElement("canvas"),te=800;let X=M.width,ne=M.height;X>ne?X>te&&(ne*=te/X,X=te):ne>te&&(X*=te/ne,ne=te),J.width=X,J.height=ne,J.getContext("2d").drawImage(M,0,0,X,ne);const _t=J.toDataURL("image/jpeg",.8);I(_t)},M.src=z.target.result},D.readAsDataURL(x)},li=async p=>{p.preventDefault(),Xr(!0);const x=new FormData(p.target);try{let D=(x.get("username")||"").trim();if(D.startsWith("@")&&(D=D.substring(1)),D){const ne=nt(oe,"artifacts",ue,"publicProfiles"),ke=m0(ne,g0("username","==",D));if((await au(ke)).docs.some(xt=>xt.data().uid!==n.uid)){alert(_("usernameTaken")||"Este nome de utilizador já está em uso."),Xr(!1);return}}const z=Ne(oe,"artifacts",ue,"users",n.uid,"profile","data"),M=x.get("dobDay"),J=x.get("dobMonth"),te=x.get("dobYear");let X=x.get("dob")||"";M&&J&&te&&(X=`${te}-${J}-${M}`),os(z,{username:D,fullName:x.get("fullName")||"",dob:X,bio:x.get("bio")||"",location:x.get("location")||"",createdAt:(F==null?void 0:F.createdAt)||new Date().getTime()},{merge:!0}).catch(ne=>{console.error(ne)})}catch(D){console.error(D)}finally{setTimeout(()=>{Xr(!1)},600)}};return i&&!n?c.jsx("div",{className:"h-screen flex items-center justify-center bg-primary-50 dark:bg-gray-950",children:c.jsx(Qy,{className:"animate-spin text-primary-600",size:40})}):t==="auth"?c.jsxs("div",{className:`min-h-screen bg-gradient-to-br from-primary-100 via-white to-purple-50 dark:from-gray-950 dark:to-gray-900 flex items-center justify-center p-6 text-gray-900 ${g?"dark":""}`,children:[c.jsx(Ve,{className:"max-w-md w-full p-6 md:p-12 border-none shadow-2xl overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"animate-custom-zoom",children:[c.jsxs("div",{className:"text-center mb-6 md:mb-10",children:[c.jsx("div",{className:"inline-flex p-5 bg-primary-600 rounded-3xl md:rounded-[2rem] shadow-2xl shadow-primary-600/40 mb-6 transition-all duration-300",children:H==="login"?c.jsx($a,{className:"text-white w-12 h-12"}):c.jsx(Hy,{className:"text-white w-12 h-12"})}),c.jsx("h1",{className:"text-5xl font-black tracking-tighter italic",children:"MyCloset"})]}),w&&c.jsxs("div",{className:"mb-6 p-4 bg-red-50 text-red-600 text-[10px] rounded-2xl flex items-center gap-2 font-black uppercase tracking-widest border border-red-100",children:[c.jsx(tb,{size:16})," ",w]}),c.jsxs("form",{onSubmit:Rc,className:"space-y-4",children:[c.jsx("input",{name:"email",type:"email",placeholder:_("emailPlaceholder"),required:!0,className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold"}),c.jsx("input",{name:"password",type:"password",placeholder:_("passwordPlaceholder"),required:!0,className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold"}),H==="login"&&c.jsx("div",{className:"text-right",children:c.jsx("button",{type:"button",onClick:Dc,className:"text-[10px] font-black text-primary-500 hover:text-primary-600 uppercase tracking-widest transition-colors",children:_("forgotPassword")||"Esqueceu-se da palavra-passe?"})}),c.jsx("button",{className:"w-full py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black text-lg shadow-2xl hover:scale-[1.02] active:scale-95 transition-all",children:_(H==="login"?"loginBtn":"registerBtn")})]}),c.jsx("div",{className:"mt-6 md:mt-10 text-center",children:c.jsx("button",{type:"button",onClick:()=>T(H==="login"?"register":"login"),className:"text-gray-400 font-black text-[10px] uppercase tracking-[0.3em] hover:text-primary-600 transition-colors text-inherit",children:_(H==="login"?"createAccount":"haveAccount")})}),c.jsx("div",{className:"mt-6 md:mt-12 flex justify-center gap-5 pt-8 border-t border-gray-100 dark:border-gray-800/50",children:[{id:"PT",flag:"🇵🇹"},{id:"EN",flag:"🇬🇧"},{id:"ES",flag:"🇪🇸"},{id:"FR",flag:"🇫🇷"},{id:"DE",flag:"🇩🇪"}].map(p=>c.jsx("button",{type:"button",onClick:()=>ei(p.id),className:`text-2xl transition-all duration-500 hover:scale-150 active:scale-95 ${yt===p.id?"scale-125 drop-shadow-[0_0_8px_rgba(79,70,229,0.3)]":"grayscale opacity-30 hover:grayscale-0 hover:opacity-100"}`,title:p.id,children:p.flag},p.id))})]},H)}),S&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>A(!1),children:c.jsxs(Ve,{className:"w-full max-w-md p-5 md:p-8 animate-in zoom-in-95",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("h3",{className:"text-2xl font-black mb-4 text-center text-inherit",children:_("forgotPassword")}),c.jsx("p",{className:"text-center opacity-70 mb-5 md:mb-8 text-sm text-inherit",children:_("forgotPasswordPrompt")}),c.jsxs("form",{onSubmit:jc,className:"space-y-4",children:[c.jsx("input",{name:"resetEmail",type:"email",placeholder:_("emailPlaceholder"),required:!0,value:R,onChange:p=>b(p.target.value),className:"w-full p-5 rounded-2xl bg-gray-50 dark:bg-gray-800 border-none focus:ring-2 focus:ring-primary-500 outline-none font-bold text-inherit"}),c.jsx("button",{type:"submit",disabled:i,className:"w-full py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black text-lg shadow-2xl hover:scale-[1.02] active:scale-95 transition-all disabled:opacity-50",children:_(i?"saving":"sendEmailBtn")})]}),c.jsx("button",{type:"button",onClick:()=>A(!1),className:"w-full mt-6 py-4 uppercase font-black text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})})]}):c.jsxs("div",{className:`min-h-screen flex transition-all duration-700 ${g?"bg-gray-950 text-white dark":"bg-[#FDFDFF] text-gray-900"}`,children:[c.jsx("aside",{className:`
fixed md:relative inset-y-0 left-0 z-[100] transition-all duration-500 ease-in-out border-r overflow-hidden
${g?"bg-gray-900/80 border-gray-800":"bg-white border-gray-100"}
${V?"w-80 translate-x-0":"w-0 -translate-x-full md:w-0 md:opacity-0"}
- `,children:c.jsxs("div",{className:"p-6 md:p-10 h-full flex flex-col backdrop-blur-xl",children:[c.jsxs("button",{onClick:()=>e("closet"),className:"flex items-center gap-4 mb-5 md:mb-8 md:mb-16 hover:scale-[1.02] transition-transform text-left cursor-pointer w-full",children:[c.jsx("div",{className:"p-3 bg-primary-600 rounded-2xl shadow-xl shadow-primary-600/30",children:c.jsx(Ba,{className:"text-white",size:24})}),c.jsx("span",{className:"text-3xl font-black tracking-tighter italic",children:"MyCloset"})]}),c.jsx("nav",{className:"flex-1 space-y-3",children:[{id:"dashboard",label:_("dashboard"),icon:eb},{id:"closet",label:_("closet"),icon:Ba},{id:"wishlist",label:_("wishlist")||"Carrinho",icon:Gy},{id:"laundry",label:_("laundry"),icon:is},{id:"outfits",label:_("outfits"),icon:$a},{id:"planner",label:_("planning"),icon:Fy},{id:"community",label:_("community"),icon:ub},{id:"settings",label:_("settings"),icon:Wh}].map(p=>c.jsxs("button",{onClick:()=>{e(p.id),window.innerWidth<768&&Q(!1)},className:`w-full flex items-center gap-4 px-6 py-4 rounded-2xl transition-all font-black text-[11px] uppercase tracking-widest ${t===p.id?"bg-primary-600 text-white shadow-2xl shadow-primary-600/30 scale-105":"opacity-40 hover:opacity-100 hover:bg-primary-500/5"}`,children:[c.jsx(p.icon,{size:20}),c.jsx("span",{children:p.label})]},p.id))}),c.jsxs("div",{className:"mt-auto pt-10 border-t border-inherit",children:[c.jsxs("div",{onClick:()=>e("profile"),className:"w-full flex items-center gap-4 mb-5 md:mb-8 px-2 text-left hover:bg-gray-100 dark:hover:bg-gray-800 py-3 rounded-2xl transition-all cursor-pointer",children:[c.jsx("div",{className:`w-12 h-12 rounded-2xl shrink-0 flex items-center justify-center font-black text-white shadow-xl overflow-hidden ${g?"bg-primary-500":"bg-primary-600"}`,children:F!=null&&F.avatar?c.jsx("img",{src:F.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):(((Aa=F==null?void 0:F.fullName)==null?void 0:Aa[0])||((Na=F==null?void 0:F.username)==null?void 0:Na[0])||((vr=n==null?void 0:n.email)==null?void 0:vr[0])||"U").toUpperCase()}),c.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[c.jsxs("p",{className:"text-sm font-black truncate text-inherit",children:["@",(F==null?void 0:F.username)||((a=n==null?void 0:n.email)==null?void 0:a.split("@")[0])||_("userTitle")]}),c.jsx("div",{onClick:to,className:"inline-block mt-1 cursor-pointer hover:opacity-80 transition-opacity",title:"Mudar estado",children:c.jsx(ou,{variant:Us==="online"?"success":Us==="away"?"warning":"default",children:_(Us)})})]})]}),c.jsxs("button",{onClick:()=>{n!=null&&n.uid&&localStorage.removeItem(`app-theme-${n.uid}`),WI(Ka)},className:"w-full py-4 text-red-500 font-black uppercase tracking-widest text-[10px] hover:bg-red-500/10 rounded-2xl transition-all flex items-center justify-center gap-3",children:[c.jsx(nb,{size:16})," ",_("logout")]})]})]})}),V&&c.jsx("div",{className:"fixed inset-0 bg-black/50 z-[90] md:hidden backdrop-blur-sm",onClick:()=>Q(!1)}),c.jsxs("main",{className:"flex-1 flex flex-col h-screen overflow-hidden",children:[c.jsxs("header",{className:`h-20 md:h-24 shrink-0 flex items-center justify-between px-4 md:px-12 transition-all border-b border-inherit ${g?"bg-gray-950/50":"bg-white/50"} backdrop-blur-xl`,children:[c.jsxs("div",{className:"flex items-center gap-3 md:gap-6",children:[c.jsx("button",{onClick:()=>Q(!V),className:`p-2 md:p-3 rounded-xl md:rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700":"bg-gray-50 border-gray-200"}`,children:V?c.jsx(sb,{size:20,className:"md:w-6 md:h-6"}):c.jsx(ob,{size:20,className:"md:w-6 md:h-6"})}),c.jsxs("h2",{className:"text-xl md:text-3xl font-black tracking-tighter truncate max-w-[150px] md:max-w-none",children:[t==="dashboard"&&_("overview"),t==="closet"&&_("myCloset"),t==="wishlist"&&(_("wishlist")||"Carrinho"),t==="laundry"&&_("laundry"),t==="outfits"&&_("outfitsAndStyle"),t==="planner"&&_("planning"),t==="community"&&_("community"),t==="settings"&&_("settings"),t==="profile"&&_("profileInfo")]})]}),c.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[c.jsx("button",{onClick:()=>Js(!0),className:"p-2 md:p-3 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 rounded-xl md:rounded-2xl hover:scale-105 active:scale-95 transition-all",children:c.jsx($a,{size:20,className:"w-5 h-5 md:w-6 md:h-6"})}),c.jsxs("div",{className:"hidden sm:flex bg-gray-100 dark:bg-gray-800 p-1.5 rounded-xl md:rounded-2xl",children:[c.jsx("button",{onClick:()=>Zs(!1),className:`p-1.5 md:p-2 rounded-lg md:rounded-xl ${g?"text-gray-500":"bg-white shadow-md text-primary-600"}`,children:c.jsx(cb,{size:16,className:"md:w-[18px] md:h-[18px]"})}),c.jsx("button",{onClick:()=>Zs(!0),className:`p-1.5 md:p-2 rounded-lg md:rounded-xl ${g?"bg-gray-900 shadow-md text-primary-400":"text-gray-500"}`,children:c.jsx(ib,{size:16,className:"md:w-[18px] md:h-[18px]"})})]}),c.jsxs("button",{onClick:()=>An(!0),className:"relative p-2 md:p-4 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 rounded-xl md:rounded-2xl hover:scale-105 active:scale-95 transition-all",children:[c.jsx(Fa,{size:20,className:"w-5 h-5 md:w-6 md:h-6"}),Wn.filter(p=>!p.read).length>0&&c.jsx("span",{className:"absolute top-1 md:top-2 right-1 md:right-2 w-2.5 h-2.5 md:w-3 md:h-3 bg-red-500 rounded-full border-2 border-white dark:border-gray-800"})]}),c.jsx("button",{onClick:()=>{v(null),I(""),e("add"),Yt(null),At([])},className:"p-2 md:p-4 bg-primary-600 text-white rounded-xl md:rounded-2xl shadow-xl shadow-primary-600/30 hover:scale-105 active:scale-95 transition-all",children:c.jsx(za,{size:20,className:"w-5 h-5 md:w-6 md:h-6"})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-12 space-y-5 md:space-y-8 md:space-y-12",children:[t==="dashboard"&&c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700",children:[c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-8",children:[{label:_("readyClothes"),val:Rn.length,icon:Ba,col:"primary"},{label:_("inLaundry"),val:Re.length,icon:is,col:"blue"},{label:_("myLooks"),val:u.length,icon:$a,col:"purple"}].map((p,E)=>c.jsxs(Ue,{className:"p-5 md:p-8 group hover:-translate-y-2",darkMode:g,children:[c.jsx("div",{className:`w-14 h-14 rounded-2xl flex items-center justify-center mb-6 shadow-inner ${g?"bg-gray-700 text-primary-400":"bg-primary-50 text-primary-600"}`,children:c.jsx(p.icon,{size:28})}),c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-1",children:p.label}),c.jsx("h4",{className:"text-4xl font-black tracking-tight",children:p.val})]},E))}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 md:gap-8",children:[c.jsxs("div",{className:"lg:col-span-2 p-6 md:p-10 rounded-3xl md:rounded-[2rem] relative overflow-hidden shadow-2xl",style:{backgroundColor:"hsl(var(--primary-600))",color:"white"},children:[c.jsxs("div",{className:"relative z-10 flex flex-col justify-between h-full",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[c.jsx($y,{size:28,style:{color:"rgba(255,255,255,0.7)"}}),c.jsx(ou,{variant:"warning",children:vt?vt.name:_("todayIn")})]}),c.jsx("h3",{className:"text-5xl font-black tracking-tighter mb-4",style:{color:"white"},children:vt?_("weatherCurrentAvg").replace("{current}",vt.currentTemp).replace("{avg}",vt.avgTemp):_("weatherUpdate")}),c.jsx("p",{className:"text-lg font-medium max-w-lg leading-relaxed",style:{color:"rgba(255,255,255,0.8)"},children:vt?`${_("weatherForecastDesc").replace("{max}",vt.maxTemp).replace("{min}",vt.minTemp)} ${_("weatherMsg")}`:_("weatherMsg")})]}),c.jsxs("div",{className:"mt-6 md:mt-10 flex gap-4 items-center",children:[Rn.filter(p=>p.category==="Tops").slice(0,2).map(p=>c.jsx("div",{className:"w-16 h-16 rounded-xl overflow-hidden border-2",style:{borderColor:"rgba(255,255,255,0.4)"},children:c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover",alt:""})},p.id)),c.jsxs("button",{onClick:()=>e("closet"),className:"flex items-center gap-2 font-black uppercase text-xs tracking-widest hover:translate-x-2 transition-transform",style:{color:"white"},children:[_("exploreSuggestions")," ",c.jsx(X1,{size:18})]})]})]}),c.jsx($y,{size:350,className:"absolute -bottom-20 -right-20",style:{color:"rgba(255,255,255,0.1)"}})]}),c.jsxs(Ue,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-lg font-black tracking-tight mb-5 md:mb-8 flex items-center gap-2 text-inherit",children:[c.jsx(ab,{size:20})," ",_("topColors")]}),c.jsx("div",{className:"space-y-6",children:es.length>0?es.map(p=>c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex justify-between text-[10px] font-black uppercase tracking-widest opacity-50",children:[c.jsx("span",{children:p.color}),c.jsxs("span",{children:[p.percentage,"% (",p.count,")"]})]}),c.jsx("div",{className:"h-2 w-full bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-primary-600",style:{width:`${p.percentage}%`}})})]},p.color)):c.jsx("p",{className:"text-xs opacity-50 italic",children:_("addColorsToItems")})})]})]})]}),(t==="closet"||t==="wishlist")&&c.jsxs("div",{className:"space-y-6 md:space-y-10 animate-in slide-in-from-bottom-8 duration-700",children:[c.jsxs("div",{className:"flex flex-col xl:flex-row gap-4 md:gap-8 items-center justify-between",children:[c.jsxs("div",{className:"relative w-full max-w-2xl",children:[c.jsx(lo,{className:"absolute left-6 top-1/2 -translate-y-1/2 text-gray-400",size:24}),c.jsx("input",{placeholder:_("searchPlaceholder"),className:`w-full pl-16 pr-8 py-6 rounded-3xl md:rounded-[2rem] shadow-inner outline-none border-none focus:ring-4 focus:ring-primary-500/10 font-bold text-lg ${g?"bg-gray-800":"bg-gray-100"}`,onChange:p=>L(p.target.value)})]}),c.jsx("div",{className:"flex gap-3 w-full xl:w-auto",children:c.jsxs("button",{onClick:()=>Ae(!0),className:"flex items-center gap-3 px-5 md:px-8 py-4 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all",children:[c.jsx(Bh,{size:18})," ",_("advancedFilters"),(Gt||se||Y!=="any"||Xe!=="Todos"&&Xe!==_("all"))&&c.jsx("span",{className:"w-2 h-2 rounded-full bg-white animate-pulse"})]})})]}),(t==="closet"||t==="wishlist"||t==="outfits")&&c.jsxs("div",{className:"flex items-center gap-3 overflow-x-auto pb-1 custom-scrollbar",children:[c.jsxs("button",{onClick:()=>va("all"),className:`shrink-0 flex items-center gap-2 px-5 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all ${Jt==="all"?"bg-primary-600 text-white shadow-lg shadow-primary-600/30":g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:[c.jsx(qy,{size:14})," ",_("allSections")]}),ln.map(p=>c.jsx("button",{onClick:()=>va(p.id),className:`shrink-0 flex items-center gap-2 px-5 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all ${Jt===p.id?"bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:p.name},p.id)),c.jsxs("button",{onClick:()=>pr(!0),className:`shrink-0 flex items-center gap-2 px-4 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all border-2 border-dashed ${g?"border-gray-700 text-gray-500 hover:border-primary-500 hover:text-primary-400":"border-gray-200 text-gray-400 hover:border-primary-400 hover:text-primary-600"}`,children:[c.jsx(Wh,{size:14})," ",_("manageSections")]})]}),c.jsx("div",{className:In==="small"?"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-6":In==="medium"?"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-5 gap-4 md:gap-8":"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-6 md:gap-10",children:Tc.map(p=>{const E={small:{badgeClass:"top-2 left-2 scale-[0.65] origin-top-left",heartContClass:"top-2 right-2",heartBtnClass:"p-1.5 rounded-lg",heartIcon:10,overlayContClass:"p-2 pb-[50px]",btnPyClass:"py-1 px-1",btnTextClass:"hidden",btnIcon:10,btnGap:"gap-1",btnRadius:"rounded-md",infoContClass:"bottom-2 left-2 right-2 p-2 rounded-xl",titleClass:"text-xs",colorDotClass:"w-2 h-2",colorTextClass:"text-[8px]",secTextClass:"text-[8px] px-1 py-0 rounded"},medium:{badgeClass:"top-4 left-4 scale-90 origin-top-left",heartContClass:"top-4 right-4",heartBtnClass:"p-2 rounded-xl",heartIcon:14,overlayContClass:"p-4 pb-[90px]",btnPyClass:"py-2 px-2",btnTextClass:"text-[8px]",btnIcon:12,btnGap:"gap-1.5",btnRadius:"rounded-xl",infoContClass:"bottom-4 left-4 right-4 p-4 rounded-2xl",titleClass:"text-sm",colorDotClass:"w-3 h-3",colorTextClass:"text-[9px]",secTextClass:"text-[9px] px-1.5 py-0.5 rounded-md"},large:{badgeClass:"top-6 left-6",heartContClass:"top-6 right-6",heartBtnClass:"p-3 rounded-2xl",heartIcon:18,overlayContClass:"p-6 pb-[136px]",btnPyClass:"py-3 px-2",btnTextClass:"text-[9px]",btnIcon:14,btnGap:"gap-2",btnRadius:"rounded-xl",infoContClass:"bottom-6 left-6 right-6 p-6 rounded-3xl",titleClass:"text-xl",colorDotClass:"w-4 h-4",colorTextClass:"text-[10px]",secTextClass:"text-[10px] px-2 py-0.5 rounded-md"}}[In]||{badgeClass:"top-6 left-6",heartContClass:"top-6 right-6",heartBtnClass:"p-3 rounded-2xl",heartIcon:18,overlayContClass:"p-6 pb-[136px]",btnPyClass:"py-3 px-2",btnTextClass:"text-[9px]",btnIcon:14,btnGap:"gap-2",btnRadius:"rounded-xl",infoContClass:"bottom-6 left-6 right-6 p-6 rounded-3xl",titleClass:"text-xl",colorDotClass:"w-4 h-4",colorTextClass:"text-[10px]",secTextClass:"text-[10px] px-2 py-0.5 rounded-md"};return c.jsx("div",{className:"group",children:c.jsxs(Ue,{className:`overflow-hidden p-0 relative border-none hover:shadow-2xl transition-all duration-500 ${In==="small"?"h-[180px]":In==="medium"?"h-[320px]":"h-[480px]"}`,darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110",alt:p.name}),c.jsx("div",{className:`absolute inset-0 bg-gradient-to-t from-black/80 via-transparent opacity-0 group-hover:opacity-100 transition-all duration-300 flex flex-col justify-end text-white z-10 pointer-events-none ${E.overlayContClass}`,children:c.jsxs("div",{className:`grid grid-cols-2 ${E.btnGap} pointer-events-auto`,children:[c.jsxs("button",{onClick:()=>{v(p),I(p.imageUrl||""),e("edit")},className:`${E.btnPyClass} bg-white text-primary-600 ${E.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-primary-50`,children:[c.jsx(Xc,{size:E.btnIcon})," ",c.jsx("span",{className:E.btnTextClass,children:_("edit")})]}),c.jsxs("button",{onClick:()=>Dn("laundry",p),className:`${E.btnPyClass} bg-blue-600 text-white ${E.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-blue-700`,children:[c.jsx(is,{size:E.btnIcon})," ",c.jsx("span",{className:E.btnTextClass,children:_("makeDirty")})]}),c.jsxs("button",{onClick:()=>Dn("trash",p),className:`${E.btnPyClass} bg-red-600/20 text-red-100 backdrop-blur-md ${E.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-red-600 transition-colors col-span-2`,children:[c.jsx(Yy,{size:E.btnIcon})," ",c.jsx("span",{className:E.btnTextClass,children:_("moveToTrash")})]})]})}),c.jsx("div",{className:`absolute z-20 ${E.badgeClass}`,children:c.jsx(ou,{children:p.category})}),c.jsx("div",{className:`absolute z-20 pointer-events-auto ${E.heartContClass}`,children:c.jsx("button",{onClick:()=>Dn("favorite",p),className:`${E.heartBtnClass} shadow-xl backdrop-blur-md transition-all ${p.favorite?"bg-rose-500 text-white":"bg-white/90 text-gray-400"}`,children:c.jsx($h,{size:E.heartIcon,fill:p.favorite?"currentColor":"none"})})}),c.jsxs("div",{className:`absolute bg-white/95 dark:bg-gray-900/95 backdrop-blur-2xl shadow-2xl transform transition-transform group-hover:-translate-y-2 z-20 pointer-events-auto ${E.infoContClass}`,children:[c.jsx("h4",{className:`${E.titleClass} font-black tracking-tighter truncate`,children:p.name}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5 border-r border-gray-200 dark:border-gray-700 pr-2",children:[c.jsx("div",{className:`${E.colorDotClass} rounded-full border border-black/10 shrink-0`,style:xc(p.color)}),c.jsx("span",{className:`${E.colorTextClass} font-black opacity-40 uppercase tracking-widest`,children:p.color})]}),p.sections&&p.sections.length>0&&c.jsx("div",{className:"flex items-center gap-1 overflow-x-auto custom-scrollbar no-scrollbar",children:p.sections.map(j=>{const z=ln.find(M=>M.id===j);return z?c.jsx("span",{className:`${E.secTextClass} font-bold bg-gray-100 dark:bg-gray-800 text-gray-500 whitespace-nowrap`,children:z.name},z.id):null})})]})]})]})},p.id)})})]}),t==="laundry"&&c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700",children:[c.jsxs("div",{className:"text-center max-w-2xl mx-auto space-y-4 text-inherit",children:[c.jsx("div",{className:"w-20 h-20 bg-blue-100 dark:bg-blue-900/30 rounded-3xl md:rounded-[2rem] flex items-center justify-center mx-auto text-blue-600 shadow-inner",children:c.jsx(is,{size:40})}),c.jsx("h3",{className:"text-4xl font-black tracking-tight",children:_("laundryBasket")})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 md:gap-8",children:[Re.map(p=>c.jsxs(Ue,{className:"p-4 flex items-center gap-4 border-blue-200 dark:border-blue-900/50",darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-16 h-16 rounded-2xl object-cover shadow-sm shrink-0",alt:""}),c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center items-start",children:[c.jsx("p",{className:"font-black text-sm truncate w-full text-inherit",children:p.name}),c.jsx("div",{className:"mt-1.5",children:c.jsx(ou,{variant:"warning",children:_("washing")})})]}),c.jsx("button",{onClick:()=>Dn("clean",p),className:"p-3 bg-green-500 text-white rounded-xl shadow-md hover:scale-105 transition-all shrink-0",children:c.jsx(Uy,{size:20})})]},p.id)),Re.length===0&&c.jsx("div",{className:"col-span-full py-20 text-center opacity-20 font-black uppercase tracking-[0.5em] text-sm",children:_("emptyBasket")})]})]}),t==="outfits"&&c.jsx("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 md:gap-12",children:[c.jsxs("div",{className:"lg:col-span-1 space-y-5 md:space-y-8",children:[c.jsxs(Ue,{className:"p-5 md:p-8 border-primary-200",darkMode:g,children:[c.jsxs("h3",{className:"text-2xl font-black tracking-tighter mb-6 flex items-center gap-3 text-inherit",children:[c.jsx($a,{className:"text-primary-600"})," ",Ve?_("editLook")||"Editar Outfit":_("createNewLook")]}),c.jsxs("form",{onSubmit:ts,className:"space-y-6",children:[c.jsx("input",{name:"lookName",placeholder:_("lookName"),defaultValue:(Ve==null?void 0:Ve.name)||"",required:!0,className:`w-full p-4 rounded-xl border-none shadow-inner font-bold ${g?"bg-gray-700":"bg-gray-100"}`}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("p",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest",children:[_("selectedPieces")," (",Qe.length,")"]}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[Qe.map(p=>{const E=o.find(j=>j.id===p);return c.jsxs("div",{className:"relative group",children:[c.jsx("img",{src:E==null?void 0:E.imageUrl,className:"w-12 h-12 rounded-lg object-cover border-2 border-primary-500",alt:""}),c.jsx("button",{type:"button",onClick:()=>At(Qe.filter(j=>j!==p)),className:"absolute -top-1 -right-1 bg-red-500 text-white rounded-full p-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(xr,{size:10})})]},p)}),Qe.length===0&&c.jsx("p",{className:"text-xs text-gray-400 italic",children:_("selectPieces")})]})]}),c.jsxs("div",{className:"space-y-3 pt-3 border-t border-inherit",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase tracking-widest opacity-50 flex items-center gap-2",children:[c.jsx(Qy,{size:12})," ",_("assignSections")]}),c.jsxs("button",{type:"button",onClick:()=>pr(!0),className:"text-[10px] font-black uppercase tracking-widest text-primary-600 hover:text-primary-700 flex items-center gap-1",children:[c.jsx(za,{size:10})," ",_("createSection")]})]}),ln.length===0?c.jsx("div",{className:"p-4 border-2 border-dashed border-gray-200 dark:border-gray-800 rounded-2xl text-center",children:c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:_("noSectionsCreated")})}):c.jsx("div",{className:"flex flex-wrap gap-2",children:ln.map(p=>c.jsxs("button",{type:"button",onClick:()=>{gr.includes(p.id)?Qs(gr.filter(E=>E!==p.id)):Qs([...gr,p.id])},className:`flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs font-bold transition-all border-2 ${gr.includes(p.id)?"border-primary-600 bg-primary-600 text-white shadow-md shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:[p.name,gr.includes(p.id)&&c.jsx(Qn,{size:12})]},p.id))})]}),c.jsxs("div",{className:"flex gap-4",children:[Ve&&c.jsx("button",{type:"button",onClick:()=>{Yt(null),At([])},className:"flex-1 py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 transition-colors",children:_("cancel")}),c.jsx("button",{disabled:Qe.length<2,className:"flex-[2] py-4 bg-primary-600 text-white rounded-2xl font-black uppercase tracking-widest text-xs shadow-xl shadow-primary-600/30 disabled:opacity-30 transition-all",children:Ve?_("saveChanges")||"Guardar":_("saveLook")})]})]},Ve?Ve.id:"new")]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-xs font-black uppercase opacity-50 tracking-widest px-2",children:_("closetLabel")}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-h-96 overflow-y-auto pr-2 custom-scrollbar",children:kc.map(p=>c.jsxs("button",{onClick:()=>!Qe.includes(p.id)&&At([...Qe,p.id]),className:`relative rounded-xl overflow-hidden aspect-square border-2 transition-all ${Qe.includes(p.id)?"border-primary-600 scale-90":"border-transparent hover:border-primary-200"}`,children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover",alt:""}),p.status==="wishlist"&&c.jsx("div",{className:"absolute top-1 left-1 bg-yellow-500 text-white p-1 rounded-md shadow-md",children:c.jsx(Gy,{size:10})}),Qe.includes(p.id)&&c.jsx("div",{className:"absolute inset-0 bg-primary-600/40 flex items-center justify-center text-white",children:c.jsx(Qn,{size:20})})]},p.id))})]})]}),c.jsx("div",{className:"lg:col-span-2 space-y-6 md:space-y-10",children:(()=>{const p=u.filter(M=>{const J=Jt==="all"||M.sections&&M.sections.includes(Jt);let te=!0;Gt&&(te=M.items.some(ne=>{const ke=o.find(_t=>_t.id===ne);return ke&&ke.color&&ke.color.includes(Gt)}));const X=!se||M.favorite;return J&&te&&X}),E=p.filter(M=>M.items.every(J=>{const te=o.find(X=>X.id===J);return!te||te.status!=="laundry"})),j=p.filter(M=>M.items.some(J=>{const te=o.find(X=>X.id===J);return te&&te.status==="laundry"})),z=M=>{const J=M.items.some(te=>{const X=o.find(ne=>ne.id===te);return X&&X.status==="laundry"});return c.jsxs(Ue,{className:`p-5 md:p-8 group hover:shadow-2xl transition-all border-none shadow-md ${J?"opacity-75":""}`,darkMode:g,children:[c.jsxs("div",{className:"flex justify-between items-start mb-6",children:[c.jsxs("div",{className:"text-inherit",children:[c.jsx("h4",{className:"text-xl font-black tracking-tight",children:M.name}),c.jsxs("p",{className:"text-[10px] opacity-40 font-bold uppercase tracking-widest",children:[M.items.length," ",_("pieces")," • ",new Date(M.createdAt).toLocaleDateString()]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{onClick:()=>Ic(M),className:`p-2 transition-colors relative group/share ${Ws===M.id?"text-green-500":"text-gray-300 hover:text-green-500"}`,title:"Partilhar outfit",children:[Ws===M.id?c.jsx(Qn,{size:18}):c.jsx(Hy,{size:18}),c.jsx("span",{className:"absolute -top-8 left-1/2 -translate-x-1/2 bg-gray-900 text-white text-[9px] font-black uppercase tracking-widest px-2 py-1 rounded-lg whitespace-nowrap opacity-0 group-hover/share:opacity-100 transition-opacity pointer-events-none",children:Ws===M.id?_("linkCopied"):_("share")})]}),c.jsx("button",{onClick:()=>ph("favorite",M),className:`p-2 transition-colors relative group/fav ${M.favorite?"text-rose-500":"text-gray-300 hover:text-rose-500"}`,title:"Favorito",children:c.jsx($h,{size:18,fill:M.favorite?"currentColor":"none"})}),c.jsx("button",{onClick:()=>{Yt(M),At(M.items)},className:"p-2 text-gray-300 hover:text-primary-500 transition-colors",children:c.jsx(Xc,{size:18})}),c.jsx("button",{onClick:()=>io(M),className:"p-2 text-gray-300 hover:text-blue-500 transition-colors",title:"Lavar outfit inteiro",children:c.jsx(is,{size:18})}),c.jsx("button",{onClick:()=>Sc(M.id),className:"p-2 text-gray-300 hover:text-red-500 transition-colors",children:c.jsx(Zc,{size:18})})]})]}),c.jsx("div",{className:"flex -space-x-4 mb-4",children:M.items.map(te=>{const X=o.find(ke=>ke.id===te),ne=(X==null?void 0:X.status)==="laundry";return c.jsxs("div",{className:`relative w-20 h-20 rounded-2xl border-4 overflow-hidden shadow-lg transform group-hover:rotate-6 transition-transform ${ne?"border-blue-400":"border-white dark:border-gray-800"}`,children:[c.jsx("img",{src:X==null?void 0:X.imageUrl,className:`w-full h-full object-cover ${ne?"brightness-75":""}`,alt:""}),ne&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-blue-500/30 backdrop-blur-[1px]",children:c.jsx(is,{size:18,className:"text-white drop-shadow"})})]},te)})}),J&&c.jsxs("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/20 rounded-xl",children:[c.jsx(is,{size:14,className:"text-blue-500 shrink-0"}),c.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-blue-500",children:[M.items.filter(te=>{const X=o.find(ne=>ne.id===te);return(X==null?void 0:X.status)==="laundry"}).length," ",_("piecesInLaundry")]})]}),M.sections&&M.sections.length>0&&c.jsx("div",{className:"flex items-center gap-1 mt-4 overflow-x-auto custom-scrollbar no-scrollbar",children:M.sections.map(te=>{const X=ln.find(ne=>ne.id===te);return X?c.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-md bg-gray-100 dark:bg-gray-800 text-gray-500 whitespace-nowrap",children:X.name},X.id):null})})]},M.id)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between px-2 flex-wrap gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),c.jsxs("h3",{className:"text-2xl font-black tracking-tighter text-inherit",children:[_("lookHistory")," ",c.jsxs("span",{className:"text-sm font-bold opacity-40",children:["— ",_("availableLooks")," (",E.length,")"]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{onClick:Ji,className:`flex items-center gap-2 px-4 py-2 rounded-xl font-black text-[10px] uppercase tracking-widest transition-colors ${g?"bg-primary-900/30 text-primary-400 hover:bg-primary-900/50":"bg-primary-50 text-primary-600 hover:bg-primary-100"}`,title:_("pasteSharedLookLink")||"Colar link de look",children:[c.jsx(tb,{size:14})," ",c.jsx("span",{className:"hidden sm:inline",children:_("pasteLink")||"Colar Link"})]}),c.jsx(Bh,{size:16,className:"text-gray-400 ml-2"}),c.jsxs("select",{value:Gt,onChange:M=>Qt(M.target.value),className:`p-2 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold text-xs ${g?"bg-gray-800 text-white":"bg-gray-100"}`,children:[c.jsx("option",{value:"",children:_("all")||"Todas as cores"}),["Vermelho","Azul","Amarelo","Verde","Laranja","Roxo","Branco","Preto","Cinzento","Bege"].map(M=>c.jsx("option",{value:M,children:M},M))]})]})]}),E.length>0?c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-8",children:E.map(z)}):c.jsx("div",{className:"py-6 md:py-12 text-center opacity-20 font-black uppercase tracking-[0.3em] text-sm",children:_("noLooksAvailable")})]}),j.length>0&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center gap-3 px-2",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-blue-400"}),c.jsxs("h3",{className:"text-2xl font-black tracking-tighter text-inherit",children:[_("toBeWashed")," ",c.jsxs("span",{className:"text-sm font-bold opacity-40",children:["— ",_("unavailable")," (",j.length,")"]})]})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-8",children:j.map(z)})]})]})})()})]})}),t==="planner"&&(()=>{const p=xe.getFullYear(),E=xe.getMonth(),j=K=>`${K.getFullYear()}-${String(K.getMonth()+1).padStart(2,"0")}-${String(K.getDate()).padStart(2,"0")}`,z=()=>{const K=new Date(p,E,1),Pt=new Date(p,E+1,0),cn=(K.getDay()+6)%7,vn=[];for(let ut=0;ut{const K=new Date(xe),Pt=(K.getDay()+6)%7,cn=new Date(K);return cn.setDate(K.getDate()-Pt),Array.from({length:7},(vn,_r)=>{const ut=new Date(cn);return ut.setDate(cn.getDate()+_r),ut})},te={PT:"pt-PT",EN:"en-GB",ES:"es-ES",FR:"fr-FR",DE:"de-DE"}[yt]||"pt-PT",X=Array.from({length:12},(K,Pt)=>{const vn=new Date(2e3,Pt,1).toLocaleDateString(te,{month:"long"});return vn.charAt(0).toUpperCase()+vn.slice(1)}),ne=Array.from({length:7},(K,Pt)=>new Date(2024,0,Pt+1).toLocaleDateString(te,{weekday:"short"}).replace(".","")),ke=()=>{const K=new Date(xe);Nn==="month"?K.setMonth(E-1):K.setDate(K.getDate()-7),ri(K)},_t=()=>{const K=new Date(xe);Nn==="month"?K.setMonth(E+1):K.setDate(K.getDate()+7),ri(K)},ct=M(),xt=`${ct[0].getDate()} ${X[ct[0].getMonth()]} — ${ct[6].getDate()} ${X[ct[6].getMonth()]} ${ct[6].getFullYear()}`,Ie=({date:K,cur:Pt=!0})=>{const cn=j(K),vn=Sa(cn),_r=cn===ba,ut=Nn==="week";let rs=null;return Hr&&vt&&vt.forecast&&(rs=vt.forecast.find(oo=>oo.date===cn)),c.jsxs("div",{onClick:()=>{ah(cn),Xs(!0)},className:`relative rounded-2xl overflow-hidden cursor-pointer transition-all group border-2 flex flex-col ${_r?"border-primary-600 shadow-lg shadow-primary-600/20":Pt?"border-transparent hover:border-primary-300 dark:hover:border-primary-700":"border-transparent opacity-30"} ${g?"bg-gray-800/80":"bg-gray-50"}`,style:{minHeight:ut?"180px":"100px"},children:[c.jsxs("div",{className:`px-3 py-2 flex items-center justify-between shrink-0 ${_r?"bg-primary-600":""}`,children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:`text-xs font-black ${_r?"text-white":""}`,children:K.getDate()}),rs&&c.jsxs("div",{className:"flex items-center gap-1 text-xs",title:`${rs.min}ºC - ${rs.max}ºC`,children:[c.jsx("span",{className:"text-sm drop-shadow-sm",children:Xi(rs.weathercode)}),c.jsxs("span",{className:`text-[10px] font-black ${_r?"text-white/90":"text-gray-500 dark:text-gray-400"}`,children:[Math.round((rs.min+rs.max)/2),"°C"]})]})]}),_r&&c.jsx("span",{className:"text-[8px] font-black text-white/80 uppercase tracking-widest",children:_("today")})]}),vn.length>0?c.jsx("div",{className:"px-2 pb-2 pt-1 flex-1 overflow-y-auto custom-scrollbar space-y-3",children:vn.map(oo=>c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"flex -space-x-2",children:oo.items.slice(0,ut?4:3).map(Cg=>{const Ag=o.find(_k=>_k.id===Cg);return Ag?c.jsx("div",{className:`${ut?"w-10 h-10":"w-7 h-7"} rounded-lg overflow-hidden border-2 border-white dark:border-gray-700 shrink-0`,children:c.jsx("img",{src:Ag.imageUrl,className:"w-full h-full object-cover",alt:""})},Cg):null})}),c.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest opacity-50 truncate",children:oo.name}),ut&&c.jsxs("p",{className:"text-[9px] opacity-40 font-bold",children:[oo.items.length," ",_("piecesShort")]})]},oo.id))}):Pt&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsxs("div",{className:`flex items-center gap-1 px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-widest ${g?"bg-gray-700 text-primary-400":"bg-white text-primary-600 shadow-sm"}`,children:[c.jsx(za,{size:10})," Outfit"]})})]})};return c.jsxs("div",{className:"space-y-6 animate-in fade-in duration-700 pb-20",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:ke,className:`p-3 rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700 hover:bg-gray-700":"bg-white border-gray-200 hover:bg-gray-50"} shadow-sm`,children:c.jsx(zy,{size:20})}),c.jsx("h3",{className:"text-lg font-black tracking-tight min-w-[220px] text-center",children:Nn==="month"?`${X[E]} ${p}`:xt}),c.jsx("button",{onClick:_t,className:`p-3 rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700 hover:bg-gray-700":"bg-white border-gray-200 hover:bg-gray-50"} shadow-sm`,children:c.jsx(Z1,{size:20})}),c.jsx("button",{onClick:()=>ri(new Date),className:"px-4 py-2 text-[10px] font-black uppercase tracking-widest text-primary-600 bg-primary-50 dark:bg-primary-900/20 rounded-xl hover:bg-primary-100 dark:hover:bg-primary-900/40 transition-colors",children:_("today")})]}),c.jsx("div",{className:`flex p-1.5 rounded-2xl gap-1 ${g?"bg-gray-800":"bg-gray-100"}`,children:["month","week"].map(K=>c.jsx("button",{onClick:()=>_c(K),className:`px-5 py-2 rounded-xl font-black text-[10px] uppercase tracking-widest transition-all ${Nn===K?`${g?"bg-gray-700":"bg-white"} shadow-md text-primary-600`:"text-gray-500 hover:text-gray-700"}`,children:_(K==="month"?"monthLabel":"weekLabel")},K))})]}),c.jsx("div",{className:"grid grid-cols-7 gap-2",children:ne.map(K=>c.jsx("div",{className:"text-center text-[10px] font-black uppercase tracking-widest opacity-40 py-1",children:K},K))}),Nn==="month"?c.jsx("div",{className:"grid grid-cols-7 gap-2",children:z().map(({date:K,cur:Pt})=>c.jsx(Ie,{date:K,cur:Pt},j(K)))}):c.jsx("div",{className:"grid grid-cols-7 gap-3",children:M().map(K=>c.jsx(Ie,{date:K,cur:!0},j(K)))})]})})(),(t==="add"||t==="edit")&&c.jsx("div",{className:"max-w-4xl mx-auto animate-in zoom-in-95 duration-500",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 md:gap-12 items-start",children:[c.jsxs("div",{className:"space-y-5 md:space-y-8",children:[c.jsx("h3",{className:"text-5xl font-black tracking-tighter text-inherit",children:_(m?"edit":"newItem")}),c.jsx(Ue,{className:"aspect-[3/4] overflow-hidden shadow-2xl relative",darkMode:g,children:B?c.jsx("img",{src:B,className:"w-full h-full object-cover",alt:""}):c.jsxs("div",{className:"h-full flex flex-col items-center justify-center opacity-10",children:[c.jsx(qh,{size:100}),c.jsx("p",{className:"font-black uppercase tracking-[0.5em] mt-6",children:_("preview")})]})})]}),c.jsx(Ue,{className:"p-6 md:p-10 shadow-2xl",darkMode:g,children:c.jsxs("form",{onSubmit:bc,className:"space-y-5 md:space-y-8",children:[c.jsx(au,{label:_("name"),name:"name",defaultValue:m==null?void 0:m.name,required:!0}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("category")}),c.jsxs("select",{name:"category",defaultValue:(m==null?void 0:m.category)||"Tops",className:`w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-primary-500/10 font-bold ${g?"bg-gray-700 text-white":"bg-gray-100"}`,children:[c.jsx("option",{children:_("tops")}),c.jsx("option",{children:_("bottoms")}),c.jsx("option",{children:_("footwear")}),c.jsx("option",{children:_("coats")}),c.jsx("option",{children:_("accessories")})]})]}),c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"checkbox",name:"isWishlist",defaultChecked:(m==null?void 0:m.status)==="wishlist",className:"w-5 h-5 text-primary-600 focus:ring-primary-500 rounded-lg"}),c.jsxs("div",{children:[c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("wishlist")||_("wishlistDesc")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50",children:_("addFuturePurchase")})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:[_("color")," *"]}),c.jsx("div",{className:"flex flex-wrap gap-2",children:["Vermelho","Azul","Amarelo","Verde","Laranja","Roxo","Branco","Preto","Cinzento","Bege"].map(p=>c.jsx("button",{type:"button",onClick:()=>{k.includes(p)?C(k.filter(E=>E!==p)):C([...k,p])},className:`px-4 py-2 rounded-xl text-xs font-bold transition-all border-2 ${k.includes(p)?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:p},p))}),c.jsx("input",{type:"hidden",name:"color",value:k.join(", ")}),k.length===0&&c.jsx("p",{className:"text-[10px] text-red-500 uppercase tracking-widest font-black mt-2",children:_("selectOneColor")})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit flex items-center gap-2",children:[c.jsx(qh,{size:12})," ",_("imageUrl")," ou Upload"]}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("input",{type:"text",name:"imageUrl",value:B,onChange:p=>I(p.target.value),placeholder:"https://...",className:`w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-primary-500/10 font-bold transition-all ${g?"bg-gray-700 text-white":"bg-gray-100 text-gray-900"}`}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 flex-1"}),c.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest opacity-30",children:_("or")}),c.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 flex-1"})]}),c.jsxs("label",{className:`flex items-center justify-center gap-3 p-5 rounded-2xl cursor-pointer transition-all font-black text-[10px] uppercase tracking-widest border-2 border-dashed ${g?"bg-gray-800 border-gray-700 hover:border-primary-500 hover:text-primary-400":"bg-gray-50 border-gray-200 hover:border-primary-400 hover:text-primary-600"}`,children:[c.jsx(qh,{size:16}),c.jsx("span",{children:_("uploadGallery")}),c.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:jc})]})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit flex items-center gap-2",children:[c.jsx(Qy,{size:12})," ",_("assignSections")]}),c.jsxs("button",{type:"button",onClick:()=>pr(!0),className:"text-[10px] font-black uppercase tracking-widest text-primary-600 hover:text-primary-700 flex items-center gap-1",children:[c.jsx(za,{size:10})," ",_("createSection")]})]}),ln.length===0?c.jsx("div",{className:"p-4 border-2 border-dashed border-gray-200 dark:border-gray-800 rounded-2xl text-center",children:c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:_("noSectionsCreated")})}):c.jsx("div",{className:"flex flex-wrap gap-2",children:ln.map(p=>c.jsxs("button",{type:"button",onClick:()=>{ni.includes(p.id)?Gs(ni.filter(E=>E!==p.id)):Gs([...ni,p.id])},className:`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all border-2 ${ni.includes(p.id)?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:[p.name,ni.includes(p.id)&&c.jsx(Qn,{size:12})]},p.id))})]}),c.jsxs("div",{className:"flex gap-4 pt-6",children:[c.jsx("button",{type:"button",onClick:()=>{v(null),I(""),e("closet")},className:"flex-1 font-black uppercase text-[10px] opacity-40 hover:opacity-100 tracking-widest transition-all text-inherit",children:_("cancel")}),c.jsx("button",{type:"submit",className:"flex-1 py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black uppercase tracking-widest text-[10px] shadow-2xl shadow-primary-600/40 hover:scale-[1.02] active:scale-95 transition-all",children:_(m?"save":"register")})]})]})})]})}),t==="profile"&&c.jsxs("div",{className:"max-w-4xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:[c.jsx(Ue,{className:"p-6 md:p-10 border-primary-100 relative overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"flex items-center gap-4 md:gap-8 relative z-10 text-inherit",children:[c.jsxs("div",{className:"w-24 h-24 rounded-[2.5rem] bg-primary-600 flex items-center justify-center text-white text-4xl font-black shadow-2xl relative overflow-hidden group cursor-pointer",children:[F!=null&&F.avatar?c.jsx("img",{src:F.avatar,className:"w-full h-full object-cover",alt:"Profile"}):c.jsx("span",{children:(((d=F==null?void 0:F.fullName)==null?void 0:d[0])||((f=F==null?void 0:F.username)==null?void 0:f[0])||((y=n==null?void 0:n.email)==null?void 0:y[0])||"U").toUpperCase()}),c.jsxs("label",{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer text-white",children:[c.jsx(Xc,{size:20}),c.jsx("span",{className:"text-[8px] uppercase font-black mt-1 tracking-widest",children:_("edit")}),c.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Dc})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-3xl font-black tracking-tighter",children:(F==null?void 0:F.fullName)||_("yourAccount")}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("p",{className:"opacity-60 font-bold text-sm",children:["@",(F==null?void 0:F.username)||((P=n==null?void 0:n.email)==null?void 0:P.split("@")[0])||_("papMode")]}),c.jsx("button",{onClick:p=>{var E;p.stopPropagation(),navigator.clipboard.writeText(`@${(F==null?void 0:F.username)||((E=n==null?void 0:n.email)==null?void 0:E.split("@")[0])||_("papMode")}`),Pe("Username copiado!"),setTimeout(()=>Pe(null),2e3)},className:"text-blue-500 hover:text-blue-600 bg-blue-500/10 p-1.5 rounded-md transition-colors",title:"Copiar Username",children:c.jsx(Ua,{size:14})})]})]})]})}),c.jsxs(Ue,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(By,{className:"text-primary-600"})," ",_("profileInfo")]}),c.jsxs("form",{onSubmit:so,className:"space-y-6",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"space-y-2 relative",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("username")}),c.jsxs("div",{className:"relative",children:[c.jsx("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 opacity-40 font-black",children:"@"}),c.jsx("input",{name:"username",defaultValue:(F==null?void 0:F.username)||"",placeholder:"amari",className:`w-full p-4 pl-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold ${g?"bg-gray-800 text-white":"bg-gray-50"}`})]})]}),c.jsx(au,{label:_("fullName"),name:"fullName",defaultValue:(F==null?void 0:F.fullName)||"",placeholder:"Ex: Amari Rodriguez"}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:[_("dob")," ",_("optional")]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("select",{name:"dobDay",defaultValue:((O=F==null?void 0:F.dob)==null?void 0:O.split("-")[2])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"DD"}),Array.from({length:31},(p,E)=>String(E+1).padStart(2,"0")).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(zh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]}),c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("select",{name:"dobMonth",defaultValue:((G=F==null?void 0:F.dob)==null?void 0:G.split("-")[1])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"MM"}),Array.from({length:12},(p,E)=>String(E+1).padStart(2,"0")).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(zh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]}),c.jsxs("div",{className:"relative flex-[1.5]",children:[c.jsxs("select",{name:"dobYear",defaultValue:((Ee=F==null?void 0:F.dob)==null?void 0:Ee.split("-")[0])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"YYYY"}),Array.from({length:100},(p,E)=>new Date().getFullYear()-E).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(zh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]})]})]}),c.jsx(au,{label:`${_("bio")} ${_("optional")}`,name:"bio",defaultValue:(F==null?void 0:F.bio)||"",placeholder:"..."}),c.jsx(au,{label:_("location"),name:"location",defaultValue:(F==null?void 0:F.location)||"",placeholder:_("locationEx")})]}),c.jsx("button",{disabled:Ui,type:"submit",className:"w-full py-4 bg-primary-600 text-white rounded-xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 disabled:opacity-50 hover:scale-[1.01] transition-all",children:_(Ui?"saving":"save")})]},`${F==null?void 0:F.username}-${F==null?void 0:F.fullName}-${F==null?void 0:F.dob}-${F==null?void 0:F.bio}-${F==null?void 0:F.location}`)]})]}),t==="community"&&c.jsx("div",{className:"max-w-7xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:Ne?c.jsxs("div",{className:"space-y-5 md:space-y-8",children:[c.jsxs("button",{onClick:()=>{fa(null),Wi(!1)},className:"flex items-center gap-2 opacity-60 hover:opacity-100 transition-opacity font-black text-inherit uppercase text-xs tracking-widest",children:[c.jsx(zy,{size:16})," Voltar"]}),c.jsx(Ue,{className:"p-5 md:p-8 border-primary-100 relative overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"flex items-center gap-4 md:gap-8 relative z-10 text-inherit",children:[c.jsx("div",{className:"w-24 h-24 rounded-[2.5rem] bg-primary-600 text-white flex items-center justify-center font-black text-4xl overflow-hidden",children:Ne.avatar?c.jsx("img",{src:Ne.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((et=Ne.fullName)==null?void 0:et[0])||((ge=Ne.username)==null?void 0:ge[0])||"U").toUpperCase()})}),c.jsxs("div",{className:"flex-1 flex justify-between items-start sm:items-center flex-col sm:flex-row gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-3xl font-black tracking-tighter",children:Ne.fullName||_("userTitle")}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("p",{className:"opacity-60 font-bold text-sm",children:["@",Ne.username||"user"]}),c.jsx("button",{onClick:p=>{p.stopPropagation(),navigator.clipboard.writeText(`@${Ne.username||"user"}`),Pe("Username copiado!"),setTimeout(()=>Pe(null),2e3)},className:"text-blue-500 hover:text-blue-600 bg-blue-500/10 p-1.5 rounded-md transition-colors",title:"Copiar Username",children:c.jsx(Ua,{size:14})})]})]}),c.jsxs("button",{onClick:()=>Wi(!0),className:"px-5 py-3 bg-primary-100 text-primary-700 dark:bg-primary-900/50 dark:text-primary-300 rounded-2xl font-black text-sm transition-all hover:scale-105 flex items-center gap-2",children:[c.jsx(lo,{size:16})," Inspecionar"]})]})]})}),qi&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Wi(!1),children:c.jsxs(Ue,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 relative",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("button",{onClick:()=>Wi(!1),className:"absolute top-6 right-6 opacity-50 hover:opacity-100 text-inherit",children:c.jsx(xr,{size:24})}),c.jsxs("div",{className:"flex items-center gap-6 mb-5 md:mb-8 text-inherit",children:[c.jsx("div",{className:"w-20 h-20 rounded-3xl md:rounded-[2rem] bg-primary-600 text-white flex items-center justify-center font-black text-3xl overflow-hidden",children:Ne.avatar?c.jsx("img",{src:Ne.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((at=Ne.fullName)==null?void 0:at[0])||((lt=Ne.username)==null?void 0:lt[0])||"U").toUpperCase()})}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-black",children:Ne.fullName||_("userTitle")}),c.jsxs("p",{className:"opacity-60 font-bold",children:["@",Ne.username||"user"]})]})]}),c.jsxs("div",{className:"space-y-6 text-inherit bg-gray-50 dark:bg-gray-800/50 p-6 rounded-3xl",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Data de Nascimento"}),c.jsx("p",{className:"font-bold",children:st!=null&&st.dob?new Date(st.dob).toLocaleDateString():"Não especificada"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Localidade"}),c.jsx("p",{className:"font-bold",children:(st==null?void 0:st.location)||Ne.location||"Não especificada"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Bio"}),c.jsx("p",{className:"font-bold opacity-80",children:(st==null?void 0:st.bio)||"Sem biografia"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Peças Registadas"}),c.jsx("p",{className:"text-2xl font-black",children:Fe.length})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Outfits Criados"}),c.jsx("p",{className:"text-2xl font-black",children:hr.length})]})]}),c.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:"Data de Registo da Conta"}),c.jsx("p",{className:"font-bold",children:st!=null&&st.createdAt?new Date(st.createdAt).toLocaleDateString():"Desconhecida"})]})]})]})}),Ne.isPrivate?c.jsxs("div",{className:"text-center py-20 opacity-50 font-black text-2xl text-inherit",children:[c.jsx(Ky,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),_("isPrivateUser")]}):c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 text-inherit",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black mb-6 uppercase tracking-widest text-[11px] opacity-50",children:[_("userOutfits")," (",hr.length,")"]}),c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-6",children:hr.map(p=>c.jsxs("div",{className:"group relative aspect-[3/4] rounded-3xl md:rounded-[2rem] overflow-hidden bg-gray-100 dark:bg-gray-800 cursor-pointer shadow-lg",children:[p.items&&p.items[0]&&Fe.find(E=>E.id===p.items[0])&&c.jsx("img",{src:Fe.find(E=>E.id===p.items[0]).imageUrl,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",alt:"Look"}),c.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent flex items-end p-6",children:[c.jsx("span",{className:"text-white font-black text-sm flex-1",children:p.name}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:E=>{E.stopPropagation(),$s(p)},className:"p-2 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Inspecionar Outfit",children:c.jsx(lo,{size:16})}),c.jsx("button",{onClick:E=>{E.stopPropagation(),Ca(p)},className:"p-2 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Copiar para o meu armário",children:c.jsx(Ua,{size:16})})]})]})]},p.id))})]}),c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black mb-6 uppercase tracking-widest text-[11px] opacity-50",children:[_("userCloset")," (",Fe.length,")"]}),c.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-4",children:Fe.map(p=>c.jsxs("div",{className:"aspect-square rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-800 shadow-md group relative",children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",alt:"Item"}),c.jsxs("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[c.jsx("button",{onClick:E=>{E.stopPropagation(),qs(p)},className:"p-2.5 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Inspecionar Peça",children:c.jsx(lo,{size:18})}),c.jsx("button",{onClick:E=>{E.stopPropagation(),ro(p)},className:"p-2.5 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Copiar para o meu armário",children:c.jsx(Ua,{size:18})})]})]},p.id))})]})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"relative mb-5 md:mb-8 flex gap-4",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(lo,{className:"absolute left-6 top-1/2 -translate-y-1/2 opacity-40 text-inherit",size:24}),c.jsx("input",{type:"text",placeholder:_("searchUsers"),value:Gr,onChange:p=>{ha(p.target.value),p.target.value&&Yr(!1)},className:`w-full p-6 pl-16 rounded-3xl font-black text-lg outline-none focus:ring-4 focus:ring-primary-500/20 transition-all shadow-xl shadow-black/5 text-inherit ${g?"bg-gray-800":"bg-white"}`})]}),c.jsxs("button",{onClick:()=>{Yr(!Qr),Qr||ha("")},className:`px-5 md:px-8 rounded-3xl font-black transition-all shadow-xl shadow-black/5 flex items-center justify-center gap-2 whitespace-nowrap ${Qr?"bg-primary-600 text-white":g?"bg-gray-800 text-inherit hover:bg-gray-700":"bg-white text-inherit hover:bg-gray-50"}`,children:[c.jsx(rb,{size:20}),c.jsx("span",{className:"hidden sm:inline",children:_("recommended")||"Recomendados"})]})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:zs.length===0?c.jsx("div",{className:"col-span-full text-center py-6 md:py-12 opacity-50 text-inherit font-black text-xl",children:_("noUsersFound")}):zs.map(p=>{var E,j;return c.jsx(Ue,{className:"p-6 cursor-pointer hover:scale-105 transition-transform",darkMode:g,onClick:()=>Ec(p),children:c.jsxs("div",{className:"flex items-center gap-4 text-inherit",children:[c.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary-600 text-white flex items-center justify-center font-black text-2xl overflow-hidden",children:p.avatar?c.jsx("img",{src:p.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((E=p.fullName)==null?void 0:E[0])||((j=p.username)==null?void 0:j[0])||"U").toUpperCase()})}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-black text-lg",children:p.fullName||_("userTitle")}),c.jsxs("p",{className:"text-sm opacity-60 font-bold",children:["@",p.username||"user"]})]})]})},p.uid)})})]})}),t==="settings"&&c.jsxs("div",{className:"max-w-4xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:gap-8",children:[c.jsxs(Ue,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(Wh,{className:"text-primary-600"})," ",_("preferences")]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("darkMode")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("interfaceAppearance")})]}),c.jsx("button",{onClick:()=>Zs(!g),className:`w-14 h-8 rounded-full transition-colors relative ${g?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${g?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("themeColor")||"Cor do Tema"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("personalizeColor")||"Personalize a cor"})]}),c.jsx("div",{className:"flex gap-2",children:[{id:"theme-indigo",color:"#4f46e5"},{id:"theme-rose",color:"#e11d48"},{id:"theme-emerald",color:"#10b981"},{id:"theme-amber",color:"#f59e0b"},{id:"theme-slate",color:"#64748b"}].map(p=>c.jsx("button",{onClick:()=>si(p.id),className:`w-6 h-6 rounded-full transition-all flex items-center justify-center ${Ke===p.id?"ring-2 ring-offset-2 ring-offset-white dark:ring-offset-gray-900 ring-primary-500 scale-110":"hover:scale-110"}`,style:{backgroundColor:p.color},children:Ke===p.id&&c.jsx(Qn,{size:12,className:"text-white"})},p.id))})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("notifications")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("lookReminders")})]}),c.jsx("button",{onClick:()=>ch(!zi),className:`w-14 h-8 rounded-full transition-colors relative ${zi?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${zi?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:"Notificação do Outfit Diário"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:"Receber notificação com o outfit planeado à hora marcada"})]}),c.jsxs("div",{className:"flex items-center gap-4 w-full sm:w-auto justify-between sm:justify-end",children:[dr&&c.jsx("input",{type:"time",value:qn,onChange:p=>{Os(p.target.value),wt("dailyOutfitTime",p.target.value),Ls(""),wt("lastNotifiedDate","")},className:`px-3 py-1.5 rounded-xl text-sm outline-none border font-bold ${g?"bg-gray-800 border-gray-700 text-white":"bg-white border-gray-200 text-gray-900"}`}),c.jsx("button",{onClick:()=>uh(!dr),className:`w-14 h-8 rounded-full transition-colors relative shrink-0 ${dr?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${dr?"left-7":"left-1"}`})})]})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("weatherAlerts")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("weatherSuggestions")})]}),c.jsx("button",{onClick:()=>Kn(!Hr),className:`w-14 h-8 rounded-full transition-colors relative ${Hr?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${Hr?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("privateProfile")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("privateProfileDesc")})]}),c.jsx("button",{onClick:()=>eo(!Vs),className:`w-14 h-8 rounded-full transition-colors relative ${Vs?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${Vs?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("cardSize")||"Tamanho do Card"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("cardSizeDesc")||"Tamanho no armário/carrinho"})]}),c.jsx("div",{className:"flex gap-2",children:["small","medium","large"].map(p=>c.jsx("button",{onClick:()=>dh(p),className:`px-3 py-1.5 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all border-2 ${In===p?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:p==="small"?_("small")||"Pequeno":p==="medium"?_("medium")||"Médio":_("large")||"Grande"},p))})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("defaultPage")||"Página Inicial"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("defaultPageDesc")||"Página que aparece após o login"})]}),c.jsx("div",{className:"flex gap-2",children:["dashboard","closet","outfits","planner"].map(p=>c.jsx("button",{onClick:()=>hh(p),className:`px-3 py-1.5 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all border-2 ${mc===p?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:_(p==="dashboard"?"dashboard":p==="closet"?"myCloset":p==="outfits"?"outfits":"planning")},p))})]}),c.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-100 dark:border-gray-800",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("appLanguage")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:yt==="PT"?"🇵🇹 "+_("portuguese"):yt==="EN"?"🇬🇧 "+_("english"):yt==="ES"?"🇪🇸 "+_("spanish"):yt==="FR"?"🇫🇷 "+_("french"):yt==="DE"?"🇩🇪 "+_("german"):yt})]}),c.jsx("button",{onClick:()=>$i(!0),className:"px-5 py-2 font-black text-[10px] uppercase tracking-widest bg-primary-50 text-primary-600 rounded-xl hover:bg-primary-100 transition-colors dark:bg-primary-900/40 dark:text-primary-400",children:_("edit")})]})]})]}),c.jsxs(Ue,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(Fa,{className:"text-primary-600"})," ",_("feedbackTitle")||"Suporte e Feedback"]}),c.jsx("p",{className:"opacity-60 text-sm font-medium mb-6",children:_("feedbackDesc")||"Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!"}),c.jsxs("form",{onSubmit:async p=>{p.preventDefault();const E=new FormData(p.target),j=E.get("type"),z=E.get("message"),M="faiker027@gmail.com";try{if((await fetch(`https://formsubmit.co/ajax/${M}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({Tipo:j,Mensagem:z,Utilizador:(n==null?void 0:n.email)||"Desconhecido",_subject:`MyCloset Feedback: ${j}`})})).ok)Pe(_("msgSentSuccess")),setTimeout(()=>Pe(null),4e3),p.target.reset();else throw new Error("Falha no envio")}catch(J){console.error("Erro ao enviar feedback:",J),Pe(_("msgSendError")),setTimeout(()=>Pe(null),4e3)}},className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"radio",name:"type",value:"Ideia/Sugestão",defaultChecked:!0,className:"text-primary-600 focus:ring-primary-500"}),c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("ideaSuggestion")})]}),c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"radio",name:"type",value:"Bug/Erro",className:"text-primary-600 focus:ring-primary-500"}),c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("bugError")})]})]}),c.jsx("textarea",{name:"message",required:!0,placeholder:_("writeMessage"),rows:4,className:`w-full p-4 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold resize-none ${g?"bg-gray-800 text-white":"bg-gray-50"}`}),c.jsx("button",{type:"submit",className:"w-full py-4 bg-primary-600 text-white rounded-xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-[1.01] transition-all",children:_("sendMessage")})]})]})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between px-2 text-inherit",children:[c.jsxs("h3",{className:"text-xl font-black text-red-500 flex items-center gap-3 tracking-widest uppercase",children:[c.jsx(Yy,{size:24})," ",_("recycleBin")]}),xa.length>0&&c.jsx("button",{onClick:Pc,className:"text-[10px] font-black text-red-500 uppercase tracking-widest hover:underline",children:_("empty")})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:xa.map(p=>c.jsxs(Ue,{className:"p-4 flex items-center gap-5 border-red-50",darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-16 h-16 rounded-2xl object-cover grayscale opacity-40",alt:""}),c.jsxs("div",{className:"flex-1 min-w-0 text-inherit",children:[c.jsx("p",{className:"font-black text-sm truncate",children:p.name}),c.jsx("p",{className:"text-[10px] font-black text-red-400 uppercase tracking-tighter",children:_("deleted")})]}),c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{onClick:()=>Dn("restore",p),className:"p-3 text-primary-600 hover:bg-primary-50 rounded-2xl transition-all",children:c.jsx(lb,{size:18})}),c.jsx("button",{onClick:()=>Dn("delete",p.id),className:"p-3 text-red-600 hover:bg-red-50 rounded-2xl transition-all",children:c.jsx(Zc,{size:18})})]})]},p.id))})]}),c.jsx(Ue,{className:"p-6 md:p-10 border-red-200 bg-red-50/10",darkMode:g,children:c.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4 md:gap-8",children:[c.jsxs("div",{className:"text-inherit",children:[c.jsxs("h4",{className:"text-xl font-black text-red-700 flex items-center gap-3",children:[c.jsx(Ky,{})," ",_("criticalZone")]}),c.jsx("p",{className:"opacity-60 font-bold text-sm mt-2",children:_("fullCleanActions")})]}),c.jsx("button",{onClick:Rc,className:"px-5 md:px-8 py-4 bg-red-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest hover:bg-red-700 transition-all",children:_("clearAll")})]})})]})]})]}),oh&&ii&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Xs(!1),children:c.jsxs(Ue,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[80vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-6",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black text-inherit flex items-center gap-3",children:[c.jsx(Fy,{size:22,className:"text-primary-600"})," ",_("chooseOutfit")]}),c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mt-1",children:(()=>{const p={PT:"pt-PT",EN:"en-GB",ES:"es-ES",FR:"fr-FR",DE:"de-DE"};return new Date(ii+"T12:00:00").toLocaleDateString(p[yt]||"pt-PT",{weekday:"long",day:"numeric",month:"long"})})()})]}),c.jsx("button",{onClick:()=>Xs(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(xr,{size:20})})]}),Pn.find(p=>p.date===ii)&&c.jsxs("button",{onClick:async()=>{await Ta(ii,null),Xs(!1)},className:"mb-4 w-full py-3 border-2 border-dashed border-red-200 dark:border-red-900/50 text-red-400 rounded-2xl font-black text-[10px] uppercase tracking-widest hover:border-red-400 hover:text-red-500 transition-all flex items-center justify-center gap-2",children:[c.jsx(Zc,{size:14})," ",_("removeOutfitDay")]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:u.length===0?c.jsx("div",{className:"py-6 md:py-12 text-center opacity-30 font-black uppercase tracking-[0.3em] text-sm",children:_("noOutfitCreated")}):u.map(p=>{const E=Pn.find(M=>M.date===ii),z=(E?E.lookIds||(E.lookId?[E.lookId]:[]):[]).includes(p.id);return c.jsxs("button",{onClick:async()=>{await Ta(ii,p.id)},className:`w-full flex items-center gap-4 p-4 rounded-2xl transition-all border-2 text-left ${z?"border-primary-600 bg-primary-50 dark:bg-primary-900/20":`border-transparent ${g?"bg-gray-800 hover:bg-gray-700":"bg-gray-50 hover:bg-gray-100"}`}`,children:[c.jsx("div",{className:"flex -space-x-2 shrink-0",children:p.items.slice(0,3).map(M=>{const J=o.find(te=>te.id===M);return J?c.jsx("div",{className:"w-12 h-12 rounded-xl overflow-hidden border-2 border-white dark:border-gray-700",children:c.jsx("img",{src:J.imageUrl,className:"w-full h-full object-cover",alt:""})},M):null})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-black text-sm truncate text-inherit",children:p.name}),c.jsxs("p",{className:"text-[10px] uppercase tracking-widest opacity-40 font-bold",children:[p.items.length," ",_("piecesShort")]})]}),z&&c.jsx(Qn,{size:18,className:"text-primary-600 shrink-0"})]},p.id)})})]})}),yn&&c.jsx("div",{className:"fixed bottom-8 left-1/2 transform -translate-x-1/2 z-[300] animate-in slide-in-from-bottom-5",children:c.jsxs("div",{className:"bg-gray-900 text-white px-6 py-3 rounded-full shadow-2xl font-bold text-sm tracking-wide flex items-center gap-3",children:[c.jsx(Uy,{size:18,className:"text-green-400"}),yn]})}),ih&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>An(!1),children:c.jsxs(Ue,{className:"w-full max-w-md p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[80vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-6",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx(Fa,{size:24,className:"text-primary-600"})," ",_("notificationsModal")]}),Wn.filter(p=>!p.read).length>0&&c.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-primary-600 mt-1",children:[Wn.filter(p=>!p.read).length," ",yt==="PT"?"nova(s)":yt==="EN"?"new":yt==="ES"?"nueva(s)":yt==="FR"?"nouvelle(s)":"neue"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[Wn.filter(p=>!p.read).length>0&&c.jsx("button",{onClick:async()=>{const p=Ha(oe);Wn.filter(E=>!E.read).forEach(E=>{const j=De(oe,"artifacts",ue,"inboxNotifications",E.id);p.update(j,{read:!0})}),await p.commit()},className:"text-[9px] font-black uppercase tracking-widest text-primary-600 hover:underline px-3 py-2 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-xl transition-all",children:_("markAllRead")}),c.jsx("button",{onClick:()=>An(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(xr,{size:20})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:Wn.length===0?c.jsxs("div",{className:"py-8 md:py-16 text-center flex flex-col items-center gap-4 opacity-30",children:[c.jsx(Fa,{size:40}),c.jsx("span",{className:"font-black uppercase tracking-[0.3em] text-sm",children:_("noNotifications")})]}):Wn.map(p=>c.jsxs("div",{className:`p-4 rounded-2xl flex items-start gap-4 transition-all ${p.read?g?"bg-gray-800/60":"bg-gray-50":"bg-primary-50 dark:bg-primary-900/20 border border-primary-100 dark:border-primary-800/40"}`,children:[c.jsx("div",{className:`shrink-0 w-12 h-12 flex items-center justify-center rounded-2xl text-xl shadow-sm ${p.read?g?"bg-gray-700":"bg-gray-200":"bg-primary-100 dark:bg-primary-900/50"}`,children:p.type==="look_copied"?"✂️":c.jsx(Fa,{size:20})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-bold text-sm leading-snug text-inherit",children:p.type==="look_copied"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-primary-600 font-black",children:p.copiedByEmail})," ",_("lookCopiedBy")," ",c.jsxs("span",{className:"italic",children:['"',p.lookName,'"']})]})}),c.jsxs("p",{className:"text-[10px] uppercase font-black tracking-widest opacity-40 mt-1.5",children:[new Date(p.createdAt).toLocaleDateString()," às ",new Date(p.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),!p.read&&c.jsx("button",{onClick:async()=>{const E=De(oe,"artifacts",ue,"inboxNotifications",p.id);await Yn(E,{read:!0})},className:"shrink-0 p-2 text-primary-600 hover:bg-primary-100 dark:hover:bg-primary-900/40 rounded-xl transition-all",title:"Marcar como lida",children:c.jsx(Qn,{size:16})})]},p.id))})]})}),Ks&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>pr(!1),children:c.jsxs(Ue,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[90vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-5 md:mb-8",children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx(qy,{size:24,className:"text-primary-600"})," ",_("manageSections")]}),c.jsx("button",{onClick:()=>pr(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(xr,{size:20})})]}),c.jsxs("div",{className:`flex gap-3 mb-5 md:mb-8 p-4 rounded-2xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("input",{value:ei,onChange:p=>ti(p.target.value),placeholder:_("sectionPlaceholder"),onKeyDown:p=>p.key==="Enter"&&ka(),className:`flex-1 p-3 rounded-xl border-none outline-none font-bold ${g?"bg-gray-700 text-white":"bg-white"} shadow-sm`}),c.jsx("button",{onClick:ka,disabled:!ei.trim(),className:"px-5 py-3 bg-primary-600 text-white rounded-xl font-black text-[10px] uppercase tracking-widest shadow-lg shadow-primary-600/30 hover:scale-105 active:scale-95 transition-all disabled:opacity-30",children:c.jsx(za,{size:18})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:ln.length===0?c.jsx("div",{className:"py-6 md:py-12 text-center opacity-30 font-black uppercase tracking-[0.3em] text-sm",children:_("noSections")}):ln.map(p=>c.jsx("div",{className:`flex items-center gap-4 p-4 rounded-2xl transition-all ${g?"bg-gray-800":"bg-gray-50"}`,children:Ki===p.id?c.jsxs(c.Fragment,{children:[c.jsx("input",{value:Qi,onChange:E=>Ys(E.target.value),onKeyDown:E=>E.key==="Enter"&&Ea(),className:`flex-1 p-2 rounded-xl border-none outline-none font-bold text-sm ${g?"bg-gray-700 text-white":"bg-white"} shadow-sm`}),c.jsx("button",{onClick:Ea,disabled:!Qi.trim(),className:"p-2 bg-green-500 text-white rounded-xl shadow-md hover:scale-105 disabled:opacity-30",children:c.jsx(Qn,{size:16})}),c.jsx("button",{onClick:()=>Gi(null),className:"p-2 bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded-xl hover:scale-105",children:c.jsx(xr,{size:16})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-black text-sm truncate",children:p.name}),c.jsxs("p",{className:"text-[10px] opacity-40 font-bold uppercase tracking-widest",children:[o.filter(E=>E.sections&&E.sections.includes(p.id)).length," ",_("pieces")," • ",u.filter(E=>E.sections&&E.sections.includes(p.id)).length," look(s)"]})]}),c.jsx("button",{onClick:()=>{Gi(p.id),Ys(p.name),vc(p.emoji)},className:"p-2 text-gray-400 hover:text-primary-600 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-xl transition-all",children:c.jsx(Xc,{size:16})}),c.jsx("button",{onClick:()=>no(p.id),className:"p-2 text-red-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-xl transition-all",children:c.jsx(Zc,{size:16})})]})},p.id))}),c.jsx("button",{onClick:()=>pr(!1),className:"mt-5 md:mt-8 w-full py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})}),Te&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Ae(!1),children:c.jsxs(Ue,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[90vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-5 md:mb-8",children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx(Bh,{size:24,className:"text-primary-600"})," ",_("advancedFilters")]}),c.jsx("button",{onClick:()=>Ae(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(xr,{size:20})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto space-y-5 md:space-y-8 pr-2 custom-scrollbar",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("closet")}),c.jsx("div",{className:"flex flex-wrap gap-2",children:[_("all"),_("tops"),_("bottoms"),_("footwear"),_("coats"),_("accessories")].map(p=>c.jsx("button",{onClick:()=>Sn(p),className:`px-5 py-3 rounded-xl font-black text-[10px] uppercase tracking-widest transition-all ${Xe===p?"bg-primary-600 text-white shadow-xl shadow-primary-600/30":g?"bg-gray-800 text-gray-400":"bg-gray-50 text-gray-500 shadow-sm border border-gray-100"} hover:scale-[1.02]`,children:p},p))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("filterByColor")}),c.jsxs("select",{value:Gt,onChange:p=>Qt(p.target.value),className:`w-full p-4 rounded-2xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold ${g?"bg-gray-800 text-white":"bg-gray-50"}`,children:[c.jsx("option",{value:"",children:_("all")}),Ia.map(p=>c.jsx("option",{value:p,children:p},p))]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("favorites")}),c.jsxs("button",{onClick:()=>Ce(!se),className:`w-full p-4 rounded-2xl flex items-center justify-between font-bold transition-all border-2 ${se?"border-rose-500 bg-rose-50 text-rose-600 dark:bg-rose-900/20 dark:text-rose-400":`border-transparent ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-50 text-gray-500 hover:bg-gray-100"}`}`,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx($h,{size:20,fill:se?"currentColor":"none"}),c.jsx("span",{children:_("onlyFavorites")})]}),se&&c.jsx(Qn,{size:20})]})]})]}),c.jsxs("div",{className:"pt-8 flex gap-4 border-t mt-5 md:mt-8 border-gray-100 dark:border-gray-800",children:[c.jsx("button",{onClick:()=>{Sn("Todos"),Qt(""),ae("any"),Ce(!1)},className:"flex-1 py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("clearAll")}),c.jsx("button",{onClick:()=>Ae(!1),className:"flex-1 py-4 bg-primary-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all",children:_("applyFilters")})]})]})}),la&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>$i(!1),children:c.jsxs(Ue,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("h3",{className:"text-2xl font-black mb-5 md:mb-8 text-center text-inherit",children:_("appLanguage")}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[{id:"PT",flag:"🇵🇹",label:_("portuguese")},{id:"EN",flag:"🇬🇧",label:_("english")},{id:"ES",flag:"🇪🇸",label:_("spanish")},{id:"FR",flag:"🇫🇷",label:_("french")},{id:"DE",flag:"🇩🇪",label:_("german")}].map(p=>c.jsxs("button",{onClick:()=>lh(p.id),className:`p-6 rounded-2xl flex flex-col items-center justify-center gap-4 transition-all ${yt===p.id?"bg-primary-600 text-white shadow-xl shadow-primary-600/30 scale-105":"bg-gray-50 text-gray-600 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:[c.jsx("span",{className:"text-4xl",children:p.flag}),c.jsx("span",{className:"font-black text-[10px] uppercase tracking-widest text-center",children:p.label})]},p.id))}),c.jsx("button",{onClick:()=>$i(!1),className:"w-full mt-5 md:mt-8 py-4 uppercase font-black text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})}),ma&&ot&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>{fr(!1),Hi(null)},children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-400)))"},children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx(Hy,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("sharedLookTitle")})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:ot.lookName}),c.jsxs("p",{className:"text-white/60 text-sm font-bold mt-1",children:[ot.items.length," peça",ot.items.length!==1?"s":""," • ",_("sharedBy")," ",((wr=ot.ownerEmail)==null?void 0:wr.split("@")[0])||_("someone")]})]})]}),c.jsxs("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"}`,children:[c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-4",children:_("includedPieces")}),c.jsx("div",{className:"flex flex-wrap gap-3 mb-5 md:mb-8",children:ot.items.map((p,E)=>c.jsxs("div",{className:"relative group/item",children:[c.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden border-2 border-gray-100 dark:border-gray-700 shadow-lg",children:c.jsx("img",{src:p.imageUrl,alt:p.name,className:"w-full h-full object-cover group-hover/item:scale-110 transition-transform duration-500"})}),c.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 bg-gray-900/90 text-white text-[8px] font-black uppercase tracking-wide px-2 py-0.5 rounded-full whitespace-nowrap opacity-0 group-hover/item:opacity-100 transition-opacity",children:p.name})]},E))}),c.jsx("div",{className:"space-y-2 mb-5 md:mb-8 max-h-32 overflow-y-auto custom-scrollbar",children:ot.items.map((p,E)=>c.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 rounded-xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("span",{className:"text-xs font-black truncate flex-1",children:p.name}),c.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest opacity-40 shrink-0",children:p.category})]},E))}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:()=>{fr(!1),Hi(null)},className:`flex-1 py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl transition-all ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:"Ignorar"}),c.jsx("button",{onClick:Cc,disabled:Cn,className:"flex-[2] py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl text-white shadow-xl transition-all hover:scale-[1.02] active:scale-95 disabled:opacity-60 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-500)))"},children:Cn?c.jsxs(c.Fragment,{children:[c.jsx(Wy,{size:16,className:"animate-spin"})," ",_("copying")]}):c.jsxs(c.Fragment,{children:[c.jsx(Qn,{size:16})," ",_("copyToMyCloset")]})})]})]})]})}),sh&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>Js(!1),children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6 bg-gradient-to-br from-primary-600 to-primary-400",children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx($a,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("dailyOutfit")})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:_("today")})]})]}),c.jsx("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"} max-h-[60vh] overflow-y-auto custom-scrollbar`,children:oi.length>0?c.jsx("div",{className:"space-y-6",children:oi.map(p=>c.jsxs("div",{className:`p-4 rounded-2xl border-2 border-gray-100 dark:border-gray-800 ${g?"bg-gray-800/50":"bg-gray-50"}`,children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h4",{className:"font-black text-lg text-inherit",children:p.name}),c.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:[p.items.length," ",_("piecesShort")]})]}),c.jsx("div",{className:"flex -space-x-4 overflow-x-auto custom-scrollbar pb-2",children:p.items.map(E=>{const j=o.find(z=>z.id===E);return j?c.jsx("div",{className:"w-16 h-16 rounded-xl overflow-hidden border-2 border-white dark:border-gray-700 shrink-0 shadow-sm relative group",children:c.jsx("img",{src:j.imageUrl,className:"w-full h-full object-cover",alt:""})},E):null})})]},p.id))}):c.jsxs("div",{className:"py-6 md:py-12 flex flex-col items-center justify-center text-center opacity-50",children:[c.jsx(Ba,{size:48,className:"mb-4 text-gray-400"}),c.jsx("p",{className:"font-black text-lg text-inherit",children:_("noOutfitPlanned")}),c.jsx("p",{className:"text-xs mt-2 uppercase tracking-widest",children:_("goToPlanning")})]})}),c.jsx("div",{className:`p-4 border-t ${g?"border-gray-800 bg-gray-900":"border-gray-100 bg-gray-50"}`,children:c.jsx("button",{onClick:()=>Js(!1),className:"w-full py-4 bg-gray-200 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-2xl font-black uppercase text-[10px] tracking-widest transition-all",children:_("close")})})]})}),Zr&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>$s(null),children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-400)))"},children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx(lo,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("inspectOutfit")||"Inspecionar Outfit"})]}),c.jsx("button",{onClick:()=>$s(null),className:"text-white/80 hover:text-white transition-colors",children:c.jsx(xr,{size:20})})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:Zr.name}),c.jsxs("p",{className:"text-white/60 text-sm font-bold mt-1",children:[((Zt=Zr.items)==null?void 0:Zt.length)||0," peça",((ns=Zr.items)==null?void 0:ns.length)!==1?"s":""]})]})]}),c.jsxs("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"}`,children:[c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-4",children:_("includedPieces")||"Peças incluídas"}),c.jsx("div",{className:"flex flex-wrap gap-3 mb-5 md:mb-8",children:(Zr.items||[]).map((p,E)=>{const j=Fe.find(z=>z.id===p);return j?c.jsxs("div",{className:"relative group/item",children:[c.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden border-2 border-gray-100 dark:border-gray-700 shadow-lg",children:c.jsx("img",{src:j.imageUrl,alt:j.name,className:"w-full h-full object-cover group-hover/item:scale-110 transition-transform duration-500"})}),c.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 bg-gray-900/90 text-white text-[8px] font-black uppercase tracking-wide px-2 py-0.5 rounded-full whitespace-nowrap opacity-0 group-hover/item:opacity-100 transition-opacity",children:j.name})]},E):null})}),c.jsx("div",{className:"space-y-2 mb-5 md:mb-8 max-h-32 overflow-y-auto custom-scrollbar",children:(Zr.items||[]).map((p,E)=>{const j=Fe.find(z=>z.id===p);return j?c.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 rounded-xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("span",{className:"text-xs font-black truncate flex-1",children:j.name}),c.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest opacity-40 shrink-0",children:j.category})]},E):null})}),c.jsx("button",{onClick:()=>$s(null),className:`w-full py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl transition-all ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:_("close")||"Fechar"})]})]})}),an&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>qs(null),children:c.jsxs("div",{className:`w-full max-w-sm rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative aspect-square",children:[c.jsx("img",{src:an.imageUrl,className:"w-full h-full object-cover",alt:"Item"}),c.jsx("button",{onClick:()=>qs(null),className:"absolute top-4 right-4 p-2 bg-black/50 hover:bg-black/70 rounded-full text-white transition-colors",children:c.jsx(xr,{size:20})})]}),c.jsxs("div",{className:"p-5 md:p-8 text-center space-y-4",children:[c.jsx("h3",{className:"text-2xl font-black text-inherit",children:an.name}),c.jsxs("div",{className:"flex items-center justify-center gap-2 opacity-60 font-bold uppercase tracking-widest text-[10px] text-inherit",children:[c.jsx("span",{children:an.category}),c.jsx("span",{children:"•"}),c.jsx("span",{children:an.color})]}),c.jsxs("button",{onClick:()=>{ro(an),qs(null)},className:"w-full py-4 mt-4 bg-primary-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all flex items-center justify-center gap-2",children:[c.jsx(Ua,{size:16})," ",_("copyToMyCloset")||"Copiar para Armário"]})]})]})})]})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/firebase-messaging-sw.js").catch(t=>{console.error("Service worker registration failed",t)})});hf.createRoot(document.getElementById("root")).render(c.jsx(Mk.StrictMode,{children:c.jsx(CR,{})}));
+ `,children:c.jsxs("div",{className:"p-6 md:p-10 h-full flex flex-col backdrop-blur-xl",children:[c.jsxs("button",{onClick:()=>e("closet"),className:"flex items-center gap-4 mb-5 md:mb-8 md:mb-16 hover:scale-[1.02] transition-transform text-left cursor-pointer w-full",children:[c.jsx("div",{className:"p-3 bg-primary-600 rounded-2xl shadow-xl shadow-primary-600/30",children:c.jsx($a,{className:"text-white",size:24})}),c.jsx("span",{className:"text-3xl font-black tracking-tighter italic",children:"MyCloset"})]}),mr&&c.jsxs("button",{onClick:()=>Qn("up"),className:"w-full flex items-center justify-center gap-2 p-2 bg-gray-100 dark:bg-gray-800 rounded-xl mb-3 text-xs font-bold hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",children:[c.jsx("span",{className:"px-2 py-1 bg-white dark:bg-gray-900 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:"Q"})," ",_("up")]}),c.jsx("nav",{className:"flex-1 space-y-3",children:[{id:"dashboard",label:_("dashboard"),icon:ib},{id:"closet",label:_("closet"),icon:$a},{id:"wishlist",label:_("wishlist")||"Carrinho",icon:Xy},{id:"laundry",label:_("laundry"),icon:ss},{id:"outfits",label:_("outfits"),icon:qa},{id:"planner",label:_("planning"),icon:$y},{id:"community",label:_("community"),icon:pb},{id:"settings",label:_("settings"),icon:Hh}].map(p=>c.jsxs("button",{onClick:()=>{e(p.id),window.innerWidth<768&&G(!1)},className:`w-full flex items-center gap-4 px-6 py-4 rounded-2xl transition-all font-black text-[11px] uppercase tracking-widest ${t===p.id?"bg-primary-600 text-white shadow-2xl shadow-primary-600/30 scale-105":"opacity-40 hover:opacity-100 hover:bg-primary-500/5"}`,children:[c.jsx(p.icon,{size:20}),c.jsx("span",{children:p.label})]},p.id))}),mr&&c.jsxs("button",{onClick:()=>Qn("down"),className:"w-full flex items-center justify-center gap-2 p-2 bg-gray-100 dark:bg-gray-800 rounded-xl mt-3 text-xs font-bold hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors",children:[c.jsx("span",{className:"px-2 py-1 bg-white dark:bg-gray-900 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700",children:"E"})," ",_("down")]}),c.jsxs("div",{className:"mt-auto pt-10 border-t border-inherit",children:[c.jsxs("div",{onClick:()=>e("profile"),className:"w-full flex items-center gap-4 mb-5 md:mb-8 px-2 text-left hover:bg-gray-100 dark:hover:bg-gray-800 py-3 rounded-2xl transition-all cursor-pointer",children:[c.jsx("div",{className:`w-12 h-12 rounded-2xl shrink-0 flex items-center justify-center font-black text-white shadow-xl overflow-hidden ${g?"bg-primary-500":"bg-primary-600"}`,children:F!=null&&F.avatar?c.jsx("img",{src:F.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):(((d=F==null?void 0:F.fullName)==null?void 0:d[0])||((f=F==null?void 0:F.username)==null?void 0:f[0])||((y=n==null?void 0:n.email)==null?void 0:y[0])||"U").toUpperCase()}),c.jsxs("div",{className:"flex-1 min-w-0 text-left",children:[c.jsxs("p",{className:"text-sm font-black truncate text-inherit",children:["@",(F==null?void 0:F.username)||((P=n==null?void 0:n.email)==null?void 0:P.split("@")[0])||_("userTitle")]}),c.jsx("div",{onClick:Sc,className:"inline-block mt-1 cursor-pointer hover:opacity-80 transition-opacity",title:"Mudar estado",children:c.jsx(lu,{variant:ti==="online"?"success":ti==="away"?"warning":"default",children:_(ti)})})]})]}),c.jsxs("button",{onClick:()=>{n!=null&&n.uid&&localStorage.removeItem(`app-theme-${n.uid}`),QI(Ga)},className:"w-full py-4 text-red-500 font-black uppercase tracking-widest text-[10px] hover:bg-red-500/10 rounded-2xl transition-all flex items-center justify-center gap-3",children:[c.jsx(ob,{size:16})," ",_("logout")]})]})]})}),V&&c.jsx("div",{className:"fixed inset-0 bg-black/50 z-[90] md:hidden backdrop-blur-sm",onClick:()=>G(!1)}),c.jsxs("main",{className:"flex-1 flex flex-col h-screen overflow-hidden",children:[c.jsxs("header",{className:`h-20 md:h-24 shrink-0 flex items-center justify-between px-4 md:px-12 transition-all border-b border-inherit ${g?"bg-gray-950/50":"bg-white/50"} backdrop-blur-xl`,children:[c.jsxs("div",{className:"flex items-center gap-3 md:gap-6",children:[c.jsx("button",{onClick:()=>G(!V),className:`p-2 md:p-3 rounded-xl md:rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700":"bg-gray-50 border-gray-200"}`,children:V?c.jsx(cb,{size:20,className:"md:w-6 md:h-6"}):c.jsx(ub,{size:20,className:"md:w-6 md:h-6"})}),c.jsxs("h2",{className:"text-xl md:text-3xl font-black tracking-tighter truncate max-w-[150px] md:max-w-none",children:[t==="dashboard"&&_("overview"),t==="closet"&&_("myCloset"),t==="wishlist"&&(_("wishlist")||"Carrinho"),t==="laundry"&&_("laundry"),t==="outfits"&&_("outfitsAndStyle"),t==="planner"&&_("planning"),t==="community"&&_("community"),t==="settings"&&_("settings"),t==="profile"&&_("profileInfo")]})]}),c.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[c.jsx("button",{onClick:()=>Ta(!0),className:"p-2 md:p-3 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 rounded-xl md:rounded-2xl hover:scale-105 active:scale-95 transition-all",children:c.jsx(qa,{size:20,className:"w-5 h-5 md:w-6 md:h-6"})}),c.jsxs("div",{className:"hidden sm:flex bg-gray-100 dark:bg-gray-800 p-1.5 rounded-xl md:rounded-2xl",children:[c.jsx("button",{onClick:()=>ba(!1),className:`p-1.5 md:p-2 rounded-lg md:rounded-xl ${g?"text-gray-500":"bg-white shadow-md text-primary-600"}`,children:c.jsx(fb,{size:16,className:"md:w-[18px] md:h-[18px]"})}),c.jsx("button",{onClick:()=>ba(!0),className:`p-1.5 md:p-2 rounded-lg md:rounded-xl ${g?"bg-gray-900 shadow-md text-primary-400":"text-gray-500"}`,children:c.jsx(lb,{size:16,className:"md:w-[18px] md:h-[18px]"})})]}),c.jsxs("button",{onClick:()=>si(!0),className:"relative p-2 md:p-4 bg-gray-100 dark:bg-gray-800 text-gray-700 dark:text-gray-200 rounded-xl md:rounded-2xl hover:scale-105 active:scale-95 transition-all",children:[c.jsx(Ua,{size:20,className:"w-5 h-5 md:w-6 md:h-6"}),_r.filter(p=>!p.read).length>0&&c.jsx("span",{className:"absolute top-1 md:top-2 right-1 md:right-2 w-2.5 h-2.5 md:w-3 md:h-3 bg-red-500 rounded-full border-2 border-white dark:border-gray-800"})]}),c.jsx("button",{onClick:()=>{v(null),I(""),e("add"),Jt(null),At([])},className:"p-2 md:p-4 bg-primary-600 text-white rounded-xl md:rounded-2xl shadow-xl shadow-primary-600/30 hover:scale-105 active:scale-95 transition-all",children:c.jsx(Ba,{size:20,className:"w-5 h-5 md:w-6 md:h-6"})})]})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto p-4 md:p-12 space-y-5 md:space-y-8 md:space-y-12",children:[t==="dashboard"&&c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700",children:[c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 md:gap-8",children:[{label:_("readyClothes"),val:Yn.length,icon:$a,col:"primary"},{label:_("inLaundry"),val:no.length,icon:ss,col:"blue"},{label:_("myLooks"),val:u.length,icon:qa,col:"purple"}].map((p,x)=>c.jsxs(Ve,{className:"p-5 md:p-8 group hover:-translate-y-2",darkMode:g,children:[c.jsx("div",{className:`w-14 h-14 rounded-2xl flex items-center justify-center mb-6 shadow-inner ${g?"bg-gray-700 text-primary-400":"bg-primary-50 text-primary-600"}`,children:c.jsx(p.icon,{size:28})}),c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-1",children:p.label}),c.jsx("h4",{className:"text-4xl font-black tracking-tight",children:p.val})]},x))}),c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 md:gap-8",children:[c.jsxs("div",{className:"lg:col-span-2 p-6 md:p-10 rounded-3xl md:rounded-[2rem] relative overflow-hidden shadow-2xl",style:{backgroundColor:"hsl(var(--primary-600))",color:"white"},children:[c.jsxs("div",{className:"relative z-10 flex flex-col justify-between h-full",children:[c.jsxs("div",{children:[c.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[c.jsx(Ky,{size:28,style:{color:"rgba(255,255,255,0.7)"}}),c.jsx(lu,{variant:"warning",children:vt?vt.name:_("todayIn")})]}),c.jsx("h3",{className:"text-5xl font-black tracking-tighter mb-4",style:{color:"white"},children:vt?_("weatherCurrentAvg").replace("{current}",vt.currentTemp).replace("{avg}",vt.avgTemp):_("weatherUpdate")}),c.jsx("p",{className:"text-lg font-medium max-w-lg leading-relaxed",style:{color:"rgba(255,255,255,0.8)"},children:vt?`${_("weatherForecastDesc").replace("{max}",vt.maxTemp).replace("{min}",vt.minTemp)} ${_("weatherMsg")}`:_("weatherMsg")})]}),c.jsxs("div",{className:"mt-6 md:mt-10 flex gap-4 items-center",children:[Yn.filter(p=>p.category==="Tops").slice(0,2).map(p=>c.jsx("div",{className:"w-16 h-16 rounded-xl overflow-hidden border-2",style:{borderColor:"rgba(255,255,255,0.4)"},children:c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover",alt:""})},p.id)),c.jsxs("button",{onClick:()=>e("closet"),className:"flex items-center gap-2 font-black uppercase text-xs tracking-widest hover:translate-x-2 transition-transform",style:{color:"white"},children:[_("exploreSuggestions")," ",c.jsx(nb,{size:18})]})]})]}),c.jsx(Ky,{size:350,className:"absolute -bottom-20 -right-20",style:{color:"rgba(255,255,255,0.1)"}})]}),c.jsxs(Ve,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-lg font-black tracking-tight mb-5 md:mb-8 flex items-center gap-2 text-inherit",children:[c.jsx(db,{size:20})," ",_("topColors")]}),c.jsx("div",{className:"space-y-6",children:Ca.length>0?Ca.map(p=>c.jsxs("div",{className:"space-y-2",children:[c.jsxs("div",{className:"flex justify-between text-[10px] font-black uppercase tracking-widest opacity-50",children:[c.jsx("span",{children:p.color}),c.jsxs("span",{children:[p.percentage,"% (",p.count,")"]})]}),c.jsx("div",{className:"h-2 w-full bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden",children:c.jsx("div",{className:"h-full bg-primary-600",style:{width:`${p.percentage}%`}})})]},p.color)):c.jsx("p",{className:"text-xs opacity-50 italic",children:_("addColorsToItems")})})]})]})]}),(t==="closet"||t==="wishlist")&&c.jsxs("div",{className:"space-y-6 md:space-y-10 animate-in slide-in-from-bottom-8 duration-700",children:[c.jsxs("div",{className:"flex flex-col xl:flex-row gap-4 md:gap-8 items-center justify-between",children:[c.jsxs("div",{className:"relative w-full max-w-2xl",children:[c.jsx(ho,{className:"absolute left-6 top-1/2 -translate-y-1/2 text-gray-400",size:24}),c.jsx("input",{placeholder:_("searchPlaceholder"),className:`w-full pl-16 pr-8 py-6 rounded-3xl md:rounded-[2rem] shadow-inner outline-none border-none focus:ring-4 focus:ring-primary-500/10 font-bold text-lg ${g?"bg-gray-800":"bg-gray-100"}`,onChange:p=>L(p.target.value)})]}),c.jsx("div",{className:"flex gap-3 w-full xl:w-auto",children:c.jsxs("button",{onClick:()=>Ae(!0),className:"flex items-center gap-3 px-5 md:px-8 py-4 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all",children:[c.jsx($h,{size:18})," ",_("advancedFilters"),(Qt||se||Y!=="any"||Xe!=="Todos"&&Xe!==_("all"))&&c.jsx("span",{className:"w-2 h-2 rounded-full bg-white animate-pulse"})]})})]}),(t==="closet"||t==="wishlist"||t==="outfits")&&c.jsxs("div",{className:"flex items-center gap-3 overflow-x-auto pb-1 custom-scrollbar",children:[c.jsxs("button",{onClick:()=>Ws("all"),className:`shrink-0 flex items-center gap-2 px-5 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all ${Nt==="all"?"bg-primary-600 text-white shadow-lg shadow-primary-600/30":g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:[c.jsx(Gy,{size:14})," ",_("allSections")]}),gn.map(p=>c.jsx("button",{onClick:()=>Ws(p.id),className:`shrink-0 flex items-center gap-2 px-5 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all ${Nt===p.id?"bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:p.name},p.id)),c.jsxs("button",{onClick:()=>yn(!0),className:`shrink-0 flex items-center gap-2 px-4 py-2.5 rounded-2xl font-black text-[10px] uppercase tracking-widest transition-all border-2 border-dashed ${g?"border-gray-700 text-gray-500 hover:border-primary-500 hover:text-primary-400":"border-gray-200 text-gray-400 hover:border-primary-400 hover:text-primary-600"}`,children:[c.jsx(Hh,{size:14})," ",_("manageSections")]})]}),c.jsx("div",{className:Nn==="small"?"grid grid-cols-2 sm:grid-cols-4 lg:grid-cols-5 2xl:grid-cols-6 gap-6":Nn==="medium"?"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 2xl:grid-cols-5 gap-4 md:gap-8":"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 2xl:grid-cols-4 gap-6 md:gap-10",children:ns.map(p=>{const x={small:{badgeClass:"top-2 left-2 scale-[0.65] origin-top-left",heartContClass:"top-2 right-2",heartBtnClass:"p-1.5 rounded-lg",heartIcon:10,overlayContClass:"p-2 pb-[50px]",btnPyClass:"py-1 px-1",btnTextClass:"hidden",btnIcon:10,btnGap:"gap-1",btnRadius:"rounded-md",infoContClass:"bottom-2 left-2 right-2 p-2 rounded-xl",titleClass:"text-xs",colorDotClass:"w-2 h-2",colorTextClass:"text-[8px]",secTextClass:"text-[8px] px-1 py-0 rounded"},medium:{badgeClass:"top-4 left-4 scale-90 origin-top-left",heartContClass:"top-4 right-4",heartBtnClass:"p-2 rounded-xl",heartIcon:14,overlayContClass:"p-4 pb-[90px]",btnPyClass:"py-2 px-2",btnTextClass:"text-[8px]",btnIcon:12,btnGap:"gap-1.5",btnRadius:"rounded-xl",infoContClass:"bottom-4 left-4 right-4 p-4 rounded-2xl",titleClass:"text-sm",colorDotClass:"w-3 h-3",colorTextClass:"text-[9px]",secTextClass:"text-[9px] px-1.5 py-0.5 rounded-md"},large:{badgeClass:"top-6 left-6",heartContClass:"top-6 right-6",heartBtnClass:"p-3 rounded-2xl",heartIcon:18,overlayContClass:"p-6 pb-[136px]",btnPyClass:"py-3 px-2",btnTextClass:"text-[9px]",btnIcon:14,btnGap:"gap-2",btnRadius:"rounded-xl",infoContClass:"bottom-6 left-6 right-6 p-6 rounded-3xl",titleClass:"text-xl",colorDotClass:"w-4 h-4",colorTextClass:"text-[10px]",secTextClass:"text-[10px] px-2 py-0.5 rounded-md"}}[Nn]||{badgeClass:"top-6 left-6",heartContClass:"top-6 right-6",heartBtnClass:"p-3 rounded-2xl",heartIcon:18,overlayContClass:"p-6 pb-[136px]",btnPyClass:"py-3 px-2",btnTextClass:"text-[9px]",btnIcon:14,btnGap:"gap-2",btnRadius:"rounded-xl",infoContClass:"bottom-6 left-6 right-6 p-6 rounded-3xl",titleClass:"text-xl",colorDotClass:"w-4 h-4",colorTextClass:"text-[10px]",secTextClass:"text-[10px] px-2 py-0.5 rounded-md"};return c.jsx("div",{className:"group",children:c.jsxs(Ve,{className:`overflow-hidden p-0 relative border-none hover:shadow-2xl transition-all duration-500 ${Nn==="small"?"h-[180px]":Nn==="medium"?"h-[320px]":"h-[480px]"}`,darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover transition-transform duration-1000 group-hover:scale-110",alt:p.name}),c.jsx("div",{className:`absolute inset-0 bg-gradient-to-t from-black/80 via-transparent opacity-0 group-hover:opacity-100 transition-all duration-300 flex flex-col justify-end text-white z-10 pointer-events-none ${x.overlayContClass}`,children:c.jsxs("div",{className:`grid grid-cols-2 ${x.btnGap} pointer-events-auto`,children:[c.jsxs("button",{onClick:()=>{v(p),I(p.imageUrl||""),e("edit")},className:`${x.btnPyClass} bg-white text-primary-600 ${x.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-primary-50`,children:[c.jsx(eu,{size:x.btnIcon})," ",c.jsx("span",{className:x.btnTextClass,children:_("edit")})]}),c.jsxs("button",{onClick:()=>Tr("laundry",p),className:`${x.btnPyClass} bg-blue-600 text-white ${x.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-blue-700`,children:[c.jsx(ss,{size:x.btnIcon})," ",c.jsx("span",{className:x.btnTextClass,children:_("makeDirty")})]}),c.jsxs("button",{onClick:()=>Tr("trash",p),className:`${x.btnPyClass} bg-red-600/20 text-red-100 backdrop-blur-md ${x.btnRadius} font-black uppercase flex items-center justify-center gap-1.5 hover:bg-red-600 transition-colors col-span-2`,children:[c.jsx(ev,{size:x.btnIcon})," ",c.jsx("span",{className:x.btnTextClass,children:_("moveToTrash")})]})]})}),c.jsx("div",{className:`absolute z-20 ${x.badgeClass}`,children:c.jsx(lu,{children:p.category})}),c.jsx("div",{className:`absolute z-20 pointer-events-auto ${x.heartContClass}`,children:c.jsx("button",{onClick:()=>Tr("favorite",p),className:`${x.heartBtnClass} shadow-xl backdrop-blur-md transition-all ${p.favorite?"bg-rose-500 text-white":"bg-white/90 text-gray-400"}`,children:c.jsx(qh,{size:x.heartIcon,fill:p.favorite?"currentColor":"none"})})}),c.jsxs("div",{className:`absolute bg-white/95 dark:bg-gray-900/95 backdrop-blur-2xl shadow-2xl transform transition-transform group-hover:-translate-y-2 z-20 pointer-events-auto ${x.infoContClass}`,children:[c.jsx("h4",{className:`${x.titleClass} font-black tracking-tighter truncate`,children:p.name}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("div",{className:"flex items-center gap-1.5 border-r border-gray-200 dark:border-gray-700 pr-2",children:[c.jsx("div",{className:`${x.colorDotClass} rounded-full border border-black/10 shrink-0`,style:Tc(p.color)}),c.jsx("span",{className:`${x.colorTextClass} font-black opacity-40 uppercase tracking-widest`,children:p.color})]}),p.sections&&p.sections.length>0&&c.jsx("div",{className:"flex items-center gap-1 overflow-x-auto custom-scrollbar no-scrollbar",children:p.sections.map(D=>{const z=gn.find(M=>M.id===D);return z?c.jsx("span",{className:`${x.secTextClass} font-bold bg-gray-100 dark:bg-gray-800 text-gray-500 whitespace-nowrap`,children:z.name},z.id):null})})]})]})]})},p.id)})})]}),t==="laundry"&&c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700",children:[c.jsxs("div",{className:"text-center max-w-2xl mx-auto space-y-4 text-inherit",children:[c.jsx("div",{className:"w-20 h-20 bg-blue-100 dark:bg-blue-900/30 rounded-3xl md:rounded-[2rem] flex items-center justify-center mx-auto text-blue-600 shadow-inner",children:c.jsx(ss,{size:40})}),c.jsx("h3",{className:"text-4xl font-black tracking-tight",children:_("laundryBasket")})]}),c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4 md:gap-8",children:[no.map(p=>c.jsxs(Ve,{className:"p-4 flex items-center gap-4 border-blue-200 dark:border-blue-900/50",darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-16 h-16 rounded-2xl object-cover shadow-sm shrink-0",alt:""}),c.jsxs("div",{className:"flex-1 min-w-0 flex flex-col justify-center items-start",children:[c.jsx("p",{className:"font-black text-sm truncate w-full text-inherit",children:p.name}),c.jsx("div",{className:"mt-1.5",children:c.jsx(lu,{variant:"warning",children:_("washing")})})]}),c.jsx("button",{onClick:()=>Tr("clean",p),className:"p-3 bg-green-500 text-white rounded-xl shadow-md hover:scale-105 transition-all shrink-0",children:c.jsx(qy,{size:20})})]},p.id)),no.length===0&&c.jsx("div",{className:"col-span-full py-20 text-center opacity-20 font-black uppercase tracking-[0.5em] text-sm",children:_("emptyBasket")})]})]}),t==="outfits"&&c.jsx("div",{className:"space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6 md:gap-12",children:[c.jsxs("div",{className:"lg:col-span-1 space-y-5 md:space-y-8",children:[c.jsxs(Ve,{className:"p-5 md:p-8 border-primary-200",darkMode:g,children:[c.jsxs("h3",{className:"text-2xl font-black tracking-tighter mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(qa,{className:"text-primary-600"})," ",Oe?_("editLook")||"Editar Outfit":_("createNewLook")]}),c.jsxs("form",{onSubmit:Na,className:"space-y-6",children:[c.jsx("input",{name:"lookName",placeholder:_("lookName"),defaultValue:(Oe==null?void 0:Oe.name)||"",required:!0,className:`w-full p-4 rounded-xl border-none shadow-inner font-bold ${g?"bg-gray-700":"bg-gray-100"}`}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("p",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest",children:[_("selectedPieces")," (",Qe.length,")"]}),c.jsxs("div",{className:"flex flex-wrap gap-2",children:[Qe.map(p=>{const x=o.find(D=>D.id===p);return c.jsxs("div",{className:"relative group",children:[c.jsx("img",{src:x==null?void 0:x.imageUrl,className:"w-12 h-12 rounded-lg object-cover border-2 border-primary-500",alt:""}),c.jsx("button",{type:"button",onClick:()=>At(Qe.filter(D=>D!==p)),className:"absolute -top-1 -right-1 bg-red-500 text-white rounded-full p-0.5 opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsx(Cr,{size:10})})]},p)}),Qe.length===0&&c.jsx("p",{className:"text-xs text-gray-400 italic",children:_("selectPieces")})]})]}),c.jsxs("div",{className:"space-y-3 pt-3 border-t border-inherit",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase tracking-widest opacity-50 flex items-center gap-2",children:[c.jsx(Zy,{size:12})," ",_("assignSections")]}),c.jsxs("button",{type:"button",onClick:()=>yn(!0),className:"text-[10px] font-black uppercase tracking-widest text-primary-600 hover:text-primary-700 flex items-center gap-1",children:[c.jsx(Ba,{size:10})," ",_("createSection")]})]}),gn.length===0?c.jsx("div",{className:"p-4 border-2 border-dashed border-gray-200 dark:border-gray-800 rounded-2xl text-center",children:c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:_("noSectionsCreated")})}):c.jsx("div",{className:"flex flex-wrap gap-2",children:gn.map(p=>c.jsxs("button",{type:"button",onClick:()=>{Hn.includes(p.id)?Ji(Hn.filter(x=>x!==p.id)):Ji([...Hn,p.id])},className:`flex items-center gap-2 px-3 py-1.5 rounded-xl text-xs font-bold transition-all border-2 ${Hn.includes(p.id)?"border-primary-600 bg-primary-600 text-white shadow-md shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:[p.name,Hn.includes(p.id)&&c.jsx(Xn,{size:12})]},p.id))})]}),c.jsxs("div",{className:"flex gap-4",children:[Oe&&c.jsx("button",{type:"button",onClick:()=>{Jt(null),At([])},className:"flex-1 py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 transition-colors",children:_("cancel")}),c.jsx("button",{disabled:Qe.length<2,className:"flex-[2] py-4 bg-primary-600 text-white rounded-2xl font-black uppercase tracking-widest text-xs shadow-xl shadow-primary-600/30 disabled:opacity-30 transition-all",children:Oe?_("saveChanges")||"Guardar":_("saveLook")})]})]},Oe?Oe.id:"new")]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("p",{className:"text-xs font-black uppercase opacity-50 tracking-widest px-2",children:_("closetLabel")}),c.jsx("div",{className:"grid grid-cols-4 gap-3 max-h-96 overflow-y-auto pr-2 custom-scrollbar",children:Ic.map(p=>c.jsxs("button",{onClick:()=>!Qe.includes(p.id)&&At([...Qe,p.id]),className:`relative rounded-xl overflow-hidden aspect-square border-2 transition-all ${Qe.includes(p.id)?"border-primary-600 scale-90":"border-transparent hover:border-primary-200"}`,children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover",alt:""}),p.status==="wishlist"&&c.jsx("div",{className:"absolute top-1 left-1 bg-yellow-500 text-white p-1 rounded-md shadow-md",children:c.jsx(Xy,{size:10})}),Qe.includes(p.id)&&c.jsx("div",{className:"absolute inset-0 bg-primary-600/40 flex items-center justify-center text-white",children:c.jsx(Xn,{size:20})})]},p.id))})]})]}),c.jsx("div",{className:"lg:col-span-2 space-y-6 md:space-y-10",children:(()=>{const p=u.filter(M=>{const J=Nt==="all"||M.sections&&M.sections.includes(Nt);let te=!0;Qt&&(te=M.items.some(ne=>{const ke=o.find(_t=>_t.id===ne);return ke&&ke.color&&ke.color.includes(Qt)}));const X=!se||M.favorite;return J&&te&&X}),x=p.filter(M=>M.items.every(J=>{const te=o.find(X=>X.id===J);return!te||te.status!=="laundry"})),D=p.filter(M=>M.items.some(J=>{const te=o.find(X=>X.id===J);return te&&te.status==="laundry"})),z=M=>{const J=M.items.some(te=>{const X=o.find(ne=>ne.id===te);return X&&X.status==="laundry"});return c.jsxs(Ve,{className:`p-5 md:p-8 group hover:shadow-2xl transition-all border-none shadow-md ${J?"opacity-75":""}`,darkMode:g,children:[c.jsxs("div",{className:"flex justify-between items-start mb-6",children:[c.jsxs("div",{className:"text-inherit",children:[c.jsx("h4",{className:"text-xl font-black tracking-tight",children:M.name}),c.jsxs("p",{className:"text-[10px] opacity-40 font-bold uppercase tracking-widest",children:[M.items.length," ",_("pieces")," • ",new Date(M.createdAt).toLocaleDateString()]})]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("button",{onClick:()=>oo(M),className:`p-2 transition-colors relative group/share ${Yi===M.id?"text-green-500":"text-gray-300 hover:text-green-500"}`,title:"Partilhar outfit",children:[Yi===M.id?c.jsx(Xn,{size:18}):c.jsx(Yy,{size:18}),c.jsx("span",{className:"absolute -top-8 left-1/2 -translate-x-1/2 bg-gray-900 text-white text-[9px] font-black uppercase tracking-widest px-2 py-1 rounded-lg whitespace-nowrap opacity-0 group-hover/share:opacity-100 transition-opacity pointer-events-none",children:Yi===M.id?_("linkCopied"):_("share")})]}),c.jsx("button",{onClick:()=>Cc("favorite",M),className:`p-2 transition-colors relative group/fav ${M.favorite?"text-rose-500":"text-gray-300 hover:text-rose-500"}`,title:"Favorito",children:c.jsx(qh,{size:18,fill:M.favorite?"currentColor":"none"})}),c.jsx("button",{onClick:()=>{Jt(M),At(M.items)},className:"p-2 text-gray-300 hover:text-primary-500 transition-colors",children:c.jsx(eu,{size:18})}),c.jsx("button",{onClick:()=>Pc(M),className:"p-2 text-gray-300 hover:text-blue-500 transition-colors",title:"Lavar outfit inteiro",children:c.jsx(ss,{size:18})}),c.jsx("button",{onClick:()=>Ac(M.id),className:"p-2 text-gray-300 hover:text-red-500 transition-colors",children:c.jsx(tu,{size:18})})]})]}),c.jsx("div",{className:"flex -space-x-4 mb-4",children:M.items.map(te=>{const X=o.find(ke=>ke.id===te),ne=(X==null?void 0:X.status)==="laundry";return c.jsxs("div",{className:`relative w-20 h-20 rounded-2xl border-4 overflow-hidden shadow-lg transform group-hover:rotate-6 transition-transform ${ne?"border-blue-400":"border-white dark:border-gray-800"}`,children:[c.jsx("img",{src:X==null?void 0:X.imageUrl,className:`w-full h-full object-cover ${ne?"brightness-75":""}`,alt:""}),ne&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-blue-500/30 backdrop-blur-[1px]",children:c.jsx(ss,{size:18,className:"text-white drop-shadow"})})]},te)})}),J&&c.jsxs("div",{className:"flex items-center gap-2 mt-2 px-3 py-2 bg-blue-50 dark:bg-blue-900/20 rounded-xl",children:[c.jsx(ss,{size:14,className:"text-blue-500 shrink-0"}),c.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-blue-500",children:[M.items.filter(te=>{const X=o.find(ne=>ne.id===te);return(X==null?void 0:X.status)==="laundry"}).length," ",_("piecesInLaundry")]})]}),M.sections&&M.sections.length>0&&c.jsx("div",{className:"flex items-center gap-1 mt-4 overflow-x-auto custom-scrollbar no-scrollbar",children:M.sections.map(te=>{const X=gn.find(ne=>ne.id===te);return X?c.jsx("span",{className:"text-[10px] font-bold px-2 py-0.5 rounded-md bg-gray-100 dark:bg-gray-800 text-gray-500 whitespace-nowrap",children:X.name},X.id):null})})]},M.id)};return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between px-2 flex-wrap gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-green-500"}),c.jsxs("h3",{className:"text-2xl font-black tracking-tighter text-inherit",children:[_("lookHistory")," ",c.jsxs("span",{className:"text-sm font-bold opacity-40",children:["— ",_("availableLooks")," (",x.length,")"]})]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[c.jsxs("button",{onClick:Me,className:`flex items-center gap-2 px-4 py-2 rounded-xl font-black text-[10px] uppercase tracking-widest transition-colors ${g?"bg-primary-900/30 text-primary-400 hover:bg-primary-900/50":"bg-primary-50 text-primary-600 hover:bg-primary-100"}`,title:_("pasteSharedLookLink")||"Colar link de look",children:[c.jsx(sb,{size:14})," ",c.jsx("span",{className:"hidden sm:inline",children:_("pasteLink")||"Colar Link"})]}),c.jsx($h,{size:16,className:"text-gray-400 ml-2"}),c.jsxs("select",{value:Qt,onChange:M=>Yt(M.target.value),className:`p-2 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold text-xs ${g?"bg-gray-800 text-white":"bg-gray-100"}`,children:[c.jsx("option",{value:"",children:_("all")||"Todas as cores"}),["Vermelho","Azul","Amarelo","Verde","Laranja","Roxo","Branco","Preto","Cinzento","Bege"].map(M=>c.jsx("option",{value:M,children:M},M))]})]})]}),x.length>0?c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-8",children:x.map(z)}):c.jsx("div",{className:"py-6 md:py-12 text-center opacity-20 font-black uppercase tracking-[0.3em] text-sm",children:_("noLooksAvailable")})]}),D.length>0&&c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center gap-3 px-2",children:[c.jsx("div",{className:"w-2.5 h-2.5 rounded-full bg-blue-400"}),c.jsxs("h3",{className:"text-2xl font-black tracking-tighter text-inherit",children:[_("toBeWashed")," ",c.jsxs("span",{className:"text-sm font-bold opacity-40",children:["— ",_("unavailable")," (",D.length,")"]})]})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 md:gap-8",children:D.map(z)})]})]})})()})]})}),t==="planner"&&(()=>{const p=Rn.getFullYear(),x=Rn.getMonth(),D=K=>`${K.getFullYear()}-${String(K.getMonth()+1).padStart(2,"0")}-${String(K.getDate()).padStart(2,"0")}`,z=()=>{const K=new Date(p,x,1),Pt=new Date(p,x+1,0),ln=(K.getDay()+6)%7,xn=[];for(let ct=0;ct{const K=new Date(Rn),Pt=(K.getDay()+6)%7,ln=new Date(K);return ln.setDate(K.getDate()-Pt),Array.from({length:7},(xn,Ir)=>{const ct=new Date(ln);return ct.setDate(ln.getDate()+Ir),ct})},te={PT:"pt-PT",EN:"en-GB",ES:"es-ES",FR:"fr-FR",DE:"de-DE"}[yt]||"pt-PT",X=Array.from({length:12},(K,Pt)=>{const xn=new Date(2e3,Pt,1).toLocaleDateString(te,{month:"long"});return xn.charAt(0).toUpperCase()+xn.slice(1)}),ne=Array.from({length:7},(K,Pt)=>new Date(2024,0,Pt+1).toLocaleDateString(te,{weekday:"short"}).replace(".","")),ke=()=>{const K=new Date(Rn);_e==="month"?K.setMonth(x-1):K.setDate(K.getDate()-7),Er(K)},_t=()=>{const K=new Date(Rn);_e==="month"?K.setMonth(x+1):K.setDate(K.getDate()+7),Er(K)},lt=M(),xt=`${lt[0].getDate()} ${X[lt[0].getMonth()]} — ${lt[6].getDate()} ${X[lt[6].getMonth()]} ${lt[6].getFullYear()}`,Ie=({date:K,cur:Pt=!0})=>{const ln=D(K),xn=ai(ln),Ir=ln===so,ct=_e==="week";let is=null;return Zr&&vt&&vt.forecast&&(is=vt.forecast.find(co=>co.date===ln)),c.jsxs("div",{onClick:()=>{Kn(ln),Xs(!0)},className:`relative rounded-2xl overflow-hidden cursor-pointer transition-all group border-2 flex flex-col ${Ir?"border-primary-600 shadow-lg shadow-primary-600/20":Pt?"border-transparent hover:border-primary-300 dark:hover:border-primary-700":"border-transparent opacity-30"} ${g?"bg-gray-800/80":"bg-gray-50"}`,style:{minHeight:ct?"180px":"100px"},children:[c.jsxs("div",{className:`px-3 py-2 flex items-center justify-between shrink-0 ${Ir?"bg-primary-600":""}`,children:[c.jsxs("div",{className:"flex items-center gap-1.5",children:[c.jsx("span",{className:`text-xs font-black ${Ir?"text-white":""}`,children:K.getDate()}),is&&c.jsxs("div",{className:"flex items-center gap-1 text-xs",title:`${is.min}ºC - ${is.max}ºC`,children:[c.jsx("span",{className:"text-sm drop-shadow-sm",children:hh(is.weathercode)}),c.jsxs("span",{className:`text-[10px] font-black ${Ir?"text-white/90":"text-gray-500 dark:text-gray-400"}`,children:[Math.round((is.min+is.max)/2),"°C"]})]})]}),Ir&&c.jsx("span",{className:"text-[8px] font-black text-white/80 uppercase tracking-widest",children:_("today")})]}),xn.length>0?c.jsx("div",{className:"px-2 pb-2 pt-1 flex-1 overflow-y-auto custom-scrollbar space-y-3",children:xn.map(co=>c.jsxs("div",{className:"space-y-1",children:[c.jsx("div",{className:"flex -space-x-2",children:co.items.slice(0,ct?4:3).map(Rg=>{const Dg=o.find(Tk=>Tk.id===Rg);return Dg?c.jsx("div",{className:`${ct?"w-10 h-10":"w-7 h-7"} rounded-lg overflow-hidden border-2 border-white dark:border-gray-700 shrink-0`,children:c.jsx("img",{src:Dg.imageUrl,className:"w-full h-full object-cover",alt:""})},Rg):null})}),c.jsx("p",{className:"text-[9px] font-black uppercase tracking-widest opacity-50 truncate",children:co.name}),ct&&c.jsxs("p",{className:"text-[9px] opacity-40 font-bold",children:[co.items.length," ",_("piecesShort")]})]},co.id))}):Pt&&c.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:c.jsxs("div",{className:`flex items-center gap-1 px-3 py-1.5 rounded-xl text-[9px] font-black uppercase tracking-widest ${g?"bg-gray-700 text-primary-400":"bg-white text-primary-600 shadow-sm"}`,children:[c.jsx(Ba,{size:10})," Outfit"]})})]})};return c.jsxs("div",{className:"space-y-6 animate-in fade-in duration-700 pb-20",children:[c.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("button",{onClick:ke,className:`p-3 rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700 hover:bg-gray-700":"bg-white border-gray-200 hover:bg-gray-50"} shadow-sm`,children:c.jsx(Wy,{size:20})}),c.jsx("h3",{className:"text-lg font-black tracking-tight min-w-[220px] text-center",children:_e==="month"?`${X[x]} ${p}`:xt}),c.jsx("button",{onClick:_t,className:`p-3 rounded-2xl transition-all border ${g?"bg-gray-800 border-gray-700 hover:bg-gray-700":"bg-white border-gray-200 hover:bg-gray-50"} shadow-sm`,children:c.jsx(rb,{size:20})}),c.jsx("button",{onClick:()=>Er(new Date),className:"px-4 py-2 text-[10px] font-black uppercase tracking-widest text-primary-600 bg-primary-50 dark:bg-primary-900/20 rounded-xl hover:bg-primary-100 dark:hover:bg-primary-900/40 transition-colors",children:_("today")})]}),c.jsx("div",{className:`flex p-1.5 rounded-2xl gap-1 ${g?"bg-gray-800":"bg-gray-100"}`,children:["month","week"].map(K=>c.jsx("button",{onClick:()=>Js(K),className:`px-5 py-2 rounded-xl font-black text-[10px] uppercase tracking-widest transition-all ${_e===K?`${g?"bg-gray-700":"bg-white"} shadow-md text-primary-600`:"text-gray-500 hover:text-gray-700"}`,children:_(K==="month"?"monthLabel":"weekLabel")},K))})]}),c.jsx("div",{className:"grid grid-cols-7 gap-2",children:ne.map(K=>c.jsx("div",{className:"text-center text-[10px] font-black uppercase tracking-widest opacity-40 py-1",children:K},K))}),_e==="month"?c.jsx("div",{className:"grid grid-cols-7 gap-2",children:z().map(({date:K,cur:Pt})=>c.jsx(Ie,{date:K,cur:Pt},D(K)))}):c.jsx("div",{className:"grid grid-cols-7 gap-3",children:M().map(K=>c.jsx(Ie,{date:K,cur:!0},D(K)))})]})})(),(t==="add"||t==="edit")&&c.jsx("div",{className:"max-w-4xl mx-auto animate-in zoom-in-95 duration-500",children:c.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6 md:gap-12 items-start",children:[c.jsxs("div",{className:"space-y-5 md:space-y-8",children:[c.jsx("h3",{className:"text-5xl font-black tracking-tighter text-inherit",children:_(m?"edit":"newItem")}),c.jsx(Ve,{className:"aspect-[3/4] overflow-hidden shadow-2xl relative",darkMode:g,children:B?c.jsx("img",{src:B,className:"w-full h-full object-cover",alt:""}):c.jsxs("div",{className:"h-full flex flex-col items-center justify-center opacity-10",children:[c.jsx(Wh,{size:100}),c.jsx("p",{className:"font-black uppercase tracking-[0.5em] mt-6",children:_("preview")})]})})]}),c.jsx(Ve,{className:"p-6 md:p-10 shadow-2xl",darkMode:g,children:c.jsxs("form",{onSubmit:Aa,className:"space-y-5 md:space-y-8",children:[c.jsx(cu,{label:_("name"),name:"name",defaultValue:m==null?void 0:m.name,required:!0}),c.jsxs("div",{className:"space-y-2",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("category")}),c.jsxs("select",{name:"category",defaultValue:(m==null?void 0:m.category)||"Tops",className:`w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-primary-500/10 font-bold ${g?"bg-gray-700 text-white":"bg-gray-100"}`,children:[c.jsx("option",{children:_("tops")}),c.jsx("option",{children:_("bottoms")}),c.jsx("option",{children:_("footwear")}),c.jsx("option",{children:_("coats")}),c.jsx("option",{children:_("accessories")})]})]}),c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"checkbox",name:"isWishlist",defaultChecked:(m==null?void 0:m.status)==="wishlist",className:"w-5 h-5 text-primary-600 focus:ring-primary-500 rounded-lg"}),c.jsxs("div",{children:[c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("wishlist")||_("wishlistDesc")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50",children:_("addFuturePurchase")})]})]}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:[_("color")," *"]}),c.jsx("div",{className:"flex flex-wrap gap-2",children:["Vermelho","Azul","Amarelo","Verde","Laranja","Roxo","Branco","Preto","Cinzento","Bege"].map(p=>c.jsx("button",{type:"button",onClick:()=>{k.includes(p)?C(k.filter(x=>x!==p)):C([...k,p])},className:`px-4 py-2 rounded-xl text-xs font-bold transition-all border-2 ${k.includes(p)?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:p},p))}),c.jsx("input",{type:"hidden",name:"color",value:k.join(", ")}),k.length===0&&c.jsx("p",{className:"text-[10px] text-red-500 uppercase tracking-widest font-black mt-2",children:_("selectOneColor")})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit flex items-center gap-2",children:[c.jsx(Wh,{size:12})," ",_("imageUrl")," ou Upload"]}),c.jsxs("div",{className:"flex flex-col gap-3",children:[c.jsx("input",{type:"text",name:"imageUrl",value:B,onChange:p=>I(p.target.value),placeholder:"https://...",className:`w-full p-5 rounded-2xl border-none outline-none focus:ring-4 focus:ring-primary-500/10 font-bold transition-all ${g?"bg-gray-700 text-white":"bg-gray-100 text-gray-900"}`}),c.jsxs("div",{className:"flex items-center gap-4",children:[c.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 flex-1"}),c.jsx("span",{className:"text-[10px] font-black uppercase tracking-widest opacity-30",children:_("or")}),c.jsx("div",{className:"h-px bg-gray-200 dark:bg-gray-700 flex-1"})]}),c.jsxs("label",{className:`flex items-center justify-center gap-3 p-5 rounded-2xl cursor-pointer transition-all font-black text-[10px] uppercase tracking-widest border-2 border-dashed ${g?"bg-gray-800 border-gray-700 hover:border-primary-500 hover:text-primary-400":"bg-gray-50 border-gray-200 hover:border-primary-400 hover:text-primary-600"}`,children:[c.jsx(Wh,{size:16}),c.jsx("span",{children:_("uploadGallery")}),c.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Lc})]})]})]}),c.jsxs("div",{className:"space-y-3",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit flex items-center gap-2",children:[c.jsx(Zy,{size:12})," ",_("assignSections")]}),c.jsxs("button",{type:"button",onClick:()=>yn(!0),className:"text-[10px] font-black uppercase tracking-widest text-primary-600 hover:text-primary-700 flex items-center gap-1",children:[c.jsx(Ba,{size:10})," ",_("createSection")]})]}),gn.length===0?c.jsx("div",{className:"p-4 border-2 border-dashed border-gray-200 dark:border-gray-800 rounded-2xl text-center",children:c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:_("noSectionsCreated")})}):c.jsx("div",{className:"flex flex-wrap gap-2",children:gn.map(p=>c.jsxs("button",{type:"button",onClick:()=>{wr.includes(p.id)?Ks(wr.filter(x=>x!==p.id)):Ks([...wr,p.id])},className:`flex items-center gap-2 px-4 py-2 rounded-xl text-xs font-bold transition-all border-2 ${wr.includes(p.id)?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:[p.name,wr.includes(p.id)&&c.jsx(Xn,{size:12})]},p.id))})]}),c.jsxs("div",{className:"flex gap-4 pt-6",children:[c.jsx("button",{type:"button",onClick:()=>{v(null),I(""),e("closet")},className:"flex-1 font-black uppercase text-[10px] opacity-40 hover:opacity-100 tracking-widest transition-all text-inherit",children:_("cancel")}),c.jsx("button",{type:"submit",className:"flex-1 py-5 bg-primary-600 text-white rounded-3xl md:rounded-[2rem] font-black uppercase tracking-widest text-[10px] shadow-2xl shadow-primary-600/40 hover:scale-[1.02] active:scale-95 transition-all",children:_(m?"save":"register")})]})]})})]})}),t==="profile"&&c.jsxs("div",{className:"max-w-4xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:[c.jsx(Ve,{className:"p-6 md:p-10 border-primary-100 relative overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"flex items-center gap-4 md:gap-8 relative z-10 text-inherit",children:[c.jsxs("div",{className:"w-24 h-24 rounded-[2.5rem] bg-primary-600 flex items-center justify-center text-white text-4xl font-black shadow-2xl relative overflow-hidden group cursor-pointer",children:[F!=null&&F.avatar?c.jsx("img",{src:F.avatar,className:"w-full h-full object-cover",alt:"Profile"}):c.jsx("span",{children:(((O=F==null?void 0:F.fullName)==null?void 0:O[0])||((Q=F==null?void 0:F.username)==null?void 0:Q[0])||((Ee=n==null?void 0:n.email)==null?void 0:Ee[0])||"U").toUpperCase()}),c.jsxs("label",{className:"absolute inset-0 bg-black/50 flex flex-col items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity cursor-pointer text-white",children:[c.jsx(eu,{size:20}),c.jsx("span",{className:"text-[8px] uppercase font-black mt-1 tracking-widest",children:_("edit")}),c.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Oc})]})]}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-3xl font-black tracking-tighter",children:(F==null?void 0:F.fullName)||_("yourAccount")}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("p",{className:"opacity-60 font-bold text-sm",children:["@",(F==null?void 0:F.username)||((tt=n==null?void 0:n.email)==null?void 0:tt.split("@")[0])||_("papMode")]}),c.jsx("button",{onClick:p=>{var x;p.stopPropagation(),navigator.clipboard.writeText(`@${(F==null?void 0:F.username)||((x=n==null?void 0:n.email)==null?void 0:x.split("@")[0])||_("papMode")}`),Le("Username copiado!"),setTimeout(()=>Le(null),2e3)},className:"text-blue-500 hover:text-blue-600 bg-blue-500/10 p-1.5 rounded-md transition-colors",title:"Copiar Username",children:c.jsx(za,{size:14})})]})]})]})}),c.jsxs(Ve,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(Hy,{className:"text-primary-600"})," ",_("profileInfo")]}),c.jsxs("form",{onSubmit:li,className:"space-y-6",children:[c.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[c.jsxs("div",{className:"space-y-2 relative",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("username")}),c.jsxs("div",{className:"relative",children:[c.jsx("span",{className:"absolute left-4 top-1/2 -translate-y-1/2 opacity-40 font-black",children:"@"}),c.jsx("input",{name:"username",defaultValue:(F==null?void 0:F.username)||"",placeholder:"amari",className:`w-full p-4 pl-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold ${g?"bg-gray-800 text-white":"bg-gray-50"}`})]})]}),c.jsx(cu,{label:_("fullName"),name:"fullName",defaultValue:(F==null?void 0:F.fullName)||"",placeholder:"Ex: Amari Rodriguez"}),c.jsxs("div",{className:"space-y-2",children:[c.jsxs("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:[_("dob")," ",_("optional")]}),c.jsxs("div",{className:"flex gap-2",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("select",{name:"dobDay",defaultValue:((ge=F==null?void 0:F.dob)==null?void 0:ge.split("-")[2])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"DD"}),Array.from({length:31},(p,x)=>String(x+1).padStart(2,"0")).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(Bh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]}),c.jsxs("div",{className:"relative flex-1",children:[c.jsxs("select",{name:"dobMonth",defaultValue:((ot=F==null?void 0:F.dob)==null?void 0:ot.split("-")[1])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"MM"}),Array.from({length:12},(p,x)=>String(x+1).padStart(2,"0")).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(Bh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]}),c.jsxs("div",{className:"relative flex-[1.5]",children:[c.jsxs("select",{name:"dobYear",defaultValue:((at=F==null?void 0:F.dob)==null?void 0:at.split("-")[0])||"",className:`w-full appearance-none p-4 pr-10 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500/40 font-bold transition-all cursor-pointer ${g?"bg-gray-800 text-white hover:bg-gray-700":"bg-gray-100 text-gray-900 hover:bg-gray-200"}`,children:[c.jsx("option",{value:"",children:"YYYY"}),Array.from({length:100},(p,x)=>new Date().getFullYear()-x).map(p=>c.jsx("option",{value:p,children:p},p))]}),c.jsx(Bh,{size:14,className:"absolute right-3 top-1/2 -translate-y-1/2 opacity-40 pointer-events-none"})]})]})]}),c.jsx(cu,{label:`${_("bio")} ${_("optional")}`,name:"bio",defaultValue:(F==null?void 0:F.bio)||"",placeholder:"..."}),c.jsx(cu,{label:_("location"),name:"location",defaultValue:(F==null?void 0:F.location)||"",placeholder:_("locationEx")})]}),c.jsx("button",{disabled:Bi,type:"submit",className:"w-full py-4 bg-primary-600 text-white rounded-xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 disabled:opacity-50 hover:scale-[1.01] transition-all",children:_(Bi?"saving":"save")})]},`${F==null?void 0:F.username}-${F==null?void 0:F.fullName}-${F==null?void 0:F.dob}-${F==null?void 0:F.bio}-${F==null?void 0:F.location}`)]})]}),t==="community"&&c.jsx("div",{className:"max-w-7xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:Ue?c.jsxs("div",{className:"space-y-5 md:space-y-8",children:[c.jsxs("button",{onClick:()=>{ga(null),Gi(!1)},className:"flex items-center gap-2 opacity-60 hover:opacity-100 transition-opacity font-black text-inherit uppercase text-xs tracking-widest",children:[c.jsx(Wy,{size:16})," Voltar"]}),c.jsx(Ve,{className:"p-5 md:p-8 border-primary-100 relative overflow-hidden",darkMode:g,children:c.jsxs("div",{className:"flex items-center gap-4 md:gap-8 relative z-10 text-inherit",children:[c.jsx("div",{className:"w-24 h-24 rounded-[2.5rem] bg-primary-600 text-white flex items-center justify-center font-black text-4xl overflow-hidden",children:Ue.avatar?c.jsx("img",{src:Ue.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((Sr=Ue.fullName)==null?void 0:Sr[0])||((Zt=Ue.username)==null?void 0:Zt[0])||"U").toUpperCase()})}),c.jsxs("div",{className:"flex-1 flex justify-between items-start sm:items-center flex-col sm:flex-row gap-4",children:[c.jsxs("div",{children:[c.jsx("h3",{className:"text-3xl font-black tracking-tighter",children:Ue.fullName||_("userTitle")}),c.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[c.jsxs("p",{className:"opacity-60 font-bold text-sm",children:["@",Ue.username||"user"]}),c.jsx("button",{onClick:p=>{p.stopPropagation(),navigator.clipboard.writeText(`@${Ue.username||"user"}`),Le("Username copiado!"),setTimeout(()=>Le(null),2e3)},className:"text-blue-500 hover:text-blue-600 bg-blue-500/10 p-1.5 rounded-md transition-colors",title:"Copiar Username",children:c.jsx(za,{size:14})})]})]}),c.jsxs("button",{onClick:()=>Gi(!0),className:"px-5 py-3 bg-primary-100 text-primary-700 dark:bg-primary-900/50 dark:text-primary-300 rounded-2xl font-black text-sm transition-all hover:scale-105 flex items-center gap-2",children:[c.jsx(ho,{size:16})," Inspecionar"]})]})]})}),wt&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Gi(!1),children:c.jsxs(Ve,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 relative",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("button",{onClick:()=>Gi(!1),className:"absolute top-6 right-6 opacity-50 hover:opacity-100 text-inherit",children:c.jsx(Cr,{size:24})}),c.jsxs("div",{className:"flex items-center gap-6 mb-5 md:mb-8 text-inherit",children:[c.jsx("div",{className:"w-20 h-20 rounded-3xl md:rounded-[2rem] bg-primary-600 text-white flex items-center justify-center font-black text-3xl overflow-hidden",children:Ue.avatar?c.jsx("img",{src:Ue.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((rs=Ue.fullName)==null?void 0:rs[0])||((lo=Ue.username)==null?void 0:lo[0])||"U").toUpperCase()})}),c.jsxs("div",{children:[c.jsx("h3",{className:"text-2xl font-black",children:Ue.fullName||_("userTitle")}),c.jsxs("p",{className:"opacity-60 font-bold",children:["@",Ue.username||"user"]})]})]}),c.jsxs("div",{className:"space-y-6 text-inherit bg-gray-50 dark:bg-gray-800/50 p-6 rounded-3xl",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("dob")}),c.jsx("p",{className:"font-bold",children:et!=null&&et.dob?new Date(et.dob).toLocaleDateString():"Não especificada"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("location")}),c.jsx("p",{className:"font-bold",children:(et==null?void 0:et.location)||Ue.location||"Não especificada"})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("bio")}),c.jsx("p",{className:"font-bold opacity-80",children:(et==null?void 0:et.bio)||"Sem biografia"})]}),c.jsxs("div",{className:"grid grid-cols-2 gap-4 pt-4 border-t border-gray-200 dark:border-gray-700",children:[c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("registeredPieces")}),c.jsx("p",{className:"text-2xl font-black",children:Xt.length})]}),c.jsxs("div",{children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("createdOutfits")}),c.jsx("p",{className:"text-2xl font-black",children:ya.length})]})]}),c.jsxs("div",{className:"pt-4 border-t border-gray-200 dark:border-gray-700",children:[c.jsx("p",{className:"text-xs font-black uppercase tracking-widest opacity-50 mb-1",children:_("accountRegistrationDate")}),c.jsx("p",{className:"font-bold",children:et!=null&&et.createdAt?new Date(et.createdAt).toLocaleDateString():"Desconhecida"})]})]})]})}),Ue.isPrivate?c.jsxs("div",{className:"text-center py-20 opacity-50 font-black text-2xl text-inherit",children:[c.jsx(Jy,{className:"w-16 h-16 mx-auto mb-4 opacity-50"}),_("isPrivateUser")]}):c.jsxs("div",{className:"space-y-5 md:space-y-8 md:space-y-12 text-inherit",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black mb-6 uppercase tracking-widest text-[11px] opacity-50",children:[_("userOutfits")," (",ya.length,")"]}),c.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 gap-6",children:ya.map(p=>c.jsxs("div",{className:"group relative aspect-[3/4] rounded-3xl md:rounded-[2rem] overflow-hidden bg-gray-100 dark:bg-gray-800 cursor-pointer shadow-lg",children:[p.items&&p.items[0]&&Xt.find(x=>x.id===p.items[0])&&c.jsx("img",{src:Xt.find(x=>x.id===p.items[0]).imageUrl,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",alt:"Look"}),c.jsxs("div",{className:"absolute inset-0 bg-gradient-to-t from-black/80 via-black/20 to-transparent flex items-end p-6",children:[c.jsx("span",{className:"text-white font-black text-sm flex-1",children:p.name}),c.jsxs("div",{className:"flex gap-2",children:[c.jsx("button",{onClick:x=>{x.stopPropagation(),$s(p)},className:"p-2 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Inspecionar Outfit",children:c.jsx(ho,{size:16})}),c.jsx("button",{onClick:x=>{x.stopPropagation(),Nc(p)},className:"p-2 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Copiar para o meu armário",children:c.jsx(za,{size:16})})]})]})]},p.id))})]}),c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black mb-6 uppercase tracking-widest text-[11px] opacity-50",children:[_("userCloset")," (",Xt.length,")"]}),c.jsx("div",{className:"grid grid-cols-3 sm:grid-cols-4 md:grid-cols-5 lg:grid-cols-6 gap-4",children:Xt.map(p=>c.jsxs("div",{className:"aspect-square rounded-2xl overflow-hidden bg-gray-100 dark:bg-gray-800 shadow-md group relative",children:[c.jsx("img",{src:p.imageUrl,className:"w-full h-full object-cover group-hover:scale-110 transition-transform duration-700",alt:"Item"}),c.jsxs("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center gap-2",children:[c.jsx("button",{onClick:x=>{x.stopPropagation(),yr(p)},className:"p-2.5 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Inspecionar Peça",children:c.jsx(ho,{size:18})}),c.jsx("button",{onClick:x=>{x.stopPropagation(),Pa(p)},className:"p-2.5 bg-white/20 hover:bg-white/40 rounded-xl backdrop-blur-sm transition-colors text-white",title:"Copiar para o meu armário",children:c.jsx(za,{size:18})})]})]},p.id))})]})]})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"relative mb-5 md:mb-8 flex gap-4",children:[c.jsxs("div",{className:"relative flex-1",children:[c.jsx(ho,{className:"absolute left-6 top-1/2 -translate-y-1/2 opacity-40 text-inherit",size:24}),c.jsx("input",{type:"text",placeholder:_("searchUsers"),value:Hi,onChange:p=>{ni(p.target.value),p.target.value&&zs(!1)},className:`w-full p-6 pl-16 rounded-3xl font-black text-lg outline-none focus:ring-4 focus:ring-primary-500/20 transition-all shadow-xl shadow-black/5 text-inherit ${g?"bg-gray-800":"bg-white"}`})]}),c.jsxs("button",{onClick:()=>{zs(!gr),gr||ni("")},className:`px-5 md:px-8 rounded-3xl font-black transition-all shadow-xl shadow-black/5 flex items-center justify-center gap-2 whitespace-nowrap ${gr?"bg-primary-600 text-white":g?"bg-gray-800 text-inherit hover:bg-gray-700":"bg-white text-inherit hover:bg-gray-50"}`,children:[c.jsx(ab,{size:20}),c.jsx("span",{className:"hidden sm:inline",children:_("recommended")||"Recomendados"})]})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:qn.length===0?c.jsx("div",{className:"col-span-full text-center py-6 md:py-12 opacity-50 text-inherit font-black text-xl",children:_("noUsersFound")}):qn.map(p=>{var x,D;return c.jsx(Ve,{className:"p-6 cursor-pointer hover:scale-105 transition-transform",darkMode:g,onClick:()=>fh(p),children:c.jsxs("div",{className:"flex items-center gap-4 text-inherit",children:[c.jsx("div",{className:"w-16 h-16 rounded-2xl bg-primary-600 text-white flex items-center justify-center font-black text-2xl overflow-hidden",children:p.avatar?c.jsx("img",{src:p.avatar,className:"w-full h-full object-cover",alt:"Avatar"}):c.jsx("span",{children:(((x=p.fullName)==null?void 0:x[0])||((D=p.username)==null?void 0:D[0])||"U").toUpperCase()})}),c.jsxs("div",{children:[c.jsx("h3",{className:"font-black text-lg",children:p.fullName||_("userTitle")}),c.jsxs("p",{className:"text-sm opacity-60 font-bold",children:["@",p.username||"user"]})]})]})},p.uid)})})]})}),t==="settings"&&c.jsxs("div",{className:"max-w-4xl mx-auto space-y-5 md:space-y-8 md:space-y-12 animate-in fade-in duration-700 pb-20",children:[c.jsxs("div",{className:"flex flex-col gap-4 md:gap-8",children:[c.jsxs(Ve,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(Hh,{className:"text-primary-600"})," ",_("preferences")]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("darkMode")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("interfaceAppearance")})]}),c.jsx("button",{onClick:()=>ba(!g),className:`w-14 h-8 rounded-full transition-colors relative ${g?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${g?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("themeColor")||"Cor do Tema"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("personalizeColor")||"Personalize a cor"})]}),c.jsx("div",{className:"flex gap-2",children:[{id:"theme-indigo",color:"#4f46e5"},{id:"theme-rose",color:"#e11d48"},{id:"theme-emerald",color:"#10b981"},{id:"theme-amber",color:"#f59e0b"},{id:"theme-slate",color:"#64748b"}].map(p=>c.jsx("button",{onClick:()=>lh(p.id),className:`w-6 h-6 rounded-full transition-all flex items-center justify-center ${He===p.id?"ring-2 ring-offset-2 ring-offset-white dark:ring-offset-gray-900 ring-primary-500 scale-110":"hover:scale-110"}`,style:{backgroundColor:p.color},children:He===p.id&&c.jsx(Xn,{size:12,className:"text-white"})},p.id))})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("notifications")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("lookReminders")})]}),c.jsx("button",{onClick:()=>Gn(!$i),className:`w-14 h-8 rounded-full transition-colors relative ${$i?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${$i?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("keyboardShortcuts")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("enableNavigationQE")})]}),c.jsx("button",{onClick:()=>es(!mr),className:`w-14 h-8 rounded-full transition-colors relative ${mr?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${mr?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("dailyOutfitNotification")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("receiveNotificationAtScheduledTime")})]}),c.jsxs("div",{className:"flex items-center gap-4 w-full sm:w-auto justify-between sm:justify-end",children:[pr&&c.jsx("input",{type:"time",value:$n,onChange:p=>{Ls(p.target.value),Ke("dailyOutfitTime",p.target.value),Ms(""),Ke("lastNotifiedDate","")},className:`px-3 py-1.5 rounded-xl text-sm outline-none border font-bold ${g?"bg-gray-800 border-gray-700 text-white":"bg-white border-gray-200 text-gray-900"}`}),c.jsx("button",{onClick:()=>uh(!pr),className:`w-14 h-8 rounded-full transition-colors relative shrink-0 ${pr?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${pr?"left-7":"left-1"}`})})]})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("weatherAlerts")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("weatherSuggestions")})]}),c.jsx("button",{onClick:()=>dh(!Zr),className:`w-14 h-8 rounded-full transition-colors relative ${Zr?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${Zr?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit flex items-center gap-2",children:_("privateProfile")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("privateProfileDesc")})]}),c.jsx("button",{onClick:()=>bc(!Fs),className:`w-14 h-8 rounded-full transition-colors relative ${Fs?"bg-primary-600":"bg-gray-200"}`,children:c.jsx("div",{className:`w-6 h-6 rounded-full bg-white absolute top-1 transition-all ${Fs?"left-7":"left-1"}`})})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("cardSize")||"Tamanho do Card"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("cardSizeDesc")||"Tamanho no armário/carrinho"})]}),c.jsx("div",{className:"flex gap-2",children:["small","medium","large"].map(p=>c.jsx("button",{onClick:()=>Zs(p),className:`px-3 py-1.5 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all border-2 ${Nn===p?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:p==="small"?_("small")||"Pequeno":p==="medium"?_("medium")||"Médio":_("large")||"Grande"},p))})]}),c.jsxs("div",{className:"flex items-center justify-between",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("defaultPage")||"Página Inicial"}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:_("defaultPageDesc")||"Página que aparece após o login"})]}),c.jsx("div",{className:"flex gap-2",children:["dashboard","closet","outfits","planner"].map(p=>c.jsx("button",{onClick:()=>eo(p),className:`px-3 py-1.5 rounded-xl text-[10px] font-black uppercase tracking-widest transition-all border-2 ${gc===p?"border-primary-600 bg-primary-600 text-white shadow-lg shadow-primary-600/30 scale-105":"border-transparent bg-gray-100 dark:bg-gray-800 text-gray-500 hover:bg-gray-200 dark:hover:bg-gray-700"}`,children:_(p==="dashboard"?"dashboard":p==="closet"?"myCloset":p==="outfits"?"outfits":"planning")},p))})]}),c.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-gray-100 dark:border-gray-800",children:[c.jsxs("div",{children:[c.jsx("p",{className:"font-bold text-inherit",children:_("appLanguage")}),c.jsx("p",{className:"text-[10px] uppercase tracking-widest opacity-50 text-inherit",children:yt==="PT"?"🇵🇹 "+_("portuguese"):yt==="EN"?"🇬🇧 "+_("english"):yt==="ES"?"🇪🇸 "+_("spanish"):yt==="FR"?"🇫🇷 "+_("french"):yt==="DE"?"🇩🇪 "+_("german"):yt})]}),c.jsx("button",{onClick:()=>Wi(!0),className:"px-5 py-2 font-black text-[10px] uppercase tracking-widest bg-primary-50 text-primary-600 rounded-xl hover:bg-primary-100 transition-colors dark:bg-primary-900/40 dark:text-primary-400",children:_("edit")})]})]})]}),c.jsxs(Ve,{className:"p-5 md:p-8",darkMode:g,children:[c.jsxs("h3",{className:"text-xl font-black mb-6 flex items-center gap-3 text-inherit",children:[c.jsx(Ua,{className:"text-primary-600"})," ",_("feedbackTitle")||"Suporte e Feedback"]}),c.jsx("p",{className:"opacity-60 text-sm font-medium mb-6",children:_("feedbackDesc")||"Tem alguma ideia, sugestão ou encontrou algum problema? Envie uma mensagem diretamente para nós!"}),c.jsxs("form",{onSubmit:async p=>{p.preventDefault();const x=new FormData(p.target),D=x.get("type"),z=x.get("message"),M="faiker027@gmail.com";try{if((await fetch(`https://formsubmit.co/ajax/${M}`,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({Tipo:D,Mensagem:z,Utilizador:(n==null?void 0:n.email)||"Desconhecido",_subject:`MyCloset Feedback: ${D}`})})).ok)Le(_("msgSentSuccess")),setTimeout(()=>Le(null),4e3),p.target.reset();else throw new Error("Falha no envio")}catch(J){console.error("Erro ao enviar feedback:",J),Le(_("msgSendError")),setTimeout(()=>Le(null),4e3)}},className:"space-y-4",children:[c.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"radio",name:"type",value:"Ideia/Sugestão",defaultChecked:!0,className:"text-primary-600 focus:ring-primary-500"}),c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("ideaSuggestion")})]}),c.jsxs("label",{className:"flex items-center gap-3 p-4 rounded-xl border border-gray-100 dark:border-gray-800 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",children:[c.jsx("input",{type:"radio",name:"type",value:"Bug/Erro",className:"text-primary-600 focus:ring-primary-500"}),c.jsx("span",{className:"font-bold text-sm text-inherit",children:_("bugError")})]})]}),c.jsx("textarea",{name:"message",required:!0,placeholder:_("writeMessage"),rows:4,className:`w-full p-4 rounded-xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold resize-none ${g?"bg-gray-800 text-white":"bg-gray-50"}`}),c.jsx("button",{type:"submit",className:"w-full py-4 bg-primary-600 text-white rounded-xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-[1.01] transition-all",children:_("sendMessage")})]})]})]}),c.jsxs("div",{className:"space-y-6",children:[c.jsxs("div",{className:"flex items-center justify-between px-2 text-inherit",children:[c.jsxs("h3",{className:"text-xl font-black text-red-500 flex items-center gap-3 tracking-widest uppercase",children:[c.jsx(ev,{size:24})," ",_("recycleBin")]}),ro.length>0&&c.jsx("button",{onClick:ao,className:"text-[10px] font-black text-red-500 uppercase tracking-widest hover:underline",children:_("empty")})]}),c.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:ro.map(p=>c.jsxs(Ve,{className:"p-4 flex items-center gap-5 border-red-50",darkMode:g,children:[c.jsx("img",{src:p.imageUrl,className:"w-16 h-16 rounded-2xl object-cover grayscale opacity-40",alt:""}),c.jsxs("div",{className:"flex-1 min-w-0 text-inherit",children:[c.jsx("p",{className:"font-black text-sm truncate",children:p.name}),c.jsx("p",{className:"text-[10px] font-black text-red-400 uppercase tracking-tighter",children:_("deleted")})]}),c.jsxs("div",{className:"flex gap-1",children:[c.jsx("button",{onClick:()=>Tr("restore",p),className:"p-3 text-primary-600 hover:bg-primary-50 rounded-2xl transition-all",children:c.jsx(hb,{size:18})}),c.jsx("button",{onClick:()=>Tr("delete",p.id),className:"p-3 text-red-600 hover:bg-red-50 rounded-2xl transition-all",children:c.jsx(tu,{size:18})})]})]},p.id))})]}),c.jsx(Ve,{className:"p-6 md:p-10 border-red-200 bg-red-50/10",darkMode:g,children:c.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4 md:gap-8",children:[c.jsxs("div",{className:"text-inherit",children:[c.jsxs("h4",{className:"text-xl font-black text-red-700 flex items-center gap-3",children:[c.jsx(Jy,{})," ",_("criticalZone")]}),c.jsx("p",{className:"opacity-60 font-bold text-sm mt-2",children:_("fullCleanActions")})]}),c.jsx("button",{onClick:zt,className:"px-5 md:px-8 py-4 bg-red-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest hover:bg-red-700 transition-all",children:_("clearAll")})]})})]})]})]}),ah&&wn&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Xs(!1),children:c.jsxs(Ve,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[80vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-6",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-xl font-black text-inherit flex items-center gap-3",children:[c.jsx($y,{size:22,className:"text-primary-600"})," ",_("chooseOutfit")]}),c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mt-1",children:(()=>{const p={PT:"pt-PT",EN:"en-GB",ES:"es-ES",FR:"fr-FR",DE:"de-DE"};return new Date(wn+"T12:00:00").toLocaleDateString(p[yt]||"pt-PT",{weekday:"long",day:"numeric",month:"long"})})()})]}),c.jsx("button",{onClick:()=>Xs(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(Cr,{size:20})})]}),Zi.find(p=>p.date===wn)&&c.jsxs("button",{onClick:async()=>{await oi(wn,null),Xs(!1)},className:"mb-4 w-full py-3 border-2 border-dashed border-red-200 dark:border-red-900/50 text-red-400 rounded-2xl font-black text-[10px] uppercase tracking-widest hover:border-red-400 hover:text-red-500 transition-all flex items-center justify-center gap-2",children:[c.jsx(tu,{size:14})," ",_("removeOutfitDay")]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:u.length===0?c.jsx("div",{className:"py-6 md:py-12 text-center opacity-30 font-black uppercase tracking-[0.3em] text-sm",children:_("noOutfitCreated")}):u.map(p=>{const x=Zi.find(M=>M.date===wn),z=(x?x.lookIds||(x.lookId?[x.lookId]:[]):[]).includes(p.id);return c.jsxs("button",{onClick:async()=>{await oi(wn,p.id)},className:`w-full flex items-center gap-4 p-4 rounded-2xl transition-all border-2 text-left ${z?"border-primary-600 bg-primary-50 dark:bg-primary-900/20":`border-transparent ${g?"bg-gray-800 hover:bg-gray-700":"bg-gray-50 hover:bg-gray-100"}`}`,children:[c.jsx("div",{className:"flex -space-x-2 shrink-0",children:p.items.slice(0,3).map(M=>{const J=o.find(te=>te.id===M);return J?c.jsx("div",{className:"w-12 h-12 rounded-xl overflow-hidden border-2 border-white dark:border-gray-700",children:c.jsx("img",{src:J.imageUrl,className:"w-full h-full object-cover",alt:""})},M):null})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-black text-sm truncate text-inherit",children:p.name}),c.jsxs("p",{className:"text-[10px] uppercase tracking-widest opacity-40 font-bold",children:[p.items.length," ",_("piecesShort")]})]}),z&&c.jsx(Xn,{size:18,className:"text-primary-600 shrink-0"})]},p.id)})})]})}),Xi&&c.jsx("div",{className:"fixed bottom-8 left-1/2 transform -translate-x-1/2 z-[300] animate-in slide-in-from-bottom-5",children:c.jsxs("div",{className:"bg-gray-900 text-white px-6 py-3 rounded-full shadow-2xl font-bold text-sm tracking-wide flex items-center gap-3",children:[c.jsx(qy,{size:18,className:"text-green-400"}),Xi]})}),Pn&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>si(!1),children:c.jsxs(Ve,{className:"w-full max-w-md p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[80vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-6",children:[c.jsxs("div",{children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx(Ua,{size:24,className:"text-primary-600"})," ",_("notificationsModal")]}),_r.filter(p=>!p.read).length>0&&c.jsxs("p",{className:"text-[10px] font-black uppercase tracking-widest text-primary-600 mt-1",children:[_r.filter(p=>!p.read).length," ",yt==="PT"?"nova(s)":yt==="EN"?"new":yt==="ES"?"nueva(s)":yt==="FR"?"nouvelle(s)":"neue"]})]}),c.jsxs("div",{className:"flex items-center gap-2",children:[_r.filter(p=>!p.read).length>0&&c.jsx("button",{onClick:async()=>{const p=Ka(oe);_r.filter(x=>!x.read).forEach(x=>{const D=Ne(oe,"artifacts",ue,"inboxNotifications",x.id);p.update(D,{read:!0})}),await p.commit()},className:"text-[9px] font-black uppercase tracking-widest text-primary-600 hover:underline px-3 py-2 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-xl transition-all",children:_("markAllRead")}),c.jsx("button",{onClick:()=>si(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(Cr,{size:20})})]})]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:_r.length===0?c.jsxs("div",{className:"py-8 md:py-16 text-center flex flex-col items-center gap-4 opacity-30",children:[c.jsx(Ua,{size:40}),c.jsx("span",{className:"font-black uppercase tracking-[0.3em] text-sm",children:_("noNotifications")})]}):_r.map(p=>c.jsxs("div",{className:`p-4 rounded-2xl flex items-start gap-4 transition-all ${p.read?g?"bg-gray-800/60":"bg-gray-50":"bg-primary-50 dark:bg-primary-900/20 border border-primary-100 dark:border-primary-800/40"}`,children:[c.jsx("div",{className:`shrink-0 w-12 h-12 flex items-center justify-center rounded-2xl text-xl shadow-sm ${p.read?g?"bg-gray-700":"bg-gray-200":"bg-primary-100 dark:bg-primary-900/50"}`,children:p.type==="look_copied"?"✂️":c.jsx(Ua,{size:20})}),c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-bold text-sm leading-snug text-inherit",children:p.type==="look_copied"&&c.jsxs(c.Fragment,{children:[c.jsx("span",{className:"text-primary-600 font-black",children:p.copiedByEmail})," ",_("lookCopiedBy")," ",c.jsxs("span",{className:"italic",children:['"',p.lookName,'"']})]})}),c.jsxs("p",{className:"text-[10px] uppercase font-black tracking-widest opacity-40 mt-1.5",children:[new Date(p.createdAt).toLocaleDateString()," às ",new Date(p.createdAt).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})]})]}),!p.read&&c.jsx("button",{onClick:async()=>{const x=Ne(oe,"artifacts",ue,"inboxNotifications",p.id);await Zn(x,{read:!0})},className:"shrink-0 p-2 text-primary-600 hover:bg-primary-100 dark:hover:bg-primary-900/40 rounded-xl transition-all",title:"Marcar como lida",children:c.jsx(Xn,{size:16})})]},p.id))})]})}),xa&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>yn(!1),children:c.jsxs(Ve,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[90vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-5 md:mb-8",children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx(Gy,{size:24,className:"text-primary-600"})," ",_("manageSections")]}),c.jsx("button",{onClick:()=>yn(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(Cr,{size:20})})]}),c.jsxs("div",{className:`flex gap-3 mb-5 md:mb-8 p-4 rounded-2xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("input",{value:vn,onChange:p=>Hs(p.target.value),placeholder:_("sectionPlaceholder"),onKeyDown:p=>p.key==="Enter"&&Sa(),className:`flex-1 p-3 rounded-xl border-none outline-none font-bold ${g?"bg-gray-700 text-white":"bg-white"} shadow-sm`}),c.jsx("button",{onClick:Sa,disabled:!vn.trim(),className:"px-5 py-3 bg-primary-600 text-white rounded-xl font-black text-[10px] uppercase tracking-widest shadow-lg shadow-primary-600/30 hover:scale-105 active:scale-95 transition-all disabled:opacity-30",children:c.jsx(Ba,{size:18})})]}),c.jsx("div",{className:"flex-1 overflow-y-auto space-y-3 custom-scrollbar",children:gn.length===0?c.jsx("div",{className:"py-6 md:py-12 text-center opacity-30 font-black uppercase tracking-[0.3em] text-sm",children:_("noSections")}):gn.map(p=>c.jsx("div",{className:`flex items-center gap-4 p-4 rounded-2xl transition-all ${g?"bg-gray-800":"bg-gray-50"}`,children:Gs===p.id?c.jsxs(c.Fragment,{children:[c.jsx("input",{value:Ys,onChange:x=>Ea(x.target.value),onKeyDown:x=>x.key==="Enter"&&_n(),className:`flex-1 p-2 rounded-xl border-none outline-none font-bold text-sm ${g?"bg-gray-700 text-white":"bg-white"} shadow-sm`}),c.jsx("button",{onClick:_n,disabled:!Ys.trim(),className:"p-2 bg-green-500 text-white rounded-xl shadow-md hover:scale-105 disabled:opacity-30",children:c.jsx(Xn,{size:16})}),c.jsx("button",{onClick:()=>Qs(null),className:"p-2 bg-gray-200 dark:bg-gray-700 text-gray-500 dark:text-gray-400 rounded-xl hover:scale-105",children:c.jsx(Cr,{size:16})})]}):c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:"flex-1 min-w-0",children:[c.jsx("p",{className:"font-black text-sm truncate",children:p.name}),c.jsxs("p",{className:"text-[10px] opacity-40 font-bold uppercase tracking-widest",children:[o.filter(x=>x.sections&&x.sections.includes(p.id)).length," ",_("pieces")," • ",u.filter(x=>x.sections&&x.sections.includes(p.id)).length," look(s)"]})]}),c.jsx("button",{onClick:()=>{Qs(p.id),Ea(p.name),ka(p.emoji)},className:"p-2 text-gray-400 hover:text-primary-600 hover:bg-primary-50 dark:hover:bg-primary-900/20 rounded-xl transition-all",children:c.jsx(eu,{size:16})}),c.jsx("button",{onClick:()=>ph(p.id),className:"p-2 text-red-400 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-xl transition-all",children:c.jsx(tu,{size:16})})]})},p.id))}),c.jsx("button",{onClick:()=>yn(!1),className:"mt-5 md:mt-8 w-full py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})}),Te&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Ae(!1),children:c.jsxs(Ve,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95 flex flex-col max-h-[90vh]",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"flex items-center justify-between mb-5 md:mb-8",children:[c.jsxs("h3",{className:"text-2xl font-black text-inherit flex items-center gap-3",children:[c.jsx($h,{size:24,className:"text-primary-600"})," ",_("advancedFilters")]}),c.jsx("button",{onClick:()=>Ae(!1),className:"p-2 bg-gray-100 dark:bg-gray-800 rounded-full hover:scale-110 transition-all text-inherit",children:c.jsx(Cr,{size:20})})]}),c.jsxs("div",{className:"flex-1 overflow-y-auto space-y-5 md:space-y-8 pr-2 custom-scrollbar",children:[c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("closet")}),c.jsx("div",{className:"flex flex-wrap gap-2",children:[_("all"),_("tops"),_("bottoms"),_("footwear"),_("coats"),_("accessories")].map(p=>c.jsx("button",{onClick:()=>An(p),className:`px-5 py-3 rounded-xl font-black text-[10px] uppercase tracking-widest transition-all ${Xe===p?"bg-primary-600 text-white shadow-xl shadow-primary-600/30":g?"bg-gray-800 text-gray-400":"bg-gray-50 text-gray-500 shadow-sm border border-gray-100"} hover:scale-[1.02]`,children:p},p))})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("filterByColor")}),c.jsxs("select",{value:Qt,onChange:p=>Yt(p.target.value),className:`w-full p-4 rounded-2xl border-none outline-none focus:ring-2 focus:ring-primary-500 font-bold ${g?"bg-gray-800 text-white":"bg-gray-50"}`,children:[c.jsx("option",{value:"",children:_("all")}),mh.map(p=>c.jsx("option",{value:p,children:p},p))]})]}),c.jsxs("div",{className:"space-y-4",children:[c.jsx("label",{className:"text-[10px] font-black uppercase opacity-40 tracking-widest ml-1 text-inherit",children:_("favorites")}),c.jsxs("button",{onClick:()=>Ce(!se),className:`w-full p-4 rounded-2xl flex items-center justify-between font-bold transition-all border-2 ${se?"border-rose-500 bg-rose-50 text-rose-600 dark:bg-rose-900/20 dark:text-rose-400":`border-transparent ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-50 text-gray-500 hover:bg-gray-100"}`}`,children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx(qh,{size:20,fill:se?"currentColor":"none"}),c.jsx("span",{children:_("onlyFavorites")})]}),se&&c.jsx(Xn,{size:20})]})]})]}),c.jsxs("div",{className:"pt-8 flex gap-4 border-t mt-5 md:mt-8 border-gray-100 dark:border-gray-800",children:[c.jsx("button",{onClick:()=>{An("Todos"),Yt(""),ae("any"),Ce(!1)},className:"flex-1 py-4 font-black uppercase text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("clearAll")}),c.jsx("button",{onClick:()=>Ae(!1),className:"flex-1 py-4 bg-primary-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all",children:_("applyFilters")})]})]})}),da&&c.jsx("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/60 backdrop-blur-sm p-6",onClick:()=>Wi(!1),children:c.jsxs(Ve,{className:"w-full max-w-lg p-5 md:p-8 animate-in zoom-in-95",darkMode:g,onClick:p=>p.stopPropagation(),children:[c.jsx("h3",{className:"text-2xl font-black mb-5 md:mb-8 text-center text-inherit",children:_("appLanguage")}),c.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-4",children:[{id:"PT",flag:"🇵🇹",label:_("portuguese")},{id:"EN",flag:"🇬🇧",label:_("english")},{id:"ES",flag:"🇪🇸",label:_("spanish")},{id:"FR",flag:"🇫🇷",label:_("french")},{id:"DE",flag:"🇩🇪",label:_("german")}].map(p=>c.jsxs("button",{onClick:()=>ch(p.id),className:`p-6 rounded-2xl flex flex-col items-center justify-center gap-4 transition-all ${yt===p.id?"bg-primary-600 text-white shadow-xl shadow-primary-600/30 scale-105":"bg-gray-50 text-gray-600 hover:bg-gray-100 dark:bg-gray-800 dark:text-gray-300 dark:hover:bg-gray-700"}`,children:[c.jsx("span",{className:"text-4xl",children:p.flag}),c.jsx("span",{className:"font-black text-[10px] uppercase tracking-widest text-center",children:p.label})]},p.id))}),c.jsx("button",{onClick:()=>Wi(!1),className:"w-full mt-5 md:mt-8 py-4 uppercase font-black text-[10px] tracking-widest text-gray-500 hover:text-gray-900 dark:hover:text-white transition-colors",children:_("cancel")})]})}),Wn&&ft&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>{Qi(!1),vr(null)},children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-400)))"},children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx(Yy,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("sharedLookTitle")})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:ft.lookName}),c.jsxs("p",{className:"text-white/60 text-sm font-bold mt-1",children:[ft.items.length," peça",ft.items.length!==1?"s":""," • ",_("sharedBy")," ",((Ag=ft.ownerEmail)==null?void 0:Ag.split("@")[0])||_("someone")]})]})]}),c.jsxs("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"}`,children:[c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-4",children:_("includedPieces")}),c.jsx("div",{className:"flex flex-wrap gap-3 mb-5 md:mb-8",children:ft.items.map((p,x)=>c.jsxs("div",{className:"relative group/item",children:[c.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden border-2 border-gray-100 dark:border-gray-700 shadow-lg",children:c.jsx("img",{src:p.imageUrl,alt:p.name,className:"w-full h-full object-cover group-hover/item:scale-110 transition-transform duration-500"})}),c.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 bg-gray-900/90 text-white text-[8px] font-black uppercase tracking-wide px-2 py-0.5 rounded-full whitespace-nowrap opacity-0 group-hover/item:opacity-100 transition-opacity",children:p.name})]},x))}),c.jsx("div",{className:"space-y-2 mb-5 md:mb-8 max-h-32 overflow-y-auto custom-scrollbar",children:ft.items.map((p,x)=>c.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 rounded-xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("span",{className:"text-xs font-black truncate flex-1",children:p.name}),c.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest opacity-40 shrink-0",children:p.category})]},x))}),c.jsxs("div",{className:"flex gap-3",children:[c.jsx("button",{onClick:()=>{Qi(!1),vr(null)},className:`flex-1 py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl transition-all ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:"Ignorar"}),c.jsx("button",{onClick:br,disabled:wa,className:"flex-[2] py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl text-white shadow-xl transition-all hover:scale-[1.02] active:scale-95 disabled:opacity-60 flex items-center justify-center gap-2",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-500)))"},children:wa?c.jsxs(c.Fragment,{children:[c.jsx(Qy,{size:16,className:"animate-spin"})," ",_("copying")]}):c.jsxs(c.Fragment,{children:[c.jsx(Xn,{size:16})," ",_("copyToMyCloset")]})})]})]})]})}),oh&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>Ta(!1),children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6 bg-gradient-to-br from-primary-600 to-primary-400",children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx(qa,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("dailyOutfit")})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:_("today")})]})]}),c.jsx("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"} max-h-[60vh] overflow-y-auto custom-scrollbar`,children:Ia.length>0?c.jsx("div",{className:"space-y-6",children:Ia.map(p=>c.jsxs("div",{className:`p-4 rounded-2xl border-2 border-gray-100 dark:border-gray-800 ${g?"bg-gray-800/50":"bg-gray-50"}`,children:[c.jsxs("div",{className:"flex items-center justify-between mb-4",children:[c.jsx("h4",{className:"font-black text-lg text-inherit",children:p.name}),c.jsxs("span",{className:"text-[10px] font-black uppercase tracking-widest opacity-40",children:[p.items.length," ",_("piecesShort")]})]}),c.jsx("div",{className:"flex -space-x-4 overflow-x-auto custom-scrollbar pb-2",children:p.items.map(x=>{const D=o.find(z=>z.id===x);return D?c.jsx("div",{className:"w-16 h-16 rounded-xl overflow-hidden border-2 border-white dark:border-gray-700 shrink-0 shadow-sm relative group",children:c.jsx("img",{src:D.imageUrl,className:"w-full h-full object-cover",alt:""})},x):null})})]},p.id))}):c.jsxs("div",{className:"py-6 md:py-12 flex flex-col items-center justify-center text-center opacity-50",children:[c.jsx($a,{size:48,className:"mb-4 text-gray-400"}),c.jsx("p",{className:"font-black text-lg text-inherit",children:_("noOutfitPlanned")}),c.jsx("p",{className:"text-xs mt-2 uppercase tracking-widest",children:_("goToPlanning")})]})}),c.jsx("div",{className:`p-4 border-t ${g?"border-gray-800 bg-gray-900":"border-gray-100 bg-gray-50"}`,children:c.jsx("button",{onClick:()=>Ta(!1),className:"w-full py-4 bg-gray-200 dark:bg-gray-800 hover:bg-gray-300 dark:hover:bg-gray-700 text-gray-700 dark:text-gray-300 rounded-2xl font-black uppercase text-[10px] tracking-widest transition-all",children:_("close")})})]})}),an&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>$s(null),children:c.jsxs("div",{className:`w-full max-w-lg rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative p-5 md:p-8 pb-6",style:{background:"linear-gradient(135deg, hsl(var(--primary-600)), hsl(var(--primary-400)))"},children:[c.jsx("div",{className:"absolute inset-0 opacity-20",style:{backgroundImage:"radial-gradient(circle at 80% 20%, white 0%, transparent 60%)"}}),c.jsxs("div",{className:"relative z-10",children:[c.jsxs("div",{className:"flex items-center justify-between mb-2",children:[c.jsxs("div",{className:"flex items-center gap-3",children:[c.jsx("div",{className:"p-2 bg-white/20 rounded-xl backdrop-blur-sm",children:c.jsx(ho,{size:20,className:"text-white"})}),c.jsx("span",{className:"text-white/80 font-black uppercase text-[10px] tracking-widest",children:_("inspectOutfit")||"Inspecionar Outfit"})]}),c.jsx("button",{onClick:()=>$s(null),className:"text-white/80 hover:text-white transition-colors",children:c.jsx(Cr,{size:20})})]}),c.jsx("h2",{className:"text-3xl font-black text-white tracking-tight",children:an.name}),c.jsxs("p",{className:"text-white/60 text-sm font-bold mt-1",children:[((Ng=an.items)==null?void 0:Ng.length)||0," peça",((Pg=an.items)==null?void 0:Pg.length)!==1?"s":""]})]})]}),c.jsxs("div",{className:`p-5 md:p-8 ${g?"bg-gray-900":"bg-white"}`,children:[c.jsx("p",{className:"text-[10px] font-black uppercase tracking-widest opacity-40 mb-4",children:_("includedPieces")||"Peças incluídas"}),c.jsx("div",{className:"flex flex-wrap gap-3 mb-5 md:mb-8",children:(an.items||[]).map((p,x)=>{const D=Xt.find(z=>z.id===p);return D?c.jsxs("div",{className:"relative group/item",children:[c.jsx("div",{className:"w-20 h-20 rounded-2xl overflow-hidden border-2 border-gray-100 dark:border-gray-700 shadow-lg",children:c.jsx("img",{src:D.imageUrl,alt:D.name,className:"w-full h-full object-cover group-hover/item:scale-110 transition-transform duration-500"})}),c.jsx("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 bg-gray-900/90 text-white text-[8px] font-black uppercase tracking-wide px-2 py-0.5 rounded-full whitespace-nowrap opacity-0 group-hover/item:opacity-100 transition-opacity",children:D.name})]},x):null})}),c.jsx("div",{className:"space-y-2 mb-5 md:mb-8 max-h-32 overflow-y-auto custom-scrollbar",children:(an.items||[]).map((p,x)=>{const D=Xt.find(z=>z.id===p);return D?c.jsxs("div",{className:`flex items-center gap-3 px-4 py-2.5 rounded-xl ${g?"bg-gray-800":"bg-gray-50"}`,children:[c.jsx("span",{className:"text-xs font-black truncate flex-1",children:D.name}),c.jsx("span",{className:"text-[9px] font-black uppercase tracking-widest opacity-40 shrink-0",children:D.category})]},x):null})}),c.jsx("button",{onClick:()=>$s(null),className:`w-full py-4 font-black uppercase text-[10px] tracking-widest rounded-2xl transition-all ${g?"bg-gray-800 text-gray-400 hover:bg-gray-700":"bg-gray-100 text-gray-500 hover:bg-gray-200"}`,children:_("close")||"Fechar"})]})]})}),ii&&c.jsx("div",{className:"fixed inset-0 z-[300] flex items-center justify-center bg-black/70 backdrop-blur-md p-6",onClick:()=>yr(null),children:c.jsxs("div",{className:`w-full max-w-sm rounded-3xl md:rounded-[2rem] shadow-2xl overflow-hidden animate-in zoom-in-95 duration-300 ${g?"bg-gray-900":"bg-white"}`,onClick:p=>p.stopPropagation(),children:[c.jsxs("div",{className:"relative aspect-square",children:[c.jsx("img",{src:ii.imageUrl,className:"w-full h-full object-cover",alt:"Item"}),c.jsx("button",{onClick:()=>yr(null),className:"absolute top-4 right-4 p-2 bg-black/50 hover:bg-black/70 rounded-full text-white transition-colors",children:c.jsx(Cr,{size:20})})]}),c.jsxs("div",{className:"p-5 md:p-8 text-center space-y-4",children:[c.jsx("h3",{className:"text-2xl font-black text-inherit",children:ii.name}),c.jsxs("div",{className:"flex items-center justify-center gap-2 opacity-60 font-bold uppercase tracking-widest text-[10px] text-inherit",children:[c.jsx("span",{children:ii.category}),c.jsx("span",{children:"•"}),c.jsx("span",{children:ii.color})]}),c.jsxs("button",{onClick:()=>{Pa(ii),yr(null)},className:"w-full py-4 mt-4 bg-primary-600 text-white rounded-2xl font-black uppercase text-[10px] tracking-widest shadow-xl shadow-primary-600/30 hover:scale-105 transition-all flex items-center justify-center gap-2",children:[c.jsx(za,{size:16})," ",_("copyToMyCloset")||"Copiar para Armário"]})]})]})})]})}"serviceWorker"in navigator&&window.addEventListener("load",()=>{navigator.serviceWorker.register("/firebase-messaging-sw.js").catch(t=>{console.error("Service worker registration failed",t)})});ff.createRoot(document.getElementById("root")).render(c.jsx(zk.StrictMode,{children:c.jsx(RR,{})}));
diff --git a/dist/assets/index-olys378F.css b/dist/assets/index-olys378F.css
deleted file mode 100644
index 0cd8ad6..0000000
--- a/dist/assets/index-olys378F.css
+++ /dev/null
@@ -1 +0,0 @@
-*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--primary-50: 226 100% 97%;--primary-100: 226 100% 94%;--primary-200: 228 98% 87%;--primary-300: 230 94% 78%;--primary-400: 234 89% 68%;--primary-500: 239 84% 61%;--primary-600: 243 75% 59%;--primary-700: 245 58% 51%;--primary-800: 243 57% 42%;--primary-900: 241 54% 35%;--primary-950: 241 54% 20%}.theme-rose{--primary-50: 356 100% 97%;--primary-100: 356 100% 94%;--primary-200: 351 98% 87%;--primary-300: 349 97% 76%;--primary-400: 348 95% 64%;--primary-500: 346 87% 53%;--primary-600: 343 79% 46%;--primary-700: 341 73% 38%;--primary-800: 339 67% 33%;--primary-900: 338 61% 29%;--primary-950: 339 62% 16%}.theme-emerald{--primary-50: 152 81% 96%;--primary-100: 149 80% 90%;--primary-200: 152 76% 80%;--primary-300: 156 73% 67%;--primary-400: 158 64% 52%;--primary-500: 160 84% 39%;--primary-600: 161 94% 30%;--primary-700: 163 94% 24%;--primary-800: 164 86% 21%;--primary-900: 164 80% 18%;--primary-950: 164 85% 10%}.theme-amber{--primary-50: 45 100% 96%;--primary-100: 48 100% 90%;--primary-200: 46 100% 80%;--primary-300: 42 100% 68%;--primary-400: 38 92% 56%;--primary-500: 35 92% 48%;--primary-600: 30 87% 40%;--primary-700: 25 81% 33%;--primary-800: 22 76% 28%;--primary-900: 20 73% 24%;--primary-950: 19 80% 12%}.theme-slate{--primary-50: 210 40% 98%;--primary-100: 210 40% 96%;--primary-200: 214 32% 91%;--primary-300: 213 27% 84%;--primary-400: 215 20% 65%;--primary-500: 215 16% 47%;--primary-600: 215 19% 35%;--primary-700: 215 21% 27%;--primary-800: 215 25% 22%;--primary-900: 215 28% 17%;--primary-950: 215 31% 11%}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{top:0;bottom:0}.-bottom-1{bottom:-.25rem}.-bottom-20{bottom:-5rem}.-right-1{right:-.25rem}.-right-20{right:-5rem}.-top-1{top:-.25rem}.-top-8{top:-2rem}.bottom-2{bottom:.5rem}.bottom-4{bottom:1rem}.bottom-6{bottom:1.5rem}.bottom-8{bottom:2rem}.left-0{left:0}.left-1{left:.25rem}.left-1\/2{left:50%}.left-2{left:.5rem}.left-4{left:1rem}.left-6{left:1.5rem}.left-7{left:1.75rem}.right-1{right:.25rem}.right-2{right:.5rem}.right-3{right:.75rem}.right-4{right:1rem}.right-6{right:1.5rem}.top-1{top:.25rem}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-6{top:1.5rem}.z-10{z-index:10}.z-20{z-index:20}.z-\[100\]{z-index:100}.z-\[200\]{z-index:200}.z-\[300\]{z-index:300}.z-\[90\]{z-index:90}.col-span-2{grid-column:span 2 / span 2}.col-span-full{grid-column:1 / -1}.mx-auto{margin-left:auto;margin-right:auto}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.ml-1{margin-left:.25rem}.ml-2{margin-left:.5rem}.mt-1{margin-top:.25rem}.mt-1\.5{margin-top:.375rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.mt-auto{margin-top:auto}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.aspect-\[3\/4\]{aspect-ratio:3/4}.aspect-square{aspect-ratio:1 / 1}.h-10{height:2.5rem}.h-12{height:3rem}.h-14{height:3.5rem}.h-16{height:4rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-20{height:5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-4{height:1rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-\[180px\]{height:180px}.h-\[320px\]{height:320px}.h-\[480px\]{height:480px}.h-full{height:100%}.h-px{height:1px}.h-screen{height:100vh}.max-h-32{max-height:8rem}.max-h-96{max-height:24rem}.max-h-\[60vh\]{max-height:60vh}.max-h-\[80vh\]{max-height:80vh}.max-h-\[90vh\]{max-height:90vh}.min-h-screen{min-height:100vh}.w-0{width:0px}.w-10{width:2.5rem}.w-12{width:3rem}.w-14{width:3.5rem}.w-16{width:4rem}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-20{width:5rem}.w-24{width:6rem}.w-3{width:.75rem}.w-4{width:1rem}.w-5{width:1.25rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-80{width:20rem}.w-full{width:100%}.min-w-0{min-width:0px}.min-w-\[220px\]{min-width:220px}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[150px\]{max-width:150px}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.flex-\[1\.5\]{flex:1.5}.flex-\[2\]{flex:2}.shrink-0{flex-shrink:0}.origin-top-left{transform-origin:top left}.-translate-x-1\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-x-full{--tw-translate-x: -100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-0{--tw-translate-x: 0px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-105{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-125{--tw-scale-x: 1.25;--tw-scale-y: 1.25;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\[0\.65\]{--tw-scale-x: .65;--tw-scale-y: .65;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.cursor-pointer{cursor:pointer}.resize-none{resize:none}.resize{resize:both}.appearance-none{-webkit-appearance:none;-moz-appearance:none;appearance:none}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.grid-cols-7{grid-template-columns:repeat(7,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-5{gap:1.25rem}.gap-6{gap:1.5rem}.-space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-.5rem * var(--tw-space-x-reverse));margin-left:calc(-.5rem * calc(1 - var(--tw-space-x-reverse)))}.-space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(-1rem * var(--tw-space-x-reverse));margin-left:calc(-1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.25rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:1rem}.rounded-3xl{border-radius:1.5rem}.rounded-\[2\.5rem\]{border-radius:2.5rem}.rounded-\[2rem\]{border-radius:2rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:.5rem}.rounded-md{border-radius:.375rem}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-2{border-width:2px}.border-4{border-width:4px}.border-b{border-bottom-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-dashed{border-style:dashed}.border-none{border-style:none}.border-black\/10{border-color:#0000001a}.border-blue-200{--tw-border-opacity: 1;border-color:rgb(191 219 254 / var(--tw-border-opacity, 1))}.border-blue-400{--tw-border-opacity: 1;border-color:rgb(96 165 250 / var(--tw-border-opacity, 1))}.border-gray-100{--tw-border-opacity: 1;border-color:rgb(243 244 246 / var(--tw-border-opacity, 1))}.border-gray-200{--tw-border-opacity: 1;border-color:rgb(229 231 235 / var(--tw-border-opacity, 1))}.border-gray-200\/50{border-color:#e5e7eb80}.border-gray-700{--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.border-gray-700\/50{border-color:#37415180}.border-gray-800{--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.border-inherit{border-color:inherit}.border-primary-100{--tw-border-opacity: 1;border-color:hsl(var(--primary-100) / var(--tw-border-opacity, 1))}.border-primary-200{--tw-border-opacity: 1;border-color:hsl(var(--primary-200) / var(--tw-border-opacity, 1))}.border-primary-500{--tw-border-opacity: 1;border-color:hsl(var(--primary-500) / var(--tw-border-opacity, 1))}.border-primary-600{--tw-border-opacity: 1;border-color:hsl(var(--primary-600) / var(--tw-border-opacity, 1))}.border-red-100{--tw-border-opacity: 1;border-color:rgb(254 226 226 / var(--tw-border-opacity, 1))}.border-red-200{--tw-border-opacity: 1;border-color:rgb(254 202 202 / var(--tw-border-opacity, 1))}.border-red-50{--tw-border-opacity: 1;border-color:rgb(254 242 242 / var(--tw-border-opacity, 1))}.border-rose-500{--tw-border-opacity: 1;border-color:rgb(244 63 94 / var(--tw-border-opacity, 1))}.border-transparent{border-color:transparent}.border-white{--tw-border-opacity: 1;border-color:rgb(255 255 255 / var(--tw-border-opacity, 1))}.bg-\[\#FDFDFF\]{--tw-bg-opacity: 1;background-color:rgb(253 253 255 / var(--tw-bg-opacity, 1))}.bg-amber-100{--tw-bg-opacity: 1;background-color:rgb(254 243 199 / var(--tw-bg-opacity, 1))}.bg-black\/40{background-color:#0006}.bg-black\/50{background-color:#00000080}.bg-black\/60{background-color:#0009}.bg-black\/70{background-color:#000000b3}.bg-blue-100{--tw-bg-opacity: 1;background-color:rgb(219 234 254 / var(--tw-bg-opacity, 1))}.bg-blue-400{--tw-bg-opacity: 1;background-color:rgb(96 165 250 / var(--tw-bg-opacity, 1))}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity, 1))}.bg-blue-500\/10{background-color:#3b82f61a}.bg-blue-500\/30{background-color:#3b82f64d}.bg-blue-600{--tw-bg-opacity: 1;background-color:rgb(37 99 235 / var(--tw-bg-opacity, 1))}.bg-gray-100{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.bg-gray-50{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.bg-gray-700{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.bg-gray-800{--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.bg-gray-800\/40{background-color:#1f293766}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-800\/60{background-color:#1f293799}.bg-gray-800\/80{background-color:#1f2937cc}.bg-gray-900{--tw-bg-opacity: 1;background-color:rgb(17 24 39 / var(--tw-bg-opacity, 1))}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-900\/90{background-color:#111827e6}.bg-gray-950{--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.bg-gray-950\/50{background-color:#03071280}.bg-green-100{--tw-bg-opacity: 1;background-color:rgb(220 252 231 / var(--tw-bg-opacity, 1))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity, 1))}.bg-indigo-100{--tw-bg-opacity: 1;background-color:rgb(224 231 255 / var(--tw-bg-opacity, 1))}.bg-primary-100{--tw-bg-opacity: 1;background-color:hsl(var(--primary-100) / var(--tw-bg-opacity, 1))}.bg-primary-50{--tw-bg-opacity: 1;background-color:hsl(var(--primary-50) / var(--tw-bg-opacity, 1))}.bg-primary-500{--tw-bg-opacity: 1;background-color:hsl(var(--primary-500) / var(--tw-bg-opacity, 1))}.bg-primary-600{--tw-bg-opacity: 1;background-color:hsl(var(--primary-600) / var(--tw-bg-opacity, 1))}.bg-primary-600\/40{background-color:hsl(var(--primary-600) / .4)}.bg-primary-900\/30{background-color:hsl(var(--primary-900) / .3)}.bg-red-100{--tw-bg-opacity: 1;background-color:rgb(254 226 226 / var(--tw-bg-opacity, 1))}.bg-red-50{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.bg-red-50\/10{background-color:#fef2f21a}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity, 1))}.bg-red-600{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.bg-red-600\/20{background-color:#dc262633}.bg-rose-50{--tw-bg-opacity: 1;background-color:rgb(255 241 242 / var(--tw-bg-opacity, 1))}.bg-rose-500{--tw-bg-opacity: 1;background-color:rgb(244 63 94 / var(--tw-bg-opacity, 1))}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity, 1))}.bg-white\/20{background-color:#fff3}.bg-white\/50{background-color:#ffffff80}.bg-white\/80{background-color:#fffc}.bg-white\/90{background-color:#ffffffe6}.bg-white\/95{background-color:#fffffff2}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity, 1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right,var(--tw-gradient-stops))}.bg-gradient-to-t{background-image:linear-gradient(to top,var(--tw-gradient-stops))}.from-black\/80{--tw-gradient-from: rgb(0 0 0 / .8) var(--tw-gradient-from-position);--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-100{--tw-gradient-from: hsl(var(--primary-100) / 1) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary-100) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.from-primary-600{--tw-gradient-from: hsl(var(--primary-600) / 1) var(--tw-gradient-from-position);--tw-gradient-to: hsl(var(--primary-600) / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.via-black\/20{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), rgb(0 0 0 / .2) var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-transparent{--tw-gradient-to: rgb(0 0 0 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), transparent var(--tw-gradient-via-position), var(--tw-gradient-to)}.via-white{--tw-gradient-to: rgb(255 255 255 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), #fff var(--tw-gradient-via-position), var(--tw-gradient-to)}.to-primary-400{--tw-gradient-to: hsl(var(--primary-400) / 1) var(--tw-gradient-to-position)}.to-purple-50{--tw-gradient-to: #faf5ff var(--tw-gradient-to-position)}.to-transparent{--tw-gradient-to: transparent var(--tw-gradient-to-position)}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-0\.5{padding:.125rem}.p-1{padding:.25rem}.p-1\.5{padding:.375rem}.p-2{padding:.5rem}.p-2\.5{padding:.625rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-5{padding:1.25rem}.p-6{padding:1.5rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-5{padding-left:1.25rem;padding-right:1.25rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.py-0{padding-top:0;padding-bottom:0}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-2\.5{padding-top:.625rem;padding-bottom:.625rem}.py-20{padding-top:5rem;padding-bottom:5rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-5{padding-top:1.25rem;padding-bottom:1.25rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-1{padding-bottom:.25rem}.pb-2{padding-bottom:.5rem}.pb-20{padding-bottom:5rem}.pb-6{padding-bottom:1.5rem}.pb-\[136px\]{padding-bottom:136px}.pb-\[50px\]{padding-bottom:50px}.pb-\[90px\]{padding-bottom:90px}.pl-10{padding-left:2.5rem}.pl-16{padding-left:4rem}.pr-10{padding-right:2.5rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-1{padding-top:.25rem}.pt-10{padding-top:2.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.text-right{text-align:right}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.text-\[8px\]{font-size:8px}.text-\[9px\]{font-size:9px}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-black{font-weight:900}.font-bold{font-weight:700}.font-medium{font-weight:500}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-relaxed{line-height:1.625}.leading-snug{line-height:1.375}.tracking-\[0\.3em\]{letter-spacing:.3em}.tracking-\[0\.5em\]{letter-spacing:.5em}.tracking-tight{letter-spacing:-.025em}.tracking-tighter{letter-spacing:-.05em}.tracking-wide{letter-spacing:.025em}.tracking-widest{letter-spacing:.1em}.text-amber-700{--tw-text-opacity: 1;color:rgb(180 83 9 / var(--tw-text-opacity, 1))}.text-blue-500{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.text-gray-300{--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.text-gray-400{--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.text-gray-500{--tw-text-opacity: 1;color:rgb(107 114 128 / var(--tw-text-opacity, 1))}.text-gray-600{--tw-text-opacity: 1;color:rgb(75 85 99 / var(--tw-text-opacity, 1))}.text-gray-700{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.text-gray-900{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.text-green-400{--tw-text-opacity: 1;color:rgb(74 222 128 / var(--tw-text-opacity, 1))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.text-green-700{--tw-text-opacity: 1;color:rgb(21 128 61 / var(--tw-text-opacity, 1))}.text-indigo-700{--tw-text-opacity: 1;color:rgb(67 56 202 / var(--tw-text-opacity, 1))}.text-inherit{color:inherit}.text-primary-400{--tw-text-opacity: 1;color:hsl(var(--primary-400) / var(--tw-text-opacity, 1))}.text-primary-500{--tw-text-opacity: 1;color:hsl(var(--primary-500) / var(--tw-text-opacity, 1))}.text-primary-600{--tw-text-opacity: 1;color:hsl(var(--primary-600) / var(--tw-text-opacity, 1))}.text-primary-700{--tw-text-opacity: 1;color:hsl(var(--primary-700) / var(--tw-text-opacity, 1))}.text-red-100{--tw-text-opacity: 1;color:rgb(254 226 226 / var(--tw-text-opacity, 1))}.text-red-400{--tw-text-opacity: 1;color:rgb(248 113 113 / var(--tw-text-opacity, 1))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.text-red-600{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.text-red-700{--tw-text-opacity: 1;color:rgb(185 28 28 / var(--tw-text-opacity, 1))}.text-rose-500{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.text-rose-600{--tw-text-opacity: 1;color:rgb(225 29 72 / var(--tw-text-opacity, 1))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.text-white\/60{color:#fff9}.text-white\/80{color:#fffc}.text-white\/90{color:#ffffffe6}.opacity-0{opacity:0}.opacity-10{opacity:.1}.opacity-20{opacity:.2}.opacity-30{opacity:.3}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-75{opacity:.75}.opacity-80{opacity:.8}.shadow-2xl{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-inner{--tw-shadow: inset 0 2px 4px 0 rgb(0 0 0 / .05);--tw-shadow-colored: inset 0 2px 4px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-xl{--tw-shadow: 0 20px 25px -5px rgb(0 0 0 / .1), 0 8px 10px -6px rgb(0 0 0 / .1);--tw-shadow-colored: 0 20px 25px -5px var(--tw-shadow-color), 0 8px 10px -6px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-black\/5{--tw-shadow-color: rgb(0 0 0 / .05);--tw-shadow: var(--tw-shadow-colored)}.shadow-primary-600\/20{--tw-shadow-color: hsl(var(--primary-600) / .2);--tw-shadow: var(--tw-shadow-colored)}.shadow-primary-600\/30{--tw-shadow-color: hsl(var(--primary-600) / .3);--tw-shadow: var(--tw-shadow-colored)}.shadow-primary-600\/40{--tw-shadow-color: hsl(var(--primary-600) / .4);--tw-shadow: var(--tw-shadow-colored)}.outline-none{outline:2px solid transparent;outline-offset:2px}.ring-2{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-primary-500{--tw-ring-opacity: 1;--tw-ring-color: hsl(var(--primary-500) / var(--tw-ring-opacity, 1))}.ring-offset-2{--tw-ring-offset-width: 2px}.ring-offset-white{--tw-ring-offset-color: #fff}.brightness-75{--tw-brightness: brightness(.75);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow{--tw-drop-shadow: drop-shadow(0 1px 2px rgb(0 0 0 / .1)) drop-shadow(0 1px 1px rgb(0 0 0 / .06));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-\[0_0_8px_rgba\(79\,70\,229\,0\.3\)\]{--tw-drop-shadow: drop-shadow(0 0 8px rgba(79,70,229,.3));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.drop-shadow-sm{--tw-drop-shadow: drop-shadow(0 1px 1px rgb(0 0 0 / .05));filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.grayscale{--tw-grayscale: grayscale(100%);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur-2xl{--tw-backdrop-blur: blur(40px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-\[1px\]{--tw-backdrop-blur: blur(1px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-md{--tw-backdrop-blur: blur(12px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-xl{--tw-backdrop-blur: blur(24px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-all{transition-property:all;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-1000{transition-duration:1s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-700{transition-duration:.7s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.custom-scrollbar::-webkit-scrollbar{height:6px;width:6px}.custom-scrollbar::-webkit-scrollbar-track{background:transparent}.custom-scrollbar::-webkit-scrollbar-thumb{background:#9ca3af4d;border-radius:10px}.custom-scrollbar::-webkit-scrollbar-thumb:hover{background:#9ca3af80}@keyframes customZoomIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}.animate-custom-zoom{animation:customZoomIn .3s ease-out forwards}.hover\:-translate-y-2:hover{--tw-translate-y: -.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:translate-x-2:hover{--tw-translate-x: .5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-105:hover{--tw-scale-x: 1.05;--tw-scale-y: 1.05;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-110:hover{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-150:hover{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.01\]:hover{--tw-scale-x: 1.01;--tw-scale-y: 1.01;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:scale-\[1\.02\]:hover{--tw-scale-x: 1.02;--tw-scale-y: 1.02;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.hover\:border-primary-200:hover{--tw-border-opacity: 1;border-color:hsl(var(--primary-200) / var(--tw-border-opacity, 1))}.hover\:border-primary-300:hover{--tw-border-opacity: 1;border-color:hsl(var(--primary-300) / var(--tw-border-opacity, 1))}.hover\:border-primary-400:hover{--tw-border-opacity: 1;border-color:hsl(var(--primary-400) / var(--tw-border-opacity, 1))}.hover\:border-primary-500:hover{--tw-border-opacity: 1;border-color:hsl(var(--primary-500) / var(--tw-border-opacity, 1))}.hover\:border-red-400:hover{--tw-border-opacity: 1;border-color:rgb(248 113 113 / var(--tw-border-opacity, 1))}.hover\:bg-black\/70:hover{background-color:#000000b3}.hover\:bg-blue-700:hover{--tw-bg-opacity: 1;background-color:rgb(29 78 216 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(243 244 246 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(229 231 235 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-300:hover{--tw-bg-opacity: 1;background-color:rgb(209 213 219 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-50:hover{--tw-bg-opacity: 1;background-color:rgb(249 250 251 / var(--tw-bg-opacity, 1))}.hover\:bg-gray-700:hover{--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.hover\:bg-primary-100:hover{--tw-bg-opacity: 1;background-color:hsl(var(--primary-100) / var(--tw-bg-opacity, 1))}.hover\:bg-primary-50:hover{--tw-bg-opacity: 1;background-color:hsl(var(--primary-50) / var(--tw-bg-opacity, 1))}.hover\:bg-primary-500\/5:hover{background-color:hsl(var(--primary-500) / .05)}.hover\:bg-primary-900\/50:hover{background-color:hsl(var(--primary-900) / .5)}.hover\:bg-red-50:hover{--tw-bg-opacity: 1;background-color:rgb(254 242 242 / var(--tw-bg-opacity, 1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-600:hover{--tw-bg-opacity: 1;background-color:rgb(220 38 38 / var(--tw-bg-opacity, 1))}.hover\:bg-red-700:hover{--tw-bg-opacity: 1;background-color:rgb(185 28 28 / var(--tw-bg-opacity, 1))}.hover\:bg-white\/40:hover{background-color:#fff6}.hover\:text-blue-500:hover{--tw-text-opacity: 1;color:rgb(59 130 246 / var(--tw-text-opacity, 1))}.hover\:text-blue-600:hover{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity, 1))}.hover\:text-gray-700:hover{--tw-text-opacity: 1;color:rgb(55 65 81 / var(--tw-text-opacity, 1))}.hover\:text-gray-900:hover{--tw-text-opacity: 1;color:rgb(17 24 39 / var(--tw-text-opacity, 1))}.hover\:text-green-500:hover{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity, 1))}.hover\:text-primary-400:hover{--tw-text-opacity: 1;color:hsl(var(--primary-400) / var(--tw-text-opacity, 1))}.hover\:text-primary-500:hover{--tw-text-opacity: 1;color:hsl(var(--primary-500) / var(--tw-text-opacity, 1))}.hover\:text-primary-600:hover{--tw-text-opacity: 1;color:hsl(var(--primary-600) / var(--tw-text-opacity, 1))}.hover\:text-primary-700:hover{--tw-text-opacity: 1;color:hsl(var(--primary-700) / var(--tw-text-opacity, 1))}.hover\:text-red-500:hover{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity, 1))}.hover\:text-red-600:hover{--tw-text-opacity: 1;color:rgb(220 38 38 / var(--tw-text-opacity, 1))}.hover\:text-rose-500:hover{--tw-text-opacity: 1;color:rgb(244 63 94 / var(--tw-text-opacity, 1))}.hover\:text-white:hover{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:opacity-80:hover{opacity:.8}.hover\:shadow-2xl:hover{--tw-shadow: 0 25px 50px -12px rgb(0 0 0 / .25);--tw-shadow-colored: 0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.hover\:grayscale-0:hover{--tw-grayscale: grayscale(0);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-4:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-indigo-500\/10:focus{--tw-ring-color: rgb(99 102 241 / .1)}.focus\:ring-primary-500:focus{--tw-ring-opacity: 1;--tw-ring-color: hsl(var(--primary-500) / var(--tw-ring-opacity, 1))}.focus\:ring-primary-500\/10:focus{--tw-ring-color: hsl(var(--primary-500) / .1)}.focus\:ring-primary-500\/20:focus{--tw-ring-color: hsl(var(--primary-500) / .2)}.focus\:ring-primary-500\/40:focus{--tw-ring-color: hsl(var(--primary-500) / .4)}.active\:scale-95:active{--tw-scale-x: .95;--tw-scale-y: .95;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.disabled\:opacity-30:disabled{opacity:.3}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:opacity-60:disabled{opacity:.6}.group:hover .group-hover\:-translate-y-2{--tw-translate-y: -.5rem;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group:hover .group-hover\:rotate-6{--tw-rotate: 6deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:hover .group-hover\/item\:scale-110,.group:hover .group-hover\:scale-110{--tw-scale-x: 1.1;--tw-scale-y: 1.1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group\/item:hover .group-hover\/item\:opacity-100,.group\/share:hover .group-hover\/share\:opacity-100,.group:hover .group-hover\:opacity-100{opacity:1}.dark\:border-blue-900\/50:is(.dark *){border-color:#1e3a8a80}.dark\:border-gray-700:is(.dark *){--tw-border-opacity: 1;border-color:rgb(55 65 81 / var(--tw-border-opacity, 1))}.dark\:border-gray-800:is(.dark *){--tw-border-opacity: 1;border-color:rgb(31 41 55 / var(--tw-border-opacity, 1))}.dark\:border-gray-800\/50:is(.dark *){border-color:#1f293780}.dark\:border-primary-800\/40:is(.dark *){border-color:hsl(var(--primary-800) / .4)}.dark\:border-red-900\/50:is(.dark *){border-color:#7f1d1d80}.dark\:bg-amber-900\/30:is(.dark *){background-color:#78350f4d}.dark\:bg-blue-900\/20:is(.dark *){background-color:#1e3a8a33}.dark\:bg-blue-900\/30:is(.dark *){background-color:#1e3a8a4d}.dark\:bg-gray-700:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:bg-gray-800\/50:is(.dark *){background-color:#1f293780}.dark\:bg-gray-900\/95:is(.dark *){background-color:#111827f2}.dark\:bg-gray-950:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(3 7 18 / var(--tw-bg-opacity, 1))}.dark\:bg-green-900\/30:is(.dark *){background-color:#14532d4d}.dark\:bg-indigo-900\/30:is(.dark *){background-color:#312e814d}.dark\:bg-primary-900\/20:is(.dark *){background-color:hsl(var(--primary-900) / .2)}.dark\:bg-primary-900\/40:is(.dark *){background-color:hsl(var(--primary-900) / .4)}.dark\:bg-primary-900\/50:is(.dark *){background-color:hsl(var(--primary-900) / .5)}.dark\:bg-red-900\/30:is(.dark *){background-color:#7f1d1d4d}.dark\:bg-rose-900\/20:is(.dark *){background-color:#88133733}.dark\:from-gray-950:is(.dark *){--tw-gradient-from: #030712 var(--tw-gradient-from-position);--tw-gradient-to: rgb(3 7 18 / 0) var(--tw-gradient-to-position);--tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to)}.dark\:to-gray-900:is(.dark *){--tw-gradient-to: #111827 var(--tw-gradient-to-position)}.dark\:text-amber-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 211 77 / var(--tw-text-opacity, 1))}.dark\:text-gray-200:is(.dark *){--tw-text-opacity: 1;color:rgb(229 231 235 / var(--tw-text-opacity, 1))}.dark\:text-gray-300:is(.dark *){--tw-text-opacity: 1;color:rgb(209 213 219 / var(--tw-text-opacity, 1))}.dark\:text-gray-400:is(.dark *){--tw-text-opacity: 1;color:rgb(156 163 175 / var(--tw-text-opacity, 1))}.dark\:text-green-300:is(.dark *){--tw-text-opacity: 1;color:rgb(134 239 172 / var(--tw-text-opacity, 1))}.dark\:text-indigo-300:is(.dark *){--tw-text-opacity: 1;color:rgb(165 180 252 / var(--tw-text-opacity, 1))}.dark\:text-primary-300:is(.dark *){--tw-text-opacity: 1;color:hsl(var(--primary-300) / var(--tw-text-opacity, 1))}.dark\:text-primary-400:is(.dark *){--tw-text-opacity: 1;color:hsl(var(--primary-400) / var(--tw-text-opacity, 1))}.dark\:text-red-300:is(.dark *){--tw-text-opacity: 1;color:rgb(252 165 165 / var(--tw-text-opacity, 1))}.dark\:text-rose-400:is(.dark *){--tw-text-opacity: 1;color:rgb(251 113 133 / var(--tw-text-opacity, 1))}.dark\:ring-offset-gray-900:is(.dark *){--tw-ring-offset-color: #111827}.dark\:hover\:border-primary-700:hover:is(.dark *){--tw-border-opacity: 1;border-color:hsl(var(--primary-700) / var(--tw-border-opacity, 1))}.dark\:hover\:bg-gray-700:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(55 65 81 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-gray-800:hover:is(.dark *){--tw-bg-opacity: 1;background-color:rgb(31 41 55 / var(--tw-bg-opacity, 1))}.dark\:hover\:bg-primary-900\/20:hover:is(.dark *){background-color:hsl(var(--primary-900) / .2)}.dark\:hover\:bg-primary-900\/40:hover:is(.dark *){background-color:hsl(var(--primary-900) / .4)}.dark\:hover\:bg-red-900\/20:hover:is(.dark *){background-color:#7f1d1d33}.dark\:hover\:text-white:hover:is(.dark *){--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity, 1))}@media (min-width: 640px){.sm\:inline{display:inline}.sm\:flex{display:flex}.sm\:w-auto{width:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-end{justify-content:flex-end}}@media (min-width: 768px){.md\:relative{position:relative}.md\:right-2{right:.5rem}.md\:top-2{top:.5rem}.md\:mb-10{margin-bottom:2.5rem}.md\:mb-16{margin-bottom:4rem}.md\:mb-8{margin-bottom:2rem}.md\:mt-10{margin-top:2.5rem}.md\:mt-12{margin-top:3rem}.md\:mt-8{margin-top:2rem}.md\:hidden{display:none}.md\:h-24{height:6rem}.md\:h-3{height:.75rem}.md\:h-6{height:1.5rem}.md\:h-\[18px\]{height:18px}.md\:w-0{width:0px}.md\:w-3{width:.75rem}.md\:w-6{width:1.5rem}.md\:w-\[18px\]{width:18px}.md\:max-w-none{max-width:none}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.md\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.md\:flex-row{flex-direction:row}.md\:gap-10{gap:2.5rem}.md\:gap-12{gap:3rem}.md\:gap-4{gap:1rem}.md\:gap-6{gap:1.5rem}.md\:gap-8{gap:2rem}.md\:space-y-10>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2.5rem * var(--tw-space-y-reverse))}.md\:space-y-12>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(3rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(3rem * var(--tw-space-y-reverse))}.md\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.md\:rounded-2xl{border-radius:1rem}.md\:rounded-\[2rem\]{border-radius:2rem}.md\:rounded-xl{border-radius:.75rem}.md\:p-10{padding:2.5rem}.md\:p-12{padding:3rem}.md\:p-2{padding:.5rem}.md\:p-3{padding:.75rem}.md\:p-4{padding:1rem}.md\:p-8{padding:2rem}.md\:px-12{padding-left:3rem;padding-right:3rem}.md\:px-8{padding-left:2rem;padding-right:2rem}.md\:py-12{padding-top:3rem;padding-bottom:3rem}.md\:py-16{padding-top:4rem;padding-bottom:4rem}.md\:text-3xl{font-size:1.875rem;line-height:2.25rem}.md\:opacity-0{opacity:0}}@media (min-width: 1024px){.lg\:col-span-1{grid-column:span 1 / span 1}.lg\:col-span-2{grid-column:span 2 / span 2}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.lg\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.lg\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}@media (min-width: 1280px){.xl\:w-auto{width:auto}.xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.xl\:flex-row{flex-direction:row}}@media (min-width: 1536px){.\32xl\:grid-cols-4{grid-template-columns:repeat(4,minmax(0,1fr))}.\32xl\:grid-cols-5{grid-template-columns:repeat(5,minmax(0,1fr))}.\32xl\:grid-cols-6{grid-template-columns:repeat(6,minmax(0,1fr))}}
diff --git a/dist/index.html b/dist/index.html
index 2cbac8e..535d8e4 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -5,8 +5,8 @@
MyCloset
-
-
+
+
diff --git a/fix_i18n.cjs b/fix_i18n.cjs
new file mode 100644
index 0000000..6799559
--- /dev/null
+++ b/fix_i18n.cjs
@@ -0,0 +1,41 @@
+const fs = require('fs');
+let content = fs.readFileSync('src/lib/i18n.js', 'utf8');
+
+// The broken string is like:
+// weatherCurrentAvg: "{current,
+// registeredPieces: "Peças Registadas",
+// ...
+// }°C Atual • Média {avg}°C",
+
+// PT
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "Baixo",\n\}\°C Atual • Média \{avg\}\°C",/g,
+ `weatherCurrentAvg: "{current}°C Atual • Média {avg}°C",\n$1down: "Baixo",`
+);
+
+// EN
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "Down",\n\}\°C Current • Average \{avg\}\°C",/g,
+ `weatherCurrentAvg: "{current}°C Current • Average {avg}°C",\n$1down: "Down",`
+);
+
+// ES
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "Abajo",\n\}\°C Actual • Media \{avg\}\°C",/g,
+ `weatherCurrentAvg: "{current}°C Actual • Media {avg}°C",\n$1down: "Abajo",`
+);
+
+// FR
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "Bas",\n\}\°C Actuel • Moyenne \{avg\}\°C",/g,
+ `weatherCurrentAvg: "{current}°C Actuel • Moyenne {avg}°C",\n$1down: "Bas",`
+);
+
+// DE
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "Runter",\n\}\°C Aktuell • Durchschnitt \{avg\}\°C",/g,
+ `weatherCurrentAvg: "{current}°C Aktuell • Durchschnitt {avg}°C",\n$1down: "Runter",`
+);
+
+fs.writeFileSync('src/lib/i18n.js', content);
+console.log('Fixed i18n.js syntax errors.');
diff --git a/fix_i18n_all.cjs b/fix_i18n_all.cjs
new file mode 100644
index 0000000..2c84652
--- /dev/null
+++ b/fix_i18n_all.cjs
@@ -0,0 +1,10 @@
+const fs = require('fs');
+let content = fs.readFileSync('src/lib/i18n.js', 'utf8');
+
+content = content.replace(
+ /weatherCurrentAvg: "\{current,([\s\S]*?)down: "([^"]+)",\n\}\°C ([^•]+) • ([^\{]+) \{avg\}\°C",/g,
+ 'weatherCurrentAvg: "{current}°C $3 • $4 {avg}°C",\n$1down: "$2",'
+);
+
+fs.writeFileSync('src/lib/i18n.js', content);
+console.log('Fixed i18n.js syntax errors dynamically.');
diff --git a/src/App.jsx b/src/App.jsx
index 25c938f..28d8e8c 100644
--- a/src/App.jsx
+++ b/src/App.jsx
@@ -69,6 +69,7 @@ export default function App() {
const [defaultPage, setDefaultPage] = useState('dashboard');
const [weatherData, setWeatherData] = useState(null);
const [isPrivate, setIsPrivate] = useState(false);
+ const [shortcutsEnabled, setShortcutsEnabled] = useState(false);
const [userStatus, setUserStatus] = useState('online');
// Estado da Comunidade
@@ -228,6 +229,26 @@ export default function App() {
saveUserSetting('isPrivate', newVal);
};
+ const handleShortcutsToggle = (newVal) => {
+ setShortcutsEnabled(newVal);
+ saveUserSetting('shortcutsEnabled', newVal);
+ };
+
+ const handleNavShortcut = (direction) => {
+ const navItems = ['dashboard', 'closet', 'wishlist', 'laundry', 'outfits', 'planner', 'community', 'settings'];
+ const currentIndex = navItems.indexOf(view);
+ if (currentIndex === -1) return;
+
+ let nextIndex;
+ if (direction === 'up') {
+ nextIndex = currentIndex === 0 ? navItems.length - 1 : currentIndex - 1;
+ } else {
+ nextIndex = currentIndex === navItems.length - 1 ? 0 : currentIndex + 1;
+ }
+ setView(navItems[nextIndex]);
+ if (window.innerWidth < 768) setSidebarOpen(false);
+ };
+
const toggleStatus = (e) => {
e.stopPropagation();
e.preventDefault();
@@ -272,6 +293,23 @@ export default function App() {
}
};
+ useEffect(() => {
+ if (!shortcutsEnabled) return;
+
+ const handleKeyDown = (e) => {
+ if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA') return;
+
+ if (e.key.toLowerCase() === 'q') {
+ handleNavShortcut('up');
+ } else if (e.key.toLowerCase() === 'e') {
+ handleNavShortcut('down');
+ }
+ };
+
+ window.addEventListener('keydown', handleKeyDown);
+ return () => window.removeEventListener('keydown', handleKeyDown);
+ }, [shortcutsEnabled, view]);
+
useEffect(() => {
if (editingItem && editingItem.color) {
setItemColors(editingItem.color.split(',').map(c => c.trim()).filter(Boolean));
@@ -415,6 +453,7 @@ export default function App() {
setDefaultPage(data.settings.defaultPage === 'planning' ? 'planner' : data.settings.defaultPage);
}
if (data.settings.isPrivate !== undefined) setIsPrivate(data.settings.isPrivate);
+ if (data.settings.shortcutsEnabled !== undefined) setShortcutsEnabled(data.settings.shortcutsEnabled);
if (data.settings.status !== undefined) setUserStatus(data.settings.status);
}
}
@@ -1435,6 +1474,11 @@ export default function App() {
MyCloset
+ {shortcutsEnabled && (
+
+ )}
+ {shortcutsEnabled && (
+
+ )}
setView('profile')} className="w-full flex items-center gap-4 mb-5 md:mb-8 px-2 text-left hover:bg-gray-100 dark:hover:bg-gray-800 py-3 rounded-2xl transition-all cursor-pointer">
@@ -2539,29 +2588,29 @@ export default function App() {
-
Data de Nascimento
+
{t('dob')}
{selectedUserProfile?.dob ? new Date(selectedUserProfile.dob).toLocaleDateString() : 'Não especificada'}
-
Localidade
+
{t('location')}
{selectedUserProfile?.location || selectedCommunityUser.location || 'Não especificada'}
-
Bio
+
{t('bio')}
{selectedUserProfile?.bio || 'Sem biografia'}
-
Peças Registadas
+
{t('registeredPieces')}
{selectedUserClothes.length}
-
Outfits Criados
+
{t('createdOutfits')}
{selectedUserLooks.length}
-
Data de Registo da Conta
+
{t('accountRegistrationDate')}
{selectedUserProfile?.createdAt ? new Date(selectedUserProfile.createdAt).toLocaleDateString() : 'Desconhecida'}
@@ -2676,10 +2725,21 @@ export default function App() {
+
+
+
+
{t('keyboardShortcuts')}
+
{t('enableNavigationQE')}
+
+
+
+
-
Notificação do Outfit Diário
-
Receber notificação com o outfit planeado à hora marcada
+
{t('dailyOutfitNotification')}
+
{t('receiveNotificationAtScheduledTime')}
{dailyOutfitNotifEnabled && (
diff --git a/src/lib/i18n.js b/src/lib/i18n.js
index 0e6fa55..9b03040 100644
--- a/src/lib/i18n.js
+++ b/src/lib/i18n.js
@@ -35,6 +35,16 @@ export const translations = {
todayIn: "Hoje em Portugal",
weatherUpdate: "22°C - Ensolarado",
weatherCurrentAvg: "{current}°C Atual • Média {avg}°C",
+
+ registeredPieces: "Peças Registadas",
+ createdOutfits: "Outfits Criados",
+ accountRegistrationDate: "Data de Registo da Conta",
+ keyboardShortcuts: "Atalhos de Teclado",
+ enableNavigationQE: "Ativar navegação com Q e E",
+ dailyOutfitNotification: "Notificação do Outfit Diário",
+ receiveNotificationAtScheduledTime: "Receber notificação com o outfit planeado à hora marcada",
+ up: "Cima",
+ down: "Baixo",
weatherForecastDesc: "O dia de hoje tem máximas de {max}°C e mínimas de {min}°C.",
weatherMsg: "Está um dia fantástico! Recomendamos as tuas peças leves. Que tal um visual casual com as tuas sapatilhas favoritas?",
exploreSuggestions: "Explorar Sugestões",
@@ -252,6 +262,16 @@ export const translations = {
todayIn: "Today in Portugal",
weatherUpdate: "22°C - Sunny",
weatherCurrentAvg: "{current}°C Current • Average {avg}°C",
+
+ registeredPieces: "Registered Pieces",
+ createdOutfits: "Created Outfits",
+ accountRegistrationDate: "Account Registration Date",
+ keyboardShortcuts: "Keyboard Shortcuts",
+ enableNavigationQE: "Enable navigation with Q and E",
+ dailyOutfitNotification: "Daily Outfit Notification",
+ receiveNotificationAtScheduledTime: "Receive notification with the planned outfit at the scheduled time",
+ up: "Up",
+ down: "Down",
weatherForecastDesc: "Today has highs of {max}°C and lows of {min}°C.",
weatherMsg: "It's a fantastic day! We recommend your light pieces. How about a casual look with your favorite sneakers?",
exploreSuggestions: "Explore Suggestions",
@@ -469,6 +489,16 @@ export const translations = {
todayIn: "Hoy en Portugal",
weatherUpdate: "22°C - Soleado",
weatherCurrentAvg: "{current}°C Actual • Media {avg}°C",
+
+ registeredPieces: "Piezas Registradas",
+ createdOutfits: "Outfits Creados",
+ accountRegistrationDate: "Fecha de Registro de la Cuenta",
+ keyboardShortcuts: "Atajos de Teclado",
+ enableNavigationQE: "Habilitar navegación con Q y E",
+ dailyOutfitNotification: "Notificación del Outfit Diario",
+ receiveNotificationAtScheduledTime: "Recibir notificación con el outfit planeado a la hora programada",
+ up: "Arriba",
+ down: "Abajo",
weatherForecastDesc: "El día de hoy tiene máximas de {max}°C y mínimas de {min}°C.",
weatherMsg: "¡Es un día fantástico! Recomendamos tus piezas ligeras. ¿Qué tal un look casual con tus zapatillas favoritas?",
exploreSuggestions: "Explorar Sugerencias",
@@ -686,6 +716,16 @@ export const translations = {
todayIn: "Aujourd'hui au Portugal",
weatherUpdate: "22°C - Ensoleillé",
weatherCurrentAvg: "{current}°C Actuel • Moyenne {avg}°C",
+
+ registeredPieces: "Pièces Enregistrées",
+ createdOutfits: "Outfits Créés",
+ accountRegistrationDate: "Date d'Inscription du Compte",
+ keyboardShortcuts: "Raccourcis Clavier",
+ enableNavigationQE: "Activer la navigation avec Q et E",
+ dailyOutfitNotification: "Notification de Tenue Quotidienne",
+ receiveNotificationAtScheduledTime: "Recevoir une notification avec la tenue prévue à l'heure programmée",
+ up: "Haut",
+ down: "Bas",
weatherForecastDesc: "Aujourd'hui a des maximales de {max}°C et des minimales de {min}°C.",
weatherMsg: "C'est une journée fantastique ! Nous recommandons vos pièces légères. Que diriez-vous d'un look décontracté avec vos baskets préférées ?",
exploreSuggestions: "Explorer les Suggestions",
@@ -903,6 +943,16 @@ export const translations = {
todayIn: "Heute in Portugal",
weatherUpdate: "22°C - Sonnig",
weatherCurrentAvg: "{current}°C Aktuell • Durchschnitt {avg}°C",
+
+ registeredPieces: "Registrierte Stücke",
+ createdOutfits: "Erstellte Outfits",
+ accountRegistrationDate: "Konto-Registrierungsdatum",
+ keyboardShortcuts: "Tastenkombinationen",
+ enableNavigationQE: "Navigation mit Q und E aktivieren",
+ dailyOutfitNotification: "Tägliche Outfit-Benachrichtigung",
+ receiveNotificationAtScheduledTime: "Benachrichtigung mit dem geplanten Outfit zur geplanten Zeit erhalten",
+ up: "Oben",
+ down: "Unten",
weatherForecastDesc: "Der heutige Tag hat Höchstwerte von {max}°C und Tiefstwerte von {min}°C.",
weatherMsg: "Es ist ein fantastischer Tag! Wir empfehlen leichte Stücke. Wie wäre es mit einem lässigen Look mit deinen Lieblings-Sneakern?",
exploreSuggestions: "Vorschläge entdecken",
diff --git a/translate_app.cjs b/translate_app.cjs
new file mode 100644
index 0000000..2620daa
--- /dev/null
+++ b/translate_app.cjs
@@ -0,0 +1,107 @@
+const fs = require('fs');
+
+// 1. Update i18n.js
+let i18nCode = fs.readFileSync('src/lib/i18n.js', 'utf8');
+
+const newTranslations = {
+ PT: {
+ registeredPieces: "Peças Registadas",
+ createdOutfits: "Outfits Criados",
+ accountRegistrationDate: "Data de Registo da Conta",
+ keyboardShortcuts: "Atalhos de Teclado",
+ enableNavigationQE: "Ativar navegação com Q e E",
+ dailyOutfitNotification: "Notificação do Outfit Diário",
+ receiveNotificationAtScheduledTime: "Receber notificação com o outfit planeado à hora marcada",
+ up: "Cima",
+ down: "Baixo"
+ },
+ EN: {
+ registeredPieces: "Registered Pieces",
+ createdOutfits: "Created Outfits",
+ accountRegistrationDate: "Account Registration Date",
+ keyboardShortcuts: "Keyboard Shortcuts",
+ enableNavigationQE: "Enable navigation with Q and E",
+ dailyOutfitNotification: "Daily Outfit Notification",
+ receiveNotificationAtScheduledTime: "Receive notification with the planned outfit at the scheduled time",
+ up: "Up",
+ down: "Down"
+ },
+ ES: {
+ registeredPieces: "Piezas Registradas",
+ createdOutfits: "Outfits Creados",
+ accountRegistrationDate: "Fecha de Registro de la Cuenta",
+ keyboardShortcuts: "Atajos de Teclado",
+ enableNavigationQE: "Habilitar navegación con Q y E",
+ dailyOutfitNotification: "Notificación del Outfit Diario",
+ receiveNotificationAtScheduledTime: "Recibir notificación con el outfit planeado a la hora programada",
+ up: "Arriba",
+ down: "Abajo"
+ },
+ FR: {
+ registeredPieces: "Pièces Enregistrées",
+ createdOutfits: "Outfits Créés",
+ accountRegistrationDate: "Date d'Inscription du Compte",
+ keyboardShortcuts: "Raccourcis Clavier",
+ enableNavigationQE: "Activer la navigation avec Q et E",
+ dailyOutfitNotification: "Notification de Tenue Quotidienne",
+ receiveNotificationAtScheduledTime: "Recevoir une notification avec la tenue prévue à l'heure programmée",
+ up: "Haut",
+ down: "Bas"
+ },
+ DE: {
+ registeredPieces: "Registrierte Stücke",
+ createdOutfits: "Erstellte Outfits",
+ accountRegistrationDate: "Konto-Registrierungsdatum",
+ keyboardShortcuts: "Tastenkombinationen",
+ enableNavigationQE: "Navigation mit Q und E aktivieren",
+ dailyOutfitNotification: "Tägliche Outfit-Benachrichtigung",
+ receiveNotificationAtScheduledTime: "Benachrichtigung mit dem geplanten Outfit zur geplanten Zeit erhalten",
+ up: "Oben",
+ down: "Unten"
+ }
+};
+
+for (const lang in newTranslations) {
+ const keys = newTranslations[lang];
+ const langRegex = new RegExp(`${lang}: \\{([\\s\\S]*?)\\}`, 'g');
+ let match = langRegex.exec(i18nCode);
+ if (match) {
+ let currentKeys = match[1];
+ let newKeysString = "";
+ for (const [k, v] of Object.entries(keys)) {
+ if (!currentKeys.includes(`${k}:`)) {
+ newKeysString += ` ${k}: "${v}",\n`;
+ }
+ }
+ if (newKeysString.length > 0) {
+ i18nCode = i18nCode.replace(currentKeys, currentKeys.trimEnd() + ",\n" + newKeysString);
+ }
+ }
+}
+fs.writeFileSync('src/lib/i18n.js', i18nCode);
+
+// 2. Update App.jsx
+let appCode = fs.readFileSync('src/App.jsx', 'utf8');
+
+const replacements = [
+ { from: />Data de Nascimento{t(\'dob\')}<' },
+ { from: />Localidade{t(\'location\')}<' },
+ { from: />Bio{t(\'bio\')}<' },
+ { from: />Peças Registadas{t(\'registeredPieces\')}<' },
+ { from: />Outfits Criados{t(\'createdOutfits\')}<' },
+ { from: />Data de Registo da Conta{t(\'accountRegistrationDate\')}<' },
+ { from: />Atalhos de Teclado{t(\'keyboardShortcuts\')}<' },
+ { from: />Ativar navegação com Q e E{t(\'enableNavigationQE\')}<' },
+ { from: />Notificação do Outfit Diário{t(\'dailyOutfitNotification\')}<' },
+ { from: />Receber notificação com o outfit planeado à hora marcada{t(\'receiveNotificationAtScheduledTime\')}<' },
+ { from: />Cima{t(\'up\')}<' },
+ { from: />Baixo{t(\'down\')}<' }
+];
+
+replacements.forEach(r => {
+ appCode = appCode.replace(r.from, r.to);
+});
+
+fs.writeFileSync('src/App.jsx', appCode);
+
+console.log('App successfully translated and i18n updated.');