1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{35:e=>{e.exports=function(e,t,n,r){var i=n?n.call(r,e,t):void 0;if(void 0!==i)return!!i;if(e===t)return!0;if("object"!=typeof e||!e||"object"!=typeof t||!t)return!1;var s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(var a=Object.prototype.hasOwnProperty.bind(t),l=0;l<s.length;l++){var u=s[l];if(!a(u))return!1;var h=e[u],c=t[u];if(!1===(i=n?n.call(r,h,c,u):void 0)||void 0===i&&h!==c)return!1}return!0}},84:(e,t,n)=>{e.exports=n(3152)()},157:(e,t,n)=>{"use strict";n.d(t,{Q$:()=>r,XO:()=>o,XQ:()=>a,cm:()=>i,qG:()=>s});let r={hidden:{opacity:0,y:50},visible:{opacity:1,y:0,transition:{type:"spring",stiffness:300,damping:24}}},i={hidden:{opacity:0},visible:{opacity:1,transition:{delay:.2,duration:.8,when:"beforeChildren",staggerChildren:.3}}},s={hidden:{opacity:0,y:20},visible:{opacity:1,y:0},exit:{opacity:0,y:-20}},o={hidden:{opacity:0,height:0},visible:{opacity:1,height:"auto",transition:{duration:.3}}},a={hidden:{x:-30,opacity:0},visible:{x:0,opacity:1,transition:{type:"spring",stiffness:100,damping:12}},exit:{x:30,opacity:0}}},179:(e,t,n)=>{"use strict";n.d(t,{B:()=>l});var r=n(2318),i=n(7610),s=n(1786),o=n(3511);let a={...i.ai,transform:e=>Math.round((0,r.q)(0,255,e))},l={test:(0,o.$)("rgb","red"),parse:(0,o.q)("red","green","blue"),transform:({red:e,green:t,blue:n,alpha:r=1})=>"rgba("+a.transform(e)+", "+a.transform(t)+", "+a.transform(n)+", "+(0,s.a)(i.X4.transform(r))+")"}},266:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return function e(t){if((0,i.isNextRouterError)(t)||(0,r.isBailoutToCSRError)(t))throw t;t instanceof Error&&"cause"in t&&e(t.cause)}}});let r=n(7833),i=n(4045);("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},315:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});let r=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu},488:(e,t,n)=>{"use strict";n.d(t,{X:()=>i,f:()=>r});let r=e=>1e3*e,i=e=>e/1e3},492:(e,t,n)=>{"use strict";n.d(t,{$:()=>r});let r=e=>/^0[^.\s]+$/u.test(e)},771:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return l.ReadonlyURLSearchParams},RedirectType:function(){return l.RedirectType},ServerInsertedHTMLContext:function(){return u.ServerInsertedHTMLContext},forbidden:function(){return l.forbidden},notFound:function(){return l.notFound},permanentRedirect:function(){return l.permanentRedirect},redirect:function(){return l.redirect},unauthorized:function(){return l.unauthorized},unstable_isUnrecognizedActionError:function(){return h.unstable_isUnrecognizedActionError},unstable_rethrow:function(){return l.unstable_rethrow},useParams:function(){return m},usePathname:function(){return f},useRouter:function(){return p},useSearchParams:function(){return d},useSelectedLayoutSegment:function(){return y},useSelectedLayoutSegments:function(){return g},useServerInsertedHTML:function(){return u.useServerInsertedHTML}});let r=n(1462),i=n(2732),s=n(6617),o=n(7221),a=n(3820),l=n(7155),u=n(6427),h=n(3573),c=void 0;function d(){let e=(0,r.useContext)(s.SearchParamsContext);return(0,r.useMemo)(()=>e?new l.ReadonlyURLSearchParams(e):null,[e])}function f(){return null==c||c("usePathname()"),(0,r.useContext)(s.PathnameContext)}function p(){let e=(0,r.useContext)(i.AppRouterContext);if(null===e)throw Object.defineProperty(Error("invariant expected app router to be mounted"),"__NEXT_ERROR_CODE",{value:"E238",enumerable:!1,configurable:!0});return e}function m(){return null==c||c("useParams()"),(0,r.useContext)(s.PathParamsContext)}function g(e){void 0===e&&(e="children"),null==c||c("useSelectedLayoutSegments()");let t=(0,r.useContext)(i.LayoutRouterContext);return t?function e(t,n,r,i){let s;if(void 0===r&&(r=!0),void 0===i&&(i=[]),r)s=t[1][n];else{var l;let e=t[1];s=null!=(l=e.children)?l:Object.values(e)[0]}if(!s)return i;let u=s[0],h=(0,o.getSegmentValue)(u);return!h||h.startsWith(a.PAGE_SEGMENT_KEY)?i:(i.push(h),e(s,n,!1,i))}(t.parentTree,e):null}function y(e){void 0===e&&(e="children"),null==c||c("useSelectedLayoutSegment()");let t=g(e);
1if(!t||0===t.length)return null;let n="children"===e?t[0]:t[t.length-1];return n===a.DEFAULT_SEGMENT_KEY?null:n}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},867:(e,t,n)=>{"use strict";n.d(t,{V:()=>r});let r=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2},1016:(e,t,n)=>{e.exports=n(6397)},1132:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImgProps",{enumerable:!0,get:function(){return l}}),n(5509);let r=n(5881),i=n(3453),s=["-moz-initial","fill","none","scale-down",void 0];function o(e){return void 0!==e.default}function a(e){return void 0===e?e:"number"==typeof e?Number.isFinite(e)?e:NaN:"string"==typeof e&&/^[0-9]+$/.test(e)?parseInt(e,10):NaN}function l(e,t){var n,l;let u,h,c,{src:d,sizes:f,unoptimized:p=!1,priority:m=!1,loading:g,className:y,quality:v,width:_,height:w,fill:b=!1,style:E,overrideSrc:T,onLoad:S,onLoadingComplete:C,placeholder:I="empty",blurDataURL:x,fetchPriority:A,decoding:k="async",layout:R,objectFit:P,objectPosition:N,lazyBoundary:O,lazyRoot:D,...L}=e,{imgConf:M,showAltText:j,blurComplete:F,defaultLoader:U}=t,V=M||i.imageConfigDefault;if("allSizes"in V)u=V;else{let e=[...V.deviceSizes,...V.imageSizes].sort((e,t)=>e-t),t=V.deviceSizes.sort((e,t)=>e-t),r=null==(n=V.qualities)?void 0:n.sort((e,t)=>e-t);u={...V,allSizes:e,deviceSizes:t,qualities:r}}if(void 0===U)throw Object.defineProperty(Error("images.loaderFile detected but the file is missing default export.\nRead more: https://nextjs.org/docs/messages/invalid-images-config"),"__NEXT_ERROR_CODE",{value:"E163",enumerable:!1,configurable:!0});let B=L.loader||U;delete L.loader,delete L.srcSet;let q="__next_img_default"in B;if(q){if("custom"===u.loader)throw Object.defineProperty(Error('Image with src "'+d+'" is missing "loader" prop.\nRead more: https://nextjs.org/docs/messages/next-image-missing-loader'),"__NEXT_ERROR_CODE",{value:"E252",enumerable:!1,configurable:!0})}else{let e=B;B=t=>{let{config:n,...r}=t;return e(r)}}if(R){"fill"===R&&(b=!0);let e={intrinsic:{maxWidth:"100%",height:"auto"},responsive:{width:"100%",height:"auto"}}[R];e&&(E={...E,...e});let t={responsive:"100vw",fill:"100vw"}[R];t&&!f&&(f=t)}let $="",z=a(_),W=a(w);if((l=d)&&"object"==typeof l&&(o(l)||void 0!==l.src)){let e=o(d)?d.default:d;if(!e.src)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include src. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E460",enumerable:!1,configurable:!0});if(!e.height||!e.width)throw Object.defineProperty(Error("An object should only be passed to the image component src parameter if it comes from a static image import. It must include height and width. Received "+JSON.stringify(e)),"__NEXT_ERROR_CODE",{value:"E48",enumerable:!1,configurable:!0});if(h=e.blurWidth,c=e.blurHeight,x=x||e.blurDataURL,$=e.src,!b)if(z||W){if(z&&!W){let t=z/e.width;W=Math.round(e.height*t)}else if(!z&&W){let t=W/e.height;z=Math.round(e.width*t)}}else z=e.width,W=e.height}let H=!m&&("lazy"===g||void 0===g);(!(d="string"==typeof d?d:$)||d.startsWith("data:")||d.startsWith("blob:"))&&(p=!0,H=!1),u.unoptimized&&(p=!0),q&&!u.dangerouslyAllowSVG&&d.split("?",1)[0].endsWith(".svg")&&(p=!0);let G=a(v),K=Object.assign(b?{position:"absolute",height:"100%",width:"100%",left:0,top:0,right:0,bottom:0,objectFit:P,objectPosition:N}:{},j?{}:{color:"transparent"},E),Y=F||"empty"===I?null:"blur"===I?'url("data:image/svg+xml;charset=utf-8,'+(0,r.getImageBlurSvg)({widthInt:z,heightInt:W,blurWidth:h,blurHeight:c,blurDataURL:x||"",objectFit:K.objectFit})+'")':'url("'+I+'")',Q=s.includes(K.objectFit)?"fill"===K.objectFit?"100% 100%":"cover":K.objectFit,X=Y?{backgroundSize:Q,backgroundPosition:K.objectPosition||"50% 50%",backgroundRepeat:"no-repeat",backgroundImage:Y}:{},J=function(e){let{config:t,src:n,unoptimized:r,width:i,quality:s,sizes:o,loader:a}=e;if(r)return{src:n,srcSet:void 0,sizes:void 0};let{widths:l,kind:u}=function(e,t,n){let{deviceSizes:r,allSizes:i}=e;if(n){let e=/(^|\s)(1?\d?\d)vw/g,t=[];for(let r;r=e.exec(n);)t.push(parseInt(r[2]));if(t.length){let e=.01*Math.min(...t);return{widths:i.filter(t=>t>=r[0]*e),kind:"w"}}return{widths:i,kind:"w"}}return"number"!=typeof t?{widths:r,kind:"w"}:{widths:[...new Set([t,2*t].map(e=>i.find(t=>t>=e)||i[i.length-1]))],kind:"x"}}(t,i,o),h=l.length-1;return{sizes:o||"w"!==u?o:"100vw",srcSet:l.map((e,r)=>a({config:t,src:n,quality:s,width:e})+" "+("w"===u?e:r+1)+u).join(", "),src:a({config:t,src:n,quality:s,width:l[h]})}}({config:u,src:d,unoptimized:p,width:z,quality:G,sizes:f,loader:B});return{props:{...L,loading:H?"lazy":g,fetchPriority:A,width:z,height:W,decoding:k,className:y,style:{...K,...X},sizes:J.sizes,srcSet:J.srcSet,src:T||J.src},meta:{unoptimized:p,priority:m,placeholder:I,fill:b}}}},1140:(e,t,n)=>{"use strict";n.d(t,{E4:()=>
1o,Hr:()=>d,W9:()=>c});var r=n(7610),i=n(6811),s=n(5615);let o=e=>e===r.ai||e===i.px,a=(e,t)=>parseFloat(e.split(", ")[t]),l=(e,t)=>(n,{transform:r})=>{if("none"===r||!r)return 0;let i=r.match(/^matrix3d\((.+)\)$/u);if(i)return a(i[1],t);{let t=r.match(/^matrix\((.+)\)$/u);return t?a(t[1],e):0}},u=new Set(["x","y","z"]),h=s.U.filter(e=>!u.has(e));function c(e){let t=[];return h.forEach(n=>{let r=e.getValue(n);void 0!==r&&(t.push([n,r.get()]),r.set(+!!n.startsWith("scale")))}),t}let d={width:({x:e},{paddingLeft:t="0",paddingRight:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),height:({y:e},{paddingTop:t="0",paddingBottom:n="0"})=>e.max-e.min-parseFloat(t)-parseFloat(n),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:l(4,13),y:l(5,14)};d.translateX=d.x,d.translateY=d.y},1374:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useIntersection",{enumerable:!0,get:function(){return l}});let r=n(1462),i=n(8845),s="function"==typeof IntersectionObserver,o=new Map,a=[];function l(e){let{rootRef:t,rootMargin:n,disabled:l}=e,u=l||!s,[h,c]=(0,r.useState)(!1),d=(0,r.useRef)(null),f=(0,r.useCallback)(e=>{d.current=e},[]);return(0,r.useEffect)(()=>{if(s){if(u||h)return;let e=d.current;if(e&&e.tagName)return function(e,t,n){let{id:r,observer:i,elements:s}=function(e){let t,n={root:e.root||null,margin:e.rootMargin||""},r=a.find(e=>e.root===n.root&&e.margin===n.margin);if(r&&(t=o.get(r)))return t;let i=new Map;return t={id:n,observer:new IntersectionObserver(e=>{e.forEach(e=>{let t=i.get(e.target),n=e.isIntersecting||e.intersectionRatio>0;t&&n&&t(n)})},e),elements:i},a.push(n),o.set(n,t),t}(n);return s.set(e,t),i.observe(e),function(){if(s.delete(e),i.unobserve(e),0===s.size){i.disconnect(),o.delete(r);let e=a.findIndex(e=>e.root===r.root&&e.margin===r.margin);e>-1&&a.splice(e,1)}}}(e,e=>e&&c(e),{root:null==t?void 0:t.current,rootMargin:n})}else if(!h){let e=(0,i.requestIdleCallback)(()=>c(!0));return()=>(0,i.cancelIdleCallback)(e)}},[u,n,t,h,d.current]),[f,h,(0,r.useCallback)(()=>{c(!1)},[])]}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},1389:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});let r=(0,n(1462).createContext)(null)},1457:(e,t,n)=>{"use strict";n.d(t,{D:()=>o});var r=n(9033),i=n(3200);let s={...n(8753).W,color:r.y,backgroundColor:r.y,outlineColor:r.y,fill:r.y,stroke:r.y,borderColor:r.y,borderTopColor:r.y,borderRightColor:r.y,borderBottomColor:r.y,borderLeftColor:r.y,filter:i.p,WebkitFilter:i.p},o=e=>s[e]},1642:(e,t,n)=>{"use strict";n.d(t,{Hb:()=>d,RI:()=>u,Xs:()=>f,jG:()=>c,vR:()=>h});var r=n(3798),i=n(1462),s=n(6245),o=n.n(s),a=n(5836);let l=(e,t)=>{let n=(0,i.memo)(t=>{let{className:n="w-6 h-6",role:i="img",focusable:s=!1,"aria-hidden":l=!0,alt:u="",...h}=t;return(0,r.jsx)(o(),{src:e||(0,a.O)(e),className:n,width:24,height:24,role:i,"aria-hidden":l,focusable:s.toString(),alt:u,...h})});return n.displayName=t,n},u=l("/Arcade/games/Icons/AlertCircle.svg","AlertCircle");l("/Arcade/games/Icons/HelpCircle.svg","HelpCircle");let h=l("/Arcade/games/Icons/Pause.svg","Pause"),c=l("/Arcade/games/Icons/Play.svg","Play");l("/Arcade/games/Icons/Rocket.svg","Rocket");let d=l("/Arcade/games/Icons/RotateCcw.svg","RotateCcw"),f=l("/Arcade/games/Icons/Trophy.svg","Trophy");l("/assets/games/Snake/Mouse.svg","Mouse"),l("/assets/games/Snake/Snake.svg","Snake"),l("/assets/games/Snake/SnakePiece.svg","SnakePiece"),l("/assets/games/Snake/snake.webp","SnakePng"),l("/assets/games/wavywake/BB.svg","BB"),l("/assets/games/wavywake/BG.svg","BG"),l("/assets/games/wavywake/BGr.svg","BGr"),l("/assets/games/wavywake/Boat.svg","Boat"),l("/assets/games/wavywake/BR.svg","BR"),l("/assets/games/wavywake/GB.svg","GB"),l("/assets/games/wavywake/GP.svg","GP"),l("/assets/games/wavywake/Steeze.webp","Steeze"),l("/SuperSeaAdventure.svg","GentryShark"),l("svgs/crown.svg","Crown")},1776:(e,t,n)=>{"use strict";n.d(t,{Q:()=>r});let r=(0,n(1462).createContext)({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"})},1786:(e,t,n)=>{"use strict";n.d(t,{a:()=>r});let r=e=>Math.round(1e5*e)/1e5},1927:(e,t,n)=>{"use strict";n.d(t,{$:()=>i,V:()=>s});var r=n(4670);let i=r.l,s=r.l}
vendor: 21,343 bytes, line 1
1,2054:(e,t,n)=>{"use strict";n.d(t,{i:()=>r});let r=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e)},2076:(e,t,n)=>{"use strict";let r=n(5564),i=n(3685),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,n){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return h(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e){var r=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);let n=0|p(r,i),s=o(n),l=s.write(r,i);return l!==n&&(s=s.slice(0,l)),s}if(ArrayBuffer.isView(e)){var s=e;if(j(s,Uint8Array)){let e=new Uint8Array(s);return d(e.buffer,e.byteOffset,e.byteLength)}return c(s)}if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(j(e,ArrayBuffer)||e&&j(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(j(e,SharedArrayBuffer)||e&&j(e.buffer,SharedArrayBuffer)))return d(e,t,n);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');let l=e.valueOf&&e.valueOf();if(null!=l&&l!==e)return a.from(l,t,n);let u=function(e){if(a.isBuffer(e)){let t=0|f(e.length),n=o(t);return 0===n.length||e.copy(n,0,0,t),n}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?o(0):c(e):"Buffer"===e.type&&Array.isArray(e.data)?c(e.data):void 0}(e);if(u)return u;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,n);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function u(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function h(e){return u(e),o(e<0?0:0|f(e))}function c(e){let t=e.length<0?0:0|f(e.length),n=o(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function d(e,t,n){let r;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),a.prototype),r}function f(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||j(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(e).length;default:if(i)return r?-1:D(e).length;t=(""+t).toLowerCase(),i=!0}}function m(e,t,n){let i=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===n||n>this.length)&&(n=this.length),n<=0||(n>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,n){let r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=F[e[r]];return i}(this,t,n);case"utf8":case"utf-8":return _(this,t,n);case"ascii":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}(this,t,n);case"latin1":case"binary":return function(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}(this,t,n);case"base64":var s,o,a;return s=this,o=t,a=n,0===o&&a===s.length?r.fromByteArray(s):r.fromByteArray(s.slice(o,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,n){let r=e.slice(t,n),i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}(this,t,n);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function g(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){var s;if(0===e.length)return -1;if("string"==typeof n?(r=n,n=0):n>0x7fffffff?n=0x7fffffff:n<-0x80000000&&(n=-0x80000000),(s=n*=1)!=s&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length)if(i)return -1;else n=e.length-1;else if(n<0)if(!i)return -1;else n=0;if("string"==typeof t&&(t=a.from(t,r)),a.isBuffer(t))return 0===t.length?-1:v(e,t,n,r,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,n);else return Uint8Array.prototype.lastIndexOf.call(e,t,n);return v(e,[t],n,r,i)}throw TypeError("val must be string, number or Buffer")}function v(e,t,n,r,i){let s,o=1,a=e.length,l=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return -1;o=2,a/=2,l/=2,n/=2}function u(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let r=-1;for(s=n;s<a;s++)if(u(e,s)===u(t,-1===r?0:s-r)){if(-1===r&&(r=s),s-r+1===l)return r*o}else -1!==r&&(s-=s-r),r=-1}else for(n+l>a&&(n=a-l),s=n;s>=0;s--){let n=!0;for(let r=0;r<l;r++)if(u(e,s+r)!==u(t,r)){n=!1;break}if(n)return s}return -1}function _(e,t,n){n=Math.min(e.length,n);let r=[],i=t;for(;i<n;){let t=e[i],s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=n){let n,r,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:(192&(n=e[i+1]))==128&&(l=(31&t)<<6|63&n)>127&&(s=l);break;case 3:n=e[i+1],r=e[i+2],(192&n)==128&&(192&r)==128&&(l=(15&t)<<12|(63&n)<<6|63&r)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:n=e[i+1],r=e[i+2],a=e[i+3],(192&n)==128&&(192&r)==128&&(192&a)==128&&(l=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&a)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|1023&s),r.push(s),i+=o}var s=r;let o=s.length;if(o<=4096)return String.fromCharCode.apply(String,s);let a="",l=0;for(;l<o;)a+=String.fromCharCode.apply(String,s.slice(l,l+=4096));return a}function w(e,t,n){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>n)throw RangeError("Trying to access beyond buffer length")}function b(e,t,n,r,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(n+r>e.length)throw RangeError("Index out of range")}function E(e,t,n,r,i){R(t,r,i,e,n,7);let s=Number(t&BigInt(0xffffffff));e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s,s>>=8,e[n++]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,n}function T(e,t,n,r,i){R(t,r,i,e,n,7);let s=Number(t&BigInt(0xffffffff));e[n+7]=s,s>>=8,e[n+6]=s,s>>=8,e[n+5]=s,s>>=8,e[n+4]=s;let o=Number(t>>BigInt(32)&BigInt(0xffffffff));return e[n+3]=o,o>>=8,e[n+2]=o,o>>=8,e[n+1]=o,o>>=8,e[n]=o,n+8}function S(e,t,n,r,i,s){if(n+r>e.length||n<0)throw RangeError("Index out of range")}function C(e,t,n,r,s){return t*=1,n>>>=0,s||S(e,t,n,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,n,r,23,4),n+4}function I(e,t,n,r,s){return t*=1,n>>>=0,s||S(e,t,n,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,n,r,52,8),n+8}t.hp=a,t.IS=50,a.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,n){return l(e,t,n)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,n){return(u(e),e<=0)?o(e):void 0!==t?"string"==typeof n?o(e).fill(t,n):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return h(e)},a.allocUnsafeSlow=function(e){return h(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),j(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:+(r<n)},a.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},a.concat=function(e,t){let n;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(n=0,t=0;n<e.length;++n)t+=e[n].length;let r=a.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){let t=e[n];if(j(t,Uint8Array))i+t.length>r.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else if(a.isBuffer(t))t.copy(r,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return r},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)g(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?_(this,0,e):m.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let e="",n=t.IS;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,n,r,i){if(j(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return -1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;let s=i-r,o=n-t,l=Math.min(s,o),u=this.slice(r,i),h=e.slice(t,n);for(let e=0;e<l;++e)if(u[e]!==h[e]){s=u[e],o=h[e];break}return s<o?-1:+(o<s)},a.prototype.includes=function(e,t,n){return -1!==this.indexOf(e,t,n)},a.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},a.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},a.prototype.write=function(e,t,n,r){var i,s,o,a,l,u,h,c;if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let d=this.length-t;if((void 0===n||n>d)&&(n=d),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let f=!1;for(;;)switch(r){case"hex":return function(e,t,n,r){let i;n=Number(n)||0;let s=e.length-n;r?(r=Number(r))>s&&(r=s):r=s;let o=t.length;for(r>o/2&&(r=o/2),i=0;i<r;++i){var a;let r=parseInt(t.substr(2*i,2),16);if((a=r)!=a)break;e[n+i]=r}return i}(this,e,t,n);case"utf8":case"utf-8":return i=t,s=n,M(D(e,this.length-i),this,i,s);case"ascii":case"latin1":case"binary":return o=t,a=n,M(function(e){let t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(e),this,o,a);case"base64":return l=t,u=n,M(L(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return h=t,c=n,M(function(e,t){let n,r,i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)r=(n=e.charCodeAt(s))>>8,i.push(n%256),i.push(r);return i}(e,this.length-h),this,h,c);default:if(f)throw TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),f=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let n=this.length;e=~~e,t=void 0===t?n:~~t,e<0?(e+=n)<0&&(e=0):e>n&&(e=n),t<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);let r=this.subarray(e,t);return Object.setPrototypeOf(r,a.prototype),r},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);let r=this[e],i=1,s=0;for(;++s<t&&(i*=256);)r+=this[e+s]*i;return r},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||w(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||w(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=U(function(e){P(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&N(e,this.length-8);let r=t+256*this[++e]+65536*this[++e]+0x1000000*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+0x1000000*n;return BigInt(r)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=U(function(e){P(e>>>=0,"offset");let t=this[e],n=this[e+7];(void 0===t||void 0===n)&&N(e,this.length-8);let r=0x1000000*t+65536*this[++e]+256*this[++e]+this[++e],i=0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);let r=this[e],i=1,s=0;for(;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},a.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||w(e,t,this.length);let r=t,i=1,s=this[e+--r];for(;r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||w(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||w(e,2,this.length);let n=this[e]|this[e+1]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt16BE=function(e,t){e>>>=0,t||w(e,2,this.length);let n=this[e+1]|this[e]<<8;return 32768&n?0xffff0000|n:n},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||w(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=U(function(e){P(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&N(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+0x1000000*this[++e])}),a.prototype.readBigInt64BE=U(function(e){P(e>>>=0,"offset");let t=this[e],n=this[e+7];return(void 0===t||void 0===n)&&N(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(0x1000000*this[++e]+65536*this[++e]+256*this[++e]+n)}),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||w(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||w(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;b(this,e,t,n,r,0)}let i=1,s=0;for(this[t]=255&e;++s<n&&(i*=256);)this[t+s]=e/i&255;return t+n},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,n,r){if(e*=1,t>>>=0,n>>>=0,!r){let r=Math.pow(2,8*n)-1;b(this,e,t,n,r,0)}let i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigUInt64LE=U(function(e,t=0){return E(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=U(function(e,t=0){return T(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);b(this,e,t,n,r-1,-r)}let i=0,s=1,o=0;for(this[t]=255&e;++i<n&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+n},a.prototype.writeIntBE=function(e,t,n,r){if(e*=1,t>>>=0,!r){let r=Math.pow(2,8*n-1);b(this,e,t,n,r-1,-r)}let i=n-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s|0)-o&255;return t+n},a.prototype.writeInt8=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,n){return e*=1,t>>>=0,n||b(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeBigInt64LE=U(function(e,t=0){return E(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=U(function(e,t=0){return T(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,n){return C(this,e,t,!0,n)},a.prototype.writeFloatBE=function(e,t,n){return C(this,e,t,!1,n)},a.prototype.writeDoubleLE=function(e,t,n){return I(this,e,t,!0,n)},a.prototype.writeDoubleBE=function(e,t,n){return I(this,e,t,!1,n)},a.prototype.copy=function(e,t,n,r){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw RangeError("Index out of range");if(r<0)throw RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);let i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},a.prototype.fill=function(e,t,n,r){let i;if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw TypeError("encoding must be a string");if("string"==typeof r&&!a.isEncoding(r))throw TypeError("Unknown encoding: "+r);if(1===e.length){let t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError("Out of range index");if(n<=t)return this;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{let s=a.isBuffer(e)?e:a.from(e,r),o=s.length;
1if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=s[i%o]}return this};let x={};function A(e,t,n){x[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function k(e){let t="",n=e.length,r=+("-"===e[0]);for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function R(e,t,n,r,i,s){if(e>n||e<t){let r,i="bigint"==typeof t?"n":"";throw r=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:`>= ${t}${i} and <= ${n}${i}`,new x.ERR_OUT_OF_RANGE("value",r,e)}P(i,"offset"),(void 0===r[i]||void 0===r[i+s])&&N(i,r.length-(s+1))}function P(e,t){if("number"!=typeof e)throw new x.ERR_INVALID_ARG_TYPE(t,"number",e)}function N(e,t,n){if(Math.floor(e)!==e)throw P(e,n),new x.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new x.ERR_BUFFER_OUT_OF_BOUNDS;throw new x.ERR_OUT_OF_RANGE(n||"offset",`>= ${+!!n} and <= ${t}`,e)}A("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),A("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),A("ERR_OUT_OF_RANGE",function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>0x100000000?i=k(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=k(i)),i+="n"),r+=` It must be ${t}. Received ${i}`},RangeError);let O=/[^+/0-9A-Za-z-_]/g;function D(e,t){let n;t=t||1/0;let r=e.length,i=null,s=[];for(let o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319||o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else if(n<1114112){if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}else throw Error("Invalid code point")}return s}function L(e){return r.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(O,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length)&&!(i>=e.length);++i)t[i+n]=e[i];return i}function j(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let F=function(){let e="0123456789abcdef",t=Array(256);for(let n=0;n<16;++n){let r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function U(e){return"undefined"==typeof BigInt?V:e}function V(){throw Error("BigInt not supported")}},2318:(e,t,n)=>{"use strict";n.d(t,{q:()=>r});let r=(e,t,n)=>n>t?t:n<e?e:n},2459:(e,t,n)=>{"use strict";function r(e){let t=[{},{}];return null==e||e.values.forEach((e,n)=>{t[0][n]=e.get(),t[1][n]=e.getVelocity()}),t}function i(e,t,n,i){if("function"==typeof t){let[s,o]=r(i);t=t(void 0!==n?n:e.custom,s,o)}if("string"==typeof t&&(t=e.variants&&e.variants[t]),"function"==typeof t){let[s,o]=r(i);t=t(void 0!==n?n:e.custom,s,o)}return t}n.d(t,{a:()=>i})},2517:(e,t,n)=>{"use strict";n.d(t,{po:()=>s,tn:()=>a,yT:()=>o});var r=n(867),i=n(3058);let s=e=>1-Math.sin(Math.acos(e)),o=(0,i.G)(s),a=(0,r.V)(s)},2530:(e,t,n)=>{"use strict";n.d(t,{L:()=>r});let r=(0,n(1462).createContext)({})},2535:(e,t,n)=>{"use strict";function r(e,t){return t?1e3/t*e:0}n.d(t,{f:()=>r})},2568:(e,t,n)=>{"use strict";n.d(t,{g:()=>i});var r=n(5274);function i(e,t){let n=e.getValue("willChange");if((0,r.S)(n)&&n.add)return n.add(t)}},2587:(e,t,n)=>{"use strict";function r(e,t,n,r){return!1}
1Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getDomainLocale",{enumerable:!0,get:function(){return r}}),n(2123),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},2599:(e,t,n)=>{"use strict";n.d(t,{OQ:()=>u});var r=n(4856),i=n(4837),s=n(2535),o=n(6890);let a={current:void 0};class l{constructor(e,t={}){this.version="11.18.2",this.canTrackVelocity=null,this.events={},this.updateAndNotify=(e,t=!0)=>{let n=r.k.now();this.updatedAt!==n&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(e),this.current!==this.prev&&this.events.change&&this.events.change.notify(this.current),t&&this.events.renderRequest&&this.events.renderRequest.notify(this.current)},this.hasAnimated=!1,this.setCurrent(e),this.owner=t.owner}setCurrent(e){this.current=e,this.updatedAt=r.k.now(),null===this.canTrackVelocity&&void 0!==e&&(this.canTrackVelocity=!isNaN(parseFloat(this.current)))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,t){this.events[e]||(this.events[e]=new i.v);let n=this.events[e].add(t);return"change"===e?()=>{n(),o.Gt.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(let e in this.events)this.events[e].clear()}attach(e,t){this.passiveEffect=e,this.stopPassiveEffect=t}set(e,t=!0){t&&this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e,t)}setWithVelocity(e,t,n){this.set(t),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-n}jump(e,t=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,t&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}get(){return a.current&&a.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){let e=r.k.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;let t=Math.min(this.updatedAt-this.prevUpdatedAt,30);return(0,s.f)(parseFloat(this.current)-parseFloat(this.prevFrameValue),t)}start(e){return this.stop(),new Promise(t=>{this.hasAnimated=!0,this.animation=e(t),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function u(e,t){return new l(e,t)}},2624:(e,t,n)=>{"use strict";n.d(t,{_:()=>p});var r=n(6311),i=n(5120),s=n(9670),o=n(3202),a=n(2568),l=n(8166),u=n(2899),h=n(6890);function c(e,t,{delay:n=0,transitionOverride:r,type:d}={}){var f;let{transition:p=e.getDefaultTransition(),transitionEnd:m,...g}=t;r&&(p=r);let y=[],v=d&&e.animationState&&e.animationState.getState()[d];for(let t in g){let r=e.getValue(t,null!=(f=e.latestValues[t])?f:null),o=g[t];if(void 0===o||v&&function({protectedKeys:e,needsAnimating:t},n){let r=e.hasOwnProperty(n)&&!0!==t[n];return t[n]=!1,r}(v,t))continue;let c={delay:n,...(0,i.rU)(p||{},t)},d=!1;if(window.MotionHandoffAnimation){let n=(0,l.P)(e);if(n){let e=window.MotionHandoffAnimation(n,t,h.Gt);null!==e&&(c.startTime=e,d=!0)}}(0,a.g)(e,t),r.start((0,u.f)(t,r,o,e.shouldReduceMotion&&s.$.has(t)?{type:!1}:c,e,d));let m=r.animation;m&&y.push(m)}return m&&Promise.all(y).then(()=>{h.Gt.update(()=>{m&&(0,o.U)(e,m)})}),y}function d(e,t,n={}){var i;let s=(0,r.K)(e,t,"exit"===n.type?null==(i=e.presenceContext)?void 0:i.custom:void 0),{transition:o=e.getDefaultTransition()||{}}=s||{};n.transitionOverride&&(o=n.transitionOverride);let a=s?()=>Promise.all(c(e,s,n)):()=>Promise.resolve(),l=e.variantChildren&&e.variantChildren.size?(r=0)=>{let{delayChildren:i=0,staggerChildren:s,staggerDirection:a}=o;return function(e,t,n=0,r=0,i=1,s){let o=[],a=(e.variantChildren.size-1)*r,l=1===i?(e=0)=>e*r:(e=0)=>a-e*r;return Array.from(e.variantChildren).sort(f).forEach((e,r)=>{e.notify("AnimationStart",t),o.push(d(e,t,{...s,delay:n+l(r)}).then(()=>e.notify("AnimationComplete",t)))}),Promise.all(o)}(e,t,i+r,s,a,n)}:()=>Promise.resolve(),{when:u}=o;if(!u)return Promise.all([a(),l(n.delay)]);{let[e,t]="beforeChildren"===u?[a,l]:[l,a];return e().then(()=>t())}}function f(e,t){return e.sortNodePosition(t)}function p(e,t,n={}){let i;if(e.notify("AnimationStart",t),Array.isArray(t))i=Promise.all(t.map(t=>d(e,t,n)));
1else if("string"==typeof t)i=d(e,t,n);else{let s="function"==typeof t?(0,r.K)(e,t,n.custom):t;i=Promise.all(c(e,s,n))}return i.then(()=>{e.notify("AnimationComplete",t)})}},2656:(e,t,n)=>{"use strict";function r(e,t){-1===e.indexOf(t)&&e.push(t)}function i(e,t){let n=e.indexOf(t);n>-1&&e.splice(n,1)}n.d(t,{Ai:()=>i,Kq:()=>r})},2658:(e,t)=>{"use strict";t.Y=function(e,t){return(function(e){return e.split(",").map(function(e){var t=(e=e.trim()).match(n),s=t[1],o=t[2],a=t[3]||"",l={};return l.inverse=!!s&&"not"===s.toLowerCase(),l.type=o?o.toLowerCase():"all",l.expressions=(a=a.match(/\([^\)]+\)/g)||[]).map(function(e){var t=e.match(r),n=t[1].toLowerCase().match(i);return{modifier:n[1],feature:n[2],value:t[2]}}),l})})(e).some(function(e){var n=e.inverse,r="all"===e.type||t.type===e.type;if(r&&n||!(r||n))return!1;var i=e.expressions.every(function(e){var n=e.feature,r=e.modifier,i=e.value,s=t[n];if(!s)return!1;switch(n){case"orientation":case"scan":return s.toLowerCase()===i.toLowerCase();case"width":case"height":case"device-width":case"device-height":i=u(i),s=u(s);break;case"resolution":i=l(i),s=l(s);break;case"aspect-ratio":case"device-aspect-ratio":case"device-pixel-ratio":i=a(i),s=a(s);break;case"grid":case"color":case"color-index":case"monochrome":i=parseInt(i,10)||1,s=parseInt(s,10)||0}switch(r){case"min":return s>=i;case"max":return s<=i;default:return s===i}});return i&&!n||!i&&n})};var n=/(?:(only|not)?\s*([^\s\(\)]+)(?:\s*and)?\s*)?(.+)?/i,r=/\(\s*([^\s\:\)]+)\s*(?:\:\s*([^\s\)]+))?\s*\)/,i=/^(?:(min|max)-)?(.+)/,s=/(em|rem|px|cm|mm|in|pt|pc)?$/,o=/(dpi|dpcm|dppx)?$/;function a(e){var t,n=Number(e);return n||(n=(t=e.match(/^(\d+)\s*\/\s*(\d+)$/))[1]/t[2]),n}function l(e){var t=parseFloat(e);switch(String(e).match(o)[1]){case"dpcm":return t/2.54;case"dppx":return 96*t;default:return t}}function u(e){var t=parseFloat(e);switch(String(e).match(s)[1]){case"em":case"rem":return 16*t;case"cm":return 96*t/2.54;case"mm":return 96*t/2.54/10;case"in":return 96*t;case"pt":return 72*t;case"pc":return 72*t/12;default:return t}}},2697:(e,t,n)=>{"use strict";n.d(t,{GE:()=>r,OD:()=>s,ag:()=>i});let r=[{id:"geos",title:"Geometry Survival",url:"/Arcade/Scratch/geos",iframe:"https://scratch.mit.edu/projects/209256324/embed",thumbnail:"https://www.quantumcybersolutions.com/games/Geo_surv.webp",instructions:"1. Get ready to dodge those pesky falling triangles using the **left** and **right arrow keys**! \uD83C\uDFC3\n2. Collect *power-ups* by touching them, but beware â some might be a blessing, others a curse! \uD83D\uDE31\n3. Power-ups last for 5 seconds, so enjoy them while they last! â³\n4. Feeling feisty? Press the **spacebar** to shoot a bullet and show those triangles who's boss! \uD83D\uDD2B"},{id:"MemeSus",title:"MemeSus",url:"/Arcade/Scratch/MemeSus",iframe:"https://scratch.mit.edu/projects/215743508/embed",thumbnail:"/Sacred/cat/Bangera.webp",instructions:"1. Get ready to dodge those pesky falling triangles using the **left** and **right arrow keys**! \uD83C\uDFC3\n2. Collect *power-ups* by touching them, but beware â some might be a blessing, others a curse! \uD83D\uDE31\n3. Power-ups last for 5 seconds, so enjoy them while they last! â³\n4. Feeling feisty? Press the **spacebar** to shoot a bullet and show those triangles who's boss! \uD83D\uDD2B"},{id:"mewow",title:"Me Wow",url:"/Arcade/Scratch/mewow",iframe:"https://scratch.mit.edu/projects/222792883/embed",thumbnail:"/Arcade/Scratch/Jamess.webp",instructions:"/Arcade/Scratch/Jamess.webp"},{id:"pong",title:"Pong",url:"/Arcade/Scratch/pong",iframe:"https://scratch.mit.edu/projects/202315549/embed",thumbnail:"/Arcade/pong.svg",instructions:""},{id:"OurCade",title:"OurCade",url:"/Arcade/OurCade",thumbnail:"/Arcade/okay.webp",instructions:"games that are still in development"}],i=[{id:"RingOfFire",title:"RingOfFire",url:"/Arcade/OurCade/ROF",thumbnail:"https://www.quantumcybersolutions.com/games/ROF2.webp",instructions:"1. Classic drinking game named ring of Fire or Kings Cup. \n2. Click on the deck to draw a card. \n3. Follow the instructions on the card. \n4. Enjoy!",StoriesRequired:["O1","R2"]},{id:"Snake",title:"Snake",url:"/Arcade/Snake#Snake",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!",StoriesRequired:["Am1"]},{id:"LLL",title:"LLL",url:"/Arcade/OurCade/LLL#LLL",thumbnail:"/Arcade/4.webp",instructions:"1. You have three chances to guess the card from a deck of cards.\n2. After each guess, the game will tell you if your guess is higher or lower.\n3. Keep track of your score of right and wrong guesses.",StoriesRequired:["O3","R2","Q2"]},{id:"CollapseFour",title:"CollapseFour",url:"/Arcade/OurCade/QCF#QCC",thumbnail:"/Superposition.svg",instructions:"1. Players take turns placing quantum pieces (purple superposition state) on the board.\n\n 2. After Random amount turns, the game enters Measurement Phase.\n\n 3. During Measurement Phase, click on purple pieces to collapse them into either spin-up (green) or spin-down (red) states.\n\n 4. Measurement Phase lasts for Random Amount of turns before returning to placement phase.\n\n 5. Connect four pieces of the same spin state (all green or all red) horizontally, vertically, or diagonally to win.\n\n 6. Strategic elements:\n - Superposition pieces can collapse to either state\n - Plan your moves considering both possible outcomes\n - Use Measurement Phase to influence board state\n\n 7. Quantum mechanics concepts demonstrated:\n - Superposition: Pieces exist in multiple states\n - Measurement: Observing collapses the quantum state\n - Quantum randomness: Collapse outcomes are probabilistic\n\n 8. Victory condition:\n - Four identical spin states in a row wins\n - Victory only possible with collapsed
1states",StoriesRequired:["O3","Q2","Q1"]},{id:"ScratchGames",title:"Scratch Games",url:"/Arcade/Scratch",thumbnail:"/Sacred/LouisWane.svg",instructions:"games that are made with scratch",StoriesRequired:[""]}],s=[{id:"CATPILR",title:"Catvolution",url:"/Arcade/DevCave/Katepiller",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!"},{id:"EEL",title:"Electric Eel",url:"/Arcade/DevCave/EEl/E",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!"},{id:"RTB",title:"RideDaBus",url:"/Arcade/DevCave/RideTheBus",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!"},{id:"SS",title:"SharkSurivial",url:"/Arcade/DevCave/Snake#Snake",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!"},{id:"WW",title:"WazyWake",url:"/Arcade/DevCave/Snake#Snake",thumbnail:"/Arcade/snake.svg",instructions:"1. Use the **arrow keys** to move the snake around the board.\n2. Eat the food to grow longer.\n3. Avoid running into the walls or the snake's own body.\n4. Try to get the highest score possible!"}]},2727:(e,t,n)=>{"use strict";n.d(t,{w:()=>r});let r=e=>t=>t.test(e)},2744:(e,t,n)=>{"use strict";n.d(t,{j:()=>i,p:()=>o});let r=e=>t=>"string"==typeof t&&t.startsWith(e),i=r("--"),s=r("var(--"),o=e=>!!s(e)&&a.test(e.split("/*")[0].trim()),a=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu},2847:(e,t,n)=>{"use strict";var r=n(2658).Y,i="undefined"!=typeof window?window.matchMedia:null;function s(e,t,n){var s,o=this;function a(e){o.matches=e.matches,o.media=e.media}i&&!n&&(s=i.call(window,e)),s?(this.matches=s.matches,this.media=s.media,s.addListener(a)):(this.matches=r(e,t),this.media=e),this.addListener=function(e){s&&s.addListener(e)},this.removeListener=function(e){s&&s.removeListener(e)},this.dispose=function(){s&&s.removeListener(a)}}e.exports=function(e,t,n){return new s(e,t,n)}},2899:(e,t,n)=>{"use strict";n.d(t,{f:()=>eE});var r=n(5120),i=n(488),s=n(6890),o=n(6616);let a={current:!1};var l=n(4670);let u=(e,t,n)=>(((1-3*n+3*t)*e+(3*n-6*t))*e+3*t)*e;function h(e,t,n,r){return e===t&&n===r?l.l:i=>0===i||1===i?i:u(function(e,t,n,r,i){let s,o,a=0;do(s=u(o=t+(n-t)/2,r,i)-e)>0?n=o:t=o;while(Math.abs(s)>1e-7&&++a<12);return o}(i,0,1,e,n),t,r)}var c=n(867),d=n(3058);let f=h(.33,1.53,.69,.99),p=(0,d.G)(f),m=(0,c.V)(p),g=e=>(e*=2)<1?.5*p(e):.5*(2-Math.pow(2,-10*(e-1)));var y=n(2517),v=n(6125),_=n(4856),w=n(6303),b=n(1927),E=n(8623);let T=(e,t)=>"zIndex"!==t&&!!("number"==typeof e||Array.isArray(e)||"string"==typeof e&&(E.f.test(e)||"0"===e)&&!e.startsWith("url(")),S=e=>null!==e;function C(e,{repeat:t,repeatType:n="loop"},r){let i=e.filter(S),s=t&&"loop"!==n&&t%2==1?0:i.length-1;return s&&void 0!==r?r:i[s]}class I{constructor({autoplay:e=!0,delay:t=0,type:n="keyframes",repeat:r=0,repeatDelay:i=0,repeatType:s="loop",...o}){this.isStopped=!1,this.hasAttemptedResolve=!1,this.createdAt=_.k.now(),this.options={autoplay:e,delay:t,type:n,repeat:r,repeatDelay:i,repeatType:s,...o},this.updateFinishedPromise()}calcStartTime(){return this.resolvedAt&&this.resolvedAt-this.createdAt>40?this.resolvedAt:this.createdAt}get resolved(){return this._resolved||this.hasAttemptedResolve||(0,w.q)(),this._resolved}onKeyframesResolved(e,t){this.resolvedAt=_.k.now(),this.hasAttemptedResolve=!0;let{name:n,type:i,velocity:s,delay:o,onComplete:l,onUpdate:u,isGenerator:h}=this.options;if(!h&&!function(e,t,n,i){let s=e[0];if(null===s)return!1;if("display"===t||"visibility"===t)return!0;let o=e[e.length-1],a=T(s,t),l=T(o,t);return(0,b.$)(a===l,`You are trying to animate ${t} from "${s}" to "${o}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${o} via the \`style\` property.`),!!a&&!!l&&(function(e){let t=e[0];if(1===e.length)return!0;for(let n=0;n<e.length;n++)if(e[n]!==t)return!0}(e)||("spring"===n||(0,r.WH)(n))&&i)}(e,n,i,s))if(a.current||!o){u&&u(C(e,this.options,t)),l&&l(),this.resolveFinishedProm
1ise();return}else this.options.duration=0;let c=this.initPlayback(e,t);!1!==c&&(this._resolved={keyframes:e,finalKeyframe:t,...c},this.onPostResolved())}onPostResolved(){}then(e,t){return this.currentFinishedPromise.then(e,t)}flatten(){this.options.type="keyframes",this.options.ease="linear"}updateFinishedPromise(){this.currentFinishedPromise=new Promise(e=>{this.resolveFinishedPromise=e})}}var x=n(2318),A=n(6949);function k(e,t,n){return(n<0&&(n+=1),n>1&&(n-=1),n<1/6)?e+(t-e)*6*n:n<.5?t:n<2/3?e+(t-e)*(2/3-n)*6:e}var R=n(3506),P=n(179),N=n(8055);function O(e,t){return n=>n>0?t:e}let D=(e,t,n)=>{let r=e*e,i=n*(t*t-r)+r;return i<0?0:Math.sqrt(i)},L=[R.u,P.B,N.V];function M(e){let t=L.find(t=>t.test(e));if((0,b.$)(!!t,`'${e}' is not an animatable color. Use the equivalent color code instead.`),!t)return!1;let n=t.parse(e);return t===N.V&&(n=function({hue:e,saturation:t,lightness:n,alpha:r}){e/=360,n/=100;let i=0,s=0,o=0;if(t/=100){let r=n<.5?n*(1+t):n+t-n*t,a=2*n-r;i=k(a,r,e+1/3),s=k(a,r,e),o=k(a,r,e-1/3)}else i=s=o=n;return{red:Math.round(255*i),green:Math.round(255*s),blue:Math.round(255*o),alpha:r}}(n)),n}let j=(e,t)=>{let n=M(e),r=M(t);if(!n||!r)return O(e,t);let i={...n};return e=>(i.red=D(n.red,r.red,e),i.green=D(n.green,r.green,e),i.blue=D(n.blue,r.blue,e),i.alpha=(0,A.k)(n.alpha,r.alpha,e),P.B.transform(i))};var F=n(4571),U=n(9033),V=n(2744);let B=new Set(["none","hidden"]);function q(e,t){return n=>(0,A.k)(e,t,n)}function $(e){return"number"==typeof e?q:"string"==typeof e?(0,V.p)(e)?O:U.y.test(e)?j:H:Array.isArray(e)?z:"object"==typeof e?U.y.test(e)?j:W:O}function z(e,t){let n=[...e],r=n.length,i=e.map((e,n)=>$(e)(e,t[n]));return e=>{for(let t=0;t<r;t++)n[t]=i[t](e);return n}}function W(e,t){let n={...e,...t},r={};for(let i in n)void 0!==e[i]&&void 0!==t[i]&&(r[i]=$(e[i])(e[i],t[i]));return e=>{for(let t in r)n[t]=r[t](e);return n}}let H=(e,t)=>{let n=E.f.createTransformer(t),r=(0,E.V)(e),i=(0,E.V)(t);return r.indexes.var.length===i.indexes.var.length&&r.indexes.color.length===i.indexes.color.length&&r.indexes.number.length>=i.indexes.number.length?B.has(e)&&!i.values.length||B.has(t)&&!r.values.length?function(e,t){return B.has(e)?n=>n<=0?e:t:n=>n>=1?t:e}(e,t):(0,F.F)(z(function(e,t){var n;let r=[],i={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){let o=t.types[s],a=e.indexes[o][i[o]],l=null!=(n=e.values[a])?n:0;r[s]=l,i[o]++}return r}(r,i),i.values),n):((0,b.$)(!0,`Complex values '${e}' and '${t}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`),O(e,t))};function G(e,t,n){return"number"==typeof e&&"number"==typeof t&&"number"==typeof n?(0,A.k)(e,t,n):$(e)(e,t)}var K=n(2535);function Y(e,t,n){let r=Math.max(t-5,0);return(0,K.f)(n-e(r),t-r)}let Q={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function X(e,t){return e*Math.sqrt(1-t*t)}let J=["duration","bounce"],Z=["stiffness","damping","mass"];function ee(e,t){return t.some(t=>void 0!==e[t])}function et(e=Q.visualDuration,t=Q.bounce){let n,s="object"!=typeof e?{visualDuration:e,keyframes:[0,1],bounce:t}:e,{restSpeed:o,restDelta:a}=s,l=s.keyframes[0],u=s.keyframes[s.keyframes.length-1],h={done:!1,value:l},{stiffness:c,damping:d,mass:f,duration:p,velocity:m,isResolvedFromDuration:g}=function(e){let t={velocity:Q.velocity,stiffness:Q.stiffness,damping:Q.damping,mass:Q.mass,isResolvedFromDuration:!1,...e};if(!ee(e,Z)&&ee(e,J))if(e.visualDuration){let n=2*Math.PI/(1.2*e.visualDuration),r=n*n,i=2*(0,x.q)(.05,1,1-(e.bounce||0))*Math.sqrt(r);t={...t,mass:Q.mass,stiffness:r,damping:i}}else{let n=function({duration:e=Q.duration,bounce:t=Q.bounce,velocity:n=Q.velocity,mass:r=Q.mass}){let s,o;(0,b.$)(e<=(0,i.f)(Q.maxDuration),"Spring duration must be 10 seconds or less");let a=1-t;a=(0,x.q)(Q.minDamping,Q.maxDamping,a),e=(0,x.q)(Q.minDuration,Q.maxDuration,(0,i.X)(e)),a<1?(s=t=>{let r=t*a,i=r*e;return .001-(r-n)/X(t,a)*Math.exp(-i)},o=t=>{let r=t*a*e,i=Math.pow(a,2)*Math.pow(t,2)*e,o=Math.exp(-r),l=X(Math.pow(t,2),a);return(r*n+n-i)*o*(-s(t)+.001>0?-1:1)/l}):(s=t=>-.001+Math.exp(-t*e)*((t-n)*e+1),o=t=>e*e*(n-t)*Math.exp(-t*e));let l=function(e,t,n){let r=n;for(let n=1;n<12;n++)r-=e(r)/t(r);return r}(s,o,5/e);if(e=(0,i.f)(e),isNaN(l))return{stiffness:Q.stiffness,damping:Q.damping,duration:e};{let t=Math.pow(l,2)*r;
1return{stiffness:t,damping:2*a*Math.sqrt(r*t),duration:e}}}(e);(t={...t,...n,mass:Q.mass}).isResolvedFromDuration=!0}return t}({...s,velocity:-(0,i.X)(s.velocity||0)}),y=m||0,v=d/(2*Math.sqrt(c*f)),_=u-l,w=(0,i.X)(Math.sqrt(c/f)),E=5>Math.abs(_);if(o||(o=E?Q.restSpeed.granular:Q.restSpeed.default),a||(a=E?Q.restDelta.granular:Q.restDelta.default),v<1){let e=X(w,v);n=t=>u-Math.exp(-v*w*t)*((y+v*w*_)/e*Math.sin(e*t)+_*Math.cos(e*t))}else if(1===v)n=e=>u-Math.exp(-w*e)*(_+(y+w*_)*e);else{let e=w*Math.sqrt(v*v-1);n=t=>{let n=Math.exp(-v*w*t),r=Math.min(e*t,300);return u-n*((y+v*w*_)*Math.sinh(r)+e*_*Math.cosh(r))/e}}let T={calculatedDuration:g&&p||null,next:e=>{let t=n(e);if(g)h.done=e>=p;else{let r=0;v<1&&(r=0===e?(0,i.f)(y):Y(n,e,t));let s=Math.abs(u-t)<=a;h.done=Math.abs(r)<=o&&s}return h.value=h.done?u:t,h},toString:()=>{let e=Math.min((0,r.tu)(T),r.YE),t=(0,r.KZ)(t=>T.next(e*t).value,e,30);return e+"ms "+t}};return T}function en({keyframes:e,velocity:t=0,power:n=.8,timeConstant:r=325,bounceDamping:i=10,bounceStiffness:s=500,modifyTarget:o,min:a,max:l,restDelta:u=.5,restSpeed:h}){let c,d,f=e[0],p={done:!1,value:f},m=n*t,g=f+m,y=void 0===o?g:o(g);y!==g&&(m=y-f);let v=e=>-m*Math.exp(-e/r),_=e=>y+v(e),w=e=>{let t=v(e),n=_(e);p.done=Math.abs(t)<=u,p.value=p.done?y:n},b=e=>{let t;if(t=p.value,void 0!==a&&t<a||void 0!==l&&t>l){var n;c=e,d=et({keyframes:[p.value,(n=p.value,void 0===a?l:void 0===l||Math.abs(a-n)<Math.abs(l-n)?a:l)],velocity:Y(_,e,p.value),damping:i,stiffness:s,restDelta:u,restSpeed:h})}};return b(0),{calculatedDuration:null,next:e=>{let t=!1;return(d||void 0!==c||(t=!0,w(e),b(e)),void 0!==c&&e>=c)?d.next(e-c):(t||w(e),p)}}}let er=h(.42,0,1,1),ei=h(0,0,.58,1),es=h(.42,0,.58,1),eo={linear:l.l,easeIn:er,easeInOut:es,easeOut:ei,circIn:y.po,circInOut:y.tn,circOut:y.yT,backIn:p,backInOut:m,backOut:f,anticipate:g},ea=e=>{if((0,r.DW)(e)){(0,b.V)(4===e.length,"Cubic bezier arrays must contain four numerical values.");let[t,n,r,i]=e;return h(t,n,r,i)}return"string"==typeof e?((0,b.V)(void 0!==eo[e],`Invalid easing type '${e}'`),eo[e]):e};var el=n(8955);function eu({duration:e=300,keyframes:t,times:n,ease:r="easeInOut"}){var i;let s=Array.isArray(r)&&"number"!=typeof r[0]?r.map(ea):ea(r),o={done:!1,value:t[0]},a=function(e,t,{clamp:n=!0,ease:r,mixer:i}={}){let s=e.length;if((0,b.V)(s===t.length,"Both input and output ranges must be the same length"),1===s)return()=>t[0];if(2===s&&t[0]===t[1])return()=>t[1];let o=e[0]===e[1];e[0]>e[s-1]&&(e=[...e].reverse(),t=[...t].reverse());let a=function(e,t,n){let r=[],i=n||G,s=e.length-1;for(let n=0;n<s;n++){let s=i(e[n],e[n+1]);if(t){let e=Array.isArray(t)?t[n]||l.l:t;s=(0,F.F)(e,s)}r.push(s)}return r}(t,r,i),u=a.length,h=n=>{if(o&&n<e[0])return t[0];let r=0;if(u>1)for(;r<e.length-2&&!(n<e[r+1]);r++);let i=(0,el.q)(e[r],e[r+1],n);return a[r](i)};return n?t=>h((0,x.q)(e[0],e[s-1],t)):h}((i=n&&n.length===t.length?n:function(e){let t=[0];return!function(e,t){let n=e[e.length-1];for(let r=1;r<=t;r++){let i=(0,el.q)(0,t,r);e.push((0,A.k)(n,1,i))}}(t,e.length-1),t}(t),i.map(t=>t*e)),t,{ease:Array.isArray(s)?s:t.map(()=>s||es).splice(0,t.length-1)});return{calculatedDuration:e,next:t=>(o.value=a(t),o.done=t>=e,o)}}let eh=e=>{let t=({timestamp:t})=>e(t);return{start:()=>s.Gt.update(t,!0),stop:()=>(0,s.WG)(t),now:()=>s.uv.isProcessing?s.uv.timestamp:_.k.now()}},ec={decay:en,inertia:en,tween:eu,keyframes:eu,spring:et},ed=e=>e/100;class ef extends I{constructor(e){super(e),this.holdTime=null,this.cancelTime=null,this.currentTime=0,this.playbackSpeed=1,this.pendingPlayState="running",this.startTime=null,this.state="idle",this.stop=()=>{if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.teardown();let{onStop:e}=this.options;e&&e()};let{name:t,motionValue:n,element:r,keyframes:i}=this.options,s=(null==r?void 0:r.KeyframeResolver)||w.h,o=(e,t)=>this.onKeyframesResolved(e,t);this.resolver=new s(i,o,t,n,r),this.resolver.scheduleResolve()}flatten(){super.flatten(),this._resolved&&Object.assign(this._resolved,this.initPlayback(this._resolved.keyframes))}initPlayback(e){let t,n,{type:i="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:a,velocity:l=0}=this.options,u=(0,r.WH)(i)?i:ec[i]||eu;u!==eu&&"number"!=typeof e[0]&&(t=(0,F.F)(ed,G(e[0],e[1])),e=[0,100]);let h=u({...this.options,keyframes:e});"mirror"===a&&(n=u({...this.options,keyframes:[...e].reverse(),velocity:-l})),null===h.calculatedDuration&&(h.calculatedDuration=(0,r.tu)(h));let{calculatedDuration:c}=h,d=c+o;return{generator:h,mirroredGenerator:n,mapPercentToKeyframes:t,calculatedDuration:c,resolvedDuration:d,totalDuration:d*(s+1)-o}}onPostResolved(){let{autoplay:e=!0}=this.options;this.play(),"paused"!==this.pendingPlayState&&e?this.state=this.pendingPlayState:this.pause()}tick(e,t=!1){let{resolved:n}=this;if(!n){let{keyframes:e}=this.options;return{done:!0,value:e[e.length-1]}}let{finalKeyframe:r,generator:i,mirroredGenerator:s,mapPercentToKeyframes:o,keyframes:a,calculatedDuration:l,totalDuration:u,resolvedDuration:h}=n;
1if(null===this.startTime)return i.next(0);let{delay:c,repeat:d,repeatType:f,repeatDelay:p,onUpdate:m}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-u/this.speed,this.startTime)),t?this.currentTime=e:null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=Math.round(e-this.startTime)*this.speed;let g=this.currentTime-c*(this.speed>=0?1:-1),y=this.speed>=0?g<0:g>u;this.currentTime=Math.max(g,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=u);let v=this.currentTime,_=i;if(d){let e=Math.min(this.currentTime,u)/h,t=Math.floor(e),n=e%1;!n&&e>=1&&(n=1),1===n&&t--,(t=Math.min(t,d+1))%2&&("reverse"===f?(n=1-n,p&&(n-=p/h)):"mirror"===f&&(_=s)),v=(0,x.q)(0,1,n)*h}let w=y?{done:!1,value:a[0]}:_.next(v);o&&(w.value=o(w.value));let{done:b}=w;y||null===l||(b=this.speed>=0?this.currentTime>=u:this.currentTime<=0);let E=null===this.holdTime&&("finished"===this.state||"running"===this.state&&b);return E&&void 0!==r&&(w.value=C(a,this.options,r)),m&&m(w.value),E&&this.finish(),w}get duration(){let{resolved:e}=this;return e?(0,i.X)(e.calculatedDuration):0}get time(){return(0,i.X)(this.currentTime)}set time(e){e=(0,i.f)(e),this.currentTime=e,null!==this.holdTime||0===this.speed?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.speed)}get speed(){return this.playbackSpeed}set speed(e){let t=this.playbackSpeed!==e;this.playbackSpeed=e,t&&(this.time=(0,i.X)(this.currentTime))}play(){if(this.resolver.isScheduled||this.resolver.resume(),!this._resolved){this.pendingPlayState="running";return}if(this.isStopped)return;let{driver:e=eh,onPlay:t,startTime:n}=this.options;this.driver||(this.driver=e(e=>this.tick(e))),t&&t();let r=this.driver.now();null!==this.holdTime?this.startTime=r-this.holdTime:this.startTime?"finished"===this.state&&(this.startTime=r):this.startTime=null!=n?n:this.calcStartTime(),"finished"===this.state&&this.updateFinishedPromise(),this.cancelTime=this.startTime,this.holdTime=null,this.state="running",this.driver.start()}pause(){var e;if(!this._resolved){this.pendingPlayState="paused";return}this.state="paused",this.holdTime=null!=(e=this.currentTime)?e:0}complete(){"running"!==this.state&&this.play(),this.pendingPlayState=this.state="finished",this.holdTime=null}finish(){this.teardown(),this.state="finished";let{onComplete:e}=this.options;e&&e()}cancel(){null!==this.cancelTime&&this.tick(this.cancelTime),this.teardown(),this.updateFinishedPromise()}teardown(){this.state="idle",this.stopDriver(),this.resolveFinishedPromise(),this.updateFinishedPromise(),this.startTime=this.cancelTime=null,this.resolver.cancel()}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}}let ep=new Set(["opacity","clipPath","filter","transform"]),em=(0,n(6704).p)(()=>Object.hasOwnProperty.call(Element.prototype,"animate")),eg={anticipate:g,backInOut:m,circInOut:y.tn};class ey extends I{constructor(e){super(e);let{name:t,motionValue:n,element:r,keyframes:i}=this.options;this.resolver=new v.K(i,(e,t)=>this.onKeyframesResolved(e,t),t,n,r),this.resolver.scheduleResolve()}initPlayback(e,t){var n;let{duration:i=300,times:s,ease:o,type:a,motionValue:l,name:u,startTime:h}=this.options;if(!l.owner||!l.owner.current)return!1;if("string"==typeof o&&(0,r.nL)()&&o in eg&&(o=eg[o]),n=this.options,(0,r.WH)(n.type)||"spring"===n.type||!(0,r.yL)(n.ease)){let{onComplete:t,onUpdate:n,motionValue:r,element:l,...u}=this.options,h=function(e,t){let n=new ef({...t,keyframes:e,repeat:0,delay:0,isGenerator:!0}),r={done:!1,value:e[0]},i=[],s=0;for(;!r.done&&s<2e4;)i.push((r=n.sample(s)).value),s+=10;return{times:void 0,keyframes:i,duration:s-10,ease:"linear"}}(e,u);1===(e=h.keyframes).length&&(e[1]=e[0]),i=h.duration,s=h.times,o=h.ease,a="keyframes"}let c=function(e,t,n,{delay:i=0,duration:s=300,repeat:o=0,repeatType:a="loop",ease:l="easeInOut",times:u}={}){let h={[t]:n};u&&(h.offset=u);let c=(0,r.TU)(l,s);return Array.isArray(c)&&(h.easing=c),e.animate(h,{delay:i,duration:s,easing:Array.isArray(c)?"linear":c,fill:"both",iterations:o+1,direction:"reverse"===a?"alternate":"normal"})}(l.owner.current,u,e,{...this.options,duration:i,times:s,ease:o});return c.startTime=null!=h?h:this.calcStartTime(),this.pendingTimeline?((0,r.vG)(c,this.pendingTimeline),this.pendingTimeline=void 0):c.onfinish=()=>{let{onComplete:n}=this.options;l.set(C(e,this.options,t)),n&&n(),this.cancel(),this.resolveFinishedProm
1ise()},{animation:c,duration:i,times:s,type:a,ease:o,keyframes:e}}get duration(){let{resolved:e}=this;if(!e)return 0;let{duration:t}=e;return(0,i.X)(t)}get time(){let{resolved:e}=this;if(!e)return 0;let{animation:t}=e;return(0,i.X)(t.currentTime||0)}set time(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.currentTime=(0,i.f)(e)}get speed(){let{resolved:e}=this;if(!e)return 1;let{animation:t}=e;return t.playbackRate}set speed(e){let{resolved:t}=this;if(!t)return;let{animation:n}=t;n.playbackRate=e}get state(){let{resolved:e}=this;if(!e)return"idle";let{animation:t}=e;return t.playState}get startTime(){let{resolved:e}=this;if(!e)return null;let{animation:t}=e;return t.startTime}attachTimeline(e){if(this._resolved){let{resolved:t}=this;if(!t)return l.l;let{animation:n}=t;(0,r.vG)(n,e)}else this.pendingTimeline=e;return l.l}play(){if(this.isStopped)return;let{resolved:e}=this;if(!e)return;let{animation:t}=e;"finished"===t.playState&&this.updateFinishedPromise(),t.play()}pause(){let{resolved:e}=this;if(!e)return;let{animation:t}=e;t.pause()}stop(){if(this.resolver.cancel(),this.isStopped=!0,"idle"===this.state)return;this.resolveFinishedPromise(),this.updateFinishedPromise();let{resolved:e}=this;if(!e)return;let{animation:t,keyframes:n,duration:r,type:s,ease:o,times:a}=e;if("idle"===t.playState||"finished"===t.playState)return;if(this.time){let{motionValue:e,onUpdate:t,onComplete:l,element:u,...h}=this.options,c=new ef({...h,keyframes:n,duration:r,type:s,ease:o,times:a,isGenerator:!0}),d=(0,i.f)(this.time);e.setWithVelocity(c.sample(d-10).value,c.sample(d).value,10)}let{onStop:l}=this.options;l&&l(),this.cancel()}complete(){let{resolved:e}=this;e&&e.animation.finish()}cancel(){let{resolved:e}=this;e&&e.animation.cancel()}static supports(e){let{motionValue:t,name:n,repeatDelay:r,repeatType:i,damping:s,type:o}=e;if(!t||!t.owner||!(t.owner.current instanceof HTMLElement))return!1;let{onUpdate:a,transformTemplate:l}=t.owner.getProps();return em()&&n&&ep.has(n)&&!a&&!l&&!r&&"mirror"!==i&&0!==s&&"inertia"!==o}}var ev=n(5615);let e_={type:"spring",stiffness:500,damping:25,restSpeed:10},ew={type:"keyframes",duration:.8},eb={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},eE=(e,t,n,l={},u,h)=>c=>{let d=(0,r.rU)(l,e)||{},f=d.delay||l.delay||0,{elapsed:p=0}=l;p-=(0,i.f)(f);let m={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:t.getVelocity(),...d,delay:-p,onUpdate:e=>{t.set(e),d.onUpdate&&d.onUpdate(e)},onComplete:()=>{c(),d.onComplete&&d.onComplete()},name:e,motionValue:t,element:h?void 0:u};!function({when:e,delay:t,delayChildren:n,staggerChildren:r,staggerDirection:i,repeat:s,repeatType:o,repeatDelay:a,from:l,elapsed:u,...h}){return!!Object.keys(h).length}(d)&&(m={...m,...((e,{keyframes:t})=>t.length>2?ew:ev.f.has(e)?e.startsWith("scale")?{type:"spring",stiffness:550,damping:0===t[1]?2*Math.sqrt(550):30,restSpeed:10}:e_:eb)(e,m)}),m.duration&&(m.duration=(0,i.f)(m.duration)),m.repeatDelay&&(m.repeatDelay=(0,i.f)(m.repeatDelay)),void 0!==m.from&&(m.keyframes[0]=m.from);let g=!1;if(!1!==m.type&&(0!==m.duration||m.repeatDelay)||(m.duration=0,0===m.delay&&(g=!0)),(a.current||o.W.skipAnimations)&&(g=!0,m.duration=0,m.delay=0),g&&!h&&void 0!==t.get()){let e=C(m.keyframes,d);if(void 0!==e)return s.Gt.update(()=>{m.onUpdate(e),m.onComplete()}),new r.P6([])}return!h&&ey.supports(m)?new ey(m):new ef(m)}},2935:e=>{!function(){var t={229:function(e){var t,n,r,i=e.exports={};function s(){throw Error("setTimeout has not been defined")}function o(){throw Error("clearTimeout has not been defined")}try{t="function"==typeof setTimeout?setTimeout:s}catch(e){t=s}try{n="function"==typeof clearTimeout?clearTimeout:o}catch(e){n=o}function a(e){if(t===setTimeout)return setTimeout(e,0);if((t===s||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}var l=[],u=!1,h=-1;function c(){u&&r&&(u=!1,r.length?l=r.concat(l):h=-1,l.length&&d())}function d(){if(!u){var e=a(c);u=!0;for(var t=l.length;t;){for(r=l,l=[];++h<t;)r&&r[h].run();h=-1,t=l.length}r=null,u=!1,function(e){if(n===clearTimeout)return clearTimeout(e);if((n===o||!n)&&clearTimeout)return n=clearTimeout,clearTimeout(e);try{n(e)}catch(t){try{return n.call(null,e)}catch(t){return n.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function p(){}i.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||a(d)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=p,i.addListener=p,i.once=p,i.off=p,i.removeListener=p,i.removeAllListeners=p,i.emit=p,i.prependListener=p,i.prependOnceListener=p,i.listeners=function(e){return[]},i.binding=function(e){throw Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw Error("process.chdir is not supported")},i.umask=function(){return 0}}},n={};function r(e){var i=n[e];if(void 0!==i)return i.exports;var s=n[e]={exports:{}},o=!0;try{t[e](s,s.exports,r),o=!1}finally{o&&delete n[e]}return s.exports}r.ab="//",e.exports=r(229)}()},3058:(e,t,n)=>{"use strict";n.d(t,{G:()=>r});let r=e=>t=>1-e(1-t)}
1,3152:(e,t,n)=>{"use strict";var r=n(8619);function i(){}function s(){}s.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,s,o){if(o!==r){var a=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:s,resetWarningCache:i};return n.PropTypes=n,n}},3200:(e,t,n)=>{"use strict";n.d(t,{p:()=>l});var r=n(8623),i=n(315);let s=new Set(["brightness","contrast","saturate","opacity"]);function o(e){let[t,n]=e.slice(0,-1).split("(");if("drop-shadow"===t)return e;let[r]=n.match(i.S)||[];if(!r)return e;let o=n.replace(r,""),a=+!!s.has(t);return r!==n&&(a*=100),t+"("+a+o+")"}let a=/\b([a-z-]*)\(.*?\)/gu,l={...r.f,getAnimatableNone:e=>{let t=e.match(a);return t?t.map(o).join(" "):e}}},3202:(e,t,n)=>{"use strict";n.d(t,{U:()=>o});var r=n(9583),i=n(2599),s=n(6311);function o(e,t){let{transitionEnd:n={},transition:o={},...a}=(0,s.K)(e,t)||{};for(let t in a={...a,...n}){let n=(0,r.K)(a[t]);e.hasValue(t)?e.getValue(t).set(n):e.addValue(t,(0,i.OQ)(n))}}},3279:(e,t,n)=>{"use strict";var r;n.d(t,{$b:()=>r,Vy:()=>u});let i=[];!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(r||(r={}));let s={debug:r.DEBUG,verbose:r.VERBOSE,info:r.INFO,warn:r.WARN,error:r.ERROR,silent:r.SILENT},o=r.INFO,a={[r.DEBUG]:"log",[r.VERBOSE]:"log",[r.INFO]:"info",[r.WARN]:"warn",[r.ERROR]:"error"},l=(e,t,...n)=>{if(t<e.logLevel)return;let r=new Date().toISOString(),i=a[t];if(i)console[i](`[${r}] ${e.name}:`,...n);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class u{constructor(e){this.name=e,this._logLevel=o,this._logHandler=l,this._userLogHandler=null,i.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in r))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?s[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,r.DEBUG,...e),this._logHandler(this,r.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,r.VERBOSE,...e),this._logHandler(this,r.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,r.INFO,...e),this._logHandler(this,r.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,r.WARN,...e),this._logHandler(this,r.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,r.ERROR,...e),this._logHandler(this,r.ERROR,...e)}}},3356:(e,t,n)=>{"use strict";function r(){throw Object.defineProperty(Error("`unauthorized()` is experimental and only allowed to be used when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E411",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unauthorized",{enumerable:!0,get:function(){return r}}),n(6695).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3432:(e,t,n)=>{"use strict";n.d(t,{T:()=>o,n:()=>a});var r=n(7610),i=n(6811),s=n(2727);let o=[r.ai,i.px,i.KN,i.uj,i.vw,i.vh,{test:e=>"auto"===e,parse:e=>e}],a=e=>o.find((0,s.w)(e))},3506:(e,t,n)=>{"use strict";n.d(t,{u:()=>i});var r=n(179);let i={test:(0,n(3511).$)("#"),parse:function(e){let t="",n="",r="",i="";return e.length>5?(t=e.substring(1,3),n=e.substring(3,5),r=e.substring(5,7),i=e.substring(7,9)):(t=e.substring(1,2),n=e.substring(2,3),r=e.substring(3,4),i=e.substring(4,5),t+=t,n+=n,r+=r,i+=i),{red:parseInt(t,16),green:parseInt(n,16),blue:parseInt(r,16),alph
1a:i?parseInt(i,16)/255:1}},transform:r.B.transform}},3511:(e,t,n)=>{"use strict";n.d(t,{$:()=>s,q:()=>o});var r=n(315);let i=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,s=(e,t)=>n=>!!("string"==typeof n&&i.test(n)&&n.startsWith(e)||t&&null!=n&&Object.prototype.hasOwnProperty.call(n,t)),o=(e,t,n)=>i=>{if("string"!=typeof i)return i;let[s,o,a,l]=i.match(r.S);return{[e]:parseFloat(s),[t]:parseFloat(o),[n]:parseFloat(a),alpha:void 0!==l?parseFloat(l):1}}},3573:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{UnrecognizedActionError:function(){return n},unstable_isUnrecognizedActionError:function(){return r}});class n extends Error{constructor(...e){super(...e),this.name="UnrecognizedActionError"}}function r(e){return!!(e&&"object"==typeof e&&e instanceof n)}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},3685:(e,t)=>{t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,l=(1<<a)-1,u=l>>1,h=-7,c=n?i-1:0,d=n?-1:1,f=e[t+c];for(c+=d,s=f&(1<<-h)-1,f>>=-h,h+=a;h>0;s=256*s+e[t+c],c+=d,h-=8);for(o=s&(1<<-h)-1,s>>=-h,h+=r;h>0;o=256*o+e[t+c],c+=d,h-=8);if(0===s)s=1-u;else{if(s===l)return o?NaN:1/0*(f?-1:1);o+=Math.pow(2,r),s-=u}return(f?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,l,u=8*s-i-1,h=(1<<u)-1,c=h>>1,d=5960464477539062e-23*(23===i),f=r?0:s-1,p=r?1:-1,m=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),o=h):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+c>=1?t+=d/l:t+=d*Math.pow(2,1-c),t*l>=2&&(o++,l/=2),o+c>=h?(a=0,o=h):o+c>=1?(a=(t*l-1)*Math.pow(2,i),o+=c):(a=t*Math.pow(2,c-1)*Math.pow(2,i),o=0));i>=8;e[n+f]=255&a,f+=p,a/=256,i-=8);for(o=o<<i|a,u+=i;u>0;e[n+f]=255&o,f+=p,o/=256,u-=8);e[n+f-p]|=128*m}},3822:(e,t,n)=>{e.exports=n(771)},4296:(e,t,n)=>{"use strict";n.d(t,{KJ:()=>y,Q0:()=>l,QB:()=>f,SG:()=>v,Vn:()=>g,WX:()=>m,XB:()=>u,Xe:()=>p,aH:()=>d,n6:()=>w,pD:()=>h,pF:()=>_,s5:()=>c});var r=n(3798),i=n(1462),s=n(6245),o=n.n(s);let a=(e,t)=>{let n=(0,i.memo)(t=>{let{className:n="w-6 h-6",role:i="img",focusable:s=!1,"aria-hidden":a=!0,alt:l="",...u}=t;return(0,r.jsx)(o(),{src:e,className:n,role:i,width:24,height:24,"aria-hidden":a,focusable:s.toString(),alt:l,...u})});return n.displayName=t,n};a("/svgs/aasb.svg","AASB");let l=a("/svgs/alexgrey.svg","AlexGrey");a("/svgs/angelfourtwenty.svg","AngelFourTwenty");let u=a("/svgs/arcade.svg","Arcade");a("/svgs/arrowDown.svg","ArrowDown"),a("/svgs/arrowDown.svg","Down"),a("/svgs/arrowLeft.svg","ArrowLeft"),a("/svgs
1/atomadventure.svg","AtomAdventure"),a("/svgs/book.svg","Book"),a("/svgs/bookspine.svg","BookSpine"),a("/svgs/compass.svg","Compass"),a("/svgs/crown.svg","Crown"),a("/svgs/flowerlife.svg","FlowerLife"),a("/svgs/home.svg","Home"),a("/svgs/horus.svg","Horus"),a("/svgs/interactive-library.svg","InteractiveLibrary");let h=a("/svgs/gift.svg","Gift");a("/svgs/laboratory.svg","Laboratory");let c=a("/svgs/LawOfBecoming.svg","LawOfBecoming");a("/svgs/library.svg","Library");let d=a("/svgs/loader.svg","Loader");a("/svgs/max.svg","Max"),a("/svgs/mentalmap.svg","MentalMap"),a("/svgs/menu.svg","Menu");let f=a("/svgs/message.svg","Message");a("/svgs/mferra.svg","MFerra"),a("/svgs/min.svg","Min"),a("/svgs/multi-display-tv.svg","MultiDisplayTv"),a("/svgs/mystical-arcade.svg","MysticalArcade"),a("/svgs/mystical-arrow-left.svg","MysticalArrowLeft"),a("/svgs/mystical-chevron-down.svg","MysticalChevronDown"),a("/svgs/mystical-compass.svg","MysticalCompass"),a("/svgs/mystical-home.svg","MysticalHome"),a("/svgs/mystical-laboratory.svg","MysticalLaboratory"),a("/svgs/mystical-loader.svg","MysticalLoader"),a("/svgs
1/mystical-maximize.svg","MysticalMaximize"),a("/svgs/mystical-message.svg","MysticalMessage"),a("/svgs/mystical-minimize.svg","MysticalMinimize"),a("/svgs/mystical-send.svg","MysticalSend");let p=a("/svgs/mystical-x.svg","MysticalX");a("/svgs/mystical-zoom-in.svg","MysticalZoomIn"),a("/svgs/mystical-zoom-out.svg","MysticalZoomOut");let m=a("/svgs/purchased.svg","Purchased");a("/svgs/qc.svg","QC"),a("/svgs/quizback.svg","QuizBack"),a("/svgs/ra.svg","Ra"),a("/svgs/robo.svg","Robo"),a("/svgs/sectionback.svg","SectionBack"),a("/svgs/share.svg","Share");let g=a("/svgs/send.svg","Send");a("/svgs/starynight.svg","StaryNight"),a("/svgs/Superposition.svg","Superposition"),a("/svgs/tv.svg","Tv");let y=a("/svgs/user.svg","User"),v=a("/svgs/wateradventure.svg","WaterAdventure");a("/svgs/YinYang.svg","YinYang"),a("/svgs/x.svg","X"),a("/svgs/zoomIn.svg","ZoomIn"),a("/svgs/zoomOut.svg","ZoomOut");let _=a("/svgs/apple/closed.min.svg","AppleClosed");a("/svgs/apple/closed.svg","Closed");let w=a("/svgs/apple/open.min.svg","AppleOpen");a("/svgs/apple/open.svg","Open"),a("/svgs/mountains.min.svg","MountainsMin"),a("/svgs/mountains.svg","Mountains"),a("/svgs/River.svg","River")},4319:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return i}});let r=n(1462);function i(e,t){let n=(0,r.useRef)(null),i=(0,r.useRef)(null);return(0,r.useCallback)(r=>{if(null===r){let e=n.current;e&&(n.current=null,e());let t=i.current;t&&(i.current=null,t())}else e&&(n.current=s(e,r)),t&&(i.current=s(t,r))},[e,t])}function s(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let n=e(t);return"function"==typeof n?n:()=>e(null)}}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},4392:(e,t)=>{"use strict";function n(e){var t;let{config:n,src:r,width:i,quality:s}=e,o=s||(null==(t=n.qualities)?void 0:t.reduce((e,t)=>Math.abs(t-75)<Math.abs(e-75)?t:e))||75;return n.path+"?url="+encodeURIComponent(r)+"&w="+i+"&q="+o+(r.startsWith("/_next/static/media/"),"")}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return r}}),n.__next_img_default=!0;let r=n},4447:e=>{"use strict";e.exports=JSON.parse('{"books":[{"id":"robot-rics-river-exploration","title":"Robot Ric\'s River Exploration","slug":"robot-rics-river-exploration","cover":"/Marketing/Logo/logo.webp","plug":"/robot-rics-river-exploration/4.webp","TOTAL_PAGES":44,"description":"Join Robot Ric on his thrilling river Exploration!","fullDescription":"In \'Robot Ric\'s River Exploration\', our waterproof hero embarks on an exciting journey down a mighty river. Along the way, Ric learns valuable lessons about friendship, perseverance, and the true meaning of being human. This captivating tale combines Exploration with important life lessons, making it perfect for young readers and robot enthusiasts alike!","price":"1.00","currency":"USD","background":"/River.svg","canvaUrl":"https://www.canva.com/design/DAGMExtjRBA/8xiX2uWMrpDfKYeFJ6KEOQ/view","canvaUrlMobile":"https://www.canva.com/design/DAGMEW30UdM/8c8KZhUig7PrcCjsZA6VWQ/view","released":true,"video":"/Adventures/RRR/video.mp4","keywords":"","mobilePath":"/robot-rics-river-exploration/mobile/","desktopPath":"/robot-rics-river-exploration/desktop/","authorNote":"I wrote Robot Ric\'s River Exploration to tell a fun tale about a robot going down a river but as I began writing I realized i was much like the robot I was born into this world with no clear purpose, a curiosity of the world around me and a current of time that pushes us along the river just like the robot I learned I needed to have fun to fully map out , survive and most importantly Thrive in the river of time!","PurchaseForm":{"terms":"Embarking on this River Exploration You Agree to the following Terms and Conditions","header":"Ride the Radiant Rapids","label":"Explorers Emails","priceText":"Secure Your Exploration","email":"[email protected]"}}]}')},4571:(e,t,n)=>{"use strict";n.d(t,{F:()=>i});let r=(e,t)=>n=>t(e(n)),i=(...e)=>e.reduce(r)},4586:(e,t,n)=>{"use strict";n.d(t,{nD:()=>nK,As:()=>nG,eu:()=>t_,$n:()=>tR,Zp:()=>t0,bw:()=>t2,wL:()=>t3,aR:()=>t1,pd:()=>nC,aF:()=>nc,Ap:()=>n8,oz:()=>n_,tU:()=>nw});var r=n(1462);function i(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}var s=n(3798),o=function(){return(o=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};Object.create;function a(e,t,n){if(n||2==arguments.length)for(var r,i=0,s=t.length;i<s;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}Object.create,"function"==typeof SuppressedError&&SuppressedError;var l=n(35),u=n.n(l),h="-ms-",c="-moz-",d="-webkit-",f="comm",p="rule",m="decl",g="@keyframes",y=Math.abs,v=String.fromCharCode,_=Object.assign;function w(e,t){return(e=t.exec(e))?e[0]:e}function b(e,t,n){return e.replace(t,n)}function E(e,t,n){return e.indexOf(t,n)}function T(e,t){return 0|e.charCodeAt(t)}function S(e,t,n){return e.slice(t,n)}function C(e){return e.length}function I(e,t){return t.push(e),e}function x(e,t){return e.filter(function(e){return!w(e,t)})}var A=1,k=1,R=0,P=0,N=0,O="";function D(e,t,n,r,i,s,o,a){return{value:e,root:t,parent:n,type:r,props:i,children:s,line:A,column:k,length:o,return:"",siblings:a}}function L(e,t){return _(D("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function M(e){for(;e.root;)e=L(e.root,{children:[e]});I(e,e.siblings)}function j(){return N=P<R?T(O,P++):0,k++,10===N&&(k=1,A++),N}function F(){return T(O,P)}function U(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function V(e){var t,n;return(t=P-1,n=function e(t){for(;j();)switch(N){case t:return P;case 34:case 39:34!==t&&39!==t&&e(N);break;case 40:41===t&&e(t);break;case 92:j()}return P}(91===e?e+2:40===e?e+1:e),S(O,t,n)).trim()}function B(e,t){for(var n="",r=0;r<e.length;r++)n+=t(e[r],r,e,t)||"";return n}function q(e,t,n,r){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case m:return e.return=e.return||e.value;case f:return"";case g:return e.return=e.value+"{"+B(e.children,r)+"}";case p:if(!C(e.value=e.props.join(",")))return""}return C(n=B(e.children,r))?e.return=e.value+"{"+n+"}":""}function $(e,t,n,r){if(e.length>-1&&!e.return)switch(e.type){case m:e.return=function e(t,n,r){var i;switch(i=n,45^T(t,0)?(((i<<2^T(t,0))<<2^T(t,1))<<2^T(t,2))<<2^T(t,3):0){case 5103:return d+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return d+t+t;case 4789:return c+t+t;
vendor: 14,007 bytes, line 1
1case 5349:case 4246:case 4810:case 6968:case 2756:return d+t+c+t+h+t+t;case 5936:switch(T(t,n+11)){case 114:return d+t+h+b(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return d+t+h+b(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return d+t+h+b(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return d+t+h+t+t;case 6165:return d+t+h+"flex-"+t+t;case 5187:return d+t+b(t,/(\w+).+(:[^]+)/,d+"box-$1$2"+h+"flex-$1$2")+t;case 5443:return d+t+h+"flex-item-"+b(t,/flex-|-self/g,"")+(w(t,/flex-|baseline/)?"":h+"grid-row-"+b(t,/flex-|-self/g,""))+t;case 4675:return d+t+h+"flex-line-pack"+b(t,/align-content|flex-|-self/g,"")+t;case 5548:return d+t+h+b(t,"shrink","negative")+t;case 5292:return d+t+h+b(t,"basis","preferred-size")+t;case 6060:return d+"box-"+b(t,"-grow","")+d+t+h+b(t,"grow","positive")+t;case 4554:return d+b(t,/([^-])(transform)/g,"$1"+d+"$2")+t;case 6187:return b(b(b(t,/(zoom-|grab)/,d+"$1"),/(image-set)/,d+"$1"),t,"")+t;case 5495:case 3959:return b(t,/(image-set\([^]*)/,d+"$1$`$1");case 4968:return b(b(t,/(.+:)(flex-)?(.*)/,d+"box-pack:$3"+h+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+d+t+t;case 4200:if(!w(t,/flex-|baseline/))return h+"grid-column-align"+S(t,n)+t;break;case 2592:case 3360:return h+b(t,"template-","")+t;case 4384:case 3616:if(r&&r.some(function(e,t){return n=t,w(e.props,/grid-\w+-end/)}))return~E(t+(r=r[n].value),"span",0)?t:h+b(t,"-start","")+t+h+"grid-row-span:"+(~E(r,"span",0)?w(r,/\d+/):w(r,/\d+/)-w(t,/\d+/))+";";return h+b(t,"-start","")+t;case 4896:case 4128:return r&&r.some(function(e){return w(e.props,/grid-\w+-start/)})?t:h+b(b(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return b(t,/(.+)-inline(.+)/,d+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(C(t)-1-n>6)switch(T(t,n+1)){case 109:if(45!==T(t,n+4))break;case 102:return b(t,/(.+:)(.+)-([^]+)/,"$1"+d+"$2-$3$1"+c+(108==T(t,n+3)?"$3":"$2-$3"))+t;case 115:return~E(t,"stretch",0)?e(b(t,"stretch","fill-available"),n,r)+t:t}break;case 5152:case 5920:return b(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(e,n,r,i,s,o,a){return h+n+":"+r+a+(i?h+n+"-span:"+(s?o:o-r)+a:"")+t});case 4949:if(121===T(t,n+6))return b(t,":",":"+d)+t;break;case 6444:switch(T(t,45===T(t,14)?18:11)){case 120:return b(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+d+(45===T(t,14)?"inline-":"")+"box$3$1"+d+"$2$3$1"+h+"$2box$3")+t;case 100:return b(t,":",":"+h)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return b(t,"scroll-","scroll-snap-")+t}return t}(e.value,e.length,n);return;case g:return B([L(e,{value:b(e.value,"@","@"+d)})],r);case p:if(e.length){var i,s;return i=n=e.props,s=function(t){switch(w(t,r=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":M(L(e,{props:[b(t,/:(read-\w+)/,":"+c+"$1")]})),M(L(e,{props:[t]})),_(e,{props:x(n,r)});break;case"::placeholder":M(L(e,{props:[b(t,/:(plac\w+)/,":"+d+"input-$1")]})),M(L(e,{props:[b(t,/:(plac\w+)/,":"+c+"$1")]})),M(L(e,{props:[b(t,/:(plac\w+)/,h+"input-$1")]})),M(L(e,{props:[t]})),_(e,{props:x(n,r)})}return""},i.map(s).join("")}}}function z(e,t,n,r,i,s,o,a,l,u,h,c){for(var d=i-1,f=0===i?s:[""],m=f.length,g=0,v=0,_=0;g<r;++g)for(var w=0,E=S(e,d+1,d=y(v=o[g])),T=e;w<m;++w)(T=(v>0?f[w]+" "+E:b(E,/&\f/g,f[w])).trim())&&(l[_++]=T);return D(e,t,n,0===i?p:a,l,u,h,c)}function W(e,t,n,r,i){return D(e,t,n,m,S(e,0,r),S(e,r+1,-1),r,i)}var H={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},G=n(7706),K=void 0!==G&&void 0!==G.env&&(G.env.REACT_APP_SC_ATTR||G.env.SC_ATTR)||"data-styled",Y="active",Q="data-styled-version",X="6.1.19",J="/*!sc*/\n",Z="undefined"!=typeof window&&"undefined"!=typeof document,ee=!!("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:void 0!==G&&void 0!==G.env&&void 0!==G.env.REACT_APP_SC_DISABLE_SPEEDY&&""!==G.env.REACT_APP_SC_DISABLE_SPEEDY?"false"!==G.env.REACT_APP_SC_DISABLE_SPEEDY&&G.env.REACT_APP_SC_DISABLE_SPEEDY:void 0!==G&&void 0!==G.env&&void 0!==G.env.SC_DISABLE_SPEEDY&&""!==G.env.SC_DISABLE_SPEEDY&&"false"!==G.env.SC_DISABLE_SPEEDY&&G.env.SC_DISABLE_SPEEDY),et=Object.freeze([]),en=Object.freeze({}),er=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track","u","ul","use","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","tspan"]),ei=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,es=/(^-|-$)/g;function eo(e){return e.replace(ei,"-").replace(es,"")}var ea=/(a)(d)/gi,el=function(e){return String.fromCharCode(e+(e>25?39:97))};function eu(e){var t,n="";for(t=Math.abs(e);t>52;t=t/52|0)n=el(t%52)+n;return(el(t%52)+n).replace(ea,"$1-$2")}var eh,ec=function(e,t){for(var n=t.length;n;)e=33*e^t.charCodeAt(--n);return e},ed=function(e){return ec(5381,e)};function ef(e){return"string"==typeof e}var ep="function"==typeof Symbol&&Symbol.for,em=ep?Symbol.for("react.memo"):60115,eg=ep?Symbol.for("react.forward_ref"):60112,ey={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},ev={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},e_={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},ew=((eh={})[eg]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},eh[em]=e_,eh);function eb(e){return("type"in e&&e.type.$$typeof)===em?e_:"$$typeof"in e?ew[e.$$typeof]:ey}var eE=Object.defineProperty,eT=Object.getOwnPropertyNames,eS=Object.getOwnPropertySymbols,eC=Object.getOwnPropertyDescriptor,eI=Object.getPrototypeOf,ex=Object.prototype;function eA(e){return"function"==typeof e}function ek(e){return"object"==typeof e&&"styledComponentId"in e}function eR(e,t){return e&&t?"".concat(e," ").concat(t):e||t||""}function eP(e,t){if(0===e.length)return"";for(var n=e[0],r=1;r<e.length;r++)n+=t?t+e[r]:e[r];return n}function eN(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function eO(e,t){Object.defineProperty(e,"toString",{value:t})}function eD(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(e," for more information.").concat(t.length>0?" Args: ".concat(t.join(", ")):""))}var eL=function(){function e(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e}return e.prototype.indexOfGroup=function(e){for(var t=0,n=0;n<e;n++)t+=this.groupSizes[n];return t},e.prototype.insertRules=function(e,t){if(e>=this.groupSizes.length){for(var n=this.groupSizes,r=n.length,i=r;e>=i;)if((i<<=1)<0)throw eD(16,"".concat(e));this.groupSizes=new Uint32Array(i),this.groupSizes.set(n),this.length=i;for(var s=r;s<i;s++)this.groupSizes[s]=0}for(var o=this.indexOfGroup(e+1),a=(s=0,t.length);s<a;s++)this.tag.insertRule(o,t[s])&&(this.groupSizes[e]++,o++)},e.prototype.clearGroup=function(e){if(e<this.length){var t=this.groupSizes[e],n=this.indexOfGroup(e),r=n+t;this.groupSizes[e]=0;for(var i=n;i<r;i++)this.tag.deleteRule(n)}},e.prototype.getGroup=function(e){var t="";if(e>=this.length||0===this.groupSizes[e])return t;for(var n=this.groupSizes[e],r=this.indexOfGroup(e),i=r+n,s=r;s<i;s++)t+="".concat(this.tag.getRule(s)).concat(J);return t},e}(),eM=new Map,ej=new Map,eF=1,eU=function(e){if(eM.has(e))return eM.get(e);for(;ej.has(eF);)eF++;var t=eF++;return eM.set(e,t),ej.set(t,e),t},eV=function(e,t){eF=t+1,eM.set(e,t),ej.set(t,e)},eB="style[".concat(K,"][").concat(Q,'="').concat(X,'"]'),eq=new RegExp("^".concat(K,'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)')),e$=function(e,t,n){for(var r,i=n.split(","),s=0,o=i.length;s<o;s++)(r=i[s])&&e.registerName(t,r)},ez=function(e,t){for(var n,r=(null!=(n=t.textContent)?n:"").split(J),i=[],s=0,o=r.length;s<o;s++){var a=r[s].trim();if(a){var l=a.match(eq);if(l){var u=0|parseInt(l[1],10),h=l[2];0!==u&&(eV(h,u),e$(e,h,l[3]),e.getTag().insertRules(u,i)),i.length=0}else i.push(a)}}},eW=function(e){for(var t=document.querySelectorAll(eB),n=0,r=t.length;n<r;n++){var i=t[n];i&&i.getAttribute(K)!==Y&&(ez(e,i),i.parentNode&&i.parentNode.removeChild(i))}},eH=function(e){var t,r=document.head,i=e||r,s=document.createElement("style"),o=(t=Array.from(i.querySelectorAll("style[".concat(K,"]"))))[t.length-1],a=void 0!==o?o.nextSibling:null;s.setAttribute(K,Y),s.setAttribute(Q,X);var l=n.nc;return l&&s.setAttribute("nonce",l),i.insertBefore(s,a),s},eG=function(){function e(e){this.element=eH(e),this.element.appendChild(document.createTextNode("")),this.sheet=function(e){if(e.sheet)return e.sheet;for(var t=document.styleSheets,n=0,r=t.length;n<r;n++){var i=t[n];if(i.ownerNode===e)return i}throw eD(17)}(this.element),this.length=0}return e.prototype.insertRule=function(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}},e.prototype.deleteRule=function(e){this.sheet.deleteRule(e),this.length--},e.prototype.getRule=function(e){var t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""},e}(),eK=function(){function e(e){this.element=eH(e),this.nodes=this.element.childNodes,this.length=0}return e.prototype.insertRule=function(e,t){if(e<=this.length&&e>=0){var n=document.createTextNode(t);return this.element.insertBefore(n,this.nodes[e]||null),this.length++,!0}return!1},e.prototype.deleteRule=function(e){this.element.removeChild(this.nodes[e]),this.length--},e.prototype.getRule=function(e){return e<this.length?this.nodes[e].textContent:""},e}(),eY=function(){function e(e){this.rules=[],this.length=0}return e.prototype.insertRule=function(e,t){return e<=this.length&&(this.rules.splice(e,0,t),this.length++,!0)},e.prototype.deleteRule=function(e){this.rules.splice(e,1),this.length--},e.prototype.getRule=function(e){return e<this.length?this.rules[e]:""},e}(),eQ=Z,eX={isServer:!Z,useCSSOMInjection:!ee},eJ=function(){function e(e,t,n){void 0===e&&(e=en),void 0===t&&(t={});var r=this;this.options=o(o({},eX),e),this.gs=t,this.names=new Map(n),this.server=!!e.isServer,!this.server&&Z&&eQ&&(eQ=!1,eW(this)),eO(this,function(){for(var e=r.getTag(),t=e.length,n="",i=0;i<t;i++)!function(t){var i=ej.get(t);if(void 0===i)return;var s=r.names.get(i),o=e.getGroup(t);if(void 0!==s&&s.size&&0!==o.length){var a="".concat(K,".g").concat(t,'[id="').concat(i,'"]'),l="";void 0!==s&&s.forEach(function(e){e.length>0&&(l+="".concat(e,","))}),n+="".concat(o).concat(a,'{content:"').concat(l,'"}').concat(J)}}(i);return n})}return e.registerId=function(e){return eU(e)},e.prototype.rehydrate=function(){!this.server&&Z&&eW(this)},e.prototype.reconstructWithOptions=function(t,n){return void 0===n&&(n=!0),new e(o(o({},this.options),t),this.gs,n&&this.names||void 0)},e.prototype.allocateGSInstance=function(e){return this.gs[e]=(this.gs[e]||0)+1},e.prototype.getTag=function(){var e,t,n;return this.tag||(this.tag=(t=(e=this.options).useCSSOMInjection,n=e.target,new eL(e.isServer?new eY(n):t?new eG(n):new eK(n))))},e.prototype.hasNameForId=function(e,t){return this.names.has(e)&&this.names.get(e).has(t)},e.prototype.registerName=function(e,t){if(eU(e),this.names.has(e))this.names.get(e).add(t);else{var n=new Set;n.add(t),this.names.set(e,n)}},e.prototype.insertRules=function(e,t,n){this.registerName(e,t),this.getTag().insertRules(eU(e),n)},e.prototype.clearNames=function(e){this.names.has(e)&&this.names.get(e).clear()},e.prototype.clearRules=function(e){this.getTag().clearGroup(eU(e)),this.clearNames(e)},e.prototype.clearTag=function(){this.tag=void 0},e}(),eZ=/&/g,e0=/^\s*\/\/.*$/gm;function e1(e){var t,n,r,i=void 0===e?en:e,s=i.options,o=void 0===s?en:s,a=i.plugins,l=void 0===a?et:a,u=function(e,r,i){return i.startsWith(n)&&i.endsWith(n)&&i.replaceAll(n,"").length>0?".".concat(t):e},h=l.slice();h.push(function(e){e.type===p&&e.value.includes("&")&&(e.props[0]=e.props[0].replace(eZ,n).replace(r,u))}),o.prefix&&h.push($),h.push(q);var c=function(e,i,s,a){void 0===i&&(i=""),void 0===s&&(s=""),void 0===a&&(a="&"),t=a,n=i,r=RegExp("\\".concat(n,"\\b"),"g");var l,u,c,d,p,m,g=e.replace(e0,""),_=(p=function e(t,n,r,i,s,o,a,l,u){for(var h,c,d,p,m=0,g=0,_=a,w=0,x=0,R=0,L=1,M=1,B=1,q=0,$="",H=s,G=o,K=i,Y=$;M;)switch(R=q,q=j()){case 40:if(108!=R&&58==T(Y,_-1)){-1!=E(Y+=b(V(q),"&","&\f"),"&\f",y(m?l[m-1]:0))&&(B=-1);break}case 34:case 39:case 91:Y+=V(q);break;case 9:case 10:case 13:case 32:Y+=function(e){for(;N=F();)if(N<33)j();else break;return U(e)>2||U(N)>3?"":" "}(R);break;case 92:Y+=function(e,t){for(var n;--t&&j()&&!(N<48)&&!(N>102)&&(!(N>57)||!(N<65))&&(!(N>
170)||!(N<97)););return n=P+(t<6&&32==F()&&32==j()),S(O,e,n)}(P-1,7);continue;case 47:switch(F()){case 42:case 47:I((h=function(e,t){for(;j();)if(e+N===57)break;else if(e+N===84&&47===F())break;return"/*"+S(O,t,P-1)+"*"+v(47===e?e:j())}(j(),P),c=n,d=r,p=u,D(h,c,d,f,v(N),S(h,2,-2),0,p)),u);break;default:Y+="/"}break;case 123*L:l[m++]=C(Y)*B;case 125*L:case 59:case 0:switch(q){case 0:case 125:M=0;case 59+g:-1==B&&(Y=b(Y,/\f/g,"")),x>0&&C(Y)-_&&I(x>32?W(Y+";",i,r,_-1,u):W(b(Y," ","")+";",i,r,_-2,u),u);break;case 59:Y+=";";default:if(I(K=z(Y,n,r,m,g,s,l,$,H=[],G=[],_,o),o),123===q)if(0===g)e(Y,n,K,K,H,o,_,l,G);else switch(99===w&&110===T(Y,3)?100:w){case 100:case 108:case 109:case 115:e(t,K,K,i&&I(z(t,K,K,0,0,s,l,$,s,H=[],_,G),G),s,G,_,l,i?H:G);break;default:e(Y,K,K,K,[""],G,0,l,G)}}m=g=x=0,L=B=1,$=Y="",_=a;break;case 58:_=1+C(Y),x=R;default:if(L<1){if(123==q)--L;else if(125==q&&0==L++&&125==(N=P>0?T(O,--P):0,k--,10===N&&(k=1,A--),N))continue}switch(Y+=v(q),q*L){case 38:B=g>0?1:(Y+="\f",-1);break;case 44:l[m++]=(C(Y)-1)*B,B=1;break;case 64:45===F()&&(Y+=V(j())),w=F(),g=_=C($=Y+=function(e){for(;!U(F());)j();return S(O,e,P)}(P)),q++;break;case 45:45===R&&2==C(Y)&&(L=0)}}return o}("",null,null,null,[""],(d=c=s||i?"".concat(s," ").concat(i," { ").concat(g," }"):g,A=k=1,R=C(O=d),P=0,c=[]),0,[0],c),O="",p);o.namespace&&(_=function e(t,n){return t.map(function(t){return"rule"===t.type&&(t.value="".concat(n," ").concat(t.value),t.value=t.value.replaceAll(",",",".concat(n," ")),t.props=t.props.map(function(e){return"".concat(n," ").concat(e)})),Array.isArray(t.children)&&"@keyframes"!==t.type&&(t.children=e(t.children,n)),t})}(_,o.namespace));var w=[];return B(_,(u=(l=h.concat((m=function(e){return w.push(e)},function(e){!e.root&&(e=e.return)&&m(e)}))).length,function(e,t,n,r){for(var i="",s=0;s<u;s++)i+=l[s](e,t,n,r)||"";return i})),w};return c.hash=l.length?l.reduce(function(e,t){return t.name||eD(15),ec(e,t.name)},5381).toString():"",c}var e2=new eJ,e3=e1(),e5=r.createContext({shouldForwardProp:void 0,styleSheet:e2,stylis:e3}),e6=(e5.Consumer,r.createContext(void 0));function e4(){return(0,r.useContext)(e5)}function e8(e){var t=(0,r.useState)(e.stylisPlugins),n=t[0],i=t[1],s=e4().styleSheet,o=(0,r.useMemo)(function(){var t=s;return e.sheet?t=e.sheet:e.target&&(t=t.reconstructWithOptions({target:e.target},!1)),e.disableCSSOMInjection&&(t=t.reconstructWithOptions({useCSSOMInjection:!1})),t},[e.disableCSSOMInjection,e.sheet,e.target,s]),a=(0,r.useMemo)(function(){return e1({options:{namespace:e.namespace,prefix:e.enableVendorPrefixes},plugins:n})},[e.enableVendorPrefixes,e.namespace,n]);(0,r.useEffect)(function(){u()(n,e.stylisPlugins)||i(e.stylisPlugins)},[e.stylisPlugins]);var l=(0,r.useMemo)(function(){return{shouldForwardProp:e.shouldForwardProp,styleSheet:o,stylis:a}},[e.shouldForwardProp,o,a]);return r.createElement(e5.Provider,{value:l},r.createElement(e6.Provider,{value:a},e.children))}var e7=function(){function e(e,t){var n=this;this.inject=function(e,t){void 0===t&&(t=e3);var r=n.name+t.hash;e.hasNameForId(n.id,r)||e.insertRules(n.id,r,t(n.rules,r,"@keyframes"))},this.name=e,this.id="sc-keyframes-".concat(e),this.rules=t,eO(this,function(){throw eD(12,String(n.name))})}return e.prototype.getName=function(e){return void 0===e&&(e=e3),this.name+e.hash},e}();function e9(e){for(var t="",n=0;n<e.length;n++){var r=e[n];if(1===n&&"-"===r&&"-"===e[0])return e;r>="A"&&r<="Z"?t+="-"+r.toLowerCase():t+=r}return t.startsWith("ms-")?"-"+t:t}var te=function(e){return null==e||!1===e||""===e},tt=function(e){var t=[];for(var n in e){var r=e[n];e.hasOwnProperty(n)&&!te(r)&&(Array.isArray(r)&&r.isCss||eA(r)?t.push("".concat(e9(n),":"),r,";"):eN(r)?t.push.apply(t,a(a(["".concat(n," {")],tt(r),!1),["}"],!1)):t.push("".concat(e9(n),": ").concat(null==r||"boolean"==typeof r||""===r?"":"number"!=typeof r||0===r||n in H||n.startsWith("--")?String(r).trim():"".concat(r,"px"),";")))}return t};function tn(e,t,n,r){if(te(e))return[];if(ek(e))return[".".concat(e.styledComponentId)];if(eA(e))return!eA(e)||e.prototype&&e.prototype.isReactComponent||!t?[e]:tn(e(t),t,n,r);return e instanceof e7?n?(e.inject(n,r),[e.getName(r)]):[e]:eN(e)?tt(e):Array.isArray(e)?Array.prototype.concat.apply(et,e.map(function(e){return tn(e,t,n,r)})):[e.toString()]}function tr(e){for(var t=0;t<e.length;t+=1){var n=e[t];if(eA(n)&&!ek(n))return!1}return!0}var ti=ed(X),ts=function(){function e(e,t,n){this.rules=e,this.staticRulesId="",this.isStatic=(void 0===n||n.isStatic)&&tr(e),this.componentId=t,this.baseHash=ec(ti,t),this.baseStyle=n,eJ.registerId(t)}return e.prototype.generateAndInjectStyles=function(e,t,n){var r=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,n
vendor: 4,176 bytes, line 1
1):"";if(this.isStatic&&!n.hash)if(this.staticRulesId&&t.hasNameForId(this.componentId,this.staticRulesId))r=eR(r,this.staticRulesId);else{var i=eP(tn(this.rules,e,t,n)),s=eu(ec(this.baseHash,i)>>>0);if(!t.hasNameForId(this.componentId,s)){var o=n(i,".".concat(s),void 0,this.componentId);t.insertRules(this.componentId,s,o)}r=eR(r,s),this.staticRulesId=s}else{for(var a=ec(this.baseHash,n.hash),l="",u=0;u<this.rules.length;u++){var h=this.rules[u];if("string"==typeof h)l+=h;else if(h){var c=eP(tn(h,e,t,n));a=ec(a,c+u),l+=c}}if(l){var d=eu(a>>>0);t.hasNameForId(this.componentId,d)||t.insertRules(this.componentId,d,n(l,".".concat(d),void 0,this.componentId)),r=eR(r,d)}}return r},e}(),to=r.createContext(void 0);to.Consumer;var ta={};function tl(e,t,n){var i,s,a,l,u=ek(e),h=!ef(e),c=t.attrs,d=void 0===c?et:c,f=t.componentId,p=void 0===f?(i=t.displayName,s=t.parentComponentId,ta[a="string"!=typeof i?"sc":eo(i)]=(ta[a]||0)+1,l="".concat(a,"-").concat(eu(ed(X+a+ta[a])>>>0)),s?"".concat(s,"-").concat(l):l):f,m=t.displayName,g=void 0===m?ef(e)?"styled.".concat(e):"Styled(".concat(e.displayName||e.name||"Component",")"):m,y=t.displayName&&t.componentId?"".concat(eo(t.displayName),"-").concat(t.componentId):t.componentId||p,v=u&&e.attrs?e.attrs.concat(d).filter(Boolean):d,_=t.shouldForwardProp;if(u&&e.shouldForwardProp){var w=e.shouldForwardProp;if(t.shouldForwardProp){var b=t.shouldForwardProp;_=function(e,t){return w(e,t)&&b(e,t)}}else _=w}var E=new ts(n,y,u?e.componentStyle:void 0);function T(e,t){return function(e,t,n){var i,s,a=e.attrs,l=e.componentStyle,u=e.defaultProps,h=e.foldedComponentIds,c=e.styledComponentId,d=e.target,f=r.useContext(to),p=e4(),m=e.shouldForwardProp||p.shouldForwardProp,g=(void 0===(i=u)&&(i=en),t.theme!==i.theme&&t.theme||f||i.theme||en),y=function(e,t,n){for(var r,i=o(o({},t),{className:void 0,theme:n}),s=0;s<e.length;s+=1){var a=eA(r=e[s])?r(i):r;for(var l in a)i[l]="className"===l?eR(i[l],a[l]):"style"===l?o(o({},i[l]),a[l]):a[l]}return t.className&&(i.className=eR(i.className,t.className)),i}(a,t,g),v=y.as||d,_={};for(var w in y)void 0===y[w]||"$"===w[0]||"as"===w||"theme"===w&&y.theme===g||("forwardedAs"===w?_.as=y.forwardedAs:m&&!m(w,v)||(_[w]=y[w]));var b=(s=e4(),l.generateAndInjectStyles(y,s.styleSheet,s.stylis)),E=eR(h,c);return b&&(E+=" "+b),y.className&&(E+=" "+y.className),_[ef(v)&&!er.has(v)?"class":"className"]=E,n&&(_.ref=n),(0,r.createElement)(v,_)}(S,e,t)}T.displayName=g;var S=r.forwardRef(T);return S.attrs=v,S.componentStyle=E,S.displayName=g,S.shouldForwardProp=_,S.foldedComponentIds=u?eR(e.foldedComponentIds,e.styledComponentId):"",S.styledComponentId=y,S.target=u?e.target:e,Object.defineProperty(S,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(t){this._foldedDefaultProps=u?function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)!function e(t,n,r){if(void 0===r&&(r=!1),!r&&!eN(t)&&!Array.isArray(t))return n;if(Array.isArray(n))for(var i=0;i<n.length;i++)t[i]=e(t[i],n[i]);else if(eN(n))for(var i in n)t[i]=e(t[i],n[i]);return t}(e,t[r],!0);return e}({},e.defaultProps,t):t}}),eO(S,function(){return".".concat(S.styledComponentId)}),h&&function e(t,n,r){if("string"!=typeof n){if(ex){var i=eI(n);i&&i!==ex&&e(t,i,r)}var s=eT(n);eS&&(s=s.concat(eS(n)));for(var o=eb(t),a=eb(n),l=0;l<s.length;++l){var u=s[l];if(!(u in ev||r&&r[u]||a&&u in a||o&&u in o)){var h=eC(n,u);try{eE(t,u,h)}catch(e){}}}}return t}(S,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),S}function tu(e,t){for(var n=[e[0]],r=0,i=t.length;r<i;r+=1)n.push(t[r],e[r+1]);return n}var th=function(e){return Object.assign(e,{isCss:!0})};function tc(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return eA(e)||eN(e)?th(tn(tu(et,a([e],t,!0)))):0===t.length&&1===e.length&&"string"==typeof e[0]?tn(e):th(tn(tu(e,t)))}var td=function(e){return function e(t,n,r){if(void 0===r&&(r=en),!n)throw eD(1,n);var i=function(e){for(var i=[],s=1;s<arguments.length;s++)i[s-1]=arguments[s];return t(n,r,tc.apply(void 0,a([e],i,!1)))};return i.attrs=function(i){return e(t,n,o(o({}
1,r),{attrs:Array.prototype.concat(r.attrs,i).filter(Boolean)}))},i.withConfig=function(i){return e(t,n,o(o({},r),i))},i}(tl,e)};function tf(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=eP(tc.apply(void 0,a([e],t,!1)));return new e7(eu(ed(r)>>>0),r)}function tp(){let e=i(["\n 0% {\n background-position: 0% 50%;\n }\n 50% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n"]);return tp=function(){return e},e}function tm(){let e=i(["\n width: ",";\n height: ",";\n display: inline-flex;\n align-items: center;\n justify-content: center;\n position: relative;\n background-color: #eee;\n overflow: hidden;\n border-radius: ",";\n\n /* Animated gradient border */\n &::before {\n content: '';\n position: absolute;\n top: -2px;\n left: -2px;\n right: -2px;\n bottom: -2px;\n z-index: -1;\n border-radius: inherit;\n background: linear-gradient(45deg, #ff9a9e, #fad0c4, #ff9a9e);\n background-size: 200% 200%;\n animation: "," 6s linear infinite;\n filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.15));\n }\n\n /* Ensure inner content appears above the border */\n img,\n span {\n width: 100%;\n height: 100%;\n object-fit: cover;\n border-radius: inherit;\n position: relative;\n z-index: 1;\n }\n"]);return tm=function(){return e},e}er.forEach(function(e){td[e]=td(e)}),function(){function e(e,t){this.rules=e,this.componentId=t,this.isStatic=tr(e),eJ.registerId(this.componentId+1)}e.prototype.createStyles=function(e,t,n,r){var i=r(eP(tn(this.rules,t,n,r)),""),s=this.componentId+e;n.insertRules(s,s,i)},e.prototype.removeStyles=function(e,t){t.clearRules(this.componentId+e)},e.prototype.renderStyles=function(e,t,n,r){e>2&&eJ.registerId(this.componentId+e),this.removeStyles(e,n),this.createStyles(e,t,n,r)}}(),function(){function e(){var e=this;this._emitSheetCSS=function(){var t=e.instance.toString();if(!t)return"";var r=n.nc,i=eP([r&&'nonce="'.concat(r,'"'),"".concat(K,'="true"'),"".concat(Q,'="').concat(X,'"')].filter(Boolean)," ");return"<style ".concat(i,">").concat(t,"</style>")},this.getStyleTags=function(){if(e.sealed)throw eD(2);return e._emitSheetCSS()}
1,this.getStyleElement=function(){if(e.sealed)throw eD(2);var t,i=e.instance.toString();if(!i)return[];var s=((t={})[K]="",t[Q]=X,t.dangerouslySetInnerHTML={__html:i},t),a=n.nc;return a&&(s.nonce=a),[r.createElement("style",o({},s,{key:"sc-0-0"}))]},this.seal=function(){e.sealed=!0},this.instance=new eJ({isServer:!0}),this.sealed=!1}e.prototype.collectStyles=function(e){if(this.sealed)throw eD(2);return r.createElement(e8,{sheet:this.instance},e)},e.prototype.interleaveWithNodeStream=function(e){throw eD(3)}}();let tg={sm:"32px",md:"48px",lg:"64px"},ty=tf(tp()),tv=td.div(tm(),e=>tg[e.size]||tg.md,e=>tg[e.size]||tg.md,e=>"circle"===e.shape?"50%":"rounded"===e.shape?"8px":"0",ty),t_=e=>{let{src:t,alt:n="",size:r="md",shape:i="circle",fallback:o}=e;return(0,s.jsx)(tv,{size:r,shape:i,"aria-label":n,children:t?(0,s.jsx)("img",{src:t,alt:n}):o||(0,s.jsx)("span",{children:n&&n.charAt(0)})})};function tw(){let e=i(["\n 0% {\n left: -100%;\n }\n 50% {\n left: 100%;\n }\n 100% {\n left: 100%;\n }\n"]);return tw=function(){return e},e}function tb(){let e=i(["\n background-color: transparent;\n border: 2px solid ",";\n color: ",";\n\n &:hover:not(:disabled) {\n background-color: ",";\n color: #fff;\n }\n "]);return tb=function(){return e},e}function tE(){let e=i(["\n background-color: transparent;\n color: ",";\n\n &:hover:not(:disabled) {\n background-color: ",";\n }\n "]);return tE=function(){return e},e}function tT(){let e=i(["\n /* Override the gradient for solid default variant */\n background: ",";\n color: #fff;\n\n &:hover:not(:disabled) {\n background: ",";\n }\n "]);return tT=function(){return e},e}function tS(){let e=i(["\n /* Variant: outline */\n ","\n\n /* Variant: ghost */\n ","\n\n /* Variant: default/solid (fallback) */\n ","\n "]);return tS=function(){return e},e}function tC(){let e=i(["\n position: relative;\n overflow: hidden;\n padding: ",";\n border: none;\n border-radius: 12px;\n cursor: pointer;\n font-weight: 600;\n outline: none;\n background: linear-gradient(135deg, #ff7e5f, #feb47b);\n color: #fff;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n transition:\n background 0.3s ease,\n box-shadow 0.3s ease,\n transform 0.2s ease;\n\n /* Media query for responsiveness */\n @media (max-width: 768px) {\n padding: calc(\n "," * 0.9\n );\n }\n\n /* Ripple effect */\n &::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n width: 120%;\n height: 120%;\n pointer-events: none;\n border-radius: 50%;\n transform: translate(-50%, -50%) scale(0);\n background-color: rgba(255, 255, 255, 0.3);\n transition:\n transform 0.3s ease,\n opacity 0.4s ease;\n opacity: 0;\n }\n\n &:active::after {\n transform: translate(-50%, -50%) scale(2.5);\n opacity: 1;\n transition:\n transform 0s,\n opacity 0s;\n }\n\n /* Shine effect */\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -100%;\n width: 50%;\n height: 100%;\n background: linear-gradient(\n 120deg,\n transparent,\n rgba(255, 255, 255, 0.6),\n transparent\n );\n transform: skewX(-25deg);\n transition: none;\n }\n\n &:hover::before {\n animation: "," 1s ease-in-out;\n }\n\n &:hover:not(:disabled) {\n box-shadow: 0 8px 16px rgba(255, 126, 95, 0.4);\n transform: translateY(-2px);\n }\n\n &:active {\n box-shadow:\n inset 2px 2px 6px rgba(14, 84, 175, 0.2),\n inset -2px -2px 6px rgba(20, 107, 34, 0.1);\n transform: scale(0.97);\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n /* THEME & VARIANTS */\n ","\n"]);return tC=function(){return e},e}function tI(){let e=i(["\n display: inline-flex;\n\n & > *:not(:first-child) {\n margin-left: 0.5rem;\n }\n"]);return tI=function(){return e},e}let tx={sm:"0.5rem 1rem",md:"0.75rem 1.5rem",lg:"1rem 2rem"},tA=tf(tw()),tk=td.button(tC(),e=>tx[e.size]||tx.md,e=>tx[e.size]||tx.md,tA,e=>{var t,n,r;let{theme:i}=e,s=(null==i||null==(t=i.colors)?void 0:t.primary)||"#0070f3",o=(null==i||null==(n=i.colors)?void 0:n.primaryHover)||"#005bb5",a=(null==i||null==(r=i.colors)?void 0:r.hover)||"#eaeaea";return tc(tS(),e=>"outline"===e.variant&&tc(tb(),s,s,s),e=>"ghost"===e.variant&&tc(tE(),s,a),e=>!e.variant&&tc(tT(),s,o))}),tR=e=>{let{children:t,loading:n,onClick:r,onPress:i,...o}=e;return(0,s.jsx)(tk,{onClick:e=>{r&&r(e),i&&i(e)},...o,children:n?"Loading...":t})};td.div(tI());var tP=n(7993);function tN(){let e=i(["\n 0% { filter: brightness(1); }\n 50% { filter: brightness(1.1); }\n 100% { filter: brightness(1); }\n"]);return tN=function(){return e},e}function tO(){let e=i(["\n 0% {\n background-position: 0% 50%;\n }\n 50% {\n background-position: 100% 50%;\n }\n 100% {\n background-position: 0% 50%;\n }\n"]);return tO=function(){return e},e}function tD(){let e=i(["\n position: relative;\n z-index: 0;\n &::before {\n content: '';\n position: absolute;\n inset: -4px;\n border-radius: inherit;\n background: linear-gradient(45deg, #ff9a9e, #fad0c4, #fad0c4, #ff9a9e);\n background-size: 300% 300%;\n z-index: -1;\n animation: "," 8s ease infinite;\n }\n"]);return tD=function(){return e},e}function tL(){let e=i(["\n background: rgba(255, 255, 255, 0.15);\n backdrop-filter: blur(12px);\n -webkit-backdrop-filter: blur(12px);\n border: 1px solid rgba(255, 255, 255, 0.3);\n"]);return tL=function(){return e},e}function tM(){let e=i(["\n position: relative;\n z-index: 0;\n &::before {\n content: '';\n position: absolute;\n inset: -3px;\n border-radius: inherit;\n background: linear-gradient(90deg, #ff00ff, #00ffff);\n box-shadow:\n 0 0 20px rgba(255, 0, 255, 0.6),\n 0 0 20px rgba(0, 255, 255, 0.6);\n z-index: -1;\n }\n"]);return tM=function(){return e},e}function tj(){let e=i(["\n perspective: 1000px;\n transition:\n transform 0.3s ease,\n box-shadow 0.3s ease;\n &:hover {\n transform: rotateX(4deg) rotateY(-4deg) translateY(-6px);\n box-shadow: 0 12px 28px rgba(0, 0, 0, 0.2);\n }\n"]);return tj=function(){return e},e}function tF(){let e=i(["\n ","\n ","\n "]);return tF=function(){return e},e}function tU(){let e=i(["\n transform: translateY(-4px);\n box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);\n "]);return tU=function(){return e},e}function tV(){let e=i(["\n /* CSS variables for easy overrides */\n --card-bg: #ffffff;\n --card-radius: 20px;\n\n position: relative;\n background: var(--card-bg);\n border-radius: var(--card-radius);\n overflow: hidden;\n animation: "," 4s ease-in-out infinite;\n transition: background 0.3s ease;\n\n /* Apply variant-specific border/background styling */\n ","\n\n /* Optionally apply a 3D t
1ilt effect if 'tilt' prop is true */\n ","\n\n /* Fallback hover if tilt is not enabled */\n &:hover {\n ","\n }\n"]);return tV=function(){return e},e}function tB(){let e=i(["\n padding: 1.5rem 2rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n font-size: 1.75rem;\n font-weight: 700;\n color: #333;\n background: linear-gradient(135deg, #ff9a9e, #fad0c4);\n transition: background 0.4s ease;\n\n &:hover {\n background: linear-gradient(135deg, #ff80ab, #ffb3c6);\n }\n"]);return tB=function(){return e},e}function tq(){let e=i(["\n padding: 1.5rem 2rem;\n font-family: 'Georgia', serif;\n font-size: 1.125rem;\n line-height: 1.7;\n color: #444;\n background-color: #fff;\n transition: background 0.3s ease;\n\n &:hover {\n background-color: #fefefe;\n }\n"]);return tq=function(){return e},e}function t$(){let e=i(["\n padding: 1.2rem 2rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n font-size: 1rem;\n text-align: right;\n color: #666;\n background: #f4f4f4;\n border-top: 1px solid rgba(0, 0, 0, 0.05);\n transition: color 0.3s ease;\n\n &:hover {\n color: #333;\n }\n"]);return t$=function(){return e},e}let tz=tf(tN()),tW=tf(tO()),tH=tc(tD(),tW),tG=tc(tL()),tK=tc(tM()),tY=tc(tj()),tQ=td.div(tV(),tz,e=>{let{variant:t}=e;switch(t){case"glass":return tc(tF(),tH,tG);case"neon":return tK;default:return tH}},e=>{let{tilt:t}=e;return t&&tY},e=>{let{tilt:t}=e;return!t&&tc(tU())}),tX=td.div(tB()),tJ=td.div(tq()),tZ=td.div(t$()),t0=e=>{let{children:t,variant:n="default",tilt:r=!1}=e;return(0,s.jsx)(tQ,{variant:n,tilt:r,children:t})},t1=e=>{let{children:t}=e;return(0,s.jsx)(tX,{children:t})},t2=e=>{let{children:t}=e;return(0,s.jsx)(tJ,{children:t})},t3=e=>{let{children:t}=e;return(0,s.jsx)(tZ,{children:t})};function t5(){let e=i(["\n width: 1px;\n height: 100%;\n align-self: stretch;\n "]);return t5=function(){return e},e}function t6(){let e=i(["\n height: 1px;\n width: 100%;\n "]);return t6=function(){return e},e}function t4(){let e=i(["\n border: none;\n background-color: #ddd;\n ","\n margin: 0.5rem 0;\n"]);return t4=function(){return e},e}function t8(){let e=i(["\n from { opacity: 0; }\n to { opacity: 1; }\n"]);return t8=function(){return e},e}function t7(){let e=i(["\n from { transform: translateY(-20px); }\n to { transform: translateY(0); }\n"]);return t7=function(){return e},e}function t9(){let e=i(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background: rgba(88, 13, 138, 0.7);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 1000;\n animation: "," 0.3s ease;\n"]);return t9=function(){return e},e}function ne(){let e=i(["\n background: #ffffff;\n border-radius: 12px;\n width: 90%;\n max-width: 600px;\n overflow: hidden;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);\n animation: "," 0.3s ease;\n display: flex;\n flex-direction: column;\n"]);return ne=function(){return e},e}function nt(){let e=i(["\n padding: 1.5rem;\n background: linear-gradient(135deg, #7b2ff7, #f107a3);\n color: #fff;\n font-size: 1.5rem;\n font-weight: 700;\n"]);return nt=function(){return e},e}function nn(){let e=i(["\n padding: 1.5rem;\n max-height: calc(\n 100vh - 300px\n ); /* Adjust height to ensure modal content scrolls if overflowing */\n overflow-y: auto;\n background: #fafafa;\n color: #333;\n font-size: 1rem;\n"]);return nn=function(){return e},e}function nr(){let e=i(["\n padding: 1rem;\n background: #fff;\n border-top: 1px solid #eee;\n display: flex;\n justify-content: flex-end;\n gap: 1rem;\n"]);return nr=function(){return e},e}t0.Header=t1,t0.Body=t2,t0.Footer=t3,td.hr(t4(),e=>"vertical"===e.orientation?tc(t5()):tc(t6()));let ni=tf(t8()),ns=tf(t7()),no=td.div(t9(),ni),na=td.div(ne(),ns),nl=td.div(nt()),nu=td.div(nn()),nh=td.div(nr()),nc=e=>{let{isOpen:t,onClose:n,children:i}=e;return((0,r.useEffect)(()=>{let e=e=>{"Escape"===e.key&&n()};return t&&document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t,n]),t)?tP.createPortal((0,s.jsx)(no,{onClick:n,"aria-modal":"true",role:"dialog",children:(0,s.jsx)(na,{onClick:e=>e.stopPropagation(),children:i})}),document.body):null};
1function nd(){let e=i(["\n display: flex;\n border-bottom: 1px solid #eee;\n"]);return nd=function(){return e},e}function nf(){let e=i(["\n background: none;\n border: none;\n padding: 1rem;\n cursor: pointer;\n font-weight: ",";\n border-bottom: ",";\n &:hover {\n background: rgb(22, 134, 87);\n }\n"]);return nf=function(){return e},e}function np(){let e=i(["\n padding: 1rem;\n"]);return np=function(){return e},e}nc.Header=e=>{let{children:t}=e;return(0,s.jsx)(nl,{children:t})},nc.Body=e=>{let{children:t}=e;return(0,s.jsx)(nu,{children:t})},nc.Footer=e=>{let{children:t}=e;return(0,s.jsx)(nh,{children:t})},nc.Content=e=>{let{children:t}=e;return(0,s.jsx)(na,{children:t})};let nm=(0,r.createContext)(),ng=td.div(nd()),ny=td.button(nf(),e=>e.active?"bold":"normal",e=>e.active?"2px solid #0070f3":"2px solid transparent"),nv=td.div(np()),n_=e=>{let{title:t,index:n}=e,{activeIndex:i,setActiveIndex:o}=(0,r.useContext)(nm);return(0,s.jsx)(ny,{active:i===n,onClick:()=>o(n),children:t})},nw=e=>{let{children:t,defaultIndex:n=0}=e,[i,o]=(0,r.useState)(n);return(0,s.jsx)(nm.Provider,{value:{activeIndex:i,setActiveIndex:o},children:t})};function nb(){let e=i(["\n 0% {\n filter: brightness(1);\n }\n 50% {\n filter: brightness(1.2);\n }\n 100% {\n filter: brightness(1);\n }\n"]);return nb=function(){return e},e}function nE(){let e=i(["\n border: 2px solid #ff4757;\n background-image: none;\n box-shadow: 0 4px 12px rgba(255, 71, 87, 0.6);\n &:focus {\n animation: none;\n }\n "]);return nE=function(){return e},e}function nT(){let e=i(["\n /* Base Padding & Typography */\n padding: 0.75rem 1.25rem;\n font-size: 1rem;\n color: #333;\n\n /* Border & Background:\n - The outer background is a gradient that acts as a border.\n - The inner background is a solid white.\n - background-clip ensures that the gradient is visible only in the border area.\n */\n border: 2px solid transparent;\n border-radius: 8px;\n background-image:\n linear-gradient(white, white),\n /* inner layer: main background */\n linear-gradient(45deg, #ff6b6b, #f8e71c, #50e3c2, #0070f3); /* border gradient */\n background-origin: border-box;\n background-clip: padding-box, border-box;\n\n /* Subtle Shadow & Transition for smooth interactions */\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n transition:\n transform 0.3s ease,\n box-shadow 0.3s ease,\n filter 0.3s ease;\n\n /* Hover effect: a slight scale-up to indicate interactivity */\n &:hover {\n transform: scale(1.01);\n }\n\n /* Focus state: Increase scale, emphasize the glow, and trigger pulse animation */\n &:focus {\n outline: none;\n transform: scale(1.02);\n animation: "," 1.5s infinite;\n box-shadow: 0 4px 12px rgba(48, 17, 121, 0.6);\n }\n\n /* Placeholder styling for a refined look */\n &::placeholder {\n color: #888;\n font-style: italic;\n }\n\n /* Error state: Override gradient border and shadow with an error palette */\n ","\n"]);return nT=function(){return e},e}nw.Tab=n_,nw.TabPanels=e=>{let{children:t}=e,{activeIndex:n}=(0,r.useContext)(nm);return(0,s.jsx)(nv,{children:r.Children.toArray(t)[n]})},nw.TabList=ng,nw.TabButton=ny,nw.TabPanel=nv;let nS=tf(nb()),nC=td.input(nT(),nS,e=>e.onError&&tc(nE()));function nI(){let e=i(["\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n padding: 1rem;\n"]);return nI=function(){return e},e}function nx(){let e=i(["\n position: relative;\n padding: 0.5rem 0.85rem;\n margin: 0 0.125rem;\n border: 1px solid #ddd;\n border-radius: 4px;\n cursor: pointer;\n background: ",";\n color: ",";\n transition:\n background 0.3s ease,\n color 0.3s ease,\n transform 0.2s ease;\n\n &:hover:not(:disabled) {\n background: ",";\n transform: scale(1.05);\n }\n\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n"]);return nx=function(){return e},e}td.div(nI()),td.button(nx(),e=>{let{active:t}=e;return t?"linear-gradient(to right, #6a11cb,rgb(35, 81, 161))":"#fff"},e=>{let{active:t}=e;return t?"#fff":"#2575fc"},e=>{let{active:t}=e;return t?"linear-gradient(to right, #5a0fb1, #1d63dd)":"#f0f4ff"});var nA=n(4296);function nk(){let e=i(["\n 0% { left: -100%; }\n 50% { left: 100%; }\n 100% { left: 100%; }\n"]);return nk=function(){return e},e}function nR(){let e=i(["\n 0% { transform: scale(1); opacity: 1; }\n 50% { transform: scale(1.3); opacity: 0.5; }\n 100% { transform: scale(1); opacity: 1; }\n"]);return nR=function(){return e},e}function nP(){let e=i(["\n 0%, 100% { box-shadow: 0 0 8px rgba(255, 118, 117, 0.5); }\n 50% { box-shadow: 0 0 20px rgba(255, 118, 117, 1); }\n"]);return nP=function(){return e},e}function nN(){let e=i(["\n display: flex;\n flex-direction: column;\n width: 100%;\n max-width: 960px;\n margin: 0 auto;\n padding: 2rem 1rem;\n border-radius: 2xl;\n"]);return nN=function(){return e},e}function nO(){let e=i(["\n border-bottom: 2px solid ",";\n margin: 1rem 0;\n"]);return nO=function(){return e},e}function nD(){let e=i(["\n width: 100%;\n padding: 1.25rem 1.5rem;\n font-family: 'Magical', cursive;\n background: linear-gradient(135deg, #ff9a9e, #fad0c4);\n color: #4a148c;\n border: 2px solid #f8c8dc;\n border-radius: 12px;\n display: flex;\n justify-content: space-between;\n align-items: center;\n position: relative;\n cursor: pointer;\n transition: all 0.4s ease;\n box-shadow: 0 6px 14px rgba(255, 105, 180, 0.2);\n\n &:hover {\n background: linear-gradient(135deg, #ff7675, #fab1a0);\n animation: "," 2s infinite;\n }\n\n &::before {\n content: '';\n position: absolute;\n top: 0;\n left: -120%;\n width: 50%;\n height: 100%;\n background: linear-gradient(\n 120deg,\n transparent,\n rgba(255, 255, 255, 0.3),\n transparent\n );\n transform: skewX(-25deg);\n }\n\n &:hover::before {\n animation: "," 1s ease-in-out;\n }\n"]);return nD=function(){return e},e}function nL(){let e=i(["\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 36px;\n height: 36px;\n transition: all 0.4s ease;\n animation: "," 0.4s ease;\n"]);return nL=function(){return e},e}function nM(){let e=i(["\n overflow: hidden;\n height: ","px;\n opacity: ",";\n transition:\n height 0.5s ease,\n opacity 0.5s ease;\n"]);return nM=function(){return e},e}function nj(){let e=i(["\n padding: 1.5rem;\n background: linear-gradient(145deg, #e3f2fd, #ffffff);\n color: #444;\n border-radius: 0 0 1rem 1rem;\n font-size: 1rem;\n font-family: 'Georgia', serif;\n\n @media (max-width: 768px) {\n font-size: 0.9rem;\n padding: 1rem;\n }\n"]);return nj=function(){return e},e}let nF=tf(nk()),nU=tf(nR()),nV=tf(nP()),nB=td.div(nN()),nq=td.div(nO(),e=>e.themeBorder),n$=td.button(nD(),nV,nF),nz=td.span(nL(),nU),nW=td.div(nM(),e=>e.height,e=>+!!e.isOpen),nH=td.div(nj()),nG=e=>{let{title:t,children:n,defaultOpen:i=!1,variant:o="magical"}=e,[a,l]=(0,r.useState)(i),[u,h]=(0,r.useState)(0),c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{c.current&&h(a?c.current.scrollHeight:0)},[a,n]),(0,s.jsxs)(nq,{themeBorder:"#f8bbd0",children:[(0,s.jsxs)(n$,{onClick:()=>l(e=>!e),children:[t,(0,s.jsx)(nz,{children:a?(0,s.jsx)(nA.pF,{width:"32",height:"32"}):(0,s.jsx)(nA.n6,{width:"32",height:"32"})})]}),(0,s.jsx)(nW,{height:u,isOpen:a,children:(0,s.jsx)(nH,{ref:c,children:n})})]})},nK=e=>{let{children:t}=e;return(0,s.jsx)(nB,{children:t})};function nY(){let e=i(["\n position: relative;\n display: inline-block;\n"]);return nY=function(){return e},e}function nQ(){let e=i(["\n cursor: pointer;\n"]);return nQ=function(){return e},e}function nX(){let e=i(["\n position: absolute;\n top: 100%;\n left: 0;\n background: white;\n border: 1px solid #ddd;\n border-radius: 4px;\n min-width: 150px;\n box-shadow: 0 2px 8px rgba(58, 10, 90, 0.1);\n z-index: 100;\n"]);return nX=function(){return e},e}function nJ(){let e=i(["\n padding: 0.75rem 1rem;\n cursor: pointer;\n &:hover {\n background: rgb(20, 94, 155);\n }\n"]);return nJ=function(){return e},e}nK.Item=nG;let nZ=td.div(nY()),n0=td.div(nQ()),n1=td.div(nX()),n2=td.div(nJ()),n3=e=>{let{children:t}=e,[n,i]=(0,r.useState)(!1),o=(0,r.useRef)();return(0,r.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[o]),(0,s.jsx)(nZ,{ref:o,children:r.Children.map(t,e=>e.type===n5?r.cloneElement(e,{onClick:()=>i(!n)}):e.type===n6?n?e:null:e)})},n5=e=>{let{children:t,onClick:n}=e;return(0,s.jsx)(n0,{onClick:n,children:t})},n6=e=>{let{children:t}=e;return(0,s.jsx)(n1,{children:t})};function n4(){let e=i(["\n width: 100%;\n"]);return n4=function(){return e},e}n3.Trigger=n5,n3.Menu=n6,n3.Item=e=>{let{children:t,onClick:n}=e;return(0,s.jsx)(n2,{onClick:n,children:t})};let n8=td.input.attrs({type:"range"})(n4());function n7(){let e=i(["\n width: 100%;\n background: #eee;\n border-radius: 4px;\n overflow: hidden;\n"]);return n7=function(){return e},e}function n9(){let e=i(["\n width: ","%;\n background: #0070f3;\n height: 10px;\n transition: width 0.3s ease;\n"]);return n9=function(){return e},e}td.div(n7()),td.div(n9(),e=>e.value)},4670:(e,t,n)=>{"use strict";n.d(t,{l:()=>r});let r=e=>e},4690:(e,t,n)=>{"use strict";n.d(t,{xQ:()=>s});var r=n(1462),i=n(1389);function s(e=!0){let t=(0,r.useContext)(i.t);if(null===t)return[!0,null];let{isPresent:n,onExitComplete:o,register:a}=t,l=(0,r.useId)();(0,r.useEffect)(()=>{e&&a(l)},[e]);let u=(0,r.useCallback)(()=>e&&o&&o(l),[l,o,e]);return!n&&o?[!1,u]:[!0]}}
1,4764:(e,t,n)=>{"use strict";n.d(t,{FF:()=>oB,ZI:()=>o7,iC:()=>oQ,Ao:()=>oG,uW:()=>o1,OR:()=>o3,SV:()=>ad,_H:()=>o4,vk:()=>at,V0:()=>oZ,$2:()=>oq,OS:()=>am,RZ:()=>au,KO:()=>oM,eY:()=>oU,HW:()=>oD,zD:()=>af,by:()=>ai,SL:()=>oV,Oe:()=>ag,lo:()=>ar,ht:()=>oL,fo:()=>oz,to:()=>ao,MF:()=>o8,Lr:()=>oY,YT:()=>o9,MY:()=>o5,nK:()=>o0,bX:()=>an,hu:()=>o2,l3:()=>o6,Oi:()=>ae,OO:()=>oJ,Y1:()=>oj,xw:()=>oF,cY:()=>oH,Z2:()=>ah,Jv:()=>oO,G6:()=>oP,Hh:()=>oN,sX:()=>o$,EY:()=>oK,S1:()=>oW});var r,i,s,o,a,l,u,h,c,d,f,p,m,g,y,v,_=n(4928);(0,_.KO)("firebase","11.10.0","app");var w=n(5880),b=n(3279),E=n(9320),T="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},S={};(function(){function e(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.B=Array(this.blockSize),this.o=this.h=0,this.s()}var t=function(){this.blockSize=-1};function n(){}function s(e,t,n){n||(n=0);var r=Array(16);if("string"==typeof t)for(var i=0;16>i;++i)r[i]=t.charCodeAt(n++)|t.charCodeAt(n++)<<8|t.charCodeAt(n++)<<16|t.charCodeAt(n++)<<24;else for(i=0;16>i;++i)r[i]=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24;t=e.g[0],n=e.g[1],i=e.g[2];var s=e.g[3],o=t+(s^n&(i^s))+r[0]+0xd76aa478|0;o=s+(i^(t=n+(o<<7|o>>>25))&(n^i))+r[1]+0xe8c7b756|0,o=i+(n^(s=t+(o<<12|o>>>20))&(t^n))+r[2]+0x242070db|0,o=n+(t^(i=s+(o<<17|o>>>15))&(s^t))+r[3]+0xc1bdceee|0,o=t+(s^(n=i+(o<<22|o>>>10))&(i^s))+r[4]+0xf57c0faf|0,o=s+(i^(t=n+(o<<7|o>>>25))&(n^i))+r[5]+0x4787c62a|0,o=i+(n^(s=t+(o<<12|o>>>20))&(t^n))+r[6]+0xa8304613|0,o=n+(t^(i=s+(o<<17|o>>>15))&(s^t))+r[7]+0xfd469501|0,o=t+(s^(n=i+(o<<22|o>>>10))&(i^s))+r[8]+0x698098d8|0,o=s+(i^(t=n+(o<<7|o>>>25))&(n^i))+r[9]+0x8b44f7af|0,o=i+(n^(s=t+(o<<12|o>>>20))&(t^n))+r[10]+0xffff5bb1|0,o=n+(t^(i=s+(o<<17|o>>>15))&(s^t))+r[11]+0x895cd7be|0,o=t+(s^(n=i+(o<<22|o>>>10))&(i^s))+r[12]+0x6b901122|0,o=s+(i^(t=n+(o<<7|o>>>25))&(n^i))+r[13]+0xfd987193|0,o=i+(n^(s=t+(o<<12|o>>>20))&(t^n))+r[14]+0xa679438e|0,o=n+(t^(i=s+(o<<17|o>>>15))&(s^t))+r[15]+0x49b40821|0,n=i+(o<<22|o>>>10),o=t+(i^s&(n^i))+r[1]+0xf61e2562|0,t=n+(o<<5|o>>>27),o=s+(n^i&(t^n))+r[6]+0xc040b340|0,s=t+(o<<9|o>>>23),o=i+(t^n&(s^t))+r[11]+0x265e5a51|0,i=s+(o<<14|o>>>18),o=n+(s^t&(i^s))+r[0]+0xe9b6c7aa|0,n=i+(o<<20|o>>>12),o=t+(i^s&(n^i))+r[5]+0xd62f105d|0,t=n+(o<<5|o>>>27),o=s+(n^i&(t^n))+r[10]+0x2441453|0,s=t+(o<<9|o>>>23),o=i+(t^n&(s^t))+r[15]+0xd8a1e681|0,i=s+(o<<14|o>>>18),o=n+(s^t&(i^s))+r[4]+0xe7d3fbc8|0,n=i+(o<<20|o>>>12),o=t+(i^s&(n^i))+r[9]+0x21e1cde6|0,t=n+(o<<5|o>>>27),o=s+(n^i&(t^n))+r[14]+0xc33707d6|0,s=t+(o<<9|o>>>23),o=i+(t^n&(s^t))+r[3]+0xf4d50d87|0,i=s+(o<<14|o>>>18),o=n+(s^t&(i^s))+r[8]+0x455a14ed|0,n=i+(o<<20|o>>>12),o=t+(i^s&(n^i))+r[13]+0xa9e3e905|0,t=n+(o<<5|o>>>27),o=s+(n^i&(t^n))+r[2]+0xfcefa3f8|0,s=t+(o<<9|o>>>23),o=i+(t^n&(s^t))+r[7]+0x676f02d9|0,i=s+(o<<14|o>>>18),o=n+(s^t&(i^s))+r[12]+0x8d2a4c8a|0,o=t+((n=i+(o<<20|o>>>12))^i^s)+r[5]+0xfffa3942|0,o=s+((t=n+(o<<4|o>>>28))^n^i)+r[8]+0x8771f681|0,o=i+((s=t+(o<<11|o>>>21))^t^n)+r[11]+0x6d9d6122|0,o=n+((i=s+(o<<16|o>>>16))^s^t)+r[14]+0xfde5380c|0,o=t+((n=i+(o<<23|o>>>9))^i^s)+r[1]+0xa4beea44|0,o=s+((t=n+(o<<4|o>>>28))^n^i)+r[4]+0x4bdecfa9|0,o=i+((s=t+(o<<11|o>>>21))^t^n)+r[7]+0xf6bb4b60|0,o=n+((i=s+(o<<16|o>>>16))^s^t)+r[10]+0xbebfbc70|0,o=t+((n=i+(o<<23|o>>>9))^i^s)+r[13]+0x289b7ec6|0,o=s+((t=n+(o<<4|o>>>28))^n^i)+r[0]+0xeaa127fa|0,o=i+((s=t+(o<<11|o>>>21))^t^n)+r[3]+0xd4ef3085|0,o=n+((i=s+(o<<16|o>>>16))^s^t)+r[6]+0x4881d05|0,o=t+((n=i+(o<<23|o>>>9))^i^s)+r[9]+0xd9d4d039|0,o=s+((t=n+(o<<4|o>>>28))^n^i)+r[12]+0xe6db99e5|0,o=i+((s=t+(o<<11|o>>>21))^t^n)+r[15]+0x1fa27cf8|0,o=n+((i=s+(o<<16|o>>>16))^s^t)+r[2]+0xc4ac5665|0,n=i+(o<<23|o>>>9),o=t+(i^(n|~s))+r[0]+0xf4292244|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~i))+r[7]+0x432aff97|0,s=t+(o<<10|o>>>22),o=i+(t^(s|~n))+r[14]+0xab9423a7|0,i=s+(o<<15|o>>>17),o=n+(s^(i|~t))+r[5]+0xfc93a039|0,n=i+(o<<21|o>>>11),o=t+(i^(n|~s))+r[12]+0x655b59c3|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~i))+r[3]+0x8f0ccc92|0,s=t+(o<<10|o>>>22),o=i+(t^(s|~n))+r[10]+0xffeff47d|0,i=s+(o<<15|o>>>17),o=n+(s^(i|~t))+r[1]+0x85845dd1|0,n=i+(o<<21|o>>>11),o=t+(i^(n|~s))+r[8]+0x6fa87e4f|0,t=n+(o<<6|o>>>26),o=s+(n^(t|~i))+r[15]+0xfe2ce6e0|0,s=t+(o<<10|o>>>22),o=i+(t^(s|~n))+r[6]+0xa3014314|0,i=s+(o<<15|o>>>17),o=n+(s^(i|~t))+r[13]+0x4e0811a1|0,n=i+(o<<21|o>>>11),o=t+(i^(n|~s))+r[4]+0xf7537e82|0,t=n+(o<<6|o>>>
126),o=s+(n^(t|~i))+r[11]+0xbd3af235|0,s=t+(o<<10|o>>>22),o=i+(t^(s|~n))+r[2]+0x2ad7d2bb|0,i=s+(o<<15|o>>>17),o=n+(s^(i|~t))+r[9]+0xeb86d391|0,e.g[0]=e.g[0]+t|0,e.g[1]=e.g[1]+(i+(o<<21|o>>>11))|0,e.g[2]=e.g[2]+i|0,e.g[3]=e.g[3]+s|0}function o(e,t){this.h=t;for(var n=[],r=!0,i=e.length-1;0<=i;i--){var s=0|e[i];r&&s==t||(n[i]=s,r=!1)}this.g=n}n.prototype=t.prototype,e.D=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.C=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)},e.prototype.s=function(){this.g[0]=0x67452301,this.g[1]=0xefcdab89,this.g[2]=0x98badcfe,this.g[3]=0x10325476,this.o=this.h=0},e.prototype.u=function(e,t){void 0===t&&(t=e.length);for(var n=t-this.blockSize,r=this.B,i=this.h,o=0;o<t;){if(0==i)for(;o<=n;)s(this,e,o),o+=this.blockSize;if("string"==typeof e){for(;o<t;)if(r[i++]=e.charCodeAt(o++),i==this.blockSize){s(this,r),i=0;break}}else for(;o<t;)if(r[i++]=e[o++],i==this.blockSize){s(this,r),i=0;break}}this.h=i,this.o+=t},e.prototype.v=function(){var e=Array((56>this.h?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;var n=8*this.o;for(t=e.length-8;t<e.length;++t)e[t]=255&n,n/=256;for(this.u(e),e=Array(16),t=n=0;4>t;++t)for(var r=0;32>r;r+=8)e[n++]=this.g[t]>>>r&255;return e};var a,l={};function u(e){var t;return -128<=e&&128>e?(t=function(e){return new o([0|e],0>e?-1:0)},Object.prototype.hasOwnProperty.call(l,e)?l[e]:l[e]=t(e)):new o([0|e],0>e?-1:0)}function h(e){if(isNaN(e)||!isFinite(e))return c;if(0>e)return g(h(-e));for(var t=[],n=1,r=0;e>=n;r++)t[r]=e/n|0,n*=0x100000000;return new o(t,0)}var c=u(0),d=u(1),f=u(0x1000000);function p(e){if(0!=e.h)return!1;for(var t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function m(e){return -1==e.h}function g(e){for(var t=e.g.length,n=[],r=0;r<t;r++)n[r]=~e.g[r];return new o(n,~e.h).add(d)}function y(e,t){return e.add(g(t))}function v(e,t){for(;(65535&e[t])!=e[t];)e[t+1]+=e[t]>>>16,e[t]&=65535,t++}function _(e,t){this.g=e,this.h=t}function w(e,t){if(p(t))throw Error("division by zero");if(p(e))return new _(c,c);if(m(e))return t=w(g(e),t),new _(g(t.g),g(t.h));if(m(t))return t=w(e,g(t)),new _(g(t.g),t.h);if(30<e.g.length){if(m(e)||m(t))throw Error("slowDivide_ only works with positive integers.");for(var n=d,r=t;0>=r.l(e);)n=b(n),r=b(r);var i=E(n,1),s=E(r,1);for(r=E(r,2),n=E(n,2);!p(r);){var o=s.add(r);0>=o.l(e)&&(i=i.add(n),s=o),r=E(r,1),n=E(n,1)}return t=y(e,i.j(t)),new _(i,t)}for(i=c;0<=e.l(t);){for(r=48>=(r=Math.ceil(Math.log(n=Math.max(1,Math.floor(e.m()/t.m())))/Math.LN2))?1:Math.pow(2,r-48),o=(s=h(n)).j(t);m(o)||0<o.l(e);)n-=r,o=(s=h(n)).j(t);p(s)&&(s=d),i=i.add(s),e=y(e,o)}return new _(i,e)}function b(e){for(var t=e.g.length+1,n=[],r=0;r<t;r++)n[r]=e.i(r)<<1|e.i(r-1)>>>31;return new o(n,e.h)}function E(e,t){var n=t>>5;t%=32;for(var r=e.g.length-n,i=[],s=0;s<r;s++)i[s]=0<t?e.i(s+n)>>>t|e.i(s+n+1)<<32-t:e.i(s+n);return new o(i,e.h)}(a=o.prototype).m=function(){if(m(this))return-g(this).m();for(var e=0,t=1,n=0;n<this.g.length;n++){var r=this.i(n);e+=(0<=r?r:0x100000000+r)*t,t*=0x100000000}return e},a.toString=function(e){if(2>(e=e||10)||36<e)throw Error("radix out of range: "+e);if(p(this))return"0";if(m(this))return"-"+g(this).toString(e);for(var t=h(Math.pow(e,6)),n=this,r="";;){var i=w(n,t).g,s=((0<(n=y(n,i.j(t))).g.length?n.g[0]:n.h)>>>0).toString(e);if(p(n=i))return s+r;for(;6>s.length;)s="0"+s;r=s+r}},a.i=function(e){return 0>e?0:e<this.g.length?this.g[e]:this.h},a.l=function(e){return m(e=y(this,e))?-1:+!p(e)},a.abs=function(){return m(this)?g(this):this},a.add=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0,i=0;i<=t;i++){var s=r+(65535&this.i(i))+(65535&e.i(i)),a=(s>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);r=a>>>16,s&=65535,a&=65535,n[i]=a<<16|s}return new o(n,-0x80000000&n[n.length-1]?-1:0)},a.j=function(e){if(p(this)||p(e))return c;if(m(this))return m(e)?g(this).j(g(e)):g(g(this).j(e));if(m(e))return g(this.j(g(e)));if(0>this.l(f)&&0>e.l(f))return h(this.m()*e.m());for(var t=this.g.length+e.g.length,n=[],r=0;r<2*t;r++)n[r]=0;for(r=0;r<this.g.length;r++)for(var i=0;i<e.g.length;i++){var s=this.i(r)>>>16,a=65535&this.i(r),l=e.i(i)>>>16,u=65535&e.i(i);n[2*r+2*i]+=a*u,v(n,2*r+2*i),n[2*r+2*i+1]+=s*u,v(n,2*r+2*i+1),n[2*r+2*i+1]+=a*l,v(n,2*r+2*i+1),n[2*r+2*i+2]+=s*l,v(n,2*r+2*i+2)}for(r=0;r<t;r++)n[r]=n[2*r+1]<<16|n[2*r];for(r=t;r<2*t;r++)n[r]=0;return new o(n,0)},a.A=function(e){return w(this,e).h},a.and=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)&e.i(r);return new o(n,this.h&e.h)},a.or=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)|e.i(r);return new o(n,this.h|e.h)},a.xor=function(e){for(var t=Math.max(this.g.length,e.g.length),n=[],r=0;r<t;r++)n[r]=this.i(r)^e.i(r);return new o(n,this.h^e.h)},e.prototype.digest=e.prototype.v,e.prototype.reset=e.prototype.s,e.prototype.update=e.prototype.u,i=S.Md5=e,o.prototype.add=o.prototype.add,o.prototype.multiply=o.prototype.j,o.prototype.modulo=o.prototype.A,o.prototype.compare=o.prototype.l,o.prototype.toNumber=o.prototype.m,o.prototype.toString=o.prototype.toString,o.prototype.getBits=o.prototype.i,o.fromNumber=h,o.fromString=function e(t,n){if(0==t.length)throw Error("number format error: empty string");if(2>(n=n||10)||36<n)throw Error("radix out of range: "+n);
1if("-"==t.charAt(0))return g(e(t.substring(1),n));if(0<=t.indexOf("-"))throw Error('number format error: interior "-" character');for(var r=h(Math.pow(n,8)),i=c,s=0;s<t.length;s+=8){var o=Math.min(8,t.length-s),a=parseInt(t.substring(s,s+o),n);8>o?(o=h(Math.pow(n,o)),i=i.j(o).add(h(a))):i=(i=i.j(r)).add(h(a))}return i},r=S.Integer=o}).apply(void 0!==T?T:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{});var C="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},I={};(function(){var e,t,n,r="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,n){return e==Array.prototype||e==Object.prototype||(e[t]=n.value),e},i=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof C&&C];for(var t=0;t<e.length;++t){var n=e[t];if(n&&n.Math==Math)return n}throw Error("Cannot find global object")}(this);!function(e,t){if(t)e:{var n=i;e=e.split(".");for(var s=0;s<e.length-1;s++){var o=e[s];if(!(o in n))break e;n=n[o]}(t=t(s=n[e=e[e.length-1]]))!=s&&null!=t&&r(n,e,{configurable:!0,writable:!0,value:t})}}("Array.prototype.values",function(e){return e||function(){var e,t,n,r,i;return e=this,t=function(e,t){return t},e instanceof String&&(e+=""),n=0,r=!1,(i={next:function(){if(!r&&n<e.length){var i=n++;return{value:t(i,e[i]),done:!1}}return r=!0,{done:!0,value:void 0}}})[Symbol.iterator]=function(){return i},i}});var f=f||{},p=this||self;function m(e){var t=typeof e;return"array"==(t="object"!=t?t:e?Array.isArray(e)?"array":t:"null")||"object"==t&&"number"==typeof e.length}function g(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function y(e,t,n){return e.call.apply(e.bind,arguments)}function v(e,t,n){if(!e)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),e.apply(t,n)}}return function(){return e.apply(t,arguments)}}function _(e,t,n){return(_=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?y:v).apply(null,arguments)}function w(e,t){var n=Array.prototype.slice.call(arguments,1);return function(){var t=n.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function b(e,t){function n(){}n.prototype=t.prototype,e.aa=t.prototype,e.prototype=new n,e.prototype.constructor=e,e.Qb=function(e,n,r){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[n].apply(e,i)}}function E(e){let t=e.length;if(0<t){let n=Array(t);for(let r=0;r<t;r++)n[r]=e[r];return n}return[]}function T(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];if(m(n)){let t=e.length||0,r=n.length||0;e.length=t+r;for(let i=0;i<r;i++)e[t+i]=n[i]}else e.push(n)}}class S{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return 0<this.h?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}function x(e){return/^[\s\xa0]*$/.test(e)}function A(){var e=p.navigator;return e&&(e=e.userAgent)?e:""}function k(e){return k[" "](e),e}k[" "]=function(){};var R=-1!=A().indexOf("Gecko")&&(-1==A().toLowerCase().indexOf("webkit")||-1!=A().indexOf("Edge"))&&-1==A().indexOf("Trident")&&-1==A().indexOf("MSIE")&&-1==A().indexOf("Edge");function P(e,t,n){for(let r in e)t.call(n,e[r],r,e)}function N(e){let t={};for(let n in e)t[n]=e[n];return t}let O="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function D(e,t){let n,r;for(let t=1;t<arguments.length;t++){for(n in r=arguments[t])e[n]=r[n];for(let t=0;t<O.length;t++)n=O[t],Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}}class L{constructor(){this.h=this.g=null}add(e,t){let n=M.get();n.set(e,t),this.h?this.h.next=n:this.g=n,this.h=n}}var M=new S(()=>new j,e=>e.reset());class j{constructor(){this.next=this.g=this.h=null}set(e,t){this.h=e,this.g=t,this.next=null}reset(){this.next=this.g=this.h=null}}let F,U=!1,V=new L,B=()=>{let e=p.Promise.resolve(void 0);F=()=>{e.then(q)}};var q=()=>{let e;for(var t;e=null,V.g&&(e=V.g,V.g=V.g.next,V.g||(V.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){p.setTimeout(()=>{throw e},0)}(e)}M.j(t),100>M.h&&(M.h++,t.next=M.g,M.g=t)}U=!1};function $(){this.s=this.s,this.C=this.C}function z(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}$.prototype.s=!1,$.prototype.ma=function(){this.s||(this.s=!0,this.N())},$.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},z.prototype.h=function(){this.defaultPrevented=!0};var W=function(){if(!p.addEventListener||!Object.defineProperty)return!1;var e=!1,t=Object.defineProperty({},"passive",{get:function(){e=!0}});try{let e=()=>{};p.addEventListener("test",e,t),p.removeEventListener("test",e,t)}catch(e){}return e}();function H(e,t){if(z.call(this,e?e.type:""),this.relatedTarget=this.g=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.state=null,this.pointerId=0,this.pointerType="",this.i=null,e){var n=this.type=e.type,r=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.g=t,t=e.relatedTarget){if(R){e:{try{k(t.nodeName);var i=!0;break e}catch(e){}i=!1}i||(t=null)}}
1else"mouseover"==n?t=e.fromElement:"mouseout"==n&&(t=e.toElement);this.relatedTarget=t,r?(this.clientX=void 0!==r.clientX?r.clientX:r.pageX,this.clientY=void 0!==r.clientY?r.clientY:r.pageY,this.screenX=r.screenX||0,this.screenY=r.screenY||0):(this.clientX=void 0!==e.clientX?e.clientX:e.pageX,this.clientY=void 0!==e.clientY?e.clientY:e.pageY,this.screenX=e.screenX||0,this.screenY=e.screenY||0),this.button=e.button,this.key=e.key||"",this.ctrlKey=e.ctrlKey,this.altKey=e.altKey,this.shiftKey=e.shiftKey,this.metaKey=e.metaKey,this.pointerId=e.pointerId||0,this.pointerType="string"==typeof e.pointerType?e.pointerType:G[e.pointerType]||"",this.state=e.state,this.i=e,e.defaultPrevented&&H.aa.h.call(this)}}b(H,z);var G={2:"touch",3:"pen",4:"mouse"};H.prototype.h=function(){H.aa.h.call(this);var e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var K="closure_listenable_"+(1e6*Math.random()|0),Y=0;function Q(e,t,n,r,i){this.listener=e,this.proxy=null,this.src=t,this.type=n,this.capture=!!r,this.ha=i,this.key=++Y,this.da=this.fa=!1}function X(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function J(e){this.src=e,this.g={},this.h=0}function Z(e,t){var n=t.type;if(n in e.g){var r,i=e.g[n],s=Array.prototype.indexOf.call(i,t,void 0);(r=0<=s)&&Array.prototype.splice.call(i,s,1),r&&(X(t),0==e.g[n].length&&(delete e.g[n],e.h--))}}function ee(e,t,n,r){for(var i=0;i<e.length;++i){var s=e[i];if(!s.da&&s.listener==t&&!!n==s.capture&&s.ha==r)return i}return -1}J.prototype.add=function(e,t,n,r,i){var s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);var o=ee(e,t,r,i);return -1<o?(t=e[o],n||(t.fa=!1)):((t=new Q(t,this.src,s,!!r,i)).fa=n,e.push(t)),t};var et="closure_lm_"+(1e6*Math.random()|0),en={};function er(e,t,n,r,i,s){if(!t)throw Error("Invalid event type");var o=g(i)?!!i.capture:!!i,a=ea(e);if(a||(e[et]=a=new J(e)),(n=a.add(t,n,r,o,s)).proxy)return n;if(r=function e(t){return eo.call(e.src,e.listener,t)},n.proxy=r,r.src=e,r.listener=n,e.addEventListener)W||(i=o),void 0===i&&(i=!1),e.addEventListener(t.toString(),r,i);else if(e.attachEvent)e.attachEvent(es(t.toString()),r);else if(e.addListener&&e.removeListener)e.addListener(r);else throw Error("addEventListener and attachEvent are unavailable.");return n}function ei(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[K])Z(t.i,e);else{var n=e.type,r=e.proxy;t.removeEventListener?t.removeEventListener(n,r,e.capture):t.detachEvent?t.detachEvent(es(n),r):t.addListener&&t.removeListener&&t.removeListener(r),(n=ea(t))?(Z(n,e),0==n.h&&(n.src=null,t[et]=null)):X(e)}}}function es(e){return e in en?en[e]:en[e]="on"+e}function eo(e,t){if(e.da)e=!0;else{t=new H(t,this);var n=e.listener,r=e.ha||e.src;e.fa&&ei(e),e=n.call(r,t)}return e}function ea(e){return(e=e[et])instanceof J?e:null}var el="__closure_events_fn_"+(1e9*Math.random()>>>0);function eu(e){return"function"==typeof e?e:(e[el]||(e[el]=function(t){return e.handleEvent(t)}),e[el])}function eh(){$.call(this),this.i=new J(this),this.M=this,this.F=null}function ec(e,t){var n,r=e.F;if(r)for(n=[];r;r=r.F)n.push(r);if(e=e.M,r=t.type||t,"string"==typeof t)t=new z(t,e);else if(t instanceof z)t.target=t.target||e;else{var i=t;D(t=new z(r,e),i)}if(i=!0,n)for(var s=n.length-1;0<=s;s--){var o=t.g=n[s];i=ed(o,r,!0,t)&&i}if(i=ed(o=t.g=e,r,!0,t)&&i,i=ed(o,r,!1,t)&&i,n)for(s=0;s<n.length;s++)i=ed(o=t.g=n[s],r,!1,t)&&i}function ed(e,t,n,r){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();for(var i=!0,s=0;s<t.length;++s){var o=t[s];if(o&&!o.da&&o.capture==n){var a=o.listener,l=o.ha||o.src;o.fa&&Z(e.i,o),i=!1!==a.call(l,r)&&i}}return i&&!r.defaultPrevented}function ef(e,t,n){if("function"==typeof e)n&&(e=_(e,n));else if(e&&"function"==typeof e.handleEvent)e=_(e.handleEvent,e);else throw Error("Invalid listener argument");return 0x7fffffff<Number(t)?-1:p.setTimeout(e,t||0)}b(eh,$),eh.prototype[K]=!0,eh.prototype.removeEventListener=function(e,t,n,r){!function e(t,n,r,i,s){if(Array.isArray(n))for(var o=0;o<n.length;o++)e(t,n[o],r,i,s);else(i=g(i)?!!i.capture:!!i,r=eu(r),t&&t[K])?(t=t.i,(n=String(n).toString())in t.g&&-1<(r=ee(o=t.g[n],r,i,s))&&(X(o[r]),Array.prototype.splice.call(o,r,1),0==o.length&&(delete t.g[n],t.h--))):t&&(t=ea(t))&&(n=t.g[n.toString()],t=-1,n&&(t=ee(n,r,i,s)),(r=-1<t?n[t]:null)&&ei(r))}(this,e,t,n,r)},eh.prototype.N=function(){if(eh.aa.N.call(this),this.i){var e,t=this.i;for(e in t.g){for(var n=t.g[e],r=0;r<n.length;r++)X(n[r]);delete t.g[e],t.h--}}this.F=null},eh.prototype.K=function(e,t,n,r){return this.i.add(String(e),t,!1,n,r)},eh.prototype.L=function(e,t,n,r){return this.i.add(String(e),t,!0,n,r)};class ep extends ${constructor(e,t){super(),this.m=e,this.l=t,this.h=null,this.i=!1,this.g=null}j(e){this.h=arguments,this.g?this.i=!0:function e(t){t.g=ef(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.l);let n=t.h;t.h=null,t.m.apply(null,n)}(this)}N(){super.N(),this.g&&(p.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function em(e){$.call(this),this.h=e,this.g={}}b(em,$);var eg=[];function ey(e){P(e.g,function(e,t){this.g.hasOwnProperty(t)&&ei(e)},e),e.g={}}em.prototype.N=function(){em.aa.N.call(this),ey(this)},em.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ev=p.JSON.stringify,e_=p.JSON.parse,ew=class{stringify(e){return p.JSON.stringify(e,void 0)}parse(e){return p.JSON.parse(e,void 0)}};function eb(){}function eE(e){return e.h||(e.h=e.i())}function eT(){}eb.prototype.h=null;var eS={OPEN:"a",kb:"b",Ja:"c",wb:"d"};function eC(){z.call(this,"d")}function eI(){z.call(this,"c")}b(eC,z),b(eI,z);var ex={},eA=null;function ek(){return eA=eA||new eh}function eR(e){z.call(this,ex.La,e)}function eP(e){let t=ek();ec(t,new eR(t))}function eN(e,t){z.call(this,ex.STAT_EVENT,e),this.stat=t}function eO(e){let t=ek();ec(t,new eN(t,e))}function eD(e,t){z.call(this,ex.Ma,e),this.size=t}function eL(e,t){if("function"!=typeof e)throw Error("Fn must not be null and must be a function");return p.setTimeout(function(){e()},t)}function eM(){this.g=!0}function ej(e,t,n,r){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{var n=JSON.parse(t);if(n){for(e=0;e<n.length;e++)if(Array.isArray(n[e])){var r=n[e];if(!(2>r.length)){var i=r[1];if(Array.isArray(i)&&!(1>i.length)){var s=i[0];if("noop"!=s&&"stop"!=s&&"close"!=s)for(var o=1;o<i.length;o++)i[o]=""}}}}return ev(n)}catch(e){return t}}(e,n)+(r?" "+r:"")})}ex.La="serverreachability",b(eR,z),ex.STAT_EVENT="statevent",b(eN,z),ex.Ma="timingevent",b(eD,z),eM.prototype.xa=function(){this.g=!1},eM.prototype.info=function(){};var eF={NO_ERROR:0,gb:1,tb:2,sb:3,nb:4,rb:5,ub:6,Ia:7,TIMEOUT:8,xb:9},eU={lb:"complete",Hb:"success",Ja:"error",Ia:"abort",zb:"ready",Ab:"readystatechange",TIMEOUT:"timeout",vb:"incrementaldata",yb:"progress",ob:"downloadprogress",Pb:"uploadprogress"};function eV(){}function eB(e,t,n,r){this.j=e,this.i=t,this.l=n,this.R=r||1,this.U=new em(this),this.I=45e3,this.H=null,this.o=!1,this.m=this.A=this.v=this.L=this.F=this.S=this.B=null,this.D=[],this.g=null,this.C=0,this.s=this.u=null,this.X=-1,this.J=!1,this.O=0,this.M=null,this.W=this.K=this.T=this.P=!1,this.h=new eq}function eq(){this.i=null,this.g="",this.h=!1}b(eV,eb),eV.prototype.g=function(){return new XMLHttpRequest},eV.prototype.i=function(){return{}},t=new eV;var e$={},ez={};function eW(e,t,n){e.L=1,e.v=to(tt(t)),e.m=n,e.P=!0,eH(e,null)}function eH(e,t){e.F=Date.now(),eK(e),e.A=tt(e.v);var n,r,i,s,o,a,l=e.A,u=e.R;Array.isArray(u)||(u=[String(u)]),t_(l.i,"t",u),e.C=0,l=e.j.J,e.h=new eq,e.g=t6(e.j,l?t:null,!e.m),
10<e.O&&(e.M=new ep(_(e.Y,e,e.g),e.O)),t=e.U,l=e.g,u=e.ca;var h="readystatechange";Array.isArray(h)||(h&&(eg[0]=h.toString()),h=eg);for(var c=0;c<h.length;c++){var d=function e(t,n,r,i,s){if(i&&i.once)return function e(t,n,r,i,s){if(Array.isArray(n)){for(var o=0;o<n.length;o++)e(t,n[o],r,i,s);return null}return r=eu(r),t&&t[K]?t.L(n,r,g(i)?!!i.capture:!!i,s):er(t,n,r,!0,i,s)}(t,n,r,i,s);if(Array.isArray(n)){for(var o=0;o<n.length;o++)e(t,n[o],r,i,s);return null}return r=eu(r),t&&t[K]?t.K(n,r,g(i)?!!i.capture:!!i,s):er(t,n,r,!1,i,s)}(l,h[c],u||t.handleEvent,!1,t.h||t);if(!d)break;t.g[d.key]=d}t=e.H?N(e.H):{},e.m?(e.u||(e.u="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.A,e.u,e.m,t)):(e.u="GET",e.g.ea(e.A,e.u,null,t)),eP(),n=e.i,r=e.u,i=e.A,s=e.l,o=e.R,a=e.m,n.info(function(){if(n.g)if(a)for(var e="",t=a.split("&"),l=0;l<t.length;l++){var u=t[l].split("=");if(1<u.length){var h=u[0];u=u[1];var c=h.split("_");e=2<=c.length&&"type"==c[1]?e+(h+"=")+u+"&":e+(h+"=redacted&")}}else e=null;else e=a;return"XMLHTTP REQ ("+s+") [attempt "+o+"]: "+r+"\n"+i+"\n"+e})}function eG(e){return!!e.g&&"GET"==e.u&&2!=e.L&&e.j.Ca}function eK(e){e.S=Date.now()+e.I,eY(e,e.I)}function eY(e,t){if(null!=e.B)throw Error("WatchDog timer not null");e.B=eL(_(e.ba,e),t)}function eQ(e){e.B&&(p.clearTimeout(e.B),e.B=null)}function eX(e){0==e.j.G||e.J||t0(e.j,e)}function eJ(e){eQ(e);var t=e.M;t&&"function"==typeof t.ma&&t.ma(),e.M=null,ey(e.U),e.g&&(t=e.g,e.g=null,t.abort(),t.ma())}function eZ(e,t){try{var n=e.j;if(0!=n.G&&(n.g==e||e5(n.h,e))){if(!e.K&&e5(n.h,e)&&3==n.G){try{var r=n.Da.g.parse(t)}catch(e){r=null}if(Array.isArray(r)&&3==r.length){var i=r;if(0==i[0]){e:if(!n.u){if(n.g)if(n.g.F+3e3<e.F)tZ(n),t$(n);else break e;tQ(n),eO(18)}}else n.za=i[1],0<n.za-n.T&&37500>i[2]&&n.F&&0==n.v&&!n.C&&(n.C=eL(_(n.Za,n),6e3));if(1>=e3(n.h)&&n.ca){try{n.ca()}catch(e){}n.ca=void 0}}else t2(n,11)}else if((e.K||n.g==e)&&tZ(n),!x(t))for(i=n.Da.g.parse(t),t=0;t<i.length;t++){let a=i[t];if(n.T=a[0],a=a[1],2==n.G)if("c"==a[0]){n.K=a[1],n.ia=a[2];let t=a[3];null!=t&&(n.la=t,n.j.info("VER="+n.la));let i=a[4];null!=i&&(n.Aa=i,n.j.info("SVER="+n.Aa));let l=a[5];null!=l&&"number"==typeof l&&0<l&&(n.L=r=1.5*l,n.j.info("backChannelRequestTimeoutMs_="+r)),r=n;let u=e.g;if(u){let e=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=r.h;s.g||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(s.j=s.l,s.g=new Set,s.h&&(e6(s,s.h),s.h=null))}if(r.D){let e=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(r.ya=e,ts(r.I,r.D,e))}}if(n.G=3,n.l&&n.l.ua(),n.ba&&(n.R=Date.now()-e.F,n.j.info("Handshake RTT: "+n.R+"ms")),(r=n).qa=t5(r,r.J?r.ia:null,r.W),e.K){e4(r.h,e);var o=r.L;o&&(e.I=o),e.B&&(eQ(e),eK(e)),r.g=e}else tY(r);0<n.i.length&&tW(n)}else"stop"!=a[0]&&"close"!=a[0]||t2(n,7);else 3==n.G&&("stop"==a[0]||"close"==a[0]?"stop"==a[0]?t2(n,7):tq(n):"noop"!=a[0]&&n.l&&n.l.ta(a),n.v=0)}}eP(4)}catch(e){}}eB.prototype.ca=function(e){e=e.target;let t=this.M;t&&3==tF(e)?t.j():this.Y(e)},eB.prototype.Y=function(e){try{if(e==this.g)e:{let v=tF(this.g);var t=this.g.Ba();let _=this.g.Z();if(!(3>v)&&(3!=v||this.g&&(this.h.h||this.g.oa()||tU(this.g)))){this.J||4!=v||7==t||(8==t||0>=_?eP(3):eP(2)),eQ(this);var n=this.g.Z();this.X=n;t:if(eG(this)){var r=tU(this.g);e="";var i=r.length,s=4==tF(this.g);if(!this.h.i){if("undefined"==typeof TextDecoder){eJ(this),eX(this);var o="";break t}this.h.i=new p.TextDecoder}for(t=0;t<i;t++)this.h.h=!0,e+=this.h.i.decode(r[t],{stream:!(s&&t==i-1)});r.length=0,this.h.g+=e,this.C=0,o=this.h.g}else o=this.g.oa();if(this.o=200==n,a=this.i,l=this.u,u=this.A,h=this.l,c=this.R,d=n,a.info(function(){return"XMLHTTP RESP ("+h+") [ attempt "+c+"]: "+l+"\n"+u+"\n"+v+" "+d}),this.o){if(this.T&&!this.K){t:{if(this.g){var a,l,u,h,c,d,f,m=this.g;if((f=m.g?m.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!x(f)){var g=f;break t}}g=null}if(n=g)ej(this.i,this.l,n,"Initial handshake response via X-HTTP-Initial-Response"),this.K=!0,eZ(this,n);else{this.o=!1,this.s=3,eO(12),eJ(this),eX(this);break e}}if(this.P){let e;for(n=!0;!this.J&&this.C<o.length;)if((e=function(e,t){var n=e.C,r=t.indexOf("\n",n);return -1==r?ez:isNaN(n=Number(t.substring(n,r)))?e$:(r+=1)+n>t.length?ez:(t=t.slice(r,r+n),e.C=r+n,t)}(this,o))==ez){4==v&&(this.s=4,eO(14),n=!1),ej(this.i,this.l,null,"[Incomplete Response]");break}else if(e==e$){this.s=4,eO(15),ej(this.i,this.l,o,"[Invalid Chunk]"),n=!1;break}else ej(this.i,this.l,e,null),eZ(this,e);if(eG(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=v||0!=o.length||this.h.h||(this.s=1,eO(16),n=!1),this.o=this.o&&n,n){if(0<o.length&&!this.W){this.W=!0;var y=this.j;y.g==this&&y.ba&&!y.M&&(y.j.info("Great, no buffering proxy detected. Bytes received: "+o.length),tX(y),y.M=!0,eO(11))}}else ej(this.i,this.l,o,"[Invalid Chunked Response]"),eJ(this),eX(this)}else ej(this.i,this.l,o,null),eZ(this,o);4==v&&eJ(this),this.o&&!this.J&&(4==v?t0(this.j,this):(this.o=!1,eK(this)))}else(function(e){let t={};e=(e.g&&2<=tF(e)&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let r=0;r<e.length;r++){if(x(e[r]))continue;var n=function(e){var t=1;e=e.split(":");let n=[];for(;0<t&&e.length;)n.push(e.shift()),t--;return e.length&&n.push(e.join(":")),n}(e[r]);let i=n[0];if("string"!=typeof(n=n[1]))continue;n=n.trim();let s=t[i]||[];t[i]=s,s.push(n)}
1var r=function(e){return e.join(", ")};for(let e in t)r.call(void 0,t[e],e,t)})(this.g),400==n&&0<o.indexOf("Unknown SID")?(this.s=3,eO(12)):(this.s=0,eO(13)),eJ(this),eX(this)}}}catch(e){}finally{}},eB.prototype.cancel=function(){this.J=!0,eJ(this)},eB.prototype.ba=function(){var e,t;this.B=null;let n=Date.now();0<=n-this.S?(e=this.i,t=this.A,e.info(function(){return"TIMEOUT: "+t}),2!=this.L&&(eP(),eO(17)),eJ(this),this.s=2,eX(this)):eY(this,this.S-n)};var e0=class{constructor(e,t){this.g=e,this.map=t}};function e1(e){this.l=e||10,e=p.PerformanceNavigationTiming?0<(e=p.performance.getEntriesByType("navigation")).length&&("hq"==e[0].nextHopProtocol||"h2"==e[0].nextHopProtocol):!!(p.chrome&&p.chrome.loadTimes&&p.chrome.loadTimes()&&p.chrome.loadTimes().wasFetchedViaSpdy),this.j=e?this.l:1,this.g=null,1<this.j&&(this.g=new Set),this.h=null,this.i=[]}function e2(e){return!!e.h||!!e.g&&e.g.size>=e.j}function e3(e){return e.h?1:e.g?e.g.size:0}function e5(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function e6(e,t){e.g?e.g.add(t):e.h=t}function e4(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function e8(e){if(null!=e.h)return e.i.concat(e.h.D);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let n of e.g.values())t=t.concat(n.D);return t}return E(e.i)}function e7(e,t){if(e.forEach&&"function"==typeof e.forEach)e.forEach(t,void 0);else if(m(e)||"string"==typeof e)Array.prototype.forEach.call(e,t,void 0);else for(var n=function(e){if(e.na&&"function"==typeof e.na)return e.na();if(!e.V||"function"!=typeof e.V){if("undefined"!=typeof Map&&e instanceof Map)return Array.from(e.keys());if(!("undefined"!=typeof Set&&e instanceof Set)){if(m(e)||"string"==typeof e){var t=[];e=e.length;for(var n=0;n<e;n++)t.push(n);return t}for(let r in t=[],n=0,e)t[n++]=r;return t}}}(e),r=function(e){if(e.V&&"function"==typeof e.V)return e.V();if("undefined"!=typeof Map&&e instanceof Map||"undefined"!=typeof Set&&e instanceof Set)return Array.from(e.values());if("string"==typeof e)return e.split("");if(m(e)){for(var t=[],n=e.length,r=0;r<n;r++)t.push(e[r]);return t}for(r in t=[],n=0,e)t[n++]=e[r];return t}(e),i=r.length,s=0;s<i;s++)t.call(void 0,r[s],n&&n[s],e)}e1.prototype.cancel=function(){if(this.i=e8(this),this.h)this.h.cancel(),this.h=null;else if(this.g&&0!==this.g.size){for(let e of this.g.values())e.cancel();this.g.clear()}};var e9=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function te(e){if(this.g=this.o=this.j="",this.s=null,this.m=this.l="",this.h=!1,e instanceof te){this.h=e.h,tn(this,e.j),this.o=e.o,this.g=e.g,tr(this,e.s),this.l=e.l;var t=e.i,n=new tm;n.i=t.i,t.g&&(n.g=new Map(t.g),n.h=t.h),ti(this,n),this.m=e.m}else e&&(t=String(e).match(e9))?(this.h=!1,tn(this,t[1]||"",!0),this.o=ta(t[2]||""),this.g=ta(t[3]||"",!0),tr(this,t[4]),this.l=ta(t[5]||"",!0),ti(this,t[6]||"",!0),this.m=ta(t[7]||"")):(this.h=!1,this.i=new tm(null,this.h))}function tt(e){return new te(e)}function tn(e,t,n){e.j=n?ta(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function tr(e,t){if(t){if(isNaN(t=Number(t))||0>t)throw Error("Bad port number "+t);e.s=t}else e.s=null}function ti(e,t,n){var r,i;t instanceof tm?(e.i=t,r=e.i,(i=e.h)&&!r.j&&(tg(r),r.i=null,r.g.forEach(function(e,t){var n=t.toLowerCase();t!=n&&(ty(this,t),t_(this,n,e))},r)),r.j=i):(n||(t=tl(t,tf)),e.i=new tm(t,e.h))}function ts(e,t,n){e.i.set(t,n)}function to(e){return ts(e,"zx",Math.floor(0x80000000*Math.random()).toString(36)+Math.abs(Math.floor(0x80000000*Math.random())^Date.now()).toString(36)),e}function ta(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function tl(e,t,n){return"string"==typeof e?(e=encodeURI(e).replace(t,tu),n&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function tu(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}te.prototype.toString=function(){var e=[],t=this.j;t&&e.push(tl(t,th,!0),":");var n=this.g;return(n||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(tl(t,th,!0),"@"),e.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.s)&&e.push(":",String(n))),(n=this.l)&&(this.g&&"/"!=n.charAt(0)&&e.push("/"),e.push(tl(n,"/"==n.charAt(0)?td:tc,!0))),(n=this.i.toString())&&e.push("?",n),(n=this.m)&&e.push("#",tl(n,tp)),e.join("")};var th=/[#\/\?@]/g,tc=/[#\?:]/g,td=/[#\?]/g,tf=/[#\?@]/g,tp=/#/g;function tm(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function tg(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(var n=0;n<e.length;n++){var r=e[n].indexOf("="),i=null;if(0<=r){var s=e[n].substring(0,r);i=e[n].substring(r+1)}else s=e[n];t(s,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}(e.i,function(t,n){e.add(decodeURIComponent(t.replace(/\+/g," ")),n)}))}function ty(e,t){tg(e),t=tw(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function tv(e,t){return tg(e),t=tw(e,t),e.g.has(t)}function t_(e,t,n){ty(e,t),0<n.length&&(e.i=null,e.g.set(tw(e,t),E(n)),e.h+=n.length)}function tw(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function tb(e,t,n,r,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),r(n)}catch(e){}}function tE(){this.g=new ew}function tT(e){this.l=e.Ub||null,this.j=e.eb||!1}function tS(e,t){eh.call(this),this.D=e,this.o=t,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}function tC(e){e.j.read().then(e.Pa.bind(e)).catch(e.ga.bind(e))}function tI(e){e.readyState=4,e.l=null,e.j=null,e.v=null,tx(e)}function tx(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function tA(e){let t="";return P(e,function(e,n){t+=n,t+=":",t+=e,t+="\r\n"}),t}
1function tk(e,t,n){e:{for(r in n){var r=!1;break e}r=!0}r||(n=tA(n),"string"==typeof e?null!=n&&encodeURIComponent(String(n)):ts(e,t,n))}function tR(e){eh.call(this),this.headers=new Map,this.o=e||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}(n=tm.prototype).add=function(e,t){tg(this),this.i=null,e=tw(this,e);var n=this.g.get(e);return n||this.g.set(e,n=[]),n.push(t),this.h+=1,this},n.forEach=function(e,t){tg(this),this.g.forEach(function(n,r){n.forEach(function(n){e.call(t,n,r,this)},this)},this)},n.na=function(){tg(this);let e=Array.from(this.g.values()),t=Array.from(this.g.keys()),n=[];for(let r=0;r<t.length;r++){let i=e[r];for(let e=0;e<i.length;e++)n.push(t[r])}return n},n.V=function(e){tg(this);let t=[];if("string"==typeof e)tv(this,e)&&(t=t.concat(this.g.get(tw(this,e))));else{e=Array.from(this.g.values());for(let n=0;n<e.length;n++)t=t.concat(e[n])}return t},n.set=function(e,t){return tg(this),this.i=null,tv(this,e=tw(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},n.get=function(e,t){return e&&0<(e=this.V(e)).length?String(e[0]):t},n.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(var n=0;n<t.length;n++){var r=t[n];let s=encodeURIComponent(String(r)),o=this.V(r);for(r=0;r<o.length;r++){var i=s;""!==o[r]&&(i+="="+encodeURIComponent(String(o[r]))),e.push(i)}}return this.i=e.join("&")},b(tT,eb),tT.prototype.g=function(){return new tS(this.l,this.j)},tT.prototype.i=(e={},function(){return e}),b(tS,eh),(n=tS.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.B=e,this.A=t,this.readyState=1,tx(this)},n.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.g=!0;let t={headers:this.u,method:this.B,credentials:this.m,cache:void 0};e&&(t.body=e),(this.D||p).fetch(new Request(this.A,t)).then(this.Sa.bind(this),this.ga.bind(this))},n.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&&4!=this.readyState&&(this.g=!1,tI(this)),this.readyState=0},n.Sa=function(e){if(this.g&&(this.l=e,this.h||(this.status=this.l.status,this.statusText=this.l.statusText,this.h=e.headers,this.readyState=2,tx(this)),this.g&&(this.readyState=3,tx(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Qa.bind(this),this.ga.bind(this));else if(void 0!==p.ReadableStream&&"body"in e){if(this.j=e.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;tC(this)}else e.text().then(this.Ra.bind(this),this.ga.bind(this))},n.Pa=function(e){if(this.g){if(this.o&&e.value)this.response.push(e.value);else if(!this.o){var t=e.value?e.value:new Uint8Array(0);(t=this.v.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tI(this):tx(this),3==this.readyState&&tC(this)}},n.Ra=function(e){this.g&&(this.response=this.responseText=e,tI(this))},n.Qa=function(e){this.g&&(this.response=e,tI(this))},n.ga=function(){this.g&&tI(this)},n.setRequestHeader=function(e,t){this.u.append(e,t)},n.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},n.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var n=t.next();!n.done;)e.push((n=n.value)[0]+": "+n[1]),n=t.next();return e.join("\r\n")},Object.defineProperty(tS.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),b(tR,eh);var tP=/^https?$/i,tN=["POST","PUT"];function tO(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.m=5,tD(e),tM(e)}function tD(e){e.A||(e.A=!0,ec(e,"complete"),ec(e,"error"))}function tL(e){if(e.h&&void 0!==f&&(!e.v[1]||4!=tF(e)||2!=e.Z())){if(e.u&&4==tF(e))ef(e.Ea,0,e);else if(ec(e,"readystatechange"),4==tF(e)){e.h=!1;try{let o=e.Z();switch(o){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,n,r=!0;break;default:r=!1}if(!(t=r)){if(n=0===o){var i=String(e.D).match(e9)[1]||null;!i&&p.self&&p.self.location&&(i=p.self.location.protocol.slice(0,-1)),n=!tP.test(i?i.toLowerCase():"")}t=n}if(t)ec(e,"complete"),ec(e,"success");else{e.m=6;try{var s=2<tF(e)?e.g.statusText:""}catch(e){s=""}e.l=s+" ["+e.Z()+"]",tD(e)}}finally{tM(e)}}}}function tM(e,t){if(e.g){tj(e);let n=e.g,r=e.v[0]?()=>{}:null;e.g=null,e.v=null,t||ec(e,"ready");try{n.onreadystatechange=r}catch(e){}}}function tj(e){e.I&&(p.clearTimeout(e.I),e.I=null)}function tF(e){return e.g?e.g.readyState:0}function tU(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.H){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}
1function tV(e,t,n){return n&&n.internalChannelParams&&n.internalChannelParams[e]||t}function tB(e){this.Aa=0,this.i=[],this.j=new eM,this.ia=this.qa=this.I=this.W=this.g=this.ya=this.D=this.H=this.m=this.S=this.o=null,this.Ya=this.U=0,this.Va=tV("failFast",!1,e),this.F=this.C=this.u=this.s=this.l=null,this.X=!0,this.za=this.T=-1,this.Y=this.v=this.B=0,this.Ta=tV("baseRetryDelayMs",5e3,e),this.cb=tV("retryDelaySeedMs",1e4,e),this.Wa=tV("forwardChannelMaxRetries",2,e),this.wa=tV("forwardChannelRequestTimeoutMs",2e4,e),this.pa=e&&e.xmlHttpFactory||void 0,this.Xa=e&&e.Tb||void 0,this.Ca=e&&e.useFetchStreams||!1,this.L=void 0,this.J=e&&e.supportsCrossDomainXhr||!1,this.K="",this.h=new e1(e&&e.concurrentRequestLimit),this.Da=new tE,this.P=e&&e.fastHandshake||!1,this.O=e&&e.encodeInitMessageHeaders||!1,this.P&&this.O&&(this.O=!1),this.Ua=e&&e.Rb||!1,e&&e.xa&&this.j.xa(),e&&e.forceLongPolling&&(this.X=!1),this.ba=!this.P&&this.X&&e&&e.detectBufferingProxy||!1,this.ja=void 0,e&&e.longPollingTimeout&&0<e.longPollingTimeout&&(this.ja=e.longPollingTimeout),this.ca=void 0,this.R=0,this.M=!1,this.ka=this.A=null}function tq(e){if(tz(e),3==e.G){var t=e.U++,n=tt(e.I);if(ts(n,"SID",e.K),ts(n,"RID",t),ts(n,"TYPE","terminate"),tG(e,n),(t=new eB(e,e.j,t)).L=2,t.v=to(tt(n)),n=!1,p.navigator&&p.navigator.sendBeacon)try{n=p.navigator.sendBeacon(t.v.toString(),"")}catch(e){}!n&&p.Image&&((new Image).src=t.v,n=!0),n||(t.g=t6(t.j,null),t.g.ea(t.v)),t.F=Date.now(),eK(t)}t3(e)}function t$(e){e.g&&(tX(e),e.g.cancel(),e.g=null)}function tz(e){t$(e),e.u&&(p.clearTimeout(e.u),e.u=null),tZ(e),e.h.cancel(),e.s&&("number"==typeof e.s&&p.clearTimeout(e.s),e.s=null)}function tW(e){if(!e2(e.h)&&!e.s){e.s=!0;var t=e.Ga;F||B(),U||(F(),U=!0),V.add(t,e),e.B=0}}function tH(e,t){var n;n=t?t.l:e.U++;let r=tt(e.I);ts(r,"SID",e.K),ts(r,"RID",n),ts(r,"AID",e.T),tG(e,r),e.m&&e.o&&tk(r,e.m,e.o),n=new eB(e,e.j,n,e.B+1),null===e.m&&(n.H=e.o),t&&(e.i=t.D.concat(e.i)),t=tK(e,n,1e3),n.I=Math.round(.5*e.wa)+Math.round(.5*e.wa*Math.random()),e6(e.h,n),eW(n,r,t)}function tG(e,t){e.H&&P(e.H,function(e,n){ts(t,n,e)}),e.l&&e7({},function(e,n){ts(t,n,e)})}function tK(e,t,n){n=Math.min(e.i.length,n);var r=e.l?_(e.l.Na,e.l,e):null;e:{var i=e.i;let t=-1;for(;;){let e=["count="+n];-1==t?0<n?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let s=!0;for(let o=0;o<n;o++){let n=i[o].g,a=i[o].map;if(0>(n-=t))t=Math.max(0,i[o].g-100),s=!1;else try{!function(e,t,n){let r=n||"";try{e7(e,function(e,n){let i=e;g(e)&&(i=ev(e)),t.push(r+n+"="+encodeURIComponent(i))})}catch(e){throw t.push(r+"type="+encodeURIComponent("_badmap")),e}}(a,e,"req"+n+"_")}catch(e){r&&r(a)}}if(s){r=e.join("&");break e}}}return t.D=e=e.i.splice(0,n),r}function tY(e){if(!e.g&&!e.u){e.Y=1;var t=e.Fa;F||B(),U||(F(),U=!0),V.add(t,e),e.v=0}}function tQ(e){return!e.g&&!e.u&&!(3<=e.v)&&(e.Y++,e.u=eL(_(e.Fa,e),t1(e,e.v)),e.v++,!0)}function tX(e){null!=e.A&&(p.clearTimeout(e.A),e.A=null)}function tJ(e){e.g=new eB(e,e.j,"rpc",e.Y),null===e.m&&(e.g.H=e.o),e.g.O=0;var t=tt(e.qa);ts(t,"RID","rpc"),ts(t,"SID",e.K),ts(t,"AID",e.T),ts(t,"CI",e.F?"0":"1"),!e.F&&e.ja&&ts(t,"TO",e.ja),ts(t,"TYPE","xmlhttp"),tG(e,t),e.m&&e.o&&tk(t,e.m,e.o),e.L&&(e.g.I=e.L);var n=e.g;e=e.ia,n.L=1,n.v=to(tt(t)),n.m=null,n.P=!0,eH(n,e)}function tZ(e){null!=e.C&&(p.clearTimeout(e.C),e.C=null)}function t0(e,t){var n,r=null;if(e.g==t){tZ(e),tX(e),e.g=null;var i=2}else{if(!e5(e.h,t))return;r=t.D,e4(e.h,t),i=1}if(0!=e.G){if(t.o)if(1==i){r=t.m?t.m.length:0,t=Date.now()-t.F;var s=e.B;ec(i=ek(),new eD(i,r)),tW(e)}else tY(e);else if(3==(s=t.s)||0==s&&0<t.X||!(1==i&&(n=t,!(e3(e.h)>=e.h.j-!!e.s)&&(e.s?(e.i=n.D.concat(e.i),!0):1!=e.G&&2!=e.G&&!(e.B>=(e.Va?0:e.Wa))&&(e.s=eL(_(e.Ga,e,n),t1(e,e.B)),e.B++,!0)))||2==i&&tQ(e)))switch(r&&0<r.length&&((t=e.h).i=t.i.concat(r)),s){case 1:t2(e,5);break;case 4:t2(e,10);break;case 3:t2(e,6);break;default:t2(e,2)}}}function t1(e,t){let n=e.Ta+Math.floor(Math.random()*e.cb);return e.isActive()||(n*=2),n*t}function t2(e,t){if(e.j.info("Error code "+t),2==t){var n=_(e.fb,e),r=e.Xa;let t=!r;r=new te(r||"//www.google.com/images/cleardot.gif"),p.location&&"http"==p.location.protocol||tn(r,"https"),to(r),t?function(e,t){let n=new eM;if(p.Image){let r=new Image;r.onload=w(tb,n,"TestLoadImage: loaded",!0,t,r),r.onerror=w(tb,n,"TestLoadImage: error",!1,t,r),r.onabort=w(tb,n,"TestLoadImage: abort",!1,t,r),r.ontimeout=w(tb,n,"TestLoadImage: timeout",!1,t,r),p.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=e}else t(!1)}(r.toString(),n):function(e,t){let n=new eM,r=new AbortController,i=setTimeout(()=>{r.abort(),tb(n,"TestPingServer: timeout",!1,t)},1e4);fetch(e,{signal:r.signal}).then(e=>{clearTimeout(i),e.ok?tb(n,"TestPingServer: ok",!0,t):tb(n,"TestPingServer: server error",!1,t)}).catch(()=>{clearTimeout(i),tb(n,"TestPingServer: error",!1,t)})}(r.toString(),n)}else eO(2);e.G=0,e.l&&e.l.sa(t),t3(e),tz(e)}function t3(e){if(e.G=0,e.ka=[],e.l){let t=e8(e.h);(0!=t.length||0!=e.i.length)&&(T(e.ka,t),T(e.ka,e.i),e.h.i.length=0,E(e.i),e.i.length=0),e.l.ra()}}function t5(e,t,n){var r=n instanceof te?tt(n):new te(n);if(""!=r.g)t&&(r.g=t+"."+r.g),tr(r,r.s);else{var i=p.location;r=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;var s=new te(null);r&&tn(s,r),t&&(s.g=t),i&&tr(s,i),n&&(s.l=n),r=s}return n=e.D,t=e.ya,n&&t&&ts(r,n,t),ts(r,"VER",e.la),tG(e,r),r}
1function t6(e,t,n){if(t&&!e.J)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tR(e.Ca&&!e.pa?new tT({eb:n}):e.pa)).Ha(e.J),t}function t4(){}function t8(){}function t7(e,t){eh.call(this),this.g=new tB(t),this.l=e,this.h=t&&t.messageUrlParams||null,e=t&&t.messageHeaders||null,t&&t.clientProtocolHeaderRequired&&(e?e["X-Client-Protocol"]="webchannel":e={"X-Client-Protocol":"webchannel"}),this.g.o=e,e=t&&t.initMessageHeaders||null,t&&t.messageContentType&&(e?e["X-WebChannel-Content-Type"]=t.messageContentType:e={"X-WebChannel-Content-Type":t.messageContentType}),t&&t.va&&(e?e["X-WebChannel-Client-Profile"]=t.va:e={"X-WebChannel-Client-Profile":t.va}),this.g.S=e,(e=t&&t.Sb)&&!x(e)&&(this.g.m=e),this.v=t&&t.supportsCrossDomainXhr||!1,this.u=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!x(t)&&(this.g.D=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new nt(this)}function t9(e){eC.call(this),e.__headers__&&(this.headers=e.__headers__,this.statusCode=e.__status__,delete e.__headers__,delete e.__status__);var t=e.__sm__;if(t){e:{for(let n in t){e=n;break e}e=void 0}(this.i=e)&&(e=this.i,t=null!==t&&e in t?t[e]:void 0),this.data=t}else this.data=e}function ne(){eI.call(this),this.status=1}function nt(e){this.g=e}(n=tR.prototype).Ha=function(e){this.J=e},n.ea=function(e,n,r,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+e);n=n?n.toUpperCase():"GET",this.D=e,this.l="",this.m=0,this.A=!1,this.h=!0,this.g=this.o?this.o.g():t.g(),this.v=this.o?eE(this.o):eE(t),this.g.onreadystatechange=_(this.Ea,this);try{this.B=!0,this.g.open(n,String(e),!0),this.B=!1}catch(e){tO(this,e);return}if(e=r||"",r=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)r.set(s,i[s]);else if("function"==typeof i.keys&&"function"==typeof i.get)for(let e of i.keys())r.set(e,i.get(e));else throw Error("Unknown input type for opt_headers: "+String(i));for(let[t,o]of(i=Array.from(r.keys()).find(e=>"content-type"==e.toLowerCase()),s=p.FormData&&e instanceof p.FormData,!(0<=Array.prototype.indexOf.call(tN,n,void 0))||i||s||r.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),r))this.g.setRequestHeader(t,o);this.H&&(this.g.responseType=this.H),"withCredentials"in this.g&&this.g.withCredentials!==this.J&&(this.g.withCredentials=this.J);try{tj(this),this.u=!0,this.g.send(e),this.u=!1}catch(e){tO(this,e)}},n.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.m=e||7,ec(this,"complete"),ec(this,"abort"),tM(this))},n.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),tM(this,!0)),tR.aa.N.call(this)},n.Ea=function(){this.s||(this.B||this.u||this.j?tL(this):this.bb())},n.bb=function(){tL(this)},n.isActive=function(){return!!this.g},n.Z=function(){try{return 2<tF(this)?this.g.status:-1}catch(e){return -1}},n.oa=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},n.Oa=function(e){if(this.g){var t=this.g.responseText;return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),e_(t)}},n.Ba=function(){return this.m},n.Ka=function(){return"string"==typeof this.l?this.l:String(this.l)},(n=tB.prototype).la=8,n.G=1,n.connect=function(e,t,n,r){eO(0),this.W=e,this.H=t||{},n&&void 0!==r&&(this.H.OSID=n,this.H.OAID=r),this.F=this.X,this.I=t5(this,null,this.W),tW(this)},n.Ga=function(e){if(this.s)if(this.s=null,1==this.G){if(!e){this.U=Math.floor(1e5*Math.random()),e=this.U++;let i=new eB(this,this.j,e),s=this.o;if(this.S&&(s?D(s=N(s),this.S):s=this.S),null!==this.m||this.O||(i.H=s,s=null),this.P)e:{for(var t=0,n=0;n<this.i.length;n++){t:{var r=this.i[n];if("__data__"in r.map&&"string"==typeof(r=r.map.__data__)){r=r.length;break t}r=void 0}if(void 0===r)break;if(4096<(t+=r)){t=n;break e}if(4096===t||n===this.i.length-1){t=n+1;break e}}t=1e3}else t=1e3;t=tK(this,i,t),ts(n=tt(this.I),"RID",e),ts(n,"CVER",22),this.D&&ts(n,"X-HTTP-Session-Id",this.D),tG(this,n),s&&(this.O?t="headers="+encodeURIComponent(String(tA(s)))+"&"+t:this.m&&tk(n,this.m,s)),e6(this.h,i),this.Ua&&ts(n,"TYPE","init"),this.P?(ts(n,"$req",t),ts(n,"SID","null"),i.T=!0,eW(i,n,null)):eW(i,n,t),this.G=2}}else 3==this.G&&(e?tH(this,e):0==this.i.length||e2(this.h)||tH(this))},n.Fa=function(){if(this.u=null,tJ(this),this.ba&&!(this.M||null==this.g||0>=this.R)){var e=2*this.R;this.j.info("BP detection timer enabled: "+e),this.A=eL(_(this.ab,this),e)}},n.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,eO(10),t$(this),tJ(this))},n.Za=function(){null!=this.C&&(this.C=null,t$(this),tQ(this),eO(19))},n.fb=function(e){e?(this.j.info("Successfully pinged google.com"),eO(2)):(this.j.info("Failed to ping google.com"),eO(1))},n.isActive=function(){return!!this.l&&this.l.isActive(this)},(n=t4.prototype).ua=function(){},n.ta=function(){},n.sa=function(){},n.ra=function(){},n.isActive=function(){return!0},n.Na=function(){},t8.prototype.g=function(e,t){return new t7(e,t)},b(t7,eh),t7.prototype.m=function(){this.g.l=this.j,this.v&&(this.g.J=!0),this.g.connect(this.l,this.h||void 0)},t7.prototype.close=function(){tq(this.g)},t7.prototype.o=function(e){var t=this.g;if("string"==typeof e){var n={};n.__data__=e,e=n}else this.u&&((n={}).__data__=ev(e),e=n);t.i.push(new e0(t.Ya++,e)),3==t.G&&tW(t)},t7.prototype.N=function(){this.g.l=null,delete this.j,tq(this.g),delete this.g,t7.aa.N.call(this)},b(t9,eC),b(ne,eI),b(nt,t4),nt.prototype.ua=function(){ec(this.g,"a")},nt.prototype.ta=function(e){ec(this.g,new t9(e))},nt.prototype.sa=function(e){ec(this.g,new ne)},nt.prototype.ra=function(){ec(this.g,"b")},t8.prototype.createWebChannel=t8.prototype.g,t7.prototype.send=t7.prototype.o,t7.prototype.open=t7.prototype.m,t7.prototype.close=t7.prototype.close,d=I.createWebChannelTransport=function(){return new t8},c=I.getStatEventTarget=function(){return ek()},h=I.Event=ex,u=I.Stat={mb:0,pb:1,qb:2,Jb:3,Ob:4,Lb:5,Mb:6,Kb:7,Ib:8,Nb:9,PROXY:10,NOPROXY:11,Gb:12,Cb:13,Db:14,Bb:15,Eb:16,Fb:17,ib:18,hb:19,jb:20},eF.NO_ERROR=0,eF.TIMEOUT=8,eF.HTTP_ERROR=6,l=I.ErrorCode=eF,eU.COMPLETE="complete",a=I.EventType=eU,eT.EventType=eS,eS.OPEN="a",eS.CLOSE="b",eS.ERROR="c",eS.MESSAGE="d",eh.prototype.listen=eh.prototype.K,o=I.WebChannel=eT,I.FetchXmlHttpFactory=tT,tR.prototype.listenOnce=tR.prototype.L,tR.prototype.getLastError=tR.prototype.Ka,tR.prototype.getLastErrorCode=tR.prototype.Ba,tR.prototype.getStatus=tR.prototype.Z,tR.prototype.getResponseJson=tR.prototype.Oa,tR.prototype.getResponseText=tR.prototype.oa,tR.prototype.send=tR.prototype.ea,tR.prototype.setWithCredentials=tR.prototype.Ha,s=I.XhrIo=tR}).apply(void 0!==C?C:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{}),n(7706);var x=n(2076).hp;let A="@firebase/firestore",k="4.8.0";class R{constructor(e){this.uid=e}isAuthenticated(){return null!=this.uid}toKey(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"}isEqual(e){return e.uid===this.uid}}R.UNAUTHENTICATED=new R(null),R.GOOGLE_CREDENTIALS=new R("google-credentials-uid"),R.FIRST_PARTY=new R("first-party-uid"),R.MOCK_USER=new R("mock-user");let P="11.10.0",N=new b.Vy("@firebase/firestore");function O(){return N.logLevel}function D(e,...t){if(N.logLevel<=b.$b.DEBUG){let n=t.map(j);N.debug(`Firestore (${P}): ${e}`,...n)}}function L(e,...t){if(N.logLevel<=b.$b.ERROR){let n=t.map(j);N.error(`Firestore (${P}): ${e}`,...n)}}function M(e,...t){if(N.logLevel<=b.$b.WARN){let n=t.map(j);N.warn(`Firestore (${P}): ${e}`,...n)}}function j(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function F(e,t,n){let r="Unexpected state";"string"==typeof t?r=t:n=t,U(e,r,n)}function U(e,t,n){let r=`FIRESTORE (${P}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==n)try{r+=" CONTEXT: "+JSON.stringify(n)}catch(e){r+=" CONTEXT: "+n}throw L(r),Error(r)}function V(e,t,n,r){let i="Unexpected state";"string"==typeof n?i=n:r=n,e||U(t,i,r)}let B={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",UNIMPLEMENT
1ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class q extends E.g{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class ${constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class z{constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class W{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(R.UNAUTHENTICATED))}shutdown(){}}class H{constructor(e){this.token=e,this.changeListener=null}getToken(){return Promise.resolve(this.token)}invalidateToken(){}start(e,t){this.changeListener=t,e.enqueueRetryable(()=>t(this.token.user))}shutdown(){this.changeListener=null}}class G{constructor(e){this.t=e,this.currentUser=R.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){V(void 0===this.o,42304);let n=this.i,r=e=>this.i!==n?(n=this.i,t(e)):Promise.resolve(),i=new $;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new $,e.enqueueRetryable(()=>r(this.currentUser))};let s=()=>{let t=i;e.enqueueRetryable(async()=>{await t.promise,await r(this.currentUser)})},o=e=>{D("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>o(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?o(e):(D("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new $)}},0),s()}getToken(){let e=this.i,t=this.forceRefresh;return this.forceRefresh=!1,this.auth?this.auth.getToken(t).then(t=>this.i!==e?(D("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(V("string"==typeof t.accessToken,31837,{l:t}),new z(t.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(){let e=this.auth&&this.auth.getUid();return V(null===e||"string"==typeof e,2055,{h:e}),new R(e)}}class K{constructor(e,t,n){this.P=e,this.T=t,this.I=n,this.type="FirstParty",this.user=R.FIRST_PARTY,this.A=new Map}R(){return this.I?this.I():null}get headers(){this.A.set("X-Goog-AuthUser",this.P);let e=this.R();return e&&this.A.set("Authorization",e),this.T&&this.A.set("X-Goog-Iam-Authorization-Token",this.T),this.A}}class Y{constructor(e,t,n){this.P=e,this.T=t,this.I=n}getToken(){return Promise.resolve(new K(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(R.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class Q{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 X{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,(0,_.xZ)(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){V(void 0===this.o,3512);let n=e=>{null!=e.error&&D("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let n=e.token!==this.m;return this.m=e.token,D("FirebaseAppCheckTokenProvider",`Received ${n?"new":"existing"} token.`),n?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>n(t))};let r=e=>{D("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>r(e)),setTimeout(()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?r(e):D("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new Q(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(V("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new Q(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}function J(){return new TextEncoder}class Z{static newId(){let e=62*Math.floor(256/62),t="";for(;t.length<20;){let n=function(e){let t="undefined"!=typeof self&&(self.crypto||self.msCrypto),n=new Uint8Array(40);if(t&&"function"==typeof t.getRandomValues)t.getRandomValues(n);else for(let e=0;e<40;
1e++)n[e]=Math.floor(256*Math.random());return n}(40);for(let r=0;r<n.length;++r)t.length<20&&n[r]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(n[r]%62))}return t}}function ee(e,t){return e<t?-1:+(e>t)}function et(e,t){let n=0;for(;n<e.length&&n<t.length;){let r=e.codePointAt(n),i=t.codePointAt(n);if(r!==i){if(r<128&&i<128)return ee(r,i);{let s=J(),o=function(e,t){for(let n=0;n<e.length&&n<t.length;++n)if(e[n]!==t[n])return ee(e[n],t[n]);return ee(e.length,t.length)}(s.encode(en(e,n)),s.encode(en(t,n)));return 0!==o?o:ee(r,i)}}n+=r>65535?2:1}return ee(e.length,t.length)}function en(e,t){return e.codePointAt(t)>65535?e.substring(t,t+2):e.substring(t,t+1)}function er(e,t,n){return e.length===t.length&&e.every((e,r)=>n(e,t[r]))}let ei="__name__";class es{constructor(e,t,n){void 0===t?t=0:t>e.length&&F(637,{offset:t,range:e.length}),void 0===n?n=e.length-t:n>e.length-t&&F(1746,{length:n,range:e.length-t}),this.segments=e,this.offset=t,this.len=n}get length(){return this.len}isEqual(e){return 0===es.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof es?e.forEach(e=>{t.push(e)}):t.push(e),this.construct(t)}limit(){return this.offset+this.length}popFirst(e){return e=void 0===e?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 0===this.length}isPrefixOf(e){if(e.length<this.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}isImmediateParentOf(e){if(this.length+1!==e.length)return!1;for(let t=0;t<this.length;t++)if(this.get(t)!==e.get(t))return!1;return!0}forEach(e){for(let t=this.offset,n=this.limit();t<n;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++){let n=es.compareSegments(e.get(r),t.get(r));if(0!==n)return n}return ee(e.length,t.length)}static compareSegments(e,t){let n=es.isNumericId(e),r=es.isNumericId(t);return n&&!r?-1:!n&&r?1:n&&r?es.extractNumericId(e).compare(es.extractNumericId(t)):et(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return r.fromString(e.substring(4,e.length-2))}}class eo extends es{construct(e,t,n){return new eo(e,t,n)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let n of e){if(n.indexOf("//")>=0)throw new q(B.INVALID_ARGUMENT,`Invalid segment (${n}). Paths must not contain // in them.`);t.push(...n.split("/").filter(e=>e.length>0))}return new eo(t)}static emptyPath(){return new eo([])}}let ea=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class el extends es{construct(e,t,n){return new el(e,t,n)}static isValidIdentifier(e){return ea.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),el.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===ei}static keyField(){return new el([ei])}static fromServerFormat(e){let t=[],n="",r=0,i=()=>{if(0===n.length)throw new q(B.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(n),n=""},s=!1;for(;r<e.length;){let t=e[r];if("\\"===t){if(r+1===e.length)throw new q(B.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[r+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new q(B.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);n+=t,r+=2}else"`"===t?s=!s:"."!==t||s?n+=t:i(),r++}if(i(),s)throw new q(B.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new el(t)}static emptyPath(){return new el([])}}class eu{constructor(e){this.path=e}static fromPath(e){return new eu(eo.fromString(e))}static fromName(e){return new eu(eo.fromString(e).popFirst(5))}static empty(){return new eu(eo.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 null!==e&&0===eo.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return eo.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new eu(new eo(e.slice()))}}function eh(e,t,n){if(!n)throw new q(B.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function ec(e){if(!eu.isDocumentKey(e))throw new q(B.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function ed(e){if(eu.isDocumentKey(e))throw new q(B.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function ef(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function ep(e){if(void 0===e)return"undefined";if(null===e)return"null";if("string"==typeof e)return e.length>20&&(e=`${e.substring(0,20)}...`),JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return""+e;if("object"==typeof e){if(e instanceof Array)return"an array";{var t;let n=(t=e).constructor?t.constructor.name:null;return n?`a custom ${n} object`:"an object"}}return"function"==typeof e?"a function":F(12329,{type:typeof e})}function em(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new q(B.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let n=ep(e);throw new q(B.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${n}`)}}return e}function eg(e,t){let n={typeString:e};return t&&(n.value=t),n}function ey(e,t){let n;if(!ef(e))throw new q(B.INVALID_ARGUMENT,"JSON must be an object");for(let r in t)if(t[r]){let i=t[r].typeString,s="value"in t[r]?{value:t[r].value}:void 0;if(!(r in e)){n=`JSON missing required field: '${r}'`;break}let o=e[r];if(i&&typeof o!==i){n=`JSON field '${r}' must be a ${i}.`;break}if(void 0!==s&&o!==s.value){n=`Expected '${r}' field to equal '${s.value}'`;break}}if(n)throw new q(B.INVALID_ARGUMENT,n);return!0}class ev{static now(){return ev.fromMillis(Date.now())}static fromDate(e){return ev.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),n=Math.floor((e-1e3*t)*1e6);return new ev(t,n)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new q(B.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-0xe7791f700||e>=0x3afff44180)throw new q(B.INVALID_ARGUMENT,"Timestamp seconds out of range: "+e)}toDate(){return new Date(this.toMillis())}toMillis(){return 1e3*this.seconds+this.nanoseconds/1e6}_compareTo(e){return this.seconds===e.seconds?ee(this.nanoseconds,e.nanoseconds):ee(this.seconds,e.seconds)}isEqual(e){return e.seconds===this.seconds&&e.nanoseconds===this.nanoseconds}toString(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"}toJSON(){return{type:ev._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(ey(e,ev._jsonSchema))return new ev(e.seconds,e.nanoseconds)}valueOf(){return String(this.seconds- -0xe7791f700).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}
1}ev._jsonSchemaVersion="firestore/timestamp/1.0",ev._jsonSchema={type:eg("string",ev._jsonSchemaVersion),seconds:eg("number"),nanoseconds:eg("number")};class e_{static fromTimestamp(e){return new e_(e)}static min(){return new e_(new ev(0,0))}static max(){return new e_(new ev(0x3afff4417f,0x3b9ac9ff))}constructor(e){this.timestamp=e}compareTo(e){return this.timestamp._compareTo(e.timestamp)}isEqual(e){return this.timestamp.isEqual(e.timestamp)}toMicroseconds(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3}toString(){return"SnapshotVersion("+this.timestamp.toString()+")"}toTimestamp(){return this.timestamp}}class ew{constructor(e,t,n,r){this.indexId=e,this.collectionGroup=t,this.fields=n,this.indexState=r}}ew.UNKNOWN_ID=-1;class eb{constructor(e,t,n){this.readTime=e,this.documentKey=t,this.largestBatchId=n}static min(){return new eb(e_.min(),eu.empty(),-1)}static max(){return new eb(e_.max(),eu.empty(),-1)}}class eE{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function eT(e){if(e.code!==B.FAILED_PRECONDITION||"The current tab is not in the required state to perform this operation. It might be necessary to refresh the browser tab."!==e.message)throw e;D("LocalStore","Unexpectedly lost primary lease")}class eS{constructor(e){this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,e(e=>{this.isDone=!0,this.result=e,this.nextCallback&&this.nextCallback(e)},e=>{this.isDone=!0,this.error=e,this.catchCallback&&this.catchCallback(e)})}catch(e){return this.next(void 0,e)}next(e,t){return this.callbackAttached&&F(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new eS((n,r)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(n,r)},this.catchCallback=e=>{this.wrapFailure(t,e).next(n,r)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof eS?t:eS.resolve(t)}catch(e){return eS.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):eS.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):eS.reject(t)}static resolve(e){return new eS((t,n)=>{t(e)})}static reject(e){return new eS((t,n)=>{n(e)})}static waitFor(e){return new eS((t,n)=>{let r=0,i=0,s=!1;e.forEach(e=>{++r,e.next(()=>{++i,s&&i===r&&t()},e=>n(e))}),s=!0,i===r&&t()})}static or(e){let t=eS.resolve(!1);for(let n of e)t=t.next(e=>e?eS.resolve(e):n());return t}static forEach(e,t){let n=[];return e.forEach((e,r)=>{n.push(t.call(this,e,r))}),this.waitFor(n)}static mapArray(e,t){return new eS((n,r)=>{let i=e.length,s=Array(i),o=0;for(let a=0;a<i;a++){let l=a;t(e[l]).next(e=>{s[l]=e,++o===i&&n(s)},e=>r(e))}})}static doWhile(e,t){return new eS((n,r)=>{let i=()=>{!0===e()?t().next(()=>{i()},r):n()};i()})}}function eC(e){return"IndexedDbTransactionError"===e.name}class eI{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this._e(e),this.ae=e=>t.writeSequenceNumber(e))}_e(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ae&&this.ae(e),e}}eI.ue=-1;function ex(e){return 0===e&&1/e==-1/0}function eA(e){let t=0;for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t++;return t}function ek(e,t){for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t(n,e[n])}function eR(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class eP{constructor(e,t){this.comparator=e,this.root=t||eO.EMPTY}insert(e,t){return new eP(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,eO.BLACK,null,null))}remove(e){return new eP(this.comparator,this.root.remove(e,this.comparator).copy(null,null,eO.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let n=this.comparator(e,t.key);if(0===n)return t.value;n<0?t=t.left:n>0&&(t=t.right)}return null}indexOf(e){let t=0,n=this.root;for(;!n.isEmpty();){let r=this.comparator(e,n.key);if(0===r)return t+n.left.size;r<0?n=n.left:(t+=n.left.size+1,n=n.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((t,n)=>(e(t,n),!1))}toString(){let e=[];return this.inorderTraversal((t,n)=>(e.push(`${t}:${n}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new eN(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new eN(this.root,e,this.comparator,!1)}getReverseIterator(){return new eN(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new eN(this.root,e,this.comparator,!0)}}class eN{constructor(e,t,n,r){this.isReverse=r,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?n(e.key,t):1,t&&r&&(i*=-1),i<0)e=this.isReverse?e.left:e.right;else{if(0===i){this.nodeStack.push(e);break}this.nodeStack.push(e),e=this.isReverse?e.right:e.left}}getNext(){let e=this.nodeStack.pop(),t={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 t}hasNext(){return this.nodeStack.length>0}peek(){if(0===this.nodeStack.length)return null;let e=this.nodeStack[this.nodeStack.length-1];return{key:e.key,value:e.value}}}class eO{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:eO.RED,this.left=null!=r?r:eO.EMPTY,this.right=null!=i?i:eO.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,n,r,i){return new eO(null!=e?e:this.key,null!=t?t:this.value,
1null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}isEmpty(){return!1}inorderTraversal(e){return this.left.inorderTraversal(e)||e(this.key,this.value)||this.right.inorderTraversal(e)}reverseTraversal(e){return this.right.reverseTraversal(e)||e(this.key,this.value)||this.left.reverseTraversal(e)}min(){return this.left.isEmpty()?this:this.left.min()}minKey(){return this.min().key}maxKey(){return this.right.isEmpty()?this.key:this.right.maxKey()}insert(e,t,n){let r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp()}removeMin(){if(this.left.isEmpty())return eO.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)).fixUp()}remove(e,t){let n,r=this;if(0>t(e,r.key))r.left.isEmpty()||r.left.isRed()||r.left.left.isRed()||(r=r.moveRedLeft()),r=r.copy(null,null,null,r.left.remove(e,t),null);else{if(r.left.isRed()&&(r=r.rotateRight()),r.right.isEmpty()||r.right.isRed()||r.right.left.isRed()||(r=r.moveRedRight()),0===t(e,r.key)){if(r.right.isEmpty())return eO.EMPTY;n=r.right.min(),r=r.copy(n.key,n.value,null,null,r.right.removeMin())}r=r.copy(null,null,null,null,r.right.remove(e,t))}return r.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=(e=e.copy(null,null,null,null,e.right.rotateRight())).rotateLeft()).colorFlip()),e}moveRedRight(){let e=this.colorFlip();return e.left.left.isRed()&&(e=(e=e.rotateRight()).colorFlip()),e}rotateLeft(){let e=this.copy(null,null,eO.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,eO.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth(){return Math.pow(2,this.check())<=this.size+1}check(){if(this.isRed()&&this.left.isRed())throw F(43730,{key:this.key,value:this.value});if(this.right.isRed())throw F(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw F(27949);return e+ +!this.isRed()}}eO.EMPTY=null,eO.RED=!0,eO.BLACK=!1,eO.EMPTY=new class{constructor(){this.size=0}get key(){throw F(57766)}get value(){throw F(16141)}get color(){throw F(16727)}get left(){throw F(29726)}get right(){throw F(36894)}copy(e,t,n,r,i){return this}insert(e,t,n){return new eO(e,t)}remove(e,t){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 eD{constructor(e){this.comparator=e,this.data=new eP(this.comparator)}has(e){return null!==this.data.get(e)}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((t,n)=>(e(t),!1))}forEachInRange(e,t){let n=this.data.getIteratorFrom(e[0]);for(;n.hasNext();){let r=n.getNext();if(this.comparator(r.key,e[1])>=0)return;t(r.key)}}forEachWhile(e,t){let n;for(n=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();n.hasNext();)if(!e(n.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new eL(this.data.getIterator())}getIteratorFrom(e){return new eL(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 t=this;return t.size<e.size&&(t=e,e=this),e.forEach(e=>{t=t.add(e)}),t}isEqual(e){if(!(e instanceof eD)||this.size!==e.size)return!1;let t=this.data.getIterator(),n=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,r=n.getNext().key;if(0!==this.comparator(e,r))return!1}return!0}toArray(){let e=[];return this.forEach(t=>{e.push(t)}),e}toString(){let e=[];return this.forEach(t=>e.push(t)),"SortedSet("+e.toString()+")"}copy(e){let t=new eD(this.comparator);return t.data=e,t}}
1class eL{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class eM{constructor(e){this.fields=e,e.sort(el.comparator)}static empty(){return new eM([])}unionWith(e){let t=new eD(el.comparator);for(let e of this.fields)t=t.add(e);for(let n of e)t=t.add(n);return new eM(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return er(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class ej extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class eF{constructor(e){this.binaryString=e}static fromBase64String(e){return new eF(function(e){try{return atob(e)}catch(e){throw"undefined"!=typeof DOMException&&e instanceof DOMException?new ej("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new eF(function(e){let t="";for(let n=0;n<e.length;++n)t+=String.fromCharCode(e[n]);return t}(e))}[Symbol.iterator](){let e=0;return{next:()=>e<this.binaryString.length?{value:this.binaryString.charCodeAt(e++),done:!1}:{value:void 0,done:!0}}}toBase64(){return btoa(this.binaryString)}toUint8Array(){var e=this.binaryString;let t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return ee(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}eF.EMPTY_BYTE_STRING=new eF("");let eU=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function eV(e){if(V(!!e,39018),"string"==typeof e){let t=0,n=eU.exec(e);if(V(!!n,46558,{timestamp:e}),n[1]){let e=n[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:eB(e.seconds),nanos:eB(e.nanos)}}function eB(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function eq(e){return"string"==typeof e?eF.fromBase64String(e):eF.fromUint8Array(e)}let e$="server_timestamp",ez="__type__",eW="__previous_value__",eH="__local_write_time__";function eG(e){var t,n;return(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{})[ez])?void 0:n.stringValue)===e$}function eK(e){let t=e.mapValue.fields[eW];return eG(t)?eK(t):t}function eY(e){let t=eV(e.mapValue.fields[eH].timestampValue);return new ev(t.seconds,t.nanos)}class eQ{constructor(e,t,n,r,i,s,o,a,l,u){this.databaseId=e,this.appId=t,this.persistenceKey=n,this.host=r,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=o,this.longPollingOptions=a,this.useFetchStreams=l,this.isUsingEmulator=u}}let eX="(default)";class eJ{constructor(e,t){this.projectId=e,this.database=t||eX}static empty(){return new eJ("","")}get isDefaultDatabase(){return this.database===eX}isEqual(e){return e instanceof eJ&&e.projectId===this.projectId&&e.database===this.database}}let eZ="__type__",e0="__max__",e1={mapValue:{fields:{__type__:{stringValue:e0}}}},e2="__vector__",e3="value";function e5(e){return"nullValue"in e?0:"booleanValue"in e?1:"integerValue"in e||"doubleValue"in e?2:"timestampValue"in e?3:"stringValue"in e?5:"bytesValue"in e?6:"referenceValue"in e?7:"geoPointValue"in e?8:"arrayValue"in e?9:"mapValue"in e?eG(e)?4:tu(e)?0x1fffffffffffff:ta(e)?10:11:F(28295,{value:e})}function e6(e,t){if(e===t)return!0;let n=e5(e);if(n!==e5(t))return!1;switch(n){case 0:case 0x1fffffffffffff:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return eY(e).isEqual(eY(t));case 3:if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let r=eV(e.timestampValue),i=eV(t.timestampValue);return r.seconds===i.seconds&&r.nanos===i.nanos;case 5:return e.stringValue===t.stringValue;case 6:return eq(e.bytesValue).isEqual(eq(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return eB(e.geoPointValue.latitude)===eB(t.geoPointValue.latitude)&&eB(e.geoPointValue.longitude)===eB(t.geoPointValue.longitude);case 2:if("integerValue"in e&&"integerValue"in t)return eB(e.integerValue)===eB(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let n=eB(e.doubleValue),r=eB(t.doubleValue);return n===r?ex(n)===ex(r):isNaN(n)&&isNaN(r)}return!1;case 9:return er(e.arrayValue.values||[],t.arrayValue.values||[],e6);case 10:case 11:let s=e.mapValue.fields||{},o=t.mapValue.fields||{};if(eA(s)!==eA(o))return!1;for(let e in s)if(s.hasOwnProperty(e)&&(void 0===o[e]||!e6(s[e],o[e])))return!1;return!0;default:return F(52216,{left:e})}}function e4(e,t){return void 0!==(e.values||[]).find(e=>e6(e,t))}function e8(e,t){if(e===t)return 0;let n=e5(e),r=e5(t);
1if(n!==r)return ee(n,r);switch(n){case 0:case 0x1fffffffffffff:return 0;case 1:return ee(e.booleanValue,t.booleanValue);case 2:let i=eB(e.integerValue||e.doubleValue),s=eB(t.integerValue||t.doubleValue);return i<s?-1:i>s?1:i===s?0:isNaN(i)?isNaN(s)?0:-1:1;case 3:return e7(e.timestampValue,t.timestampValue);case 4:return e7(eY(e),eY(t));case 5:return et(e.stringValue,t.stringValue);case 6:return function(e,t){let n=eq(e),r=eq(t);return n.compareTo(r)}(e.bytesValue,t.bytesValue);case 7:return function(e,t){let n=e.split("/"),r=t.split("/");for(let e=0;e<n.length&&e<r.length;e++){let t=ee(n[e],r[e]);if(0!==t)return t}return ee(n.length,r.length)}(e.referenceValue,t.referenceValue);case 8:return function(e,t){let n=ee(eB(e.latitude),eB(t.latitude));return 0!==n?n:ee(eB(e.longitude),eB(t.longitude))}(e.geoPointValue,t.geoPointValue);case 9:return e9(e.arrayValue,t.arrayValue);case 10:return function(e,t){var n,r,i,s;let o=e.fields||{},a=t.fields||{},l=null==(n=o[e3])?void 0:n.arrayValue,u=null==(r=a[e3])?void 0:r.arrayValue,h=ee((null==(i=null==l?void 0:l.values)?void 0:i.length)||0,(null==(s=null==u?void 0:u.values)?void 0:s.length)||0);return 0!==h?h:e9(l,u)}(e.mapValue,t.mapValue);case 11:return function(e,t){if(e===e1.mapValue&&t===e1.mapValue)return 0;if(e===e1.mapValue)return 1;if(t===e1.mapValue)return -1;let n=e.fields||{},r=Object.keys(n),i=t.fields||{},s=Object.keys(i);r.sort(),s.sort();for(let e=0;e<r.length&&e<s.length;++e){let t=et(r[e],s[e]);if(0!==t)return t;let o=e8(n[r[e]],i[s[e]]);if(0!==o)return o}return ee(r.length,s.length)}(e.mapValue,t.mapValue);default:throw F(23264,{le:n})}}function e7(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return ee(e,t);let n=eV(e),r=eV(t),i=ee(n.seconds,r.seconds);return 0!==i?i:ee(n.nanos,r.nanos)}function e9(e,t){let n=e.values||[],r=t.values||[];for(let e=0;e<n.length&&e<r.length;++e){let t=e8(n[e],r[e]);if(t)return t}return ee(n.length,r.length)}function te(e){var t,n;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?function(e){let t=eV(e);return`time(${t.seconds},${t.nanos})`}(e.timestampValue):"stringValue"in e?e.stringValue:"bytesValue"in e?eq(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,eu.fromName(t).toString()):"geoPointValue"in e?(n=e.geoPointValue,`geo(${n.latitude},${n.longitude})`):"arrayValue"in e?function(e){let t="[",n=!0;for(let r of e.values||[])n?n=!1:t+=",",t+=te(r);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),n="{",r=!0;for(let i of t)r?r=!1:n+=",",n+=`${i}:${te(e.fields[i])}`;return n+"}"}(e.mapValue):F(61005,{value:e})}function tt(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function tn(e){return!!e&&"integerValue"in e}function tr(e){return!!e&&"arrayValue"in e}function ti(e){return!!e&&"nullValue"in e}function ts(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function to(e){return!!e&&"mapValue"in e}function ta(e){var t,n;return(null==(n=((null==(t=null==e?void 0:e.mapValue)?void 0:t.fields)||{})[eZ])?void 0:n.stringValue)===e2}function tl(e){if(e.geoPointValue)return{geoPointValue:Object.assign({},e.geoPointValue)};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:Object.assign({},e.timestampValue)};if(e.mapValue){let t={mapValue:{fields:{}}};return ek(e.mapValue.fields,(e,n)=>t.mapValue.fields[e]=tl(n)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let n=0;n<(e.arrayValue.values||[]).length;++n)t.arrayValue.values[n]=tl(e.arrayValue.values[n]);return t}return Object.assign({},e)}function tu(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===e0}class th{constructor(e){this.value=e}static empty(){return new th({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let n=0;n<e.length-1;++n)if(!to(t=(t.mapValue.fields||{})[e.get(n)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=tl(t)}setAll(e){let t=el.emptyPath(),n={},r=[];e.forEach((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,n,r),n={},r=[],t=i.popLast()}e?n[i.lastSegment()]=tl(e):r.push(i.lastSegment())});let i=this.getFieldsMap(t);this.applyChanges(i,n,r)}delete(e){let t=this.field(e.popLast());to(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return e6(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let n=0;n<e.length;++n){let r=t.mapValue.fields[e.get(n)];to(r)&&r.mapValue.fields||(r={mapValue:{fields:{}}},t.mapValue.fields[e.get(n)]=r),t=r}return t.mapValue.fields}
1applyChanges(e,t,n){for(let r of(ek(t,(t,n)=>e[t]=n),n))delete e[r]}clone(){return new th(tl(this.value))}}class tc{constructor(e,t,n,r,i,s,o){this.key=e,this.documentType=t,this.version=n,this.readTime=r,this.createTime=i,this.data=s,this.documentState=o}static newInvalidDocument(e){return new tc(e,0,e_.min(),e_.min(),e_.min(),th.empty(),0)}static newFoundDocument(e,t,n,r){return new tc(e,1,t,e_.min(),n,r,0)}static newNoDocument(e,t){return new tc(e,2,t,e_.min(),e_.min(),th.empty(),0)}static newUnknownDocument(e,t){return new tc(e,3,t,e_.min(),e_.min(),th.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(e_.min())&&(2===this.documentType||0===this.documentType)&&(this.createTime=e),this.version=e,this.documentType=1,this.data=t,this.documentState=0,this}convertToNoDocument(e){return this.version=e,this.documentType=2,this.data=th.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=th.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=e_.min(),this}setReadTime(e){return this.readTime=e,this}get hasLocalMutations(){return 1===this.documentState}get hasCommittedMutations(){return 2===this.documentState}get hasPendingWrites(){return this.hasLocalMutations||this.hasCommittedMutations}isValidDocument(){return 0!==this.documentType}isFoundDocument(){return 1===this.documentType}isNoDocument(){return 2===this.documentType}isUnknownDocument(){return 3===this.documentType}isEqual(e){return e instanceof tc&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.documentType===e.documentType&&this.documentState===e.documentState&&this.data.isEqual(e.data)}mutableCopy(){return new tc(this.key,this.documentType,this.version,this.readTime,this.createTime,this.data.clone(),this.documentState)}toString(){return`Document(${this.key}, ${this.version}, ${JSON.stringify(this.data.value)}, {createTime: ${this.createTime}}), {documentType: ${this.documentType}}), {documentState: ${this.documentState}})`}}class td{constructor(e,t){this.position=e,this.inclusive=t}}function tf(e,t,n){let r=0;for(let i=0;i<e.position.length;i++){let s=t[i],o=e.position[i];if(r=s.field.isKeyField()?eu.comparator(eu.fromName(o.referenceValue),n.key):e8(o,n.data.field(s.field)),"desc"===s.dir&&(r*=-1),0!==r)break}return r}function tp(e,t){if(null===e)return null===t;if(null===t||e.inclusive!==t.inclusive||e.position.length!==t.position.length)return!1;for(let n=0;n<e.position.length;n++)if(!e6(e.position[n],t.position[n]))return!1;return!0}class tm{constructor(e,t="asc"){this.field=e,this.dir=t}}class tg{}class ty extends tg{constructor(e,t,n){super(),this.field=e,this.op=t,this.value=n}static create(e,t,n){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,n):new tb(e,t,n):"array-contains"===t?new tC(e,n):"in"===t?new tI(e,n):"not-in"===t?new tx(e,n):"array-contains-any"===t?new tA(e,n):new ty(e,t,n)}static createKeyFieldInFilter(e,t,n){return"in"===t?new tE(e,n):new tT(e,n)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(e8(t,this.value)):null!==t&&e5(this.value)===e5(t)&&this.matchesComparison(e8(t,this.value))}matchesComparison(e){switch(this.op){case"<":return e<0;case"<=":return e<=0;case"==":return 0===e;case"!=":return 0!==e;case">":return e>0;case">=":return e>=0;default:return F(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class tv extends tg{constructor(e,t){super(),this.filters=e,this.op=t,this.he=null}static create(e,t){return new tv(e,t)}matches(e){return t_(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.he||(this.he=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.he}getFilters(){return Object.assign([],this.filters)}}function t_(e){return"and"===e.op}function tw(e){for(let t of e.filters)if(t instanceof tv)return!1;return!0}class tb extends ty{constructor(e,t,n){super(e,t,n),this.key=eu.fromName(n.referenceValue)}matches(e){let t=eu.comparator(e.key,this.key);return this.matchesComparison(t)}}class tE extends ty{constructor(e,t){super(e,"in",t),this.keys=tS("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class tT extends ty{constructor(e,t){super(e,"not-in",t),this.keys=tS("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function tS(e,t){var n;return((null==(n=t.arrayValue)?void 0:n.values)||[]).map(e=>eu.fromName(e.referenceValue))}class tC extends ty{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return tr(t)&&e4(t.arrayValue,this.value)}}class tI extends ty{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&e4(this.value.arrayValue,t)}}class tx extends ty{constructor(e,t){super(e,"not-in",t)}matches(e){if(e4(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!e4(this.value.arrayValue,t)}}class tA extends ty{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!tr(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>e4(this.value.arrayValue,e))}}class tk{constructor(e,t=null,n=[],r=[],i=null,s=null,o=null){this.path=e,this.collectionGroup=t,this.orderBy=n,this.filters=r,this.limit=i,this.startAt=s,this.endAt=o,this.Pe=null}}function tR(e,t=null,n=[],r=[],i=null,s=null,o=null){return new tk(e,t,n,r,i,s,o)}function tP(e){if(null===e.Pe){let t=e.path.canonicalString();null!==e.collectionGroup&&(t+="|cg:"+e.collectionGroup),t+="|f:",t+=e.filters.map(e=>(function e(t){if(t instanceof ty)return t.field.canonicalString()+t.op.toString()+te(t.value);if(tw(t)&&t_(t))return t.filters.map(t=>e(t)).join(",");{let n=t.filters.map(t=>e(t)).join(",");return`${t.op}(${n})`}})(e)).join(","),t+="|ob:",t+=e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),null==e.limit||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>te(e)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>te(e)).join(",")),e.Pe=t}return e.Pe}function tN(e,t){if(e.limit!==t.limit||e.orderBy.length!==t.orderBy.length)return!1;for(let i=0;i<e.orderBy.length;i++){var n,r;if(n=e.orderBy[i],r=t.orderBy[i],!(n.dir===r.dir&&n.field.isEqual(r.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let n=0;n<e.filters.length;n++)if(!function e(t,n){return t instanceof ty?n instanceof ty&&t.op===n.op&&t.field.isEqual(n.field)&&e6(t.value,n.value):t instanceof tv?n instanceof tv&&t.op===n.op&&t.filters.length===n.filters.length&&t.filters.reduce((t,r,i)=>t&&e(r,n.filters[i]),!0):void F(19439)}(e.filters[n],t.filters[n]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!tp(e.startAt,t.startAt)&&tp(e.endAt,t.endAt)}function tO(e){return eu.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class tD{constructor(e,t=null,n=[],r=[],i=null,s="F",o=null,a=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=n,this.filters=r,this.limit=i,this.limitType=s,this.startAt=o,this.endAt=a,this.Te=null,this.Ie=null,this.de=null,this.startAt,this.endAt}}function tL(e){return 0===e.filters.length&&null===e.limit&&null==e.startAt&&null==e.endAt&&(0===e.explicitOrderBy.length||1===e.explicitOrderBy.length&&e.explicitOrderBy[0].field.isKeyField())}function tM(e){return null!==e.collectionGroup}function tj(e){if(null===e.Te){let t;e.Te=[];let n=new Set;for(let t of e.explicitOrderBy)e.Te.push(t),n.add(t.field.canonicalString());let r=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";
1(t=new eD(el.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t).forEach(t=>{n.has(t.canonicalString())||t.isKeyField()||e.Te.push(new tm(t,r))}),n.has(el.keyField().canonicalString())||e.Te.push(new tm(el.keyField(),r))}return e.Te}function tF(e){return e.Ie||(e.Ie=function(e,t){if("F"===e.limitType)return tR(e.path,e.collectionGroup,t,e.filters,e.limit,e.startAt,e.endAt);{t=t.map(e=>{let t="desc"===e.dir?"asc":"desc";return new tm(e.field,t)});let n=e.endAt?new td(e.endAt.position,e.endAt.inclusive):null,r=e.startAt?new td(e.startAt.position,e.startAt.inclusive):null;return tR(e.path,e.collectionGroup,t,e.filters,e.limit,n,r)}}(e,tj(e))),e.Ie}function tU(e,t){let n=e.filters.concat([t]);return new tD(e.path,e.collectionGroup,e.explicitOrderBy.slice(),n,e.limit,e.limitType,e.startAt,e.endAt)}function tV(e,t,n){return new tD(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,n,e.startAt,e.endAt)}function tB(e,t){return tN(tF(e),tF(t))&&e.limitType===t.limitType}function tq(e){return`${tP(tF(e))}|lt:${e.limitType}`}function t$(e){var t;let n;return`Query(target=${n=(t=tF(e)).path.canonicalString(),null!==t.collectionGroup&&(n+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(n+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof ty?`${t.field.canonicalString()} ${t.op} ${te(t.value)}`:t instanceof tv?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),null==t.limit||(n+=", limit: "+t.limit),t.orderBy.length>0&&(n+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(n+=", startAt: ",n+=t.startAt.inclusive?"b:":"a:",n+=t.startAt.position.map(e=>te(e)).join(",")),t.endAt&&(n+=", endAt: ",n+=t.endAt.inclusive?"a:":"b:",n+=t.endAt.position.map(e=>te(e)).join(",")),`Target(${n})`}; limitType=${e.limitType})`}function tz(e,t){return t.isFoundDocument()&&function(e,t){let n=t.key.path;return null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(n):eu.isDocumentKey(e.path)?e.path.isEqual(n):e.path.isImmediateParentOf(n)}(e,t)&&function(e,t){for(let n of tj(e))if(!n.field.isKeyField()&&null===t.data.field(n.field))return!1;return!0}(e,t)&&function(e,t){for(let n of e.filters)if(!n.matches(t))return!1;return!0}(e,t)&&(!e.startAt||!!function(e,t,n){let r=tf(e,t,n);return e.inclusive?r<=0:r<0}(e.startAt,tj(e),t))&&(!e.endAt||!!function(e,t,n){let r=tf(e,t,n);return e.inclusive?r>=0:r>0}(e.endAt,tj(e),t))}function tW(e){return(t,n)=>{let r=!1;for(let i of tj(e)){let e=function(e,t,n){let r=e.field.isKeyField()?eu.comparator(t.key,n.key):function(e,t,n){let r=t.data.field(e),i=n.data.field(e);return null!==r&&null!==i?e8(r,i):F(42886)}(e.field,t,n);switch(e.dir){case"asc":return r;case"desc":return -1*r;default:return F(19790,{direction:e.dir})}}(i,t,n);if(0!==e)return e;r=r||i.field.isKeyField()}return 0}}class tH{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0!==n){for(let[t,r]of n)if(this.equalsFn(t,e))return r}}has(e){return void 0!==this.get(e)}set(e,t){let n=this.mapKeyFn(e),r=this.inner[n];if(void 0===r)return this.inner[n]=[[e,t]],void this.innerSize++;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return void(r[n]=[e,t]);r.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),n=this.inner[t];if(void 0===n)return!1;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return 1===n.length?delete this.inner[t]:n.splice(r,1),this.innerSize--,!0;return!1}forEach(e){ek(this.inner,(t,n)=>{for(let[t,r]of n)e(t,r)})}isEmpty(){return eR(this.inner)}size(){return this.innerSize}}let tG=new eP(eu.comparator),tK=new eP(eu.comparator);function tY(...e){let t=tK;for(let n of e)t=t.insert(n.key,n);return t}function tQ(e){let t=tK;return e.forEach((e,n)=>t=t.insert(e,n.overlayedDocument)),t}function tX(){return new tH(e=>e.toString(),(e,t)=>e.isEqual(t))}let tJ=new eP(eu.comparator),tZ=new eD(eu.comparator);function t0(...e){let t=tZ;for(let n of e)t=t.add(n);return t}let t1=new eD(ee);function t2(e,t){if(e.useProto3Json){if(isNaN(t))return{doubleValue:"NaN"};if(t===1/0)return{doubleValue:"Infinity"};if(t===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:ex(t)?"-0":t}}function t3(e){return{integerValue:""+e}}class t5{constructor(){this._=void 0}}function t6(e,t){return e instanceof nt?tn(t)||t&&"doubleValue"in t?t:{integerValue:0}:null}class t4 extends t5{}class t8 extends t5{constructor(e){super(),this.elements=e}}function t7(e,t){let n=nr(t);for(let t of e.elements)n.some(e=>e6(e,t))||n.push(t);return{arrayValue:{values:n}}}class t9 extends t5{constructor(e){super(),this.elements=e}}function ne(e,t){let n=nr(t);for(let t of e.elements)n=n.filter(e=>!e6(e,t));return{arrayValue:{values:n}}}
1class nt extends t5{constructor(e,t){super(),this.serializer=e,this.Ee=t}}function nn(e){return eB(e.integerValue||e.doubleValue)}function nr(e){return tr(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class ni{constructor(e,t){this.field=e,this.transform=t}}class ns{constructor(e,t){this.version=e,this.transformResults=t}}class no{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new no}static exists(e){return new no(void 0,e)}static updateTime(e){return new no(e)}get isNone(){return void 0===this.updateTime&&void 0===this.exists}isEqual(e){return this.exists===e.exists&&(this.updateTime?!!e.updateTime&&this.updateTime.isEqual(e.updateTime):!e.updateTime)}}function na(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class nl{}function nu(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new ny(e.key,no.none()):new nd(e.key,e.data,no.none());{let n=e.data,r=th.empty(),i=new eD(el.comparator);for(let e of t.fields)if(!i.has(e)){let t=n.field(e);null===t&&e.length>1&&(e=e.popLast(),t=n.field(e)),null===t?r.delete(e):r.set(e,t),i=i.add(e)}return new nf(e.key,r,new eM(i.toArray()),no.none())}}function nh(e,t,n,r){return e instanceof nd?function(e,t,n,r){if(!na(e.precondition,t))return n;let i=e.value.clone(),s=ng(e.fieldTransforms,r,t);return i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,n,r):e instanceof nf?function(e,t,n,r){if(!na(e.precondition,t))return n;let i=ng(e.fieldTransforms,r,t),s=t.data;return(s.setAll(np(e)),s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===n)?null:n.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,n,r):na(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):n}function nc(e,t){var n,r;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(n=e.fieldTransforms,r=t.fieldTransforms,!!(void 0===n&&void 0===r||!(!n||!r)&&er(n,r,(e,t)=>{var n,r;return e.field.isEqual(t.field)&&(n=e.transform,r=t.transform,n instanceof t8&&r instanceof t8||n instanceof t9&&r instanceof t9?er(n.elements,r.elements,e6):n instanceof nt&&r instanceof nt?e6(n.Ee,r.Ee):n instanceof t4&&r instanceof t4)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class nd extends nl{constructor(e,t,n,r=[]){super(),this.key=e,this.value=t,this.precondition=n,this.fieldTransforms=r,this.type=0}getFieldMask(){return null}}class nf extends nl{constructor(e,t,n,r,i=[]){super(),this.key=e,this.data=t,this.fieldMask=n,this.precondition=r,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function np(e){let t=new Map;return e.fieldMask.fields.forEach(n=>{if(!n.isEmpty()){let r=e.data.field(n);t.set(n,r)}}),t}function nm(e,t,n){let r=new Map;V(e.length===n.length,32656,{Ae:n.length,Re:e.length});for(let s=0;s<n.length;s++){var i;let o=e[s],a=o.transform,l=t.data.field(o.field);r.set(o.field,(i=n[s],a instanceof t8?t7(a,l):a instanceof t9?ne(a,l):i))}return r}function ng(e,t,n){let r=new Map;for(let i of e){let e=i.transform,s=n.data.field(i.field);r.set(i.field,e instanceof t4?function(e,t){let n={fields:{[ez]:{stringValue:e$},[eH]:{timestampValue:{seconds:e.seconds,nanos:e.nanoseconds}}}};return t&&eG(t)&&(t=eK(t)),t&&(n.fields[eW]=t),{mapValue:n}}(t,s):e instanceof t8?t7(e,s):e instanceof t9?ne(e,s):function(e,t){let n=t6(e,t),r=nn(n)+nn(e.Ee);return tn(n)&&tn(e.Ee)?t3(r):t2(e.serializer,r)}(e,s))}return r}class ny extends nl{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class nv extends nl{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class n_{constructor(e,t,n,r){this.batchId=e,this.localWriteTime=t,this.baseMutations=n,this.mutations=r}applyToRemoteDocument(e,t){let n=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let r=this.mutations[t];r.key.isEqual(e.key)&&function(e,t,n){e instanceof nd?function(e,t,n){let r=e.value.clone(),i=nm(e.fieldTransforms,t,n.transformResults);r.setAll(i),t.convertToFoundDocument(n.version,r).setHasCommittedMutations()}
1(e,t,n):e instanceof nf?function(e,t,n){if(!na(e.precondition,t))return t.convertToUnknownDocument(n.version);let r=nm(e.fieldTransforms,t,n.transformResults),i=t.data;i.setAll(np(e)),i.setAll(r),t.convertToFoundDocument(n.version,i).setHasCommittedMutations()}(e,t,n):t.convertToNoDocument(n.version).setHasCommittedMutations()}(r,e,n[t])}}applyToLocalView(e,t){for(let n of this.baseMutations)n.key.isEqual(e.key)&&(t=nh(n,e,t,this.localWriteTime));for(let n of this.mutations)n.key.isEqual(e.key)&&(t=nh(n,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let n=tX();return this.mutations.forEach(r=>{let i=e.get(r.key),s=i.overlayedDocument,o=this.applyToLocalView(s,i.mutatedFields),a=nu(s,o=t.has(r.key)?null:o);null!==a&&n.set(r.key,a),s.isValidDocument()||s.convertToNoDocument(e_.min())}),n}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),t0())}isEqual(e){return this.batchId===e.batchId&&er(this.mutations,e.mutations,(e,t)=>nc(e,t))&&er(this.baseMutations,e.baseMutations,(e,t)=>nc(e,t))}}class nw{constructor(e,t,n,r){this.batch=e,this.commitVersion=t,this.mutationResults=n,this.docVersions=r}static from(e,t,n){V(e.mutations.length===n.length,58842,{Ve:e.mutations.length,me:n.length});let r=tJ,i=e.mutations;for(let e=0;e<i.length;e++)r=r.insert(i[e].key,n[e].version);return new nw(e,t,n,r)}}class nb{constructor(e,t){this.largestBatchId=e,this.mutation=t}getKey(){return this.mutation.key}isEqual(e){return null!==e&&this.mutation===e.mutation}toString(){return`Overlay{ 2 largestBatchId: ${this.largestBatchId}, 3 mutation: ${this.mutation.toString()} 4 }`}}class nE{constructor(e,t){this.count=e,this.unchangedNames=t}}function nT(e){if(void 0===e)return L("GRPC error has no .code"),B.UNKNOWN;switch(e){case f.OK:return B.OK;case f.CANCELLED:return B.CANCELLED;case f.UNKNOWN:return B.UNKNOWN;case f.DEADLINE_EXCEEDED:return B.DEADLINE_EXCEEDED;case f.RESOURCE_EXHAUSTED:return B.RESOURCE_EXHAUSTED;case f.INTERNAL:return B.INTERNAL;case f.UNAVAILABLE:return B.UNAVAILABLE;case f.UNAUTHENTICATED:return B.UNAUTHENTICATED;case f.INVALID_ARGUMENT:return B.INVALID_ARGUMENT;case f.NOT_FOUND:return B.NOT_FOUND;case f.ALREADY_EXISTS:return B.ALREADY_EXISTS;case f.PERMISSION_DENIED:return B.PERMISSION_DENIED;case f.FAILED_PRECONDITION:return B.FAILED_PRECONDITION;case f.ABORTED:return B.ABORTED;case f.OUT_OF_RANGE:return B.OUT_OF_RANGE;case f.UNIMPLEMENTED:return B.UNIMPLEMENTED;case f.DATA_LOSS:return B.DATA_LOSS;default:return F(39323,{code:e})}}(p=f||(f={}))[p.OK=0]="OK",p[p.CANCELLED=1]="CANCELLED",p[p.UNKNOWN=2]="UNKNOWN",p[p.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",p[p.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",p[p.NOT_FOUND=5]="NOT_FOUND",p[p.ALREADY_EXISTS=6]="ALREADY_EXISTS",p[p.PERMISSION_DENIED=7]="PERMISSION_DENIED",p[p.UNAUTHENTICATED=16]="UNAUTHENTICATED",p[p.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",p[p.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",p[p.ABORTED=10]="ABORTED",p[p.OUT_OF_RANGE=11]="OUT_OF_RANGE",p[p.UNIMPLEMENTED=12]="UNIMPLEMENTED",p[p.INTERNAL=13]="INTERNAL",p[p.UNAVAILABLE=14]="UNAVAILABLE",p[p.DATA_LOSS=15]="DATA_LOSS";let nS=new r([0xffffffff,0xffffffff],0);function nC(e){let t=J().encode(e),n=new i;return n.update(t),new Uint8Array(n.digest())}function nI(e){let t=new DataView(e.buffer),n=t.getUint32(0,!0),i=t.getUint32(4,!0),s=t.getUint32(8,!0),o=t.getUint32(12,!0);return[new r([n,i],0),new r([s,o],0)]}class nx{constructor(e,t,n){if(this.bitmap=e,this.padding=t,this.hashCount=n,t<0||t>=8)throw new nA(`Invalid padding: ${t}`);if(n<0||e.length>0&&0===this.hashCount)throw new nA(`Invalid hash count: ${n}`);if(0===e.length&&0!==t)throw new nA(`Invalid padding when bitmap length is 0: ${t}`);this.fe=8*e.length-t,this.ge=r.fromNumber(this.fe)}pe(e,t,n){let i=e.add(t.multiply(r.fromNumber(n)));return 1===i.compare(nS)&&(i=new r([i.getBits(0),i.getBits(1)],0)),i.modulo(this.ge).toNumber()}ye(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.fe)return!1;let[t,n]=nI(nC(e));for(let e=0;e<this.hashCount;e++){let r=this.pe(t,n,e);if(!this.ye(r))return!1}return!0}static create(e,t,n){let r=new nx(new Uint8Array(Math.ceil(e/8)),e%8==0?0:8-e%8,t);
4return n.forEach(e=>r.insert(e)),r}insert(e){if(0===this.fe)return;let[t,n]=nI(nC(e));for(let e=0;e<this.hashCount;e++){let r=this.pe(t,n,e);this.we(r)}}we(e){let t=Math.floor(e/8);this.bitmap[t]|=1<<e%8}}class nA extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class nk{constructor(e,t,n,r,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=n,this.documentUpdates=r,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,n){let r=new Map;return r.set(e,nR.createSynthesizedTargetChangeForCurrentChange(e,t,n)),new nk(e_.min(),r,new eP(ee),tG,t0())}}class nR{constructor(e,t,n,r,i){this.resumeToken=e,this.current=t,this.addedDocuments=n,this.modifiedDocuments=r,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,n){return new nR(n,t,t0(),t0(),t0())}}class nP{constructor(e,t,n,r){this.Se=e,this.removedTargetIds=t,this.key=n,this.be=r}}class nN{constructor(e,t){this.targetId=e,this.De=t}}class nO{constructor(e,t,n=eF.EMPTY_BYTE_STRING,r=null){this.state=e,this.targetIds=t,this.resumeToken=n,this.cause=r}}class nD{constructor(){this.ve=0,this.Ce=nj(),this.Fe=eF.EMPTY_BYTE_STRING,this.Me=!1,this.xe=!0}get current(){return this.Me}get resumeToken(){return this.Fe}get Oe(){return 0!==this.ve}get Ne(){return this.xe}Be(e){e.approximateByteSize()>0&&(this.xe=!0,this.Fe=e)}Le(){let e=t0(),t=t0(),n=t0();return this.Ce.forEach((r,i)=>{switch(i){case 0:e=e.add(r);break;case 2:t=t.add(r);break;case 1:n=n.add(r);break;default:F(38017,{changeType:i})}}),new nR(this.Fe,this.Me,e,t,n)}ke(){this.xe=!1,this.Ce=nj()}qe(e,t){this.xe=!0,this.Ce=this.Ce.insert(e,t)}Qe(e){this.xe=!0,this.Ce=this.Ce.remove(e)}$e(){this.ve+=1}Ue(){this.ve-=1,V(this.ve>=0,3241,{ve:this.ve})}Ke(){this.xe=!0,this.Me=!0}}class nL{constructor(e){this.We=e,this.Ge=new Map,this.ze=tG,this.je=nM(),this.Je=nM(),this.He=new eP(ee)}Ye(e){for(let t of e.Se)e.be&&e.be.isFoundDocument()?this.Ze(t,e.be):this.Xe(t,e.key,e.be);for(let t of e.removedTargetIds)this.Xe(t,e.key,e.be)}et(e){this.forEachTarget(e,t=>{let n=this.tt(t);switch(e.state){case 0:this.nt(t)&&n.Be(e.resumeToken);break;case 1:n.Ue(),n.Oe||n.ke(),n.Be(e.resumeToken);break;case 2:n.Ue(),n.Oe||this.removeTarget(t);break;case 3:this.nt(t)&&(n.Ke(),n.Be(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),n.Be(e.resumeToken));break;default:F(56790,{state:e.state})}})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.Ge.forEach((e,n)=>{this.nt(n)&&t(n)})}it(e){let t=e.targetId,n=e.De.count,r=this.st(t);if(r){let i=r.target;if(tO(i))if(0===n){let e=new eu(i.path);this.Xe(t,e,tc.newNoDocument(e,e_.min()))}else V(1===n,20013,{expectedCount:n});else{let r=this.ot(t);if(r!==n){let n=this._t(e),i=n?this.ut(n,e,r):1;0!==i&&(this.rt(t),this.He=this.He.insert(t,2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch"))}}}}_t(e){let t,n,r=e.De.unchangedNames;if(!r||!r.bits)return null;let{bits:{bitmap:i="",padding:s=0},hashCount:o=0}=r;try{t=eq(i).toUint8Array()}catch(e){if(e instanceof ej)return M("Decoding the base64 bloom filter in existence filter failed ("+e.message+"); ignoring the bloom filter and falling back to full re-query."),null;throw e}try{n=new nx(t,s,o)}catch(e){return M(e instanceof nA?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===n.fe?null:n}ut(e,t,n){return 2*(t.De.count!==n-this.ht(e,t.targetId))}ht(e,t){let n=this.We.getRemoteKeysForTarget(t),r=0;return n.forEach(n=>{let i=this.We.lt(),s=`projects/${i.projectId}/databases/${i.database}/documents/${n.path.canonicalString()}`;e.mightContain(s)||(this.Xe(t,n,null),r++)}),r}Pt(e){let t=new Map;this.Ge.forEach((n,r)=>{let i=this.st(r);if(i){if(n.current&&tO(i.target)){let t=new eu(i.target.path);this.Tt(t).has(r)||this.It(r,t)||this.Xe(r,t,tc.newNoDocument(t,e))}n.Ne&&(t.set(r,n.Le()),n.ke())}});let n=t0();this.Je.forEach((e,t)=>{let r=!0;t.forEachWhile(e=>{let t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(r=!1,!1)}),r&&(n=n.add(e))}),this.ze.forEach((t,n)=>n.setReadTime(e));let r=new nk(e,t,this.He,this.ze,n);return this.ze=tG,this.je=nM(),this.Je=nM(),this.He=new eP(ee),r}Ze(e,t){if(!this.nt(e))return;
4let n=2*!!this.It(e,t.key);this.tt(e).qe(t.key,n),this.ze=this.ze.insert(t.key,t),this.je=this.je.insert(t.key,this.Tt(t.key).add(e)),this.Je=this.Je.insert(t.key,this.dt(t.key).add(e))}Xe(e,t,n){if(!this.nt(e))return;let r=this.tt(e);this.It(e,t)?r.qe(t,1):r.Qe(t),this.Je=this.Je.insert(t,this.dt(t).delete(e)),this.Je=this.Je.insert(t,this.dt(t).add(e)),n&&(this.ze=this.ze.insert(t,n))}removeTarget(e){this.Ge.delete(e)}ot(e){let t=this.tt(e).Le();return this.We.getRemoteKeysForTarget(e).size+t.addedDocuments.size-t.removedDocuments.size}$e(e){this.tt(e).$e()}tt(e){let t=this.Ge.get(e);return t||(t=new nD,this.Ge.set(e,t)),t}dt(e){let t=this.Je.get(e);return t||(t=new eD(ee),this.Je=this.Je.insert(e,t)),t}Tt(e){let t=this.je.get(e);return t||(t=new eD(ee),this.je=this.je.insert(e,t)),t}nt(e){let t=null!==this.st(e);return t||D("WatchChangeAggregator","Detected inactive target",e),t}st(e){let t=this.Ge.get(e);return t&&t.Oe?null:this.We.Et(e)}rt(e){this.Ge.set(e,new nD),this.We.getRemoteKeysForTarget(e).forEach(t=>{this.Xe(e,t,null)})}It(e,t){return this.We.getRemoteKeysForTarget(e).has(t)}}function nM(){return new eP(eu.comparator)}function nj(){return new eP(eu.comparator)}let nF={asc:"ASCENDING",desc:"DESCENDING"},nU={"<":"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"},nV={and:"AND",or:"OR"};class nB{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function nq(e,t){return e.useProto3Json||null==t?t:{value:t}}function n$(e,t){return e.useProto3Json?`${new Date(1e3*t.seconds).toISOString().replace(/\.\d*/,"").replace("Z","")}.${("000000000"+t.nanoseconds).slice(-9)}Z`:{seconds:""+t.seconds,nanos:t.nanoseconds}}function nz(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function nW(e){return V(!!e,49232),e_.fromTimestamp(function(e){let t=eV(e);return new ev(t.seconds,t.nanos)}(e))}function nH(e,t){return nG(e,t).canonicalString()}function nG(e,t){let n=new eo(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?n:n.child(t)}function nK(e){let t=eo.fromString(e);return V(n3(t),10190,{key:t.toString()}),t}function nY(e,t){return nH(e.databaseId,t.path)}function nQ(e,t){let n=nK(t);if(n.get(1)!==e.databaseId.projectId)throw new q(B.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+n.get(1)+" vs "+e.databaseId.projectId);if(n.get(3)!==e.databaseId.database)throw new q(B.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+n.get(3)+" vs "+e.databaseId.database);return new eu(nZ(n))}function nX(e,t){return nH(e.databaseId,t)}function nJ(e){return new eo(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function nZ(e){return V(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function n0(e,t,n){return{name:nY(e,t),fields:n.value.mapValue.fields}}function n1(e){return{fieldPath:e.canonicalString()}}function n2(e){return el.fromServerFormat(e.fieldPath)}function n3(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}class n5{constructor(e,t,n,r,i=e_.min(),s=e_.min(),o=eF.EMPTY_BYTE_STRING,a=null){this.target=e,this.targetId=t,this.purpose=n,this.sequenceNumber=r,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=o,this.expectedCount=a}withSequenceNumber(e){return new n5(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new n5(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new n5(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new n5(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class n6{constructor(e){this.gt=e}}class n4{constructor(){}bt(e,t){this.Dt(e,t),t.vt()}Dt(e,t){if("nullValue"in e)this.Ct(t,5);else if("booleanValue"in e)this.Ct(t,10),t.Ft(+!!e.booleanValue);else if("integerValue"in e)this.Ct(t,15),t.Ft(eB(e.integerValue));else if("doubleValue"in e){let n=eB(e.doubleValue);isNaN(n)?this.Ct(t,13):(this.Ct(t,15),ex(n)?t.Ft(0):t.Ft(n))}else if("timestampValue"in e){let n=e.timestampValue;this.Ct(t,20),"string"==typeof n&&(n=eV(n)),t.Mt(`${n.seconds||""}`),t.Ft(n.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,t),this.Ot(t);else if("bytesValue"in e)this.Ct(t,30),t.Nt(eq(e.bytesValue)),this.Ot(t);else if("referenceValue"in e)this.Bt(e.referenceValue,t);else if("geoPointValue"in e){let n=e.geoPointValue;this.Ct(t,45),t.Ft(n.latitude||0),t.Ft(n.longitude||0)}else"mapValue"in e?tu(e)?this.Ct(t,Number.MAX_SAFE_INTEGER):ta(e)?this.Lt(e.mapValue,t):(this.kt(e.mapValue,t),this.Ot(t)):"arrayValue"in e?(this.qt(e.arrayValue,t),this.Ot(t)):F(19022,{Qt:e})}xt(e,t){this.Ct(t,25),this.$t(e,t)}$t(e,t){t.Mt(e)}kt(e,t){let n=e.fields||{};for(let e of(this.Ct(t,55),Object.keys(n)))this.xt(e,t),this.Dt(n[e],t)}Lt(e,t){var n,r;let i=e.fields||{};this.Ct(t,53);let s=(null==(r=null==(n=i[e3].arrayValue)?void 0:n.values)?void 0:r.length)||0;this.Ct(t,15),t.Ft(eB(s)),this.xt(e3,t),this.Dt(i[e3],t)}qt(e,t){let n=e.values||[];for(let e of(this.Ct(t,50),n))this.Dt(e,t)}
4Bt(e,t){this.Ct(t,37),eu.fromName(e).path.forEach(e=>{this.Ct(t,60),this.$t(e,t)})}Ct(e,t){e.Ft(t)}Ot(e){e.Ft(2)}}n4.Ut=new n4;class n8{constructor(){this.Dn=new n7}addToCollectionParentIndex(e,t){return this.Dn.add(t),eS.resolve()}getCollectionParents(e,t){return eS.resolve(this.Dn.getEntries(t))}addFieldIndex(e,t){return eS.resolve()}deleteFieldIndex(e,t){return eS.resolve()}deleteAllFieldIndexes(e){return eS.resolve()}createTargetIndexes(e,t){return eS.resolve()}getDocumentsMatchingTarget(e,t){return eS.resolve(null)}getIndexType(e,t){return eS.resolve(0)}getFieldIndexes(e,t){return eS.resolve([])}getNextCollectionGroupToUpdate(e){return eS.resolve(null)}getMinOffset(e,t){return eS.resolve(eb.min())}getMinOffsetFromCollectionGroup(e,t){return eS.resolve(eb.min())}updateCollectionGroup(e,t,n){return eS.resolve()}updateIndexEntries(e,t){return eS.resolve()}}class n7{constructor(){this.index={}}add(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t]||new eD(eo.comparator),i=!r.has(n);return this.index[t]=r.add(n),i}has(e){let t=e.lastSegment(),n=e.popLast(),r=this.index[t];return r&&r.has(n)}getEntries(e){return(this.index[e]||new eD(eo.comparator)).toArray()}}new Uint8Array(0);let n9={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0};class re{static withCacheSize(e){return new re(e,re.DEFAULT_COLLECTION_PERCENTILE,re.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,n){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=n}}re.DEFAULT_COLLECTION_PERCENTILE=10,re.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,re.DEFAULT=new re(0x2800000,re.DEFAULT_COLLECTION_PERCENTILE,re.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),re.DISABLED=new re(-1,0,0);class rt{constructor(e){this._r=e}next(){return this._r+=2,this._r}static ar(){return new rt(0)}static ur(){return new rt(-1)}}let rn="LruGarbageCollector";function rr([e,t],[n,r]){let i=ee(e,n);return 0===i?ee(t,r):i}class ri{constructor(e){this.Tr=e,this.buffer=new eD(rr),this.Ir=0}dr(){return++this.Ir}Er(e){let t=[e,this.dr()];if(this.buffer.size<this.Tr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();0>rr(t,e)&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class rs{constructor(e,t,n){this.garbageCollector=e,this.asyncQueue=t,this.localStore=n,this.Ar=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Rr(6e4)}stop(){this.Ar&&(this.Ar.cancel(),this.Ar=null)}get started(){return null!==this.Ar}Rr(e){D(rn,`Garbage collection scheduled in ${e}ms`),this.Ar=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Ar=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){eC(e)?D(rn,"Ignoring IndexedDB error during garbage collection: ",e):await eT(e)}await this.Rr(3e5)})}}class ro{constructor(e,t){this.Vr=e,this.params=t}calculateTargetCount(e,t){return this.Vr.mr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return eS.resolve(eI.ue);let n=new ri(t);return this.Vr.forEachTarget(e,e=>n.Er(e.sequenceNumber)).next(()=>this.Vr.gr(e,e=>n.Er(e))).next(()=>n.maxValue)}removeTargets(e,t,n){return this.Vr.removeTargets(e,t,n)}removeOrphanedDocuments(e,t){return this.Vr.removeOrphanedDocuments(e,t)}collect(e,t){return -1===this.params.cacheSizeCollectionThreshold?(D("LruGarbageCollector","Garbage collection skipped; disabled"),eS.resolve(n9)):this.getCacheSize(e).next(n=>n<this.params.cacheSizeCollectionThreshold?(D("LruGarbageCollector",`Garbage collection skipped; Cache size ${n} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),n9):this.pr(e,t))}getCacheSize(e){return this.Vr.getCacheSize(e)}pr(e,t){let n,r,i,s,o,a,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(D("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),r=this.params.maximumSequenceNumbersToCollect):r=t,s=Date.now(),this.nthSequenceNumber(e,r))).next(r=>(n=r,o=Date.now(),this.removeTargets(e,n,t))).next(t=>(i=t,a=Date.now(),this.removeOrphanedDocuments(e,n))).next(e=>(l=Date.now(),O()<=b.$b.DEBUG&&D("LruGarbageCollector",`LRU Garbage Collection 5 Counted targets in ${s-u}ms 6 Determined least recently used ${r} in `+(o-s)+"ms\n"+` Removed ${i} targets in `+(a-o)+"ms\n"+` Removed ${e} documents in `+(l-a)+"ms\n"+`Total Duration: ${l-u}ms`),eS.resolve({didRun:!0,sequenceNumbersCollected:r,targetsRemoved:i,documentsRemoved:e})))}}class ra{constructor(){this.changes=new tH(e=>e.toString(),(e,t)=>e.isEqual(t)),this.changesApplied=!1}addEntry(e){this.assertNotApplied(),this.changes.set(e.key,e)}removeEntry(e,t){this.assertNotApplied(),this.changes.set(e,tc.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let n=this.changes.get(t);return void 0!==n?eS.resolve(n):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}
6assertNotApplied(){}}class rl{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class ru{constructor(e,t,n,r){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=n,this.indexManager=r}getDocument(e,t){let n=null;return this.documentOverlayCache.getOverlay(e,t).next(r=>(n=r,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==n&&nh(n.mutation,e,eM.empty(),ev.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,t0()).next(()=>t))}getLocalViewOfDocuments(e,t,n=t0()){let r=tX();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,n).next(e=>{let t=tY();return e.forEach((e,n)=>{t=t.insert(e,n.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let n=tX();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,t0()))}populateOverlays(e,t,n){let r=[];return n.forEach(e=>{t.has(e)||r.push(e)}),this.documentOverlayCache.getOverlays(e,r).next(e=>{e.forEach((e,n)=>{t.set(e,n)})})}computeViews(e,t,n,r){let i=tG,s=tX(),o=tX();return t.forEach((e,t)=>{let o=n.get(t.key);r.has(t.key)&&(void 0===o||o.mutation instanceof nf)?i=i.insert(t.key,t):void 0!==o?(s.set(t.key,o.mutation.getFieldMask()),nh(o.mutation,t,o.mutation.getFieldMask(),ev.now())):s.set(t.key,eM.empty())}),this.recalculateAndSaveOverlays(e,i).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>{var n;return o.set(e,new rl(t,null!=(n=s.get(e))?n:null))}),o))}recalculateAndSaveOverlays(e,t){let n=tX(),r=new eP((e,t)=>e-t),i=t0();return this.mutationQueue.getAllMutationBatchesAffectingDocumentKeys(e,t).next(e=>{for(let i of e)i.keys().forEach(e=>{let s=t.get(e);if(null===s)return;let o=n.get(e)||eM.empty();o=i.applyToLocalView(s,o),n.set(e,o);let a=(r.get(i.batchId)||t0()).add(e);r=r.insert(i.batchId,a)})}).next(()=>{let s=[],o=r.getReverseIterator();for(;o.hasNext();){let r=o.getNext(),a=r.key,l=r.value,u=tX();l.forEach(e=>{if(!i.has(e)){let r=nu(t.get(e),n.get(e));null!==r&&u.set(e,r),i=i.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,a,u))}return eS.waitFor(s)}).next(()=>n)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,n,r){return eu.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):tM(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,n,r):this.getDocumentsMatchingCollectionQuery(e,t,n,r)}getNextDocuments(e,t,n,r){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,n,r).next(i=>{let s=r-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,n.largestBatchId,r-i.size):eS.resolve(tX()),o=-1,a=i;return s.next(t=>eS.forEach(t,(t,n)=>(o<n.largestBatchId&&(o=n.largestBatchId),i.get(t)?eS.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{a=a.insert(t,e)}))).next(()=>this.populateOverlays(e,t,i)).next(()=>this.computeViews(e,a,t,t0())).next(e=>({batchId:o,changes:tQ(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new eu(t)).next(e=>{let t=tY();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,n,r){let i=t.collectionGroup,s=tY();return this.indexManager.getCollectionParents(e,i).next(o=>eS.forEach(o,o=>{let a=new tD(o.child(i),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,a,n,r).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,n,r){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,n.largestBatchId).next(s=>(i=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,n,i,r))).next(e=>{i.forEach((t,n)=>{let r=n.getKey();null===e.get(r)&&(e=e.insert(r,tc.newInvalidDocument(r)))});let n=tY();return e.forEach((e,r)=>{let s=i.get(e);void 0!==s&&nh(s.mutation,r,eM.empty(),ev.now()),tz(t,r)&&(n=n.insert(e,r))}),n})}}class rh{constructor(e){this.serializer=e,this.Br=new Map,this.Lr=new Map}
6getBundleMetadata(e,t){return eS.resolve(this.Br.get(t))}saveBundleMetadata(e,t){return this.Br.set(t.id,{id:t.id,version:t.version,createTime:nW(t.createTime)}),eS.resolve()}getNamedQuery(e,t){return eS.resolve(this.Lr.get(t))}saveNamedQuery(e,t){return this.Lr.set(t.name,{name:t.name,query:function(e){let t=function(e){var t;let n,r=function(e){let t=nK(e);return 4===t.length?eo.emptyPath():nZ(t)}(e.parent),i=e.structuredQuery,s=i.from?i.from.length:0,o=null;if(s>0){V(1===s,65062);let e=i.from[0];e.allDescendants?o=e.collectionId:r=r.child(e.collectionId)}let a=[];i.where&&(a=function(e){var t;let n=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=n2(e.unaryFilter.field);return ty.create(t,"==",{doubleValue:NaN});case"IS_NULL":let n=n2(e.unaryFilter.field);return ty.create(n,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let r=n2(e.unaryFilter.field);return ty.create(r,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let i=n2(e.unaryFilter.field);return ty.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return F(61313);default:return F(60726)}}(t):void 0!==t.fieldFilter?ty.create(n2(t.fieldFilter.field),function(e){switch(e){case"EQUAL":return"==";case"NOT_EQUAL":return"!=";case"GREATER_THAN":return">";case"GREATER_THAN_OR_EQUAL":return">=";case"LESS_THAN":return"<";case"LESS_THAN_OR_EQUAL":return"<=";case"ARRAY_CONTAINS":return"array-contains";case"IN":return"in";case"NOT_IN":return"not-in";case"ARRAY_CONTAINS_ANY":return"array-contains-any";case"OPERATOR_UNSPECIFIED":return F(58110);default:return F(50506)}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?tv.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return F(1026)}}(t.compositeFilter.op)):F(30097,{filter:t})}(e);return n instanceof tv&&tw(t=n)&&t_(t)?n.getFilters():[n]}(i.where));let l=[];i.orderBy&&(l=i.orderBy.map(e=>new tm(n2(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let u=null;i.limit&&(u=null==(n="object"==typeof(t=i.limit)?t.value:t)?null:n);let h=null;i.startAt&&(h=function(e){let t=!!e.before;return new td(e.values||[],t)}(i.startAt));let c=null;return i.endAt&&(c=function(e){let t=!e.before;return new td(e.values||[],t)}(i.endAt)),new tD(r,o,l,a,u,"F",h,c)}({parent:e.parent,structuredQuery:e.structuredQuery});return"LAST"===e.limitType?tV(t,t.limit,"L"):t}(t.bundledQuery),readTime:nW(t.readTime)}),eS.resolve()}}class rc{constructor(){this.overlays=new eP(eu.comparator),this.kr=new Map}getOverlay(e,t){return eS.resolve(this.overlays.get(t))}getOverlays(e,t){let n=tX();
6return eS.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&n.set(t,e)})).next(()=>n)}saveOverlays(e,t,n){return n.forEach((n,r)=>{this.wt(e,t,r)}),eS.resolve()}removeOverlaysForBatchId(e,t,n){let r=this.kr.get(n);return void 0!==r&&(r.forEach(e=>this.overlays=this.overlays.remove(e)),this.kr.delete(n)),eS.resolve()}getOverlaysForCollection(e,t,n){let r=tX(),i=t.length+1,s=new eu(t.child("")),o=this.overlays.getIteratorFrom(s);for(;o.hasNext();){let e=o.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===i&&e.largestBatchId>n&&r.set(e.getKey(),e)}return eS.resolve(r)}getOverlaysForCollectionGroup(e,t,n,r){let i=new eP((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>n){let t=i.get(e.largestBatchId);null===t&&(t=tX(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let o=tX(),a=i.getIterator();for(;a.hasNext()&&(a.getNext().value.forEach((e,t)=>o.set(e,t)),!(o.size()>=r)););return eS.resolve(o)}wt(e,t,n){let r=this.overlays.get(n.key);if(null!==r){let e=this.kr.get(r.largestBatchId).delete(n.key);this.kr.set(r.largestBatchId,e)}this.overlays=this.overlays.insert(n.key,new nb(t,n));let i=this.kr.get(t);void 0===i&&(i=t0(),this.kr.set(t,i)),this.kr.set(t,i.add(n.key))}}class rd{constructor(){this.sessionToken=eF.EMPTY_BYTE_STRING}getSessionToken(e){return eS.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,eS.resolve()}}class rf{constructor(){this.qr=new eD(rp.Qr),this.$r=new eD(rp.Ur)}isEmpty(){return this.qr.isEmpty()}addReference(e,t){let n=new rp(e,t);this.qr=this.qr.add(n),this.$r=this.$r.add(n)}Kr(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.Wr(new rp(e,t))}Gr(e,t){e.forEach(e=>this.removeReference(e,t))}zr(e){let t=new eu(new eo([])),n=new rp(t,e),r=new rp(t,e+1),i=[];return this.$r.forEachInRange([n,r],e=>{this.Wr(e),i.push(e.key)}),i}jr(){this.qr.forEach(e=>this.Wr(e))}Wr(e){this.qr=this.qr.delete(e),this.$r=this.$r.delete(e)}Jr(e){let t=new eu(new eo([])),n=new rp(t,e),r=new rp(t,e+1),i=t0();return this.$r.forEachInRange([n,r],e=>{i=i.add(e.key)}),i}containsKey(e){let t=new rp(e,0),n=this.qr.firstAfterOrEqual(t);return null!==n&&e.isEqual(n.key)}}class rp{constructor(e,t){this.key=e,this.Hr=t}static Qr(e,t){return eu.comparator(e.key,t.key)||ee(e.Hr,t.Hr)}static Ur(e,t){return ee(e.Hr,t.Hr)||eu.comparator(e.key,t.key)}}class rm{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.er=1,this.Yr=new eD(rp.Qr)}checkEmpty(e){return eS.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,n,r){let i=this.er;this.er++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new n_(i,t,n,r);for(let t of(this.mutationQueue.push(s),r))this.Yr=this.Yr.add(new rp(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return eS.resolve(s)}lookupMutationBatch(e,t){return eS.resolve(this.Zr(t))}getNextMutationBatchAfterBatchId(e,t){let n=this.Xr(t+1),r=n<0?0:n;return eS.resolve(this.mutationQueue.length>r?this.mutationQueue[r]:null)}getHighestUnacknowledgedBatchId(){return eS.resolve(0===this.mutationQueue.length?-1:this.er-1)}getAllMutationBatches(e){return eS.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let n=new rp(t,0),r=new rp(t,1/0),i=[];return this.Yr.forEachInRange([n,r],e=>{let t=this.Zr(e.Hr);i.push(t)}),eS.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let n=new eD(ee);return t.forEach(e=>{let t=new rp(e,0),r=new rp(e,1/0);this.Yr.forEachInRange([t,r],e=>{n=n.add(e.Hr)})}),eS.resolve(this.ei(n))}getAllMutationBatchesAffectingQuery(e,t){let n=t.path,r=n.length+1,i=n;eu.isDocumentKey(i)||(i=i.child(""));let s=new rp(new eu(i),0),o=new eD(ee);return this.Yr.forEachWhile(e=>{let t=e.key.path;return!!n.isPrefixOf(t)&&(t.length===r&&(o=o.add(e.Hr)),!0)},s),eS.resolve(this.ei(o))}ei(e){let t=[];return e.forEach(e=>{let n=this.Zr(e);null!==n&&t.push(n)}),t}removeMutationBatch(e,t){V(0===this.ti(t.batchId,"removed"),55003),this.mutation
6Queue.shift();let n=this.Yr;return eS.forEach(t.mutations,r=>{let i=new rp(r.key,t.batchId);return n=n.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,r.key)}).next(()=>{this.Yr=n})}rr(e){}containsKey(e,t){let n=new rp(t,0),r=this.Yr.firstAfterOrEqual(n);return eS.resolve(t.isEqual(r&&r.key))}performConsistencyCheck(e){return this.mutationQueue.length,eS.resolve()}ti(e,t){return this.Xr(e)}Xr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Zr(e){let t=this.Xr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class rg{constructor(e){this.ni=e,this.docs=new eP(eu.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let n=t.key,r=this.docs.get(n),i=r?r.size:0,s=this.ni(t);return this.docs=this.docs.insert(n,{document:t.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(e,n.path.popLast())}removeEntry(e){let t=this.docs.get(e);t&&(this.docs=this.docs.remove(e),this.size-=t.size)}getEntry(e,t){let n=this.docs.get(t);return eS.resolve(n?n.document.mutableCopy():tc.newInvalidDocument(t))}getEntries(e,t){let n=tG;return t.forEach(e=>{let t=this.docs.get(e);n=n.insert(e,t?t.document.mutableCopy():tc.newInvalidDocument(e))}),eS.resolve(n)}getDocumentsMatchingQuery(e,t,n,r){let i=tG,s=t.path,o=new eu(s.child("__id-9223372036854775808__")),a=this.docs.getIteratorFrom(o);for(;a.hasNext();){let{key:e,value:{document:o}}=a.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let n=e.readTime.compareTo(t.readTime);return 0!==n||0!==(n=eu.comparator(e.documentKey,t.documentKey))?n:ee(e.largestBatchId,t.largestBatchId)}(new eb(o.readTime,o.key,-1),n)||(r.has(o.key)||tz(t,o))&&(i=i.insert(o.key,o.mutableCopy()))}return eS.resolve(i)}getAllFromCollectionGroup(e,t,n,r){F(9500)}
vendor: 4,249 bytes, line 6
6ri(e,t){return eS.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new ry(this)}getSize(e){return eS.resolve(this.size)}}class ry extends ra{constructor(e){super(),this.Or=e}applyChanges(e){let t=[];return this.changes.forEach((n,r)=>{r.isValidDocument()?t.push(this.Or.addEntry(e,r)):this.Or.removeEntry(n)}),eS.waitFor(t)}getFromCache(e,t){return this.Or.getEntry(e,t)}getAllFromCache(e,t){return this.Or.getEntries(e,t)}}class rv{constructor(e){this.persistence=e,this.ii=new tH(e=>tP(e),tN),this.lastRemoteSnapshotVersion=e_.min(),this.highestTargetId=0,this.si=0,this.oi=new rf,this.targetCount=0,this._i=rt.ar()}forEachTarget(e,t){return this.ii.forEach((e,n)=>t(n)),eS.resolve()}getLastRemoteSnapshotVersion(e){return eS.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return eS.resolve(this.si)}allocateTargetId(e){return this.highestTargetId=this._i.next(),eS.resolve(this.highestTargetId)}setTargetsMetadata(e,t,n){return n&&(this.lastRemoteSnapshotVersion=n),t>this.si&&(this.si=t),eS.resolve()}hr(e){this.ii.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this._i=new rt(t),this.highestTargetId=t),e.sequenceNumber>this.si&&(this.si=e.sequenceNumber)}addTargetData(e,t){return this.hr(t),this.targetCount+=1,eS.resolve()}updateTargetData(e,t){return this.hr(t),eS.resolve()}removeTargetData(e,t){return this.ii.delete(t.target),this.oi.zr(t.targetId),this.targetCount-=1,eS.resolve()}removeTargets(e,t,n){let r=0,i=[];return this.ii.forEach((s,o)=>{o.sequenceNumber<=t&&null===n.get(o.targetId)&&(this.ii.delete(s),i.push(this.removeMatchingKeysForTargetId(e,o.targetId)),r++)}),eS.waitFor(i).next(()=>r)}getTargetCount(e){return eS.resolve(this.targetCount)}getTargetData(e,t){let n=this.ii.get(t)||null;return eS.resolve(n)}addMatchingKeys(e,t,n){return this.oi.Kr(t,n),eS.resolve()}removeMatchingKeys(e,t,n){this.oi.Gr(t,n);let r=this.persistence.referenceDelegate,i=[];return r&&t.forEach(t=>{i.push(r.markPotentiallyOrphaned(e,t))}),eS.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.oi.zr(t),eS.resolve()}getMatchingKeysForTargetId(e,t){let n=this.oi.Jr(t);return eS.resolve(n)}containsKey(e,t){return eS.resolve(this.oi.containsKey(t))}}class r_{constructor(e,t){this.ai={},this.overlays={},this.ui=new eI(0),this.ci=!1,this.ci=!0,this.li=new rd,this.referenceDelegate=e(this),this.hi=new rv(this),this.indexManager=new n8,this.remoteDocumentCache=new rg(e=>this.referenceDelegate.Pi(e)),this.serializer=new n6(t),this.Ti=new rh(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ci=!1,Promise.resolve()}get started(){return this.ci}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new rc,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let n=this.ai[e.toKey()];return n||(n=new rm(t,this.referenceDelegate),this.ai[e.toKey()]=n),n}getGlobalsCache(){return this.li}getTargetCache(){return this.hi}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.Ti}runTransaction(e,t,n){D("MemoryPersistence","Starting transaction:",e);let r=new rw(this.ui.next());return this.referenceDelegate.Ii(),n(r).next(e=>this.referenceDelegate.di(r).next(()=>e)).toPromise().then(e=>(r.raiseOnCommittedEvent(),e))}Ei(e,t){return eS.or(Object.values(this.ai).map(n=>()=>n.containsKey(e,t)))}}class rw extends eE{constructor(e){super(),this.currentSequenceNumber=e}}class rb{constructor(e){this.persistence=e,this.Ai=new rf,this.Ri=null}static Vi(e){return new rb(e)}get mi(){if(this.Ri)return this.Ri;throw F(60996)}addReference(e,t,n){return this.Ai.addReference(n,t),this.mi.delete(n.toString()),eS.resolve()}removeReference(e,t,n){return this.Ai.removeReference(n,t),this.mi.add(n.toString()),eS.resolve()}markPotentiallyOrphaned(e,t){return this.mi.add(t.toString()),eS.resolve()}removeTarget(e,t){this.Ai.zr(t.targetId).forEach(e=>this.mi.add(e.toString()));let n=this.persistence.getTargetCache();return n.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.mi.add(e.toString()))}).next(()=>n.removeTargetData(e,t))}Ii(){this.Ri=new Set}di(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();
6return eS.forEach(this.mi,n=>{let r=eu.fromPath(n);return this.fi(e,r).next(e=>{e||t.removeEntry(r,e_.min())})}).next(()=>(this.Ri=null,t.apply(e)))}updateLimboDocument(e,t){return this.fi(e,t).next(e=>{e?this.mi.delete(t.toString()):this.mi.add(t.toString())})}Pi(e){return 0}fi(e,t){return eS.or([()=>eS.resolve(this.Ai.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ei(e,t)])}}class rE{constructor(e,t){this.persistence=e,this.gi=new tH(e=>(function(e){let t="";for(let n=0;n<e.length;n++)t.length>0&&(t+="\x01\x01"),t=function(e,t){let n=t,r=e.length;for(let t=0;t<r;t++){let r=e.charAt(t);switch(r){case"\0":n+="\x01\x10";break;case"\x01":n+="\x01\x11";break;default:n+=r}}return n}(e.get(n),t);return t+"\x01\x01"})(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=new ro(this,t)}static Vi(e,t){return new rE(e,t)}Ii(){}di(e){return eS.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEachTarget(e,t)}mr(e){let t=this.yr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}yr(e){let t=0;return this.gr(e,e=>{t++}).next(()=>t)}
6gr(e,t){return eS.forEach(this.gi,(n,r)=>this.Sr(e,n,r).next(e=>e?eS.resolve():t(r)))}removeTargets(e,t,n){return this.persistence.getTargetCache().removeTargets(e,t,n)}removeOrphanedDocuments(e,t){let n=0,r=this.persistence.getRemoteDocumentCache(),i=r.newChangeBuffer();return r.ri(e,r=>this.Sr(e,r,t).next(e=>{e||(n++,i.removeEntry(r,e_.min()))})).next(()=>i.apply(e)).next(()=>n)}markPotentiallyOrphaned(e,t){return this.gi.set(t,e.currentSequenceNumber),eS.resolve()}removeTarget(e,t){let n=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,n)}addReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),eS.resolve()}removeReference(e,t,n){return this.gi.set(n,e.currentSequenceNumber),eS.resolve()}updateLimboDocument(e,t){return this.gi.set(t,e.currentSequenceNumber),eS.resolve()}Pi(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=function e(t){switch(e5(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let n=eK(t);return n?16+e(n):16;case 5:return 2*t.stringValue.length;case 6:return eq(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(t.arrayValue.values||[]).reduce((t,n)=>t+e(n),0);case 10:case 11:var r;let i;return r=t.mapValue,i=0,ek(r.fields,(t,n)=>{i+=t.length+e(n)}),i;default:throw F(13486,{value:t})}}(e.data.value)),t}Sr(e,t,n){return eS.or([()=>this.persistence.Ei(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.gi.get(t);return eS.resolve(void 0!==e&&e>n)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class rT{constructor(e,t,n,r){this.targetId=e,this.fromCache=t,this.Is=n,this.ds=r}static Es(e,t){let n=t0(),r=t0();for(let e of t.docChanges)switch(e.type){case 0:n=n.add(e.doc.key);break;case 1:r=r.add(e.doc.key)}return new rT(e,t.fromCache,n,r)}}class rS{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class rC{constructor(){this.As=!1,this.Rs=!1,this.Vs=100,this.fs=(0,E.nr)()?8:function(e){let t=e.match(/Android ([\d.]+)/i);return Number(t?t[1].split(".").slice(0,2).join("."):"-1")}((0,E.ZQ)())>0?6:4}initialize(e,t){this.gs=e,this.indexManager=t,this.As=!0}getDocumentsMatchingQuery(e,t,n,r){let i={result:null};return this.ps(e,t).next(e=>{i.result=e}).next(()=>{if(!i.result)return this.ys(e,t,r,n).next(e=>{i.result=e})}).next(()=>{if(i.result)return;let n=new rS;return this.ws(e,t,n).next(r=>{if(i.result=r,this.Rs)return this.Ss(e,t,n,r.size)})}).next(()=>i.result)}Ss(e,t,n,r){return n.documentReadCount<this.Vs?(O()<=b.$b.DEBUG&&D("QueryEngine","SDK will not create cache indexes for query:",t$(t),"since it only creates cache indexes for collection contains","more than or equal to",this.Vs,"documents"),eS.resolve()):(O()<=b.$b.DEBUG&&D("QueryEngine","Query:",t$(t),"scans",n.documentReadCount,"local documents and returns",r,"documents as results."),n.documentReadCount>this.fs*r?(O()<=b.$b.DEBUG&&D("QueryEngine","The SDK decides to create cache indexes for query:",t$(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,tF(t))):eS.resolve())}ps(e,t){if(tL(t))return eS.resolve(null);let n=tF(t);return this.indexManager.getIndexType(e,n).next(r=>0===r?null:(null!==t.limit&&1===r&&(n=tF(t=tV(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,n).next(r=>{let i=t0(...r);return this.gs.getDocuments(e,i).next(r=>this.indexManager.getMinOffset(e,n).next(n=>{let s=this.bs(t,r);return this.Ds(t,s,i,n.readTime)?this.ps(e,tV(t,null,"F")):this.vs(e,s,t,n)}))})))}ys(e,t,n,r){return tL(t)||r.isEqual(e_.min())?eS.resolve(null):this.gs.getDocuments(e,n).next(i=>{let s=this.bs(t,i);return this.Ds(t,s,n,r)?eS.resolve(null):(O()<=b.$b.DEBUG&&D("QueryEngine","Re-using previous result from %s to execute query: %s",r.toString(),t$(t)),this.vs(e,s,t,function(e,t){let n=e.toTimestamp().seconds,r=e.toTimestamp().nanoseconds+1;return new eb(e_.fromTimestamp(1e9===r?new ev(n+1,0):new ev(n,r)),eu.empty(),-1)}(r,0)).next(e=>e))})}bs(e,t){let n=new eD(tW(e));return t.forEach((t,r)=>{tz(e,r)&&(n=n.add(r))}),n}Ds(e,t,n,r){if(null===e.limit)return!1;if(n.size!==t.size)return!0;let i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(r)>0)}ws(e,t,n){return O()<=b.$b.DEBUG&&D("QueryEngine","Using full collection scan to execute query:",t$(t)),this.gs.getDocumentsMatchingQuery(e,t,eb.min(),n)}vs(e,t,n,r){return this.gs.getDocumentsMatchingQuery(e,n,r).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}let rI="LocalStore";class rx{constructor(e,t,n,r){this.persistence=e,this.Cs=t,this.serializer
6=r,this.Fs=new eP(ee),this.Ms=new tH(e=>tP(e),tN),this.xs=new Map,this.Os=e.getRemoteDocumentCache(),this.hi=e.getTargetCache(),this.Ti=e.getBundleCache(),this.Ns(n)}Ns(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ru(this.Os,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Os.setIndexManager(this.indexManager),this.Cs.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Fs))}}async function rA(e,t){return await e.persistence.runTransaction("Handle user change","readonly",n=>{let r;return e.mutationQueue.getAllMutationBatches(n).next(i=>(r=i,e.Ns(t),e.mutationQueue.getAllMutationBatches(n))).next(t=>{let i=[],s=[],o=t0();for(let e of r)for(let t of(i.push(e.batchId),e.mutations))o=o.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))o=o.add(t.key);return e.localDocuments.getDocuments(n,o).next(e=>({Bs:e,removedBatchIds:i,addedBatchIds:s}))})})}function rk(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.hi.getLastRemoteSnapshotVersion(t))}async function rR(e,t,n){let r=e.Fs.get(t);try{n||await e.persistence.runTransaction("Release target",n?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,r))}catch(e){if(!eC(e))throw e;D(rI,`Failed to update sequence numbers for target ${t}: ${e}`)}e.Fs=e.Fs.remove(t),e.Ms.delete(r.target)}function rP(e,t,n){let r=e_.min(),i=t0();return e.persistence.runTransaction("Execute query","readwrite",s=>(function(e,t,n){let r=e.Ms.get(n);return void 0!==r?eS.resolve(e.Fs.get(r)):e.hi.getTargetData(t,n)})(e,s,tF(t)).next(t=>{if(t)return r=t.lastLimboFreeSnapshotVersion,e.hi.getMatchingKeysForTargetId(s,t.targetId).next(e=>{i=e})}).next(()=>e.Cs.getDocumentsMatchingQuery(s,t,n?r:e_.min(),n?i:t0())).next(n=>{var r,s,o;let a;return r=e,s=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),o=n,a=r.xs.get(s)||e_.min(),o.forEach((e,t)=>{t.readTime.compareTo(a)>0&&(a=t.readTime)}),r.xs.set(s,a),{documents:n,qs:i}}))}class rN{constructor(){this.activeTargetIds=t1}Gs(e){this.activeTargetIds=this.activeTargetIds.add(e)}zs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}Ws(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class rO{constructor(){this.Fo=new rN,this.Mo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,n){}addLocalQueryTarget(e,t=!0){return t&&this.Fo.Gs(e),this.Mo[e]||"not-current"}updateQueryState(e,t,n){this.Mo[e]=t}removeLocalQueryTarget(e){this.Fo.zs(e)}isLocalQueryTarget(e){return this.Fo.activeTargetIds.has(e)}clearQueryState(e){delete this.Mo[e]}getAllActiveQueryTargets(){return this.Fo.activeTargetIds}isActiveQueryTarget(e){return this.Fo.activeTargetIds.has(e)}start(){return this.Fo=new rN,Promise.resolve()}handleUserChange(e,t,n){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class rD{xo(e){}shutdown(){}}let rL="ConnectivityMonitor";class rM{constructor(){this.Oo=()=>this.No(),this.Bo=()=>this.Lo(),this.ko=[],this.qo()}xo(e){this.ko.push(e)}shutdown(){window.removeEventListener("online",this.Oo),window.removeEventListener("offline",this.Bo)}qo(){window.addEventListener("online",this.Oo),window.addEventListener("offline",this.Bo)}No(){for(let e of(D(rL,"Network connectivity changed: AVAILABLE"),this.ko))e(0)}Lo(){for(let e of(D(rL,"Network connectivity changed: UNAVAILABLE"),this.ko))e(1)}static C(){return"undefined"!=typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let rj=null;function rF(){return null===rj?rj=0x10000000+Math.round(0x80000000*Math.random()):rj++,"0x"+rj.toString(16)}let rU="RestConnection",rV={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
6Query:"runAggregationQuery"};class rB{get Qo(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;let t=e.ssl?"https":"http",n=encodeURIComponent(this.databaseId.projectId),r=encodeURIComponent(this.databaseId.database);this.$o=t+"://"+e.host,this.Uo=`projects/${n}/databases/${r}`,this.Ko=this.databaseId.database===eX?`project_id=${n}`:`project_id=${n}&database_id=${r}`}Wo(e,t,n,r,i){let s=rF(),o=this.Go(e,t.toUriEncodedString());D(rU,`Sending RPC '${e}' ${s}:`,o,n);let a={"google-cloud-resource-prefix":this.Uo,"x-goog-request-params":this.Ko};this.zo(a,r,i);let{host:l}=new URL(o),u=(0,E.zJ)(l);return this.jo(e,o,a,n,u).then(t=>(D(rU,`Received RPC '${e}' ${s}: `,t),t),t=>{throw M(rU,`RPC '${e}' ${s} failed with error: `,t,"url: ",o,"request:",n),t})}Jo(e,t,n,r,i,s){return this.Wo(e,t,n,r,i)}zo(e,t,n){e["X-Goog-Api-Client"]="gl-js/ fire/"+P,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,n)=>e[n]=t),n&&n.headers.forEach((t,n)=>e[n]=t)}Go(e,t){let n=rV[e];return`${this.$o}/v1/${t}:${n}`}terminate(){}}class rq{constructor(e){this.Ho=e.Ho,this.Yo=e.Yo}Zo(e){this.Xo=e}e_(e){this.t_=e}n_(e){this.r_=e}onMessage(e){this.i_=e}close(){this.Yo()}send(e){this.Ho(e)}s_(){this.Xo()}o_(){this.t_()}__(e){this.r_(e)}a_(e){this.i_(e)}}let r$="WebChannelConnection";class rz extends rB{constructor(e){super(e),this.u_=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}jo(e,t,n,r,i){let o=rF();return new Promise((i,u)=>{let h=new s;h.setWithCredentials(!0),h.listenOnce(a.COMPLETE,()=>{try{switch(h.getLastErrorCode()){case l.NO_ERROR:let t=h.getResponseJson();D(r$,`XHR for RPC '${e}' ${o} received:`,JSON.stringify(t)),i(t);break;case l.TIMEOUT:D(r$,`RPC '${e}' ${o} timed out`),u(new q(B.DEADLINE_EXCEEDED,"Request time out"));break;case l.HTTP_ERROR:let n=h.getStatus();if(D(r$,`RPC '${e}' ${o} failed with status:`,n,"response text:",h.getResponseText()),n>0){let e=h.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=null==e?void 0:e.error;if(t&&t.status&&t.message){let e=function(e){let t=e.toLowerCase().replace(/_/g,"-");return Object.values(B).indexOf(t)>=0?t:B.UNKNOWN}(t.status);u(new q(e,t.message))}else u(new q(B.UNKNOWN,"Server responded with status "+h.getStatus()))}else u(new q(B.UNAVAILABLE,"Connection failed."));break;default:F(9055,{c_:e,streamId:o,l_:h.getLastErrorCode(),h_:h.getLastError()})}}finally{D(r$,`RPC '${e}' ${o} completed.`)}});let c=JSON.stringify(r);D(r$,`RPC '${e}' ${o} sending request:`,r),h.send(t,"POST",c,n,15)})}P_(e,t,n){let r=rF(),i=[this.$o,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=d(),a=c(),l={httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:`projects/${this.databaseId.projectId}/databases/${this.databaseId.database}`},sendRawJson:!0,supportsCrossDomainXhr:!0,internalChannelParams:{forwardChannelRequestTimeoutMs:6e5},forceLongPolling:this.forceLongPolling,detectBufferingProxy:this.autoDetectLongPolling},p=this.longPollingOptions.timeoutSeconds;void 0!==p&&(l.longPollingTimeout=Math.round(1e3*p)),this.useFetchStreams&&(l.useFetchStreams=!0),this.zo(l.initMessageHeaders,t,n),l.encodeInitMessageHeaders=!0;let m=i.join("");D(r$,`Creating RPC '${e}' stream ${r}: ${m}`,l);let g=s.createWebChannel(m,l);this.T_(g);let y=!1,v=!1,_=new rq({Ho:t=>{v?D(r$,`Not sending because RPC '${e}' stream ${r} is closed:`,t):(y||(D(r$,`Opening RPC '${e}' stream ${r} transport.`),g.open(),y=!0),D(r$,`RPC '${e}' stream ${r} sending:`,t),g.send(t))},Yo:()=>g.close()}),w=(e,t,n)=>{e.listen(t,e=>{try{n(e)}catch(e){setTimeout(()=>{throw e},0)}})};return w(g,o.EventType.OPEN,()=>{v||(D(r$,`RPC '${e}' stream ${r} transport opened.`),_.s_())}),w(g,o.EventType.CLOSE,()=>{v||(v=!0,D(r$,`RPC '${e}' stream ${r} transport closed`),_.__(),this.I_(g))}),w(g,o.EventType.ERROR,t=>{v||(v=!0,M(r$,`RPC '${e}' stream ${r} transport errored. Name:`,t.name,"Message:",t.message),_.__(new q(B.UNAVAILABLE,"The operation could not be completed")))}),w(g,o.EventType.MESSAGE,t=>{var n;if(!v){let i=t.data[0];V(!!i,16349);let s=(null==i?void 0:i.error)||(null==(n=i[0])?void 0:n.error);if(s){D(r$,`RPC '${e}' stream ${r} received error:`,s);let t=s.status,n=function(e){let t=f[e];if(void 0!==t)return nT(t)}(t),i=s.message;void 0===n&&(n=B.INTERNAL,i="Unknown error status: "+t+" with message "+s.message),v=!0,_.__(new q(n,i)),g.close()}else D(r$,`RPC '${e}' stream ${r} received:`,i),_.a_(i)}}),w(a,h.STAT_EVENT,t=>{t.stat===u.PROXY?D(r$,`RPC '${e}' stream ${r} detected buffering proxy`):t.stat===u.NOPROXY&&D(r$,`RPC '${e}' stream ${r} detected no buffering proxy`)}),setTimeout(()=>{_.o_()},0),_}
6terminate(){this.u_.forEach(e=>e.close()),this.u_=[]}T_(e){this.u_.push(e)}I_(e){this.u_=this.u_.filter(t=>t===e)}}function rW(){return"undefined"!=typeof document?document:null}function rH(e){return new nB(e,!0)}class rG{constructor(e,t,n=1e3,r=1.5,i=6e4){this.Fi=e,this.timerId=t,this.d_=n,this.E_=r,this.A_=i,this.R_=0,this.V_=null,this.m_=Date.now(),this.reset()}reset(){this.R_=0}f_(){this.R_=this.A_}g_(e){this.cancel();let t=Math.floor(this.R_+this.p_()),n=Math.max(0,Date.now()-this.m_),r=Math.max(0,t-n);r>0&&D("ExponentialBackoff",`Backing off for ${r} ms (base delay: ${this.R_} ms, delay with jitter: ${t} ms, last attempt: ${n} ms ago)`),this.V_=this.Fi.enqueueAfterDelay(this.timerId,r,()=>(this.m_=Date.now(),e())),this.R_*=this.E_,this.R_<this.d_&&(this.R_=this.d_),this.R_>this.A_&&(this.R_=this.A_)}y_(){null!==this.V_&&(this.V_.skipDelay(),this.V_=null)}cancel(){null!==this.V_&&(this.V_.cancel(),this.V_=null)}p_(){return(Math.random()-.5)*this.R_}}let rK="PersistentStream";class rY{constructor(e,t,n,r,i,s,o,a){this.Fi=e,this.w_=n,this.S_=r,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=o,this.listener=a,this.state=0,this.b_=0,this.D_=null,this.v_=null,this.stream=null,this.C_=0,this.F_=new rG(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.C_=0,4!==this.state?this.auth():this.O_()}async stop(){this.M_()&&await this.close(0)}N_(){this.state=0,this.F_.reset()}B_(){this.x_()&&null===this.D_&&(this.D_=this.Fi.enqueueAfterDelay(this.w_,6e4,()=>this.L_()))}k_(e){this.q_(),this.stream.send(e)}async L_(){if(this.x_())return this.close(0)}q_(){this.D_&&(this.D_.cancel(),this.D_=null)}Q_(){this.v_&&(this.v_.cancel(),this.v_=null)}async close(e,t){this.q_(),this.Q_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===B.RESOURCE_EXHAUSTED?(L(t.toString()),L("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===B.UNAUTHENTICATED&&3!==this.state&&(this.authCredentialsProvider.invalidateToken(),this.appCheckCredentialsProvider.invalidateToken()),null!==this.stream&&(this.U_(),this.stream.close(),this.stream=null),this.state=e,await this.listener.n_(t)}U_(){}auth(){this.state=1;let e=this.K_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,n])=>{this.b_===t&&this.W_(e,n)},t=>{e(()=>{let e=new q(B.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}W_(e,t){let n=this.K_(this.b_);this.stream=this.z_(e,t),this.stream.Zo(()=>{n(()=>this.listener.Zo())}),this.stream.e_(()=>{n(()=>(this.state=2,this.v_=this.Fi.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.e_()))}),this.stream.n_(e=>{n(()=>this.G_(e))}),this.stream.onMessage(e=>{n(()=>1==++this.C_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return D(rK,`close with error: ${e}`),this.stream=null,this.close(4,e)}K_(e){return t=>{this.Fi.enqueueAndForget(()=>this.b_===e?t():(D(rK,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class rQ extends rY{constructor(e,t,n,r,i,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,n,r,s),this.serializer=i}z_(e,t){return this.connection.P_("Listen",e,t)}j_(e){return this.onNext(e)}onNext(e){this.F_.reset();let t=function(e,t){let n;if("targetChange"in t){var r,i;t.targetChange;let s="NO_CHANGE"===(r=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===r?1:"REMOVE"===r?2:"CURRENT"===r?3:"RESET"===r?4:F(39313,{state:r}),o=t.targetChange.targetIds||[],a=(i=t.targetChange.resumeToken,e.useProto3Json?(V(void 0===i||"string"==typeof i,58123),eF.fromBase64String(i||"")):(V(void 0===i||i instanceof x||i instanceof Uint8Array,16193),eF.fromUint8Array(i||new Uint8Array))),l=t.targetChange.cause;n=new nO(s,o,a,l&&new q(void 0===l.code?B.UNKNOWN:nT(l.code),l.message||"")||null)}else if("documentChange"in t){t.documentChange;let r=t.documentChange;r.document,r.document.name,r.document.updateTime;let i=nQ(e,r.document.name),s=nW(r.document.updateTime),o=r.document.createTime?nW(r.document.createTime):e_.min(),a=new th({mapValue:{fields:r.document.fields}}),l=tc.newFoundDocument(i,s,o,a);n=new nP(r.targetIds||[],r.removedTargetIds||[],l.key,l)}else if("documentDelete"in t){t.documentDelete;let r=t.documentDelete;r.document;let i=nQ(e,r.document),s=r.readTime?nW(r.readTime):e_.min(),o=tc.newNoDocument(i,s);n=new nP([],r.removedTargetIds||[],o.key,o)}else if("documentRemove"in t){t.documentRemove;let r=t.documentRemove;r.document;let i=nQ(e,r.document);n=new nP([],r.removedTargetIds||[],i,null)}else{if(!("filter"in t))return F(11601,{At:t});{t.filter;let e=t.filter;e.targetId;
6let{count:r=0,unchangedNames:i}=e,s=new nE(r,i);n=new nN(e.targetId,s)}}return n}(this.serializer,e),n=function(e){if(!("targetChange"in e))return e_.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?e_.min():t.readTime?nW(t.readTime):e_.min()}(e);return this.listener.J_(t,n)}H_(e){let t={};t.database=nJ(this.serializer),t.addTarget=function(e,t){let n,r=t.target;if((n=tO(r)?{documents:{documents:[nX(e,r.path)]}}:{query:function(e,t){var n,r;let i,s={structuredQuery:{}},o=t.path;null!==t.collectionGroup?(i=o,s.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=o.popLast(),s.structuredQuery.from=[{collectionId:o.lastSegment()}]),s.parent=nX(e,i);let a=function(e){if(0!==e.length)return function e(t){return t instanceof ty?function(e){if("=="===e.op){if(ts(e.value))return{unaryFilter:{field:n1(e.field),op:"IS_NAN"}};if(ti(e.value))return{unaryFilter:{field:n1(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(ts(e.value))return{unaryFilter:{field:n1(e.field),op:"IS_NOT_NAN"}};if(ti(e.value))return{unaryFilter:{field:n1(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:n1(e.field),op:nU[e.op],value:e.value}}}(t):t instanceof tv?function(t){let n=t.getFilters().map(t=>e(t));return 1===n.length?n[0]:{compositeFilter:{op:nV[t.op],filters:n}}}(t):F(54877,{filter:t})}(tv.create(e,"and"))}(t.filters);a&&(s.structuredQuery.where=a);let l=function(e){if(0!==e.length)return e.map(e=>({field:n1(e.field),direction:nF[e.dir]}))}(t.orderBy);l&&(s.structuredQuery.orderBy=l);let u=nq(e,t.limit);return null!==u&&(s.structuredQuery.limit=u),t.startAt&&(s.structuredQuery.startAt={before:(n=t.startAt).inclusive,values:n.position}),t.endAt&&(s.structuredQuery.endAt={before:!(r=t.endAt).inclusive,values:r.position}),{Vt:s,parent:i}}(e,r).Vt}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){n.resumeToken=nz(e,t.resumeToken);let r=nq(e,t.expectedCount);null!==r&&(n.expectedCount=r)}else if(t.snapshotVersion.compareTo(e_.min())>0){n.readTime=n$(e,t.snapshotVersion.toTimestamp());let r=nq(e,t.expectedCount);null!==r&&(n.expectedCount=r)}return n}(this.serializer,e);let n=function(e,t){let n=function(e){switch(e){case"TargetPurposeListen":return null;case"TargetPurposeExistenceFilterMismatch":return"existence-filter-mismatch";case"TargetPurposeExistenceFilterMismatchBloom":return"existence-filter-mismatch-bloom";case"TargetPurposeLimboResolution":return"limbo-document";default:return F(28987,{purpose:e})}}(t.purpose);return null==n?null:{"goog-listen-tags":n}}(this.serializer,e);n&&(t.labels=n),this.k_(t)}Y_(e){let t={};t.database=nJ(this.serializer),t.removeTarget=e,this.k_(t)}}class rX extends rY{constructor(e,t,n,r,i,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,n,r,s),this.serializer=i}get Z_(){return this.C_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.Z_&&this.X_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return V(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,V(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){var t,n;V(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();let r=(t=e.writeResults,n=e.commitTime,t&&t.length>0?(V(void 0!==n,14353),t.map(e=>{let t;return(t=e.updateTime?nW(e.updateTime):nW(n)).isEqual(e_.min())&&(t=nW(n)),new ns(t,e.transformResults||[])})):[]),i=nW(e.commitTime);return this.listener.ta(i,r)}na(){let e={};e.database=nJ(this.serializer),this.k_(e)}X_(e){let t={streamToken:this.lastStreamToken,writes:e.map(e=>(function(e,t){var n;let r;if(t instanceof nd)r={update:n0(e,t.key,t.value)};else if(t instanceof ny)r={delete:nY(e,t.key)};else if(t instanceof nf)r={update:n0(e,t.key,t.data),updateMask:function(e){let t=[];return e.fields.forEach(e=>t.push(e.canonicalString())),{fieldPaths:t}}(t.fieldMask)};else{if(!(t instanceof nv))return F(16599,{Rt:t.type});r={verify:nY(e,t.key)}}return t.fieldTransforms.length>0&&(r.updateTransforms=t.fieldTransforms.map(e=>(function(e,t){let n=t.transform;if(n instanceof t4)return{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(n instanceof t8)return{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements}};if(n instanceof t9)return{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements}};if(n instanceof nt)return{fieldPath:t.field.canonicalString(),increment:n.Ee};throw F(20930,{transform:t.transform})})(0,e))),t.precondition.isNone||(r.currentDocument=void 0!==(n=t.precondition).updateTime?{updateTime:n$(e,n.updateTime.toTimestamp())}:void 0!==n.exists?{exists:n.exists}:F(27497)),r})(this.serializer,e))};this.k_(t)}}class rJ{}class rZ extends rJ{constructor(e,t,n,r){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=n,this.serializer
6=r,this.ra=!1}ia(){if(this.ra)throw new q(B.FAILED_PRECONDITION,"The client has already been terminated.")}Wo(e,t,n,r){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.Wo(e,nG(t,n),r,i,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===B.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new q(B.UNKNOWN,e.toString())})}Jo(e,t,n,r,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,o])=>this.connection.Jo(e,nG(t,n),r,s,o,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===B.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new q(B.UNKNOWN,e.toString())})}terminate(){this.ra=!0,this.connection.terminate()}}class r0{constructor(e,t){this.asyncQueue=e,this.onlineStateHandler=t,this.state="Unknown",this.sa=0,this.oa=null,this._a=!0}aa(){0===this.sa&&(this.ua("Unknown"),this.oa=this.asyncQueue.enqueueAfterDelay("online_state_timeout",1e4,()=>(this.oa=null,this.ca("Backend didn't respond within 10 seconds."),this.ua("Offline"),Promise.resolve())))}la(e){"Online"===this.state?this.ua("Unknown"):(this.sa++,this.sa>=1&&(this.ha(),this.ca(`Connection failed 1 times. Most recent error: ${e.toString()}`),this.ua("Offline")))}set(e){this.ha(),this.sa=0,"Online"===e&&(this._a=!1),this.ua(e)}ua(e){e!==this.state&&(this.state=e,this.onlineStateHandler(e))}ca(e){let t=`Could not reach Cloud Firestore backend. ${e} 7This 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._a?(L(t),this._a=!1):D("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}let r1="RemoteStore";class r2{constructor(e,t,n,r,i){this.localStore=e,this.datastore=t,this.asyncQueue=n,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Set,this.da=[],this.Ea=i,this.Ea.xo(e=>{n.enqueueAndForget(async()=>{it(this)&&(D(r1,"Restarting streams for network reachability change."),await async function(e){e.Ia.add(4),await r5(e),e.Aa.set("Unknown"),e.Ia.delete(4),await r3(e)}(this))})}),this.Aa=new r0(n,r)}}async function r3(e){if(it(e))for(let t of e.da)await t(!0)}async function r5(e){for(let t of e.da)await t(!1)}function r6(e,t){e.Ta.has(t.targetId)||(e.Ta.set(t.targetId,t),ie(e)?r9(e):i_(e).x_()&&r8(e,t))}function r4(e,t){let n=i_(e);e.Ta.delete(t),n.x_()&&r7(e,t),0===e.Ta.size&&(n.x_()?n.B_():it(e)&&e.Aa.set("Unknown"))}function r8(e,t){if(e.Ra.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(e_.min())>0){let n=e.remoteSyncer.getRemoteKeysForTarget(t.targetId).size;t=t.withExpectedCount(n)}i_(e).H_(t)}function r7(e,t){e.Ra.$e(t),i_(e).Y_(t)}function r9(e){e.Ra=new nL({getRemoteKeysForTarget:t=>e.remoteSyncer.getRemoteKeysForTarget(t),Et:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),i_(e).start(),e.Aa.aa()}function ie(e){return it(e)&&!i_(e).M_()&&e.Ta.size>0}function it(e){return 0===e.Ia.size}async function ir(e){e.Aa.set("Online")}async function ii(e){e.Ta.forEach((t,n)=>{r8(e,t)})}async function is(e,t){e.Ra=void 0,ie(e)?(e.Aa.la(t),r9(e)):e.Aa.set("Unknown")}async function io(e,t,n){if(e.Aa.set("Online"),t instanceof nO&&2===t.state&&t.cause)try{await async function(e,t){let n=t.cause;for(let r of t.targetIds)e.Ta.has(r)&&(await e.remoteSyncer.rejectListen(r,n),e.Ta.delete(r),e.Ra.removeTarget(r))}(e,t)}catch(n){D(r1,"Failed to remove targets %s: %s ",t.targetIds.join(","),n),await ia(e,n)}else if(t instanceof nP?e.Ra.Ye(t):t instanceof nN?e.Ra.it(t):e.Ra.et(t),!n.isEqual(e_.min()))try{let t=await rk(e.localStore);n.compareTo(t)>=0&&await function(e,t){let n=e.Ra.Pt(t);
7return n.targetChanges.forEach((n,r)=>{if(n.resumeToken.approximateByteSize()>0){let i=e.Ta.get(r);i&&e.Ta.set(r,i.withResumeToken(n.resumeToken,t))}}),n.targetMismatches.forEach((t,n)=>{let r=e.Ta.get(t);if(!r)return;e.Ta.set(t,r.withResumeToken(eF.EMPTY_BYTE_STRING,r.snapshotVersion)),r7(e,t);let i=new n5(r.target,t,n,r.sequenceNumber);r8(e,i)}),e.remoteSyncer.applyRemoteEvent(n)}(e,n)}catch(t){D(r1,"Failed to raise snapshot:",t),await ia(e,t)}}async function ia(e,t,n){if(!eC(t))throw t;e.Ia.add(1),await r5(e),e.Aa.set("Offline"),n||(n=()=>rk(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{D(r1,"Retrying IndexedDB access"),await n(),e.Ia.delete(1),await r3(e)})}function il(e,t){return t().catch(n=>ia(e,n,t))}async function iu(e){var t;let n=iw(e),r=e.Pa.length>0?e.Pa[e.Pa.length-1].batchId:-1;for(;it(t=e)&&t.Pa.length<10;)try{let t=await function(e,t){return e.persistence.runTransaction("Get next mutation batch","readonly",n=>(void 0===t&&(t=-1),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)))}(e.localStore,r);if(null===t){0===e.Pa.length&&n.B_();break}r=t.batchId,function(e,t){e.Pa.push(t);let n=iw(e);n.x_()&&n.Z_&&n.X_(t.mutations)}(e,t)}catch(t){await ia(e,t)}ih(e)&&ic(e)}function ih(e){return it(e)&&!iw(e).M_()&&e.Pa.length>0}function ic(e){iw(e).start()}async function id(e){iw(e).na()}async function ip(e){let t=iw(e);for(let n of e.Pa)t.X_(n.mutations)}async function im(e,t,n){let r=e.Pa.shift(),i=nw.from(r,t,n);await il(e,()=>e.remoteSyncer.applySuccessfulWrite(i)),await iu(e)}async function ig(e,t){t&&iw(e).Z_&&await async function(e,t){var n;if(function(e){switch(e){case B.OK:return F(64938);case B.CANCELLED:case B.UNKNOWN:case B.DEADLINE_EXCEEDED:case B.RESOURCE_EXHAUSTED:case B.INTERNAL:case B.UNAVAILABLE:case B.UNAUTHENTICATED:return!1;case B.INVALID_ARGUMENT:case B.NOT_FOUND:case B.ALREADY_EXISTS:case B.PERMISSION_DENIED:case B.FAILED_PRECONDITION:case B.ABORTED:case B.OUT_OF_RANGE:case B.UNIMPLEMENTED:case B.DATA_LOSS:return!0;default:return F(15467,{code:e})}}(n=t.code)&&n!==B.ABORTED){let n=e.Pa.shift();iw(e).N_(),await il(e,()=>e.remoteSyncer.rejectFailedWrite(n.batchId,t)),await iu(e)}}(e,t),ih(e)&&ic(e)}async function iy(e,t){e.asyncQueue.verifyOperationInProgress(),D(r1,"RemoteStore received new credentials");let n=it(e);e.Ia.add(3),await r5(e),n&&e.Aa.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.Ia.delete(3),await r3(e)}async function iv(e,t){t?(e.Ia.delete(2),await r3(e)):t||(e.Ia.add(2),await r5(e),e.Aa.set("Unknown"))}function i_(e){var t,n,r;return e.Va||(t=e.datastore,n=e.asyncQueue,r={Zo:ir.bind(null,e),e_:ii.bind(null,e),n_:is.bind(null,e),J_:io.bind(null,e)},t.ia(),e.Va=new rQ(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,r),e.da.push(async t=>{t?(e.Va.N_(),ie(e)?r9(e):e.Aa.set("Unknown")):(await e.Va.stop(),e.Ra=void 0)})),e.Va}function iw(e){var t,n,r;return e.ma||(t=e.datastore,n=e.asyncQueue,r={Zo:()=>Promise.resolve(),e_:id.bind(null,e),n_:ig.bind(null,e),ea:ip.bind(null,e),ta:im.bind(null,e)},t.ia(),e.ma=new rX(n,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,r),e.da.push(async t=>{t?(e.ma.N_(),await iu(e)):(await e.ma.stop(),e.Pa.length>0&&(D(r1,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ma}class ib{constructor(e,t,n,r,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new $,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.deferred.promise.catch(e=>{})}get promise(){return this.deferred.promise}static createAndSchedule(e,t,n,r,i){let s=new ib(e,t,Date.now()+n,r,i);return s.start(n),s}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new q(B.CANCELLED,"Operation cancelled"+(e?": "+e:""))))}handleDelayElapsed(){this.asyncQueue.enqueueAndForget(()=>null!==this.timerHandle?(this.clearTimeout(),this.op().then(e=>this.deferred.resolve(e))):Promise.resolve())}clearTimeout(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)}}function iE(e,t){if(L("AsyncQueue",`${t}: ${e}`),eC(e))return new q(B.UNAVAILABLE,`${t}: ${e}`);throw e}class iT{static emptySet(e){return new iT(e.comparator)}constructor(e){this.comparator=e?(t,n)=>e(t,n)||eu.comparator(t.key,n.key):(e,t)=>eu.comparator(e.key,t.key),this.keyedMap=tY(),this.sortedSet=new eP(this.comparator)}has(e){return null!=this.keyedMap.get(e)}get(e){return this.keyedMap.get(e)}first(){return this.sortedSet.minKey()}last(){return this.sortedSet.maxKey()}isEmpty(){return this.sortedSet.isEmpty()}indexOf(e){let t=this.keyedMap.get(e);return t?this.sortedSet.indexOf(t):-1}get size(){return this.sortedSet.size}forEach(e){this.sortedSet.inorderTraversal((t,n)=>(e(t),!1))}add(e){let t=this.delete(e.key);return t.copy(t.keyedMap.insert(e.key,e),t.sortedSet.insert(e,null))}delete(e){let t=this.get(e);return t?this.copy(this.keyedMap.remove(e),this.sortedSet.remove(t)):this}isEqual(e){if(!(e instanceof iT)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),n=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,r=n.getNext().key;if(!e.isEqual(r))return!1}return!0}toString(){let e=[];return this.forEach(t=>{e.push(t.toString())}),0===e.length?"DocumentSet ()":"DocumentSet (\n "+e.join(" \n")+"\n)"}copy(e,t){let n=new iT;return n.comparator=this.comparator,n.keyedMap=e,n.sortedSet=t,n}}class iS{constructor(){this.fa=new eP(eu.comparator)}track(e){let t=e.doc.key,n=this.fa.get(t);n?0!==e.type&&3===n.type?this.fa=this.fa.insert(t,e):3===e.type&&1!==n.type?this.fa=this.fa.insert(t,{type:n.type,doc:e.doc}):2===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===n.type?this.fa=this.fa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===n.type?this.fa=this.fa.remove(t):1===e.type&&2===n.type?this.fa=this.fa.insert(t,{type:1,doc:n.doc}):0===e.type&&1===n.type?this.fa=this.fa.insert(t,{type:2,doc:e.doc}):F(63341,{At:e,ga:n}):this.fa=this.fa.insert(t,e)}pa(){let e=[];return this.fa.inorderTraversal((t,n)=>{e.push(n)}),e}}class iC{constructor(e,t,n,r,i,s,o,a,l){this.query=e,this.docs=t,this.oldDocs=n,this.docChanges=r,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=o,this.excludesMetadataChanges=a,this.hasCachedResults=l}static fromInitialDocuments(e,t,n,r,i){let s=[];
7return t.forEach(e=>{s.push({type:0,doc:e})}),new iC(e,t,iT.emptySet(t),s,n,r,!0,!1,i)}get hasPendingWrites(){return!this.mutatedKeys.isEmpty()}isEqual(e){if(!(this.fromCache===e.fromCache&&this.hasCachedResults===e.hasCachedResults&&this.syncStateChanged===e.syncStateChanged&&this.mutatedKeys.isEqual(e.mutatedKeys)&&tB(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,n=e.docChanges;if(t.length!==n.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==n[e].type||!t[e].doc.isEqual(n[e].doc))return!1;return!0}}class iI{constructor(){this.ya=void 0,this.wa=[]}Sa(){return this.wa.some(e=>e.ba())}}class ix{constructor(){this.queries=iA(),this.onlineState="Unknown",this.Da=new Set}terminate(){!function(e,t){let n=e.queries;e.queries=iA(),n.forEach((e,n)=>{for(let e of n.wa)e.onError(t)})}(this,new q(B.ABORTED,"Firestore shutting down"))}}function iA(){return new tH(e=>tq(e),tB)}async function ik(e,t){let n=3,r=t.query,i=e.queries.get(r);i?!i.Sa()&&t.ba()&&(n=2):(i=new iI,n=+!t.ba());try{switch(n){case 0:i.ya=await e.onListen(r,!0);break;case 1:i.ya=await e.onListen(r,!1);break;case 2:await e.onFirstRemoteStoreListen(r)}}catch(n){let e=iE(n,`Initialization of query '${t$(t.query)}' failed`);return void t.onError(e)}e.queries.set(r,i),i.wa.push(t),t.va(e.onlineState),i.ya&&t.Ca(i.ya)&&iO(e)}async function iR(e,t){let n=t.query,r=3,i=e.queries.get(n);if(i){let e=i.wa.indexOf(t);e>=0&&(i.wa.splice(e,1),0===i.wa.length?r=+!t.ba():!i.Sa()&&t.ba()&&(r=2))}switch(r){case 0:return e.queries.delete(n),e.onUnlisten(n,!0);case 1:return e.queries.delete(n),e.onUnlisten(n,!1);case 2:return e.onLastRemoteStoreUnlisten(n);default:return}}function iP(e,t){let n=!1;for(let r of t){let t=r.query,i=e.queries.get(t);if(i){for(let e of i.wa)e.Ca(r)&&(n=!0);i.ya=r}}n&&iO(e)}function iN(e,t,n){let r=e.queries.get(t);if(r)for(let e of r.wa)e.onError(n);e.queries.delete(t)}
7function iO(e){e.Da.forEach(e=>{e.next()})}(g=m||(m={})).Fa="default",g.Cache="cache";class iD{constructor(e,t,n){this.query=e,this.Ma=t,this.xa=!1,this.Oa=null,this.onlineState="Unknown",this.options=n||{}}Ca(e){if(!this.options.includeMetadataChanges){let t=[];for(let n of e.docChanges)3!==n.type&&t.push(n);e=new iC(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.xa?this.Na(e)&&(this.Ma.next(e),t=!0):this.Ba(e,this.onlineState)&&(this.La(e),t=!0),this.Oa=e,t}onError(e){this.Ma.error(e)}va(e){this.onlineState=e;let t=!1;return this.Oa&&!this.xa&&this.Ba(this.Oa,e)&&(this.La(this.Oa),t=!0),t}Ba(e,t){return!(e.fromCache&&this.ba())||(!this.options.ka||"Offline"===t)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}Na(e){if(e.docChanges.length>0)return!0;let t=this.Oa&&this.Oa.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}La(e){e=iC.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.xa=!0,this.Ma.next(e)}ba(){return this.options.source!==m.Cache}}class iL{constructor(e){this.key=e}}class iM{constructor(e){this.key=e}}class ij{constructor(e,t){this.query=e,this.Ha=t,this.Ya=null,this.hasCachedResults=!1,this.current=!1,this.Za=t0(),this.mutatedKeys=t0(),this.Xa=tW(e),this.eu=new iT(this.Xa)}get tu(){return this.Ha}nu(e,t){let n=t?t.ru:new iS,r=t?t.eu:this.eu,i=t?t.mutatedKeys:this.mutatedKeys,s=r,o=!1,a="F"===this.query.limitType&&r.size===this.query.limit?r.last():null,l="L"===this.query.limitType&&r.size===this.query.limit?r.first():null;if(e.inorderTraversal((e,t)=>{let u=r.get(e),h=tz(this.query,t)?t:null,c=!!u&&this.mutatedKeys.has(u.key),d=!!h&&(h.hasLocalMutations||this.mutatedKeys.has(h.key)&&h.hasCommittedMutations),f=!1;u&&h?u.data.isEqual(h.data)?c!==d&&(n.track({type:3,doc:h}),f=!0):this.iu(u,h)||(n.track({type:2,doc:h}),f=!0,(a&&this.Xa(h,a)>0||l&&0>this.Xa(h,l))&&(o=!0)):!u&&h?(n.track({type:0,doc:h}),f=!0):u&&!h&&(n.track({type:1,doc:u}),f=!0,(a||l)&&(o=!0)),f&&(h?(s=s.add(h),i=d?i.add(e):i.delete(e)):(s=s.delete(e),i=i.delete(e)))}),null!==this.query.limit)for(;s.size>this.query.limit;){let e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),i=i.delete(e.key),n.track({type:1,doc:e})}return{eu:s,ru:n,Ds:o,mutatedKeys:i}}iu(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,n,r){let i=this.eu;this.eu=e.eu,this.mutatedKeys=e.mutatedKeys;let s=e.ru.pa();s.sort((e,t)=>(function(e,t){let n=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return F(20277,{At:e})}};return n(e)-n(t)})(e.type,t.type)||this.Xa(e.doc,t.doc)),this.su(n),r=null!=r&&r;let o=t&&!r?this.ou():[],a=0===this.Za.size&&this.current&&!r?1:0,l=a!==this.Ya;return(this.Ya=a,0!==s.length||l)?{snapshot:new iC(this.query,e.eu,i,s,e.mutatedKeys,0===a,l,!1,!!n&&n.resumeToken.approximateByteSize()>0),_u:o}:{_u:o}}va(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({eu:this.eu,ru:new iS,mutatedKeys:this.mutatedKeys,Ds:!1},!1)):{_u:[]}}au(e){return!this.Ha.has(e)&&!!this.eu.has(e)&&!this.eu.get(e).hasLocalMutations}su(e){e&&(e.addedDocuments.forEach(e=>this.Ha=this.Ha.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.Ha=this.Ha.delete(e)),this.current=e.current)}ou(){if(!this.current)return[];let e=this.Za;this.Za=t0(),this.eu.forEach(e=>{this.au(e.key)&&(this.Za=this.Za.add(e.key))});let t=[];return e.forEach(e=>{this.Za.has(e)||t.push(new iM(e))}
7),this.Za.forEach(n=>{e.has(n)||t.push(new iL(n))}),t}uu(e){this.Ha=e.qs,this.Za=t0();let t=this.nu(e.documents);return this.applyChanges(t,!0)}cu(){return iC.fromInitialDocuments(this.query,this.eu,this.mutatedKeys,0===this.Ya,this.hasCachedResults)}}let iF="SyncEngine";class iU{constructor(e,t,n){this.query=e,this.targetId=t,this.view=n}}class iV{constructor(e){this.key=e,this.lu=!1}}class iB{constructor(e,t,n,r,i,s){this.localStore=e,this.remoteStore=t,this.eventManager=n,this.sharedClientState=r,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.hu={},this.Pu=new tH(e=>tq(e),tB),this.Tu=new Map,this.Iu=new Set,this.du=new eP(eu.comparator),this.Eu=new Map,this.Au=new rf,this.Ru={},this.Vu=new Map,this.mu=rt.ur(),this.onlineState="Unknown",this.fu=void 0}get isPrimaryClient(){return!0===this.fu}}async function iq(e,t,n=!0){let r,i=i9(e),s=i.Pu.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),r=s.view.cu()):r=await iz(i,t,n,!0),r}async function i$(e,t){let n=i9(e);await iz(n,t,!0,!1)}async function iz(e,t,n,r){var i,s;let o,a=await (i=e.localStore,s=tF(t),i.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return i.hi.getTargetData(e,s).next(n=>n?(t=n,eS.resolve(t)):i.hi.allocateTargetId(e).next(n=>(t=new n5(s,n,"TargetPurposeListen",e.currentSequenceNumber),i.hi.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=i.Fs.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(i.Fs=i.Fs.insert(e.targetId,e),i.Ms.set(s,e.targetId)),e})),l=a.targetId,u=e.sharedClientState.addLocalQueryTarget(l,n);return r&&(o=await iW(e,t,l,"current"===u,a.resumeToken)),e.isPrimaryClient&&n&&r6(e.remoteStore,a),o}async function iW(e,t,n,r,i){e.gu=(t,n,r)=>(async function(e,t,n,r){let i=t.view.nu(n);i.Ds&&(i=await rP(e.localStore,t.query,!1).then(({documents:e})=>t.view.nu(e,i)));let s=r&&r.targetChanges.get(t.targetId),o=r&&null!=r.targetMismatches.get(t.targetId),a=t.view.applyChanges(i,e.isPrimaryClient,s,o);return i5(e,t.targetId,a._u),a.snapshot})(e,t,n,r);let s=await rP(e.localStore,t,!0),o=new ij(t,s.qs),a=o.nu(s.documents),l=nR.createSynthesizedTargetChangeForCurrentChange(n,r&&"Offline"!==e.onlineState,i),u=o.applyChanges(a,e.isPrimaryClient,l);i5(e,n,u._u);let h=new iU(t,n,o);return e.Pu.set(t,h),e.Tu.has(n)?e.Tu.get(n).push(t):e.Tu.set(n,[t]),u.snapshot}async function iH(e,t,n){let r=e.Pu.get(t),i=e.Tu.get(r.targetId);if(i.length>1)return e.Tu.set(r.targetId,i.filter(e=>!tB(e,t))),void e.Pu.delete(t);e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(r.targetId),e.sharedClientState.isActiveQueryTarget(r.targetId)||await rR(e.localStore,r.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(r.targetId),n&&r4(e.remoteStore,r.targetId),i2(e,r.targetId)}).catch(eT)):(i2(e,r.targetId),await rR(e.localStore,r.targetId,!0))}async function iG(e,t){let n=e.Pu.get(t),r=e.Tu.get(n.targetId);e.isPrimaryClient&&1===r.length&&(e.sharedClientState.removeLocalQueryTarget(n.targetId),r4(e.remoteStore,n.targetId))}async function iK(e,t,n){var r,i;let s=((r=e).remoteStore.remoteSyncer.applySuccessfulWrite=iJ.bind(null,r),r.remoteStore.remoteSyncer.rejectFailedWrite=iZ.bind(null,r),r);try{let e,r=await function(e,t){let n,r,i=ev.now(),s=t.reduce((e,t)=>e.add(t.key),t0());return e.persistence.runTransaction("Locally write mutations","readwrite",o=>{let a=tG,l=t0();return e.Os.getEntries(o,s).next(e=>{(a=e).forEach((e,t)=>{t.isValidDocument()||(l=l.add(e))})}).next(()=>e.localDocuments.getOverlayedDocuments(o,a)).next(r=>{n=r;let s=[];for(let e of t){let t=function(e,t){let n=null;for(let r of e.fieldTransforms){let e=t.data.field(r.field),i=t6(r.transform,e||null);null!=i&&(null===n&&(n=th.empty()),n.set(r.field,i))}return n||null}(e,n.get(e.key).overlayedDocument);null!=t&&s.push(new nf(e.key,t,function e(t){let n=[];return ek(t.fields,(t,r)=>{let i=new el([t]);if(to(r)){let t=e(r.mapValue).fields;if(0===t.length)n.push(i);else for(let e of t)n.push(i.child(e))}else n.push(i)}),new eM(n)}(t.value.mapValue),no.exists(!0)))}return e.mutationQueue.addMutationBatch(o,i,s,t)}).next(t=>{r=t;let i=t.applyToLocalDocumentSet(n,l);return e.documentOverlayCache.saveOverlays(o,t.batchId,i)})}).then(()=>({batchId:r.batchId,changes:tQ(n)}))}(s.localStore,t);
7s.sharedClientState.addPendingMutation(r.batchId),i=r.batchId,(e=s.Ru[s.currentUser.toKey()])||(e=new eP(ee)),e=e.insert(i,n),s.Ru[s.currentUser.toKey()]=e,await i4(s,r.changes),await iu(s.remoteStore)}catch(t){let e=iE(t,"Failed to persist write");n.reject(e)}}async function iY(e,t){try{let n=await function(e,t){let n=t.snapshotVersion,r=e.Fs;return e.persistence.runTransaction("Apply remote event","readwrite-primary",i=>{var s,o,a;let l,u,h=e.Os.newChangeBuffer({trackRemovals:!0});r=e.Fs;let c=[];t.targetChanges.forEach((s,o)=>{var a;let l=r.get(o);if(!l)return;c.push(e.hi.removeMatchingKeys(i,s.removedDocuments,o).next(()=>e.hi.addMatchingKeys(i,s.addedDocuments,o)));let u=l.withSequenceNumber(i.currentSequenceNumber);null!==t.targetMismatches.get(o)?u=u.withResumeToken(eF.EMPTY_BYTE_STRING,e_.min()).withLastLimboFreeSnapshotVersion(e_.min()):s.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(s.resumeToken,n)),r=r.insert(o,u),a=u,(0===l.resumeToken.approximateByteSize()||a.snapshotVersion.toMicroseconds()-l.snapshotVersion.toMicroseconds()>=3e8||s.addedDocuments.size+s.modifiedDocuments.size+s.removedDocuments.size>0)&&c.push(e.hi.updateTargetData(i,u))});let d=tG,f=t0();if(t.documentUpdates.forEach(n=>{t.resolvedLimboDocuments.has(n)&&c.push(e.persistence.referenceDelegate.updateLimboDocument(i,n))}),c.push((s=i,o=h,a=t.documentUpdates,l=t0(),u=t0(),a.forEach(e=>l=l.add(e)),o.getEntries(s,l).next(e=>{let t=tG;return a.forEach((n,r)=>{let i=e.get(n);r.isFoundDocument()!==i.isFoundDocument()&&(u=u.add(n)),r.isNoDocument()&&r.version.isEqual(e_.min())?(o.removeEntry(n,r.readTime),t=t.insert(n,r)):!i.isValidDocument()||r.version.compareTo(i.version)>0||0===r.version.compareTo(i.version)&&i.hasPendingWrites?(o.addEntry(r),t=t.insert(n,r)):D(rI,"Ignoring outdated watch update for ",n,". Current version:",i.version," Watch version:",r.version)}),{Ls:t,ks:u}})).next(e=>{d=e.Ls,f=e.ks})),!n.isEqual(e_.min())){let t=e.hi.getLastRemoteSnapshotVersion(i).next(t=>e.hi.setTargetsMetadata(i,i.currentSequenceNumber,n));c.push(t)}return eS.waitFor(c).next(()=>h.apply(i)).next(()=>e.localDocuments.getLocalViewOfDocuments(i,d,f)).next(()=>d)}).then(t=>(e.Fs=r,t))}(e.localStore,t);
7t.targetChanges.forEach((t,n)=>{let r=e.Eu.get(n);r&&(V(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1,22616),t.addedDocuments.size>0?r.lu=!0:t.modifiedDocuments.size>0?V(r.lu,14607):t.removedDocuments.size>0&&(V(r.lu,42227),r.lu=!1))}),await i4(e,n,t)}catch(e){await eT(e)}}function iQ(e,t,n){var r;if(e.isPrimaryClient&&0===n||!e.isPrimaryClient&&1===n){let n,i=[];e.Pu.forEach((e,n)=>{let r=n.view.va(t);r.snapshot&&i.push(r.snapshot)}),(r=e.eventManager).onlineState=t,n=!1,r.queries.forEach((e,r)=>{for(let e of r.wa)e.va(t)&&(n=!0)}),n&&iO(r),i.length&&e.hu.J_(i),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function iX(e,t,n){e.sharedClientState.updateQueryState(t,"rejected",n);let r=e.Eu.get(t),i=r&&r.key;if(i){let n=new eP(eu.comparator);n=n.insert(i,tc.newNoDocument(i,e_.min()));let r=t0().add(i),s=new nk(e_.min(),new Map,new eP(ee),n,r);await iY(e,s),e.du=e.du.remove(i),e.Eu.delete(t),i6(e)}else await rR(e.localStore,t,!1).then(()=>i2(e,t,n)).catch(eT)}async function iJ(e,t){var n;let r=t.batch.batchId;try{let i=await (n=e.localStore,n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{let r=t.batch.keys(),i=n.Os.newChangeBuffer({trackRemovals:!0});return(function(e,t,n,r){let i=n.batch,s=i.keys(),o=eS.resolve();return s.forEach(e=>{o=o.next(()=>r.getEntry(t,e)).next(t=>{let s=n.docVersions.get(e);V(null!==s,48541),0>t.version.compareTo(s)&&(i.applyToRemoteDocument(t,n),t.isValidDocument()&&(t.setReadTime(n.commitVersion),r.addEntry(t)))})}),o.next(()=>e.mutationQueue.removeMutationBatch(t,i))})(n,e,t,i).next(()=>i.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=t0();for(let n=0;n<e.mutationResults.length;++n)e.mutationResults[n].transformResults.length>0&&(t=t.add(e.batch.mutations[n].key));return t}(t))).next(()=>n.localDocuments.getDocuments(e,r))}));i1(e,r,null),i0(e,r),e.sharedClientState.updateMutationState(r,"acknowledged"),await i4(e,i)}catch(e){await eT(e)}}async function iZ(e,t,n){var r;try{let i=await (r=e.localStore,r.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let n;return r.mutationQueue.lookupMutationBatch(e,t).next(t=>(V(null!==t,37113),n=t.keys(),r.mutationQueue.removeMutationBatch(e,t))).next(()=>r.mutationQueue.performConsistencyCheck(e)).next(()=>r.documentOverlayCache.removeOverlaysForBatchId(e,n,t)).next(()=>r.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,n)).next(()=>r.localDocuments.getDocuments(e,n))}));i1(e,t,n),i0(e,t),e.sharedClientState.updateMutationState(t,"rejected",n),await i4(e,i)}catch(e){await eT(e)}}function i0(e,t){(e.Vu.get(t)||[]).forEach(e=>{e.resolve()}),e.Vu.delete(t)}function i1(e,t,n){let r=e.Ru[e.currentUser.toKey()];if(r){let i=r.get(t);i&&(n?i.reject(n):i.resolve(),r=r.remove(t)),e.Ru[e.currentUser.toKey()]=r}}function i2(e,t,n=null){for(let r of(e.sharedClientState.removeLocalQueryTarget(t),e.Tu.get(t)))e.Pu.delete(r),n&&e.hu.pu(r,n);e.Tu.delete(t),e.isPrimaryClient&&e.Au.zr(t).forEach(t=>{e.Au.containsKey(t)||i3(e,t)})}function i3(e,t){e.Iu.delete(t.path.canonicalString());let n=e.du.get(t);null!==n&&(r4(e.remoteStore,n),e.du=e.du.remove(t),e.Eu.delete(n),i6(e))}function i5(e,t,n){for(let r of n)r instanceof iL?(e.Au.addReference(r.key,t),function(e,t){let n=t.key,r=n.path.canonicalString();e.du.get(n)||e.Iu.has(r)||(D(iF,"New document in limbo: "+n),e.Iu.add(r),i6(e))}(e,r)):r instanceof iM?(D(iF,"Document no longer in limbo: "+r.key),e.Au.removeReference(r.key,t),e.Au.containsKey(r.key)||i3(e,r.key)):F(19791,{yu:r})}function i6(e){for(;e.Iu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){let t=e.Iu.values().next().value;e.Iu.delete(t);let n=new eu(eo.fromString(t)),r=e.mu.next();e.Eu.set(r,new iV(n)),e.du=e.du.insert(n,r),r6(e.remoteStore,new n5(tF(new tD(n.path)),r,"TargetPurposeLimboResolution",eI.ue))}}async function i4(e,t,n){let r=[],i=[],s=[];e.Pu.isEmpty()||(e.Pu.forEach((o,a)=>{s.push(e.gu(a,t,n).then(t=>{var s;if((t||n)&&e.isPrimaryClient){let r=t?!t.fromCache:null==(s=null==n?void 0:n.targetChanges.get(a.targetId))?void 0:s.current;
7e.sharedClientState.updateQueryState(a.targetId,r?"current":"not-current")}if(t){r.push(t);let e=rT.Es(a.targetId,t);i.push(e)}}))}),await Promise.all(s),e.hu.J_(r),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",n=>eS.forEach(t,t=>eS.forEach(t.Is,r=>e.persistence.referenceDelegate.addReference(n,t.targetId,r)).next(()=>eS.forEach(t.ds,r=>e.persistence.referenceDelegate.removeReference(n,t.targetId,r)))))}catch(e){if(!eC(e))throw e;D(rI,"Failed to update sequence numbers: "+e)}for(let n of t){let t=n.targetId;if(!n.fromCache){let n=e.Fs.get(t),r=n.snapshotVersion,i=n.withLastLimboFreeSnapshotVersion(r);e.Fs=e.Fs.insert(t,i)}}}(e.localStore,i))}async function i8(e,t){if(!e.currentUser.isEqual(t)){D(iF,"User change. New user:",t.toKey());let n=await rA(e.localStore,t);e.currentUser=t,e.Vu.forEach(e=>{e.forEach(e=>{e.reject(new q(B.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.Vu.clear(),e.sharedClientState.handleUserChange(t,n.removedBatchIds,n.addedBatchIds),await i4(e,n.Bs)}}function i7(e,t){let n=e.Eu.get(t);if(n&&n.lu)return t0().add(n.key);{let n=t0(),r=e.Tu.get(t);if(!r)return n;for(let t of r){let r=e.Pu.get(t);n=n.unionWith(r.view.tu)}return n}}function i9(e){return e.remoteStore.remoteSyncer.applyRemoteEvent=iY.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=i7.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=iX.bind(null,e),e.hu.J_=iP.bind(null,e.eventManager),e.hu.pu=iN.bind(null,e.eventManager),e}class se{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=rH(e.databaseInfo.databaseId),this.sharedClientState=this.bu(e),this.persistence=this.Du(e),await this.persistence.start(),this.localStore=this.vu(e),this.gcScheduler=this.Cu(e,this.localStore),this.indexBackfillerScheduler=this.Fu(e,this.localStore)}Cu(e,t){return null}Fu(e,t){return null}vu(e){var t,n;return t=this.persistence,n=new rC,new rx(t,n,e.initialUser,this.serializer)}Du(e){return new r_(rb.Vi,this.serializer)}bu(e){return new rO}async terminate(){var e,t;null==(e=this.gcScheduler)||e.stop(),null==(t=this.indexBackfillerScheduler)||t.stop(),this.sharedClientState.shutdown(),await this.persistence.shutdown()}}se.provider={build:()=>new se};class st extends se{constructor(e){super(),this.cacheSizeBytes=e}Cu(e,t){return V(this.persistence.referenceDelegate instanceof rE,46915),new rs(this.persistence.referenceDelegate.garbageCollector,e.asyncQueue,t)}Du(e){let t=void 0!==this.cacheSizeBytes?re.withCacheSize(this.cacheSizeBytes):re.DEFAULT;return new r_(e=>rE.Vi(e,t),this.serializer)}}class sn{async initialize(e,t){this.localStore||(this.localStore=e.localStore,this.sharedClientState=e.sharedClientState,this.datastore=this.createDatastore(t),this.remoteStore=this.createRemoteStore(t),this.eventManager=this.createEventManager(t),this.syncEngine=this.createSyncEngine(t,!e.synchronizeTabs),this.sharedClientState.onlineStateHandler=e=>iQ(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=i8.bind(null,this.syncEngine),await iv(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new ix}createDatastore(e){var t;let n=rH(e.databaseInfo.databaseId),r=new rz(e.databaseInfo);return t=e.authCredentials,new rZ(t,e.appCheckCredentials,r,n)}createRemoteStore(e){var t,n;return t=this.localStore,n=this.datastore,new r2(t,n,e.asyncQueue,e=>iQ(this.syncEngine,e,0),rM.C()?new rM:new rD)}createSyncEngine(e,t){return function(e,t,n,r,i,s,o){let a=new iB(e,t,n,r,i,s);return o&&(a.fu=!0),a}(this.localStore,this.remoteStore,this.eventManager,this.sharedClientState,e.initialUser,e.maxConcurrentLimboResolutions,t)}async terminate(){var e,t;await async function(e){D(r1,"RemoteStore shutting down."),e.Ia.add(5),await r5(e),e.Ea.shutdown(),e.Aa.set("Unknown")}(this.remoteStore),null==(e=this.datastore)||e.terminate(),null==(t=this.eventManager)||t.terminate()}}sn.provider={build:()=>new sn};class sr{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.xu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.xu(this.observer.error,e):L("Uncaught Error in snapshot listener:",e.toString()))}Ou(){this.muted=!0}
7xu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}let si="FirestoreClient";class ss{constructor(e,t,n,r,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=n,this.databaseInfo=r,this.user=R.UNAUTHENTICATED,this.clientId=Z.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(n,async e=>{D(si,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(n,e=>(D(si,"Received new app check token=",e),this.appCheckCredentialListener(e,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();let e=new $;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){let t=iE(n,"Failed to shutdown persistence");e.reject(t)}}),e.promise}}async function so(e,t){e.asyncQueue.verifyOperationInProgress(),D(si,"Initializing OfflineComponentProvider");let n=e.configuration;await t.initialize(n);let r=n.initialUser;e.setCredentialChangeListener(async e=>{r.isEqual(e)||(await rA(t.localStore,e),r=e)}),t.persistence.setDatabaseDeletedListener(()=>{M("Terminating Firestore due to IndexedDb database deletion"),e.terminate().then(()=>{D("Terminating Firestore due to IndexedDb database deletion completed successfully")}).catch(e=>{M("Terminating Firestore due to IndexedDb database deletion failed",e)})}),e._offlineComponents=t}async function sa(e,t){e.asyncQueue.verifyOperationInProgress();let n=await sl(e);D(si,"Initializing OnlineComponentProvider"),await t.initialize(n,e.configuration),e.setCredentialChangeListener(e=>iy(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,n)=>iy(t.remoteStore,n)),e._onlineComponents=t}async function sl(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){D(si,"Using user provided OfflineComponentProvider");try{await so(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===B.FAILED_PRECONDITION||t.code===B.UNIMPLEMENTED:!("undefined"!=typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;M("Error using user provided cache. Falling back to memory cache: "+t),await so(e,new se)}}else D(si,"Using default OfflineComponentProvider"),await so(e,new st(void 0));return e._offlineComponents}async function su(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(D(si,"Using user provided OnlineComponentProvider"),await sa(e,e._uninitializedComponentsProvider._online)):(D(si,"Using default OnlineComponentProvider"),await sa(e,new sn))),e._onlineComponents}async function sh(e){let t=await su(e),n=t.eventManager;return n.onListen=iq.bind(null,t.syncEngine),n.onUnlisten=iH.bind(null,t.syncEngine),n.onFirstRemoteStoreListen=i$.bind(null,t.syncEngine),n.onLastRemoteStoreUnlisten=iG.bind(null,t.syncEngine),n}function sc(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}let sd=new Map,sf="firestore.googleapis.com";class sp{constructor(e){var t,n;if(void 0===e.host){if(void 0!==e.ssl)throw new q(B.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=sf,this.ssl=!0}else this.host=e.host,this.ssl=null==(t=e.ssl)||t;if(this.isUsingEmulator=void 0!==e.emulatorOptions,this.credentials=e.credentials,this.ignoreUndefinedProperties=!!e.ignoreUndefinedProperties,this.localCache=e.localCache,void 0===e.cacheSizeBytes)this.cacheSizeBytes=0x2800000;else{if(-1!==e.cacheSizeBytes&&e.cacheSizeBytes<1048576)throw new q(B.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,n,r){if(!0===t&&!0===r)throw new q(B.INVALID_ARGUMENT,`${e} and ${n} cannot be used together.`)})("experimentalForceLongPolling",e.experimentalForceLongPolling,"experimentalAutoDetectLongPolling",e.experimentalAutoDetectLongPolling),this.experimentalForceLongPolling=!!e.experimentalForceLongPolling,this.experimentalForceLongPolling?this.experimentalAutoDetectLongPolling=!1:void 0===e.experimentalAutoDetectLongPolling?this.experimentalAutoDetectLongPolling=!0:this.experimentalAutoDetectLongPolling=!!e.experimentalAutoDetectLongPolling,this.experimentalLongPollingOptions=sc(null!=(n=e.experimentalLongPollingOptions)?n:{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new q(B.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new q(B.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new q(B.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,n;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&&(t=this.experimentalLongPollingOptions,n=e.experimentalLongPollingOptions,t.timeoutSeconds===n.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class sm{constructor(e,t,n,r){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=n,this._app=r,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new sp({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new q(B.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"notTerminated"!==this._terminateTask}_setSettings(e){if(this._settingsFrozen)throw new q(B.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 sp(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new W;switch(e.type){case"firstParty":return new Y(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new q(B.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
7d credential type")}}(e.credentials))}_getSettings(){return this._settings}_getEmulatorOptions(){return this._emulatorOptions}_freezeSettings(){return this._settingsFrozen=!0,this._settings}_delete(){return"notTerminated"===this._terminateTask&&(this._terminateTask=this._terminate()),this._terminateTask}async _restart(){"notTerminated"===this._terminateTask?await this._terminate():this._terminateTask="notTerminated"}toJSON(){return{app:this._app,databaseId:this._databaseId,settings:this._settings}}_terminate(){return function(e){let t=sd.get(e);t&&(D("ComponentProvider","Removing Datastore"),sd.delete(e),t.terminate())}(this),Promise.resolve()}}class sg{constructor(e,t,n){this.converter=t,this._query=n,this.type="query",this.firestore=e}withConverter(e){return new sg(this.firestore,e,this._query)}}class sy{constructor(e,t,n){this.converter=t,this._key=n,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 sv(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new sy(this.firestore,e,this._key)}toJSON(){return{type:sy._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,n){if(ey(t,sy._jsonSchema))return new sy(e,n||null,new eu(eo.fromString(t.referencePath)))}}sy._jsonSchemaVersion="firestore/documentReference/1.0",sy._jsonSchema={type:eg("string",sy._jsonSchemaVersion),referencePath:eg("string")};class sv extends sg{constructor(e,t,n){super(e,t,new tD(n)),this._path=n,this.type="collection"}get id(){return this._query.path.lastSegment()}get path(){return this._query.path.canonicalString()}get parent(){let e=this._path.popLast();return e.isEmpty()?null:new sy(this.firestore,null,new eu(e))}withConverter(e){return new sv(this.firestore,e,this._path)}}function s_(e,t,...n){if(e=(0,E.Ku)(e),eh("collection","path",t),e instanceof sm){let r=eo.fromString(t,...n);return ed(r),new sv(e,null,r)}{if(!(e instanceof sy||e instanceof sv))throw new q(B.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=e._path.child(eo.fromString(t,...n));return ed(r),new sv(e.firestore,null,r)}}function sw(e,t,...n){if(e=(0,E.Ku)(e),1==arguments.length&&(t=Z.newId()),eh("doc","path",t),e instanceof sm){let r=eo.fromString(t,...n);return ec(r),new sy(e,null,new eu(r))}{if(!(e instanceof sy||e instanceof sv))throw new q(B.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let r=e._path.child(eo.fromString(t,...n));return ec(r),new sy(e.firestore,e instanceof sv?e.converter:null,new eu(r))}}let sb="AsyncQueue";class sE{constructor(e=Promise.resolve()){this.Zu=[],this.Xu=!1,this.ec=[],this.tc=null,this.nc=!1,this.rc=!1,this.sc=[],this.F_=new rG(this,"async_queue_retry"),this.oc=()=>{let e=rW();e&&D(sb,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this._c=e;let t=rW();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.oc)}get isShuttingDown(){return this.Xu}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.ac(),this.uc(e)}enterRestrictedMode(e){if(!this.Xu){this.Xu=!0,this.rc=e||!1;let t=rW();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.oc)}}enqueue(e){if(this.ac(),this.Xu)return new Promise(()=>{});let t=new $;return this.uc(()=>this.Xu&&this.rc?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.Zu.push(e),this.cc()))}async cc(){if(0!==this.Zu.length){try{await this.Zu[0](),this.Zu.shift(),this.F_.reset()}catch(e){if(!eC(e))throw e;D(sb,"Operation failed with retryable error: "+e)}this.Zu.length>0&&this.F_.g_(()=>this.cc())}}uc(e){let t=this._c.then(()=>(this.nc=!0,e().catch(e=>{throw this.tc=e,this.nc=!1,L("INTERNAL UNHANDLED ERROR: ",sT(e)),e}).then(e=>(this.nc=!1,e))));return this._c=t,t}enqueueAfterDelay(e,t,n){this.ac(),this.sc.indexOf(e)>-1&&(t=0);let r=ib.createAndSchedule(this,e,t,n,e=>this.lc(e));return this.ec.push(r),r}ac(){this.tc&&F(47125,{hc:sT(this.tc)})}verifyOperationInProgress(){}async Pc(){let e;do e=this._c,await e;while(e!==this._c)}Tc(e){for(let t of this.ec)if(t.timerId===e)return!0;return!1}Ic(e){return this.Pc().then(()=>{for(let t of(this.ec.sort((e,t)=>
7e.targetTimeMs-t.targetTimeMs),this.ec))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Pc()})}dc(e){this.sc.push(e)}lc(e){let t=this.ec.indexOf(e);this.ec.splice(t,1)}}function sT(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class sS extends sm{constructor(e,t,n,r){super(e,t,n,r),this.type="firestore",this._queue=new sE,this._persistenceKey=(null==r?void 0:r.name)||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new sE(e),this._firestoreClient=void 0,await e}}}function sC(e){if(e._terminated)throw new q(B.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,n,r,i,s;let o=e._freezeSettings(),a=(i=e._databaseId,s=(null==(t=e._app)?void 0:t.options.appId)||"",new eQ(i,s,e._persistenceKey,o.host,o.ssl,o.experimentalForceLongPolling,o.experimentalAutoDetectLongPolling,sc(o.experimentalLongPollingOptions),o.useFetchStreams,o.isUsingEmulator));e._componentsProvider||(null==(n=o.localCache)?void 0:n._offlineComponentProvider)&&(null==(r=o.localCache)?void 0:r._onlineComponentProvider)&&(e._componentsProvider={_offline:o.localCache._offlineComponentProvider,_online:o.localCache._onlineComponentProvider}),e._firestoreClient=new ss(e._authCredentials,e._appCheckCredentials,e._queue,a,e._componentsProvider&&function(e){let t=null==e?void 0:e._online.build();return{_offline:null==e?void 0:e._offline.build(t),_online:t}}(e._componentsProvider))}(e),e._firestoreClient}class sI{constructor(e){this._byteString=e}static fromBase64String(e){try{return new sI(eF.fromBase64String(e))}catch(e){throw new q(B.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new sI(eF.fromUint8Array(e))}toBase64(){return this._byteString.toBase64()}toUint8Array(){return this._byteString.toUint8Array()}toString(){return"Bytes(base64: "+this.toBase64()+")"}isEqual(e){return this._byteString.isEqual(e._byteString)}toJSON(){return{type:sI._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(ey(e,sI._jsonSchema))return sI.fromBase64String(e.bytes)}}sI._jsonSchemaVersion="firestore/bytes/1.0",sI._jsonSchema={type:eg("string",sI._jsonSchemaVersion),bytes:eg("string")};class sx{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new q(B.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new el(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class sA{constructor(e){this._methodName=e}}class sk{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new q(B.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new q(B.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+t);this._lat=e,this._long=t}get latitude(){return this._lat}get longitude(){return this._long}isEqual(e){return this._lat===e._lat&&this._long===e._long}_compareTo(e){return ee(this._lat,e._lat)||ee(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:sk._jsonSchemaVersion}}static fromJSON(e){if(ey(e,sk._jsonSchema))return new sk(e.latitude,e.longitude)}}sk._jsonSchemaVersion="firestore/geoPoint/1.0",sk._jsonSchema={type:eg("string",sk._jsonSchemaVersion),latitude:eg("number"),longitude:eg("number")};class sR{constructor(e){this._values=(e||[]).map(e=>e)}toArray(){return this._values.map(e=>e)}isEqual(e){return function(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}(this._values,e._values)}toJSON(){return{type:sR._jsonSchemaVersion,vectorValues:this._values}}static fromJSON(e){if(ey(e,sR._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new sR(e.vectorValues);throw new q(B.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}sR._jsonSchemaVersion="firestore/vectorValue/1.0",sR._jsonSchema={type:eg("string",sR._jsonSchemaVersion),vectorValues:eg("object")};let sP=/^__.*__$/;class sN{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return null!==this.fieldMask?new nf(e,this.data,this.fieldMask,t,this.fieldTransforms):new nd(e,this.data,t,this.fieldTransforms)}}class sO{constructor(e,t,n){this.data=e,this.fieldMask=t,this.fieldTransforms=n}toMutation(e,t){return new nf(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function sD(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw F(40011,{Ec:e})}}class sL{constructor(e,t,n,r,i,s){this.settings=e,this.databaseId=t,this.serializer
7=n,this.ignoreUndefinedProperties=r,void 0===i&&this.Ac(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get Ec(){return this.settings.Ec}Rc(e){return new sL(Object.assign(Object.assign({},this.settings),e),this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}Vc(e){var t;let n=null==(t=this.path)?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.fc(e),r}gc(e){var t;let n=null==(t=this.path)?void 0:t.child(e),r=this.Rc({path:n,mc:!1});return r.Ac(),r}yc(e){return this.Rc({path:void 0,mc:!0})}wc(e){return sK(e,this.settings.methodName,this.settings.Sc||!1,this.path,this.settings.bc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}Ac(){if(this.path)for(let e=0;e<this.path.length;e++)this.fc(this.path.get(e))}fc(e){if(0===e.length)throw this.wc("Document fields must not be empty");if(sD(this.Ec)&&sP.test(e))throw this.wc('Document fields cannot begin and end with "__"')}}class sM{constructor(e,t,n){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=n||rH(e)}Dc(e,t,n,r=!1){return new sL({Ec:e,methodName:t,bc:n,path:el.emptyPath(),mc:!1,Sc:r},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function sj(e){let t=e._freezeSettings(),n=rH(e._databaseId);return new sM(e._databaseId,!!t.ignoreUndefinedProperties,n)}class sF extends sA{_toFieldTransform(e){if(2!==e.Ec)throw 1===e.Ec?e.wc(`${this._methodName}() can only appear at the top level of your update data`):e.wc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof sF}}class sU extends sA{_toFieldTransform(e){return new ni(e.path,new t4)}isEqual(e){return e instanceof sU}}class sV extends sA{constructor(e,t){super(e),this.vc=t}_toFieldTransform(e){let t=new sL({Ec:3,bc:e.settings.bc,methodName:this._methodName,mc:!0},e.databaseId,e.serializer,e.ignoreUndefinedProperties),n=new t8(this.vc.map(e=>sB(e,t)));return new ni(e.path,n)}isEqual(e){return e instanceof sV&&(0,E.bD)(this.vc,e.vc)}}function sB(e,t){if(s$(e=(0,E.Ku)(e)))return sz("Unsupported field value:",t,e),sq(e,t);if(e instanceof sA)return function(e,t){if(!sD(t.Ec))throw t.wc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.wc(`${e._methodName}() is not currently supported inside arrays`);let n=e._toFieldTransform(t);n&&t.fieldTransforms.push(n)}(e,t),null;if(void 0===e&&t.ignoreUndefinedProperties)return null;if(t.path&&t.fieldMask.push(t.path),e instanceof Array){if(t.settings.mc&&4!==t.Ec)throw t.wc("Nested arrays are not supported");let n=[],r=0;for(let i of e){let e=sB(i,t.yc(r));null==e&&(e={nullValue:"NULL_VALUE"}),n.push(e),r++}return{arrayValue:{values:n}}}return function(e,t){var n,r,i;if(null===(e=(0,E.Ku)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return n=t.serializer,"number"==typeof(i=r=e)&&Number.isInteger(i)&&!ex(i)&&i<=Number.MAX_SAFE_INTEGER&&i>=Number.MIN_SAFE_INTEGER?t3(r):t2(n,r);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let n=ev.fromDate(e);return{timestampValue:n$(t.serializer,n)}}if(e instanceof ev){let n=new ev(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:n$(t.serializer,n)}}if(e instanceof sk)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof sI)return{bytesValue:nz(t.serializer,e._byteString)};if(e instanceof sy){let n=t.databaseId,r=e.firestore._databaseId;if(!r.isEqual(n))throw t.wc(`Document reference is for database ${r.projectId}/${r.database} but should be for database ${n.projectId}/${n.database}`);return{referenceValue:nH(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof sR)return{mapValue:{fields:{[eZ]:{stringValue:e2},[e3]:{arrayValue:{values:e.toArray().map(e=>{if("number"!=typeof e)throw t.wc("VectorValues must only contain numeric values.");return t2(t.serializer,e)})}}}}};throw t.wc(`Unsupported field value: ${ep(e)}`)}(e,t)}function sq(e,t){let n={};return eR(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):ek(e,(e,r)=>{let i=sB(r,t.Vc(e));null!=i&&(n[e]=i)}),{mapValue:{fields:n}}}function s$(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof ev||e instanceof sk||e instanceof sI||e instanceof sy||e instanceof sA||e instanceof sR)}function sz(e,t,n){if(!s$(n)||!ef(n)){let r=ep(n);throw"an object"===r?t.wc(e+" a custom object"):t.wc(e+" "+r)}}function sW(e,t,n){if((t=(0,E.Ku)(t))instanceof sx)return t._internalPath;if("string"==typeof t)return sG(e,t);throw sK("Field path arguments must be of type string or ",e,!1,void 0,n)}let sH=RegExp("[~\\*/\\[\\]]");function sG(e,t,n){if(t.search(sH)>=0)throw sK(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,n);try{return new sx(...t.split("."))._internalPath}catch(r){throw sK(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,n)}}function sK(e,t,n,r,i){let s=r&&!r.isEmpty(),o=void 0!==i,a=`Function ${t}
7() called with invalid data`;n&&(a+=" (via `toFirestore()`)"),a+=". ";let l="";return(s||o)&&(l+=" (found",s&&(l+=` in field ${r}`),o&&(l+=` in document ${i}`),l+=")"),new q(B.INVALID_ARGUMENT,a+e+l)}function sY(e,t){return e.some(e=>e.isEqual(t))}class sQ{constructor(e,t,n,r,i){this._firestore=e,this._userDataWriter=t,this._key=n,this._document=r,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new sy(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new sX(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){let t=this._document.data.field(sJ("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class sX extends sQ{data(){return super.data()}}function sJ(e,t){return"string"==typeof t?sG(e,t):t instanceof sx?t._internalPath:t._delegate._internalPath}class sZ{}class s0 extends sZ{}class s1 extends s0{constructor(e,t,n){super(),this._field=e,this._op=t,this._value=n,this.type="where"}static _create(e,t,n){return new s1(e,t,n)}_apply(e){let t=this._parse(e);return s6(e._query,t),new sg(e.firestore,e.converter,tU(e._query,t))}_parse(e){let t=sj(e.firestore);return function(e,t,n,r,i,s,o){let a;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new q(B.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){s5(o,s);let t=[];for(let n of o)t.push(s3(r,e,n));a={arrayValue:{values:t}}}else a=s3(r,e,o)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||s5(o,s),a=function(e,t,n,r=!1){return sB(n,e.Dc(r?4:3,t))}(n,t,o,"in"===s||"not-in"===s);return ty.create(i,s,a)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}class s2 extends sZ{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new s2(e,t)}_parse(e){let t=this._queryConstraints.map(t=>t._parse(e)).filter(e=>e.getFilters().length>0);return 1===t.length?t[0]:tv.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let n=e;for(let e of t.getFlattenedFilters())s6(n,e),n=tU(n,e)}(e._query,t),new sg(e.firestore,e.converter,tU(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}function s3(e,t,n){if("string"==typeof(n=(0,E.Ku)(n))){if(""===n)throw new q(B.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!tM(t)&&-1!==n.indexOf("/"))throw new q(B.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${n}' contains a '/' character.`);let r=t.path.child(eo.fromString(n));if(!eu.isDocumentKey(r))throw new q(B.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 tt(e,new eu(r))}if(n instanceof sy)return tt(e,n._key);throw new q(B.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${ep(n)}.`)}function s5(e,t){if(!Array.isArray(e)||0===e.length)throw new q(B.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function s6(e,t){let n=function(e,t){for(let n of e)for(let e of n.getFlattenedFilters())if(t.indexOf(e.op)>=0)return e.op;return null}(e.filters,function(e){switch(e){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[]}}(t.op));if(null!==n)throw n===t.op?new q(B.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new q(B.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${n.toString()}' filters.`)}class s4{convertValue(e,t="none"){switch(e5(e)){case 0:return null;case 1:return e.booleanValue;case 2:return eB(e.integerValue||e.doubleValue);case 3:return this.convertTimestamp(e.timestampValue);case 4:return this.convertServerTimestamp(e,t);case 5:return e.stringValue;case 6:return this.convertBytes(eq(e.bytesValue));case 7:return this.convertReference(e.referenceValue);case 8:return this.convertGeoPoint(e.geoPointValue);case 9:return this.convertArray(e.arrayValue,t);case 11:return this.convertObject(e.mapValue,t);case 10:return this.convertVectorValue(e.mapValue);default:throw F(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let n={};return ek(e,(e,r)=>{n[e]=this.convertValue(r,t)}),n}convertVectorValue(e){var t,n,r;return new sR(null==(r=null==(n=null==(t=e.fields)?void 0:t[e3].arrayValue)?void 0:n.values)?void 0:r.map(e=>eB(e.doubleValue)))}convertGeoPoint(e){return new sk(eB(e.latitude),eB(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let n=eK(e);return null==n?null:this.convertValue(n,t);case"estimate":return this.convertTimestamp(eY(e));default:return null}}convertTimestamp(e){let t=eV(e);return new ev(t.seconds,t.nanos)}convertDocumentKey(e,t){let n=eo.fromString(e);V(n3(n),9688,{name:e});let r=new eJ(n.get(1),n.get(3)),i=new eu(n.popFirst(5));return r.isEqual(t)||L(`Document ${i} contains a document reference within a different database (${r.projectId}/${r.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}class s8{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}
7class s7 extends sQ{constructor(e,t,n,r,i,s){super(e,t,n,r,s),this._firestore=e,this._firestoreImpl=e,this.metadata=i}exists(){return super.exists()}data(e={}){if(this._document){if(this._converter){let t=new s9(this._firestore,this._userDataWriter,this._key,this._document,this.metadata,null);return this._converter.fromFirestore(t,e)}return this._userDataWriter.convertValue(this._document.data.value,e.serverTimestamps)}}get(e,t={}){if(this._document){let n=this._document.data.field(sJ("DocumentSnapshot.get",e));if(null!==n)return this._userDataWriter.convertValue(n,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new q(B.FAILED_PRECONDITION,"DocumentSnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e=this._document,t={};return t.type=s7._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()&&(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),this._firestore,this.ref.path,t.bundle="NOT SUPPORTED"),t}}s7._jsonSchemaVersion="firestore/documentSnapshot/1.0",s7._jsonSchema={type:eg("string",s7._jsonSchemaVersion),bundleSource:eg("string","DocumentSnapshot"),bundleName:eg("string"),bundle:eg("string")};class s9 extends s7{data(e={}){return super.data(e)}}class oe{constructor(e,t,n,r){this._firestore=e,this._userDataWriter=t,this._snapshot=r,this.metadata=new s8(r.hasPendingWrites,r.fromCache),this.query=n}get docs(){let e=[];return this.forEach(t=>e.push(t)),e}get size(){return this._snapshot.docs.size}get empty(){return 0===this.size}forEach(e,t){this._snapshot.docs.forEach(n=>{e.call(t,new s9(this._firestore,this._userDataWriter,n.key,n,new s8(this._snapshot.mutatedKeys.has(n.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new q(B.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===t||(this._cachedChanges=function(e,t){if(e._snapshot.oldDocs.isEmpty()){let t=0;return e._snapshot.docChanges.map(n=>{let r=new s9(e._firestore,e._userDataWriter,n.doc.key,n.doc,new s8(e._snapshot.mutatedKeys.has(n.doc.key),e._snapshot.fromCache),e.query.converter);return n.doc,{type:"added",doc:r,oldIndex:-1,newIndex:t++}})}{let n=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{let r=new s9(e._firestore,e._userDataWriter,t.doc.key,t.doc,new s8(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,s=-1;return 0!==t.type&&(i=n.indexOf(t.doc.key),n=n.delete(t.doc.key)),1!==t.type&&(s=(n=n.add(t.doc)).indexOf(t.doc.key)),{type:function(e){switch(e){case 0:return"added";case 2:case 3:return"modified";case 1:return"removed";default:return F(61501,{type:e})}}(t.type),doc:r,oldIndex:i,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new q(B.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=oe._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=Z.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let t=[],n=[],r=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),n.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),r.push(e.ref.path))}),this._firestore,this.query._query,e.bundleName,e.bundle="NOT SUPPORTED",e}}function ot(e){e=em(e,sy);let t=em(e.firestore,sS);return(function(e,t,n={}){let r=new $;return e.asyncQueue.enqueueAndForget(async()=>(function(e,t,n,r,i){let s=new sr({next:a=>{s.Ou(),t.enqueueAndForget(()=>iR(e,o));let l=a.docs.has(n);!l&&a.fromCache?i.reject(new q(B.UNAVAILABLE,"Failed to get document because the client is offline.")):l&&a.fromCache&&r&&"server"===r.source?i.reject(new q(B.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.)')):i.resolve(a)},error:e=>i.reject(e)}),o=new iD(new tD(n.path),s,{includeMetadataChanges:!0,ka:!0});return ik(e,o)})(await sh(e),e.asyncQueue,t,n,r)),r.promise})(sC(t),e._key).then(n=>(function(e,t,n){let r=n.docs.get(t._key),i=new on(e);return new s7(e,i,t._key,r,new s8(n.hasPendingWrites,n.fromCache),t.converter)})(t,e,n))}
7oe._jsonSchemaVersion="firestore/querySnapshot/1.0",oe._jsonSchema={type:eg("string",oe._jsonSchemaVersion),bundleSource:eg("string","QuerySnapshot"),bundleName:eg("string"),bundle:eg("string")};class on extends s4{constructor(e){super(),this.firestore=e}convertBytes(e){return new sI(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new sy(this.firestore,null,t)}}function or(e){e=em(e,sg);let t=em(e.firestore,sS),n=sC(t),r=new on(t);return function(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new q(B.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}(e._query),(function(e,t,n={}){let r=new $;return e.asyncQueue.enqueueAndForget(async()=>(function(e,t,n,r,i){let s=new sr({next:n=>{s.Ou(),t.enqueueAndForget(()=>iR(e,o)),n.fromCache&&"server"===r.source?i.reject(new q(B.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.)')):i.resolve(n)},error:e=>i.reject(e)}),o=new iD(n,s,{includeMetadataChanges:!0,ka:!0});return ik(e,o)})(await sh(e),e.asyncQueue,t,n,r)),r.promise})(n,e._query).then(n=>new oe(t,r,e,n))}function oi(e,t,n){var r;e=em(e,sy);let i=em(e.firestore,sS),s=(r=e.converter,r?n&&(n.merge||n.mergeFields)?r.toFirestore(t,n):r.toFirestore(t):t);return oo(i,[(function(e,t,n,r,i,s={}){let o,a,l=e.Dc(s.merge||s.mergeFields?2:0,t,n,i);sz("Data must be an object, but it was:",l,r);let u=sq(r,l);if(s.merge)o=new eM(l.fieldMask),a=l.fieldTransforms;else if(s.mergeFields){let e=[];for(let r of s.mergeFields){let i=sW(t,r,n);if(!l.contains(i))throw new q(B.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);sY(e,i)||e.push(i)}o=new eM(e),a=l.fieldTransforms.filter(e=>o.covers(e.field))}else o=null,a=l.fieldTransforms;return new sN(new th(u),o,a)})(sj(i),"setDoc",e._key,s,null!==e.converter,n).toMutation(e._key,no.none())])}function os(e,t,n,...r){e=em(e,sy);let i=em(e.firestore,sS),s=sj(i);return oo(i,[("string"==typeof(t=(0,E.Ku)(t))||t instanceof sx?function(e,t,n,r,i,s){let o=e.Dc(1,t,n),a=[sW(t,r,n)],l=[i];if(s.length%2!=0)throw new q(B.INVALID_ARGUMENT,`Function ${t}() needs to be called with an even number of arguments that alternate between field names and values.`);for(let e=0;e<s.length;e+=2)a.push(sW(t,s[e])),l.push(s[e+1]);let u=[],h=th.empty();for(let e=a.length-1;e>=0;--e)if(!sY(u,a[e])){let t=a[e],n=l[e];n=(0,E.Ku)(n);let r=o.gc(t);if(n instanceof sF)u.push(t);else{let e=sB(n,r);null!=e&&(u.push(t),h.set(t,e))}}return new sO(h,new eM(u),o.fieldTransforms)}(s,"updateDoc",e._key,t,n,r):function(e,t,n,r){let i=e.Dc(1,t,n);sz("Data must be an object, but it was:",i,r);let s=[],o=th.empty();return ek(r,(e,r)=>{let a=sG(t,e,n);r=(0,E.Ku)(r);let l=i.gc(a);if(r instanceof sF)s.push(a);else{let e=sB(r,l);null!=e&&(s.push(a),o.set(a,e))}}),new sO(o,new eM(s),i.fieldTransforms)}(s,"updateDoc",e._key,t)).toMutation(e._key,no.exists(!0))])}function oo(e,t){var n=sC(e);let r=new $;return n.asyncQueue.enqueueAndForget(async()=>iK(await su(n).then(e=>e.syncEngine),t,r)),r.promise}function oa(){return new sU("serverTimestamp")}function ol(...e){return new sV("arrayUnion",e)}new WeakMap,function(e=!0){P=_.MF,(0,_.om)(new w.uA("firestore",(t,{instanceIdentifier:n,options:r})=>{let i=t.getProvider("app").getImmediate(),s=new sS(new G(t.getProvider("auth-internal")),new X(i,t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new q(B.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new eJ(e.options.projectId,t)}(i,n),i);return r=Object.assign({useFetchStreams:e},r),s._setSettings(r),s},"PUBLIC").setMultipleInstances(!0)),(0,_.KO)(A,k,void 0),(0,_.KO)(A,k,"esm2017")}();var ou=n(7270),oh=n(6091);let oc="firebasestorage.googleapis.com";class od extends E.g{constructor(e,t,n=0){super(of(e),`Firebase Storage: ${t} (${of(e)})`),this.status_=n,this.customData={serverResponse:null},this._baseMessage=this.message,Object.setPrototypeOf(this,od.prototype)}get status(){return this.status_}set status(e){this.status_=e}_codeEquals(e){return of(e)===this.code}get serverResponse(){return this.customData.serverResponse}set serverResponse(e){this.customData.serverResponse=e,this.customData.serverResponse?this.message=`${this._baseMessage} 8${this.customData.serverResponse}`:this.message=this._baseMessage}}function of(e){return"storage/"+e}function op(e){return new od(y.INVALID_ARGUMENT,e)}function om(){return new od(y.APP_DELETED,"The Firebase app was deleted.")}!function(e){e.UNKNOWN="unknown",e.OBJECT_NOT_FOUND="object-not-found",e.BUCKET_NOT_FOUND="bucket-not-found",e.PROJECT_NOT_FOUND="project-not-found",e.QUOTA_EXCEEDED="quota-exceeded",e.UNAUTHENTICATED="unauthenticated",e.UNAUTHORIZED="unauthorized",e.UNAUTHORIZED_APP="unauthorized-app",e.RETRY_LIMIT_EXCEEDED="retry-limit-exceeded",e.INVALID_CHECKSUM="invalid-checksum",e.CANCELED="canceled",e.INVALID_EVENT_NAME="invalid-event-name",e.INVALID_URL="invalid-url",e.INVALID_DEFAULT_BUCKET="invalid-default-bucket",e.NO_DEFAULT_BUCKET="no-default-bucket",e.CA
8NNOT_SLICE_BLOB="cannot-slice-blob",e.SERVER_FILE_WRONG_SIZE="server-file-wrong-size",e.NO_DOWNLOAD_URL="no-download-url",e.INVALID_ARGUMENT="invalid-argument",e.INVALID_ARGUMENT_COUNT="invalid-argument-count",e.APP_DELETED="app-deleted",e.INVALID_ROOT_OPERATION="invalid-root-operation",e.INVALID_FORMAT="invalid-format",e.INTERNAL_ERROR="internal-error",e.UNSUPPORTED_ENVIRONMENT="unsupported-environment"}(y||(y={}));class og{constructor(e,t){this.bucket=e,this.path_=t}get path(){return this.path_}get isRoot(){return 0===this.path.length}fullServerUrl(){let e=encodeURIComponent;return"/b/"+e(this.bucket)+"/o/"+e(this.path)}bucketOnlyServerUrl(){return"/b/"+encodeURIComponent(this.bucket)+"/o"}static makeFromBucketSpec(e,t){let n;try{n=og.makeFromUrl(e,t)}catch(t){return new og(e,"")}if(""===n.path)return n;throw new od(y.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+e+"'.")}static makeFromUrl(e,t){let n=null,r="([A-Za-z0-9.\\-_]+)",i=RegExp("^gs://"+r+"(/(.*))?$","i");function s(e){e.path_=decodeURIComponent(e.path)}let o=t.replace(/[.]/g,"\\."),a=RegExp(`^https?://${o}/v[A-Za-z0-9_]+/b/${r}/o(/([^?#]*).*)?$`,"i"),l=t===oc?"(?:storage.googleapis.com|storage.cloud.google.com)":t,u=[{regex:i,indices:{bucket:1,path:3},postModify:function(e){"/"===e.path.charAt(e.path.length-1)&&(e.path_=e.path_.slice(0,-1))}},{regex:a,indices:{bucket:1,path:3},postModify:s},{regex:RegExp(`^https?://${l}/${r}/([^?#]*)`,"i"),indices:{bucket:1,path:2},postModify:s}];for(let t=0;t<u.length;t++){let r=u[t],i=r.regex.exec(e);if(i){let e=i[r.indices.bucket],t=i[r.indices.path];t||(t=""),n=new og(e,t),r.postModify(n);break}}if(null==n)throw new od(y.INVALID_URL,"Invalid URL '"+e+"'.");return n}}class oy{constructor(e){this.promise_=Promise.reject(e)}getPromise(){return this.promise_}cancel(e=!1){}}function ov(e,t,n,r){if(r<t)throw op(`Invalid value for '${e}'. Expected ${t} or greater.`);if(r>n)throw op(`Invalid value for '${e}'. Expected ${n} or less.`)}!function(e){e[e.NO_ERROR=0]="NO_ERROR",e[e.NETWORK_ERROR=1]="NETWORK_ERROR",e[e.ABORT=2]="ABORT"}(v||(v={}));class o_{constructor(e,t,n,r,i,s,o,a,l,u,h,c=!0,d=!1){this.url_=e,this.method_=t,this.headers_=n,this.body_=r,this.successCodes_=i,this.additionalRetryCodes_=s,this.callback_=o,this.errorCallback_=a,this.timeout_=l,this.progressCallback_=u,this.connectionFactory_=h,this.retry=c,this.isUsingEmulator=d,this.pendingConnection_=null,this.backoffId_=null,this.canceled_=!1,this.appDelete_=!1,this.promise_=new Promise((e,t)=>{this.resolve_=e,this.reject_=t,this.start_()})}start_(){let e=(e,t)=>{if(t)return void e(!1,new ow(!1,null,!0));let n=this.connectionFactory_();this.pendingConnection_=n;let r=e=>{let t=e.loaded,n=e.lengthComputable?e.total:-1;null!==this.progressCallback_&&this.progressCallback_(t,n)};null!==this.progressCallback_&&n.addUploadProgressListener(r),n.send(this.url_,this.method_,this.isUsingEmulator,this.body_,this.headers_).then(()=>{null!==this.progressCallback_&&n.removeUploadProgressListener(r),this.pendingConnection_=null;let t=n.getErrorCode()===v.NO_ERROR,i=n.getStatus();if(!t||function(e,t){let n=e>=500&&e<600,r=-1!==[408,429].indexOf(e),i=-1!==t.indexOf(e);return n||r||i}(i,this.additionalRetryCodes_)&&this.retry)return void e(!1,new ow(!1,null,n.getErrorCode()===v.ABORT));e(!0,new ow(-1!==this.successCodes_.indexOf(i),n))})},t=(e,t)=>{let n=this.resolve_,r=this.reject_,i=t.connection;if(t.wasSuccessCode)try{let e=this.callback_(i,i.getResponse());void 0!==e?n(e):n()}catch(e){r(e)}else if(null!==i){let e=new od(y.UNKNOWN,"An unknown error occurred, please check the error payload for server response.");e.serverResponse=i.getErrorText(),r(this.errorCallback_?this.errorCallback_(i,e):e)}else r(t.canceled?this.appDelete_?om():new od(y.CANCELED,"User canceled the upload/download."):new od(y.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again."))};this.canceled_?t(!1,new ow(!1,null,!0)):this.backoffId_=function(e,t,n){let r=1,i=null,s=null,o=!1,a=0,l=!1;function u(...e){l||(l=!0,t.apply(null,e))}function h(t){i=setTimeout(()=>{i=null,e(d,2===a)},t)}function c(){s&&clearTimeout(s)}function d(e,...t){let n;if(l)return void c();if(e||2===a||o){c(),u.call(null,e,...t);return}r<64&&(r*=2),1===a?(a=2,n=0):n=(r+Math.random())*1e3,h(n)}let f=!1;
8function p(e){f||(f=!0,c(),!l&&(null!==i?(e||(a=2),clearTimeout(i),h(0)):e||(a=1)))}return h(0),s=setTimeout(()=>{o=!0,p(!0)},n),p}(e,t,this.timeout_)}getPromise(){return this.promise_}cancel(e){this.canceled_=!0,this.appDelete_=e||!1,null!==this.backoffId_&&(0,this.backoffId_)(!1),null!==this.pendingConnection_&&this.pendingConnection_.abort()}}class ow{constructor(e,t,n){this.wasSuccessCode=e,this.connection=t,this.canceled=!!n}}class ob{constructor(e,t){this._service=e,t instanceof og?this._location=t:this._location=og.makeFromUrl(t,e.host)}toString(){return"gs://"+this._location.bucket+"/"+this._location.path}_newRef(e,t){return new ob(e,t)}get root(){let e=new og(this._location.bucket,"");return this._newRef(this._service,e)}get bucket(){return this._location.bucket}get fullPath(){return this._location.path}get name(){var e=this._location.path;let t=e.lastIndexOf("/",e.length-2);return -1===t?e:e.slice(t+1)}get storage(){return this._service}get parent(){let e=function(e){if(0===e.length)return null;let t=e.lastIndexOf("/");return -1===t?"":e.slice(0,t)}(this._location.path);if(null===e)return null;let t=new og(this._location.bucket,e);return new ob(this._service,t)}_throwIfRoot(e){if(""===this._location.path)throw new od(y.INVALID_ROOT_OPERATION,"The operation '"+e+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}}function oE(e,t){let n=null==t?void 0:t.storageBucket;return null==n?null:og.makeFromBucketSpec(n,e)}class oT{constructor(e,t,n,r,i,s=!1){this.app=e,this._authProvider=t,this._appCheckProvider=n,this._url=r,this._firebaseVersion=i,this._isUsingEmulator=s,this._bucket=null,this._host=oc,this._protocol="https",this._appId=null,this._deleted=!1,this._maxOperationRetryTime=12e4,this._maxUploadRetryTime=6e5,this._requests=new Set,null!=r?this._bucket=og.makeFromBucketSpec(r,this._host):this._bucket=oE(this._host,this.app.options)}get host(){return this._host}set host(e){this._host=e,null!=this._url?this._bucket=og.makeFromBucketSpec(this._url,e):this._bucket=oE(e,this.app.options)}get maxUploadRetryTime(){return this._maxUploadRetryTime}set maxUploadRetryTime(e){ov("time",0,1/0,e),this._maxUploadRetryTime=e}get maxOperationRetryTime(){return this._maxOperationRetryTime}set maxOperationRetryTime(e){ov("time",0,1/0,e),this._maxOperationRetryTime=e}async _getAuthToken(){if(this._overrideAuthToken)return this._overrideAuthToken;let e=this._authProvider.getImmediate({optional:!0});if(e){let t=await e.getToken();if(null!==t)return t.accessToken}return null}async _getAppCheckToken(){if((0,_.xZ)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=this._appCheckProvider.getImmediate({optional:!0});return e?(await e.getToken()).token:null}_delete(){return this._deleted||(this._deleted=!0,this._requests.forEach(e=>e.cancel()),this._requests.clear()),Promise.resolve()}_makeStorageReference(e){return new ob(this,e)}_makeRequest(e,t,n,r,i=!0){if(this._deleted)return new oy(om());{let s=function(e,t,n,r,i,s,o=!0,a=!1){let l=function(e){let t=encodeURIComponent,n="?";for(let r in e)e.hasOwnProperty(r)&&(n=n+(t(r)+"=")+t(e[r])+"&");return n.slice(0,-1)}(e.urlParams),u=e.url+l,h=Object.assign({},e.headers);return t&&(h["X-Firebase-GMPID"]=t),null!==n&&n.length>0&&(h.Authorization="Firebase "+n),h["X-Firebase-Storage-Version"]="webjs/"+(null!=s?s:"AppManager"),null!==r&&(h["X-Firebase-AppCheck"]=r),new o_(u,e.method,h,e.body,e.successCodes,e.additionalRetryCodes,e.handler,e.errorHandler,e.timeout,e.progressCallback,i,o,a)}(e,this._appId,n,r,t,this._firebaseVersion,i,this._isUsingEmulator);return this._requests.add(s),s.getPromise().then(()=>this._requests.delete(s),()=>this._requests.delete(s)),s}}async makeRequestWithTokens(e,t){let[n,r]=await Promise.all([this._getAuthToken(),this._getAppCheckToken()]);return this._makeRequest(e,t,n,r).getPromise()}}let oS="@firebase/storage",oC="0.13.14",oI="storage";(0,_.om)(new w.uA(oI,function(e,{instanceIdentifier:t}){let n=e.getProvider("app").getImmediate();return new oT(n,e.getProvider("auth-internal"),e.getProvider("app-check-internal"),t,_.MF)},"PUBLIC").setMultipleInstances(!0)),(0,_.KO)(oS,oC,""),(0,_.KO)(oS,oC,"esm2017");let ox=(0,_.Wp)({apiKey:"AIzaSyAdXmcJHngjNiFZUxYlbWjPAywWD0Li0sM",authDomain:"robotric-d4382.firebaseapp.com",projectId:"robotric-d4382",storageBucket:"robotric-d4382.appspot.com",messagingSenderId:"719851774611",appId:"1:719851774611:web:eaecf83282e5035105a366",measurementId:"G-TY1K9XPSWC",databaseURL:"https://robotric-d4382-default-rtdb.firebaseio.com"}),oA=function(e,t){let n="object"==typeof e?e:(0,_.Sx)(),r=(0,_.j6)(n,"firestore").getImmediate({identifier:"string"==typeof e?e:eX});if(!r._initialized){let e=(0,E.yU)("firestore");e&&function(e,t,n,r={}){var i;e=em(e,sm);
8let s=(0,E.zJ)(t),o=e._getSettings(),a=Object.assign(Object.assign({},o),{emulatorOptions:e._getEmulatorOptions()}),l=`${t}:${n}`;s&&((0,E.gE)(`https://${l}`),(0,E.P1)("Firestore",!0)),o.host!==sf&&o.host!==l&&M("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let u=Object.assign(Object.assign({},o),{host:l,ssl:s,emulatorOptions:r});if(!(0,E.bD)(u,a)&&(e._setSettings(u),r.mockUserToken)){let t,n;if("string"==typeof r.mockUserToken)t=r.mockUserToken,n=R.MOCK_USER;else{t=(0,E.Fy)(r.mockUserToken,null==(i=e._app)?void 0:i.options.projectId);let s=r.mockUserToken.sub||r.mockUserToken.user_id;if(!s)throw new q(B.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");n=new R(s)}e._authCredentials=new H(new z(t,n))}}(r,...e)}return r}(ox),ok=(0,oh.xI)(ox);!function(e=(0,_.Sx)(),t){e=(0,E.Ku)(e);let n=(0,_.j6)(e,oI).getImmediate({identifier:t}),r=(0,E.yU)("storage");r&&function(e,t,n,r={}){!function(e,t,n,r={}){e.host=`${t}:${n}`;let i=(0,E.zJ)(t);i&&((0,E.gE)(`https://${e.host}/b`),(0,E.P1)("Storage",!0)),e._isUsingEmulator=!0,e._protocol=i?"https":"http";let{mockUserToken:s}=r;s&&(e._overrideAuthToken="string"==typeof s?s:(0,E.Fy)(s,e.app.options.projectId))}(e,t,n,r)}(n,...r)}(ox,"gs://robotric-d4382.appspot.com"),(0,ou.C3)(ox);let oR=(e,t)=>{throw console.error("".concat(t,":"),e),Error("".concat(t,": ").concat(e.message))},oP=async()=>{try{let e=new oh.HF,t=(await (0,oh.df)(ok,e)).user;return(await ot(sw(oA,"users",t.email))).exists()?await os(sw(oA,"users",t.email),{updatedAt:oa()}):await oi(sw(oA,"users",t.email),{email:t.email,createdAt:oa(),updatedAt:oa(),purchasedBooks:[]}),t}catch(e){console.error(e,"Error signing in with Google")}},oN=async function(e,t){arguments.length>2&&void 0!==arguments[2]&&arguments[2];try{let n=await (0,oh.eJ)(ok,e,t);return await oi(sw(oA,"users",e),{email:e,createdAt:oa(),updatedAt:oa(),purchasedBooks:[]}),n.user}catch(e){oR(e,"Error during sign up")}},oO=async(e,t)=>{try{return await (0,oh.x9)(ok,e,t)}catch(e){oR(e,"Error during sign in")}},oD=()=>new Promise((e,t)=>{let n=(0,oh.hg)(ok,t=>{n(),e(t)},t)}),oL=async e=>{try{let t=s_(oA,"users"),n=function(e,t,...n){let r=[];for(let i of(t instanceof sZ&&r.push(t),function(e){let t=e.filter(e=>e instanceof s2).length,n=e.filter(e=>e instanceof s1).length;if(t>1||t>0&&n>0)throw new q(B.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=r.concat(n)),r))e=i._apply(e);return e}(t,function(e,t,n){let r=sJ("where",e);return s1._create(r,"==",n)}("email",0,e)),r=await or(n);if(!r.empty)return r.docs[0].data();return null}catch(e){oR(e,"Error fetching user by email")}},oM=async()=>{try{return(await or(s_(oA,"books"))).docs.map(e=>({id:e.id,...e.data()}))}catch(e){oR(e,"Error fetching all books")}},oj=async(e,t)=>{try{let n=sw(oA,"users",e),r=await ot(n);if(r.exists())return(r.data().purchasedBooks||[]).includes(t);return!1}catch(e){throw console.error("Error checking user purchase:",e),e}},oF=async e=>{try{await (0,oh.J1)(ok,e)}catch(e){oR(e,"Error sending password reset email")}},oU=async e=>{try{let t=await ot(sw(oA,"books",e));if(!t.exists())throw Error("Book not found");return{id:t.id,...t.data()}}catch(e){oR(e,"Error fetching book details")}},oV=async e=>{try{let t=await ot(sw(oA,"users",e));if(!t.exists())throw Error("User not found");let n=t.data().purchasedBooks.map(e=>oU(e));return await Promise.all(n)}catch(e){oR(e,"Error fetching purchased books")}},oB=async(e,t)=>{try{let n=sw(oA,"users",e),r=await ot(n);if(!r.exists())throw Error("User not found");r.data().purchasedBooks.includes(t)||await os(n,{purchasedBooks:ol(t),updatedAt:oa()})}catch(e){oR(e,"Error adding book to user collection")}},oq=async(e,t)=>{try{let n,r=await ot(sw(oA,"users",e));if(r.exists())await os(sw(oA,"users",e),{purchasedBooks:ol(t),updatedAt:oa()});else{n=Math.random().toString(36).slice(-8),await (0,oh.eJ)(ok,e,n);let i={email:e,purchasedBooks:[t],Bag:[],createdAt:oa(),updatedAt:oa()};await oi(sw(oA,"users",e),i),r=await ot(sw(oA,"users",e))}return{user:r.data(),tempPassword:n}}catch(e){throw console.error("Error in createUserIfNotExistsAndAddBook: ".concat(e.message)),e}},o$=async e=>{try{let{orderId:t,userId:n,userEmail:r,amountPaid:i,orderDate:s,bookId:o}=e;if(!r)throw Error("User email must be provided");let a={userId:r,userEmail:r,amountPaid:i,orderDate:s,bookId:o,status:"completed",createdAt:oa()};return await oi(sw(oA,"orders",t),a),t}catch(e){oR(e,"Error storing order information")}},oz=async(e,t)=>{try{let n=sw(oA,"users",e),r=await ot(n);if(r.exists())return(r.data().readingProgress||{})[t]||{currentPage:1,lastReadAt:null};return{currentPage:1,lastReadAt:null}}catch(e){throw console.error("Error getting user reading progress:",e),e}},oW=async(e,t,n)=>{try{let r=sw(oA,"users",e);await os(r,{["readingProgress.".concat(t)]:{currentPage:parseInt(n,10),lastReadAt:oa()}})}catch(e){throw console.error("Error updating user reading progress:",e),e}},oH=async(e,t,n)=>{try{let n=sw(oA,"users",e);await os(n,{["readingProgress.".concat(t)]:{currentPage:parseInt(0,10),lastReadAt:oa()}})}catch(e){throw console.error("Error updating user reading progress:",e),e}},oG=async(e,t,n)=>{try{let s=sw(oA,"users",e),o=await ot(s);if(o.exists()){var r,i;let e=(null==(i=o.data().Games)||null==(r=i[t])?void 0:r.score)||0;n>e&&await os(s,{["Games.".concat(t,".score")]:n})}else await os(s,{["Games.".concat(t,".score")]:n})}catch(e){throw console.error("Error adding high score:",e),e}},oK=async(e,t,n,r)=>{if(!t)return;let i=sw(oA,"users",t);console.log("Updating quiz progress for user: ".concat(t,", quizId: ").concat(r,", sectionId: ").concat(n)),(await ot(i)).exists()?(console.log("Existing document found for user: ".concat(t,". Updating document.")),await os(i,{["QuizProgress.".concat(n,".").concat(r)]:{completed:!0}}),console.log("Document updated for user: ".concat(t," with new progress."))):(console.log("No existing document found for user: ".concat(t,". Creating new document.")),await oi(i,{["QuizProgress.".concat(n,".").concat(r)]:{completed:!0}}),console.log("New document created for user: ".concat(t," with quizId: ").concat(r)))},oY=async(e,t)=>{if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().CompletedAdventures))&&r.data().CompletedAdventures.includes(t)},oQ=async(e,t)=>{var n;if(!e)throw Error("Email is required");let r=sw(oA,"users",e),i=await ot(r);if(!i.exists())throw Error("User not found");return Array.isArray(i.data().CompletedAdventures)||await os(r,{CompletedAdventures:[]}),(null==(n=i.data().CompletedAdventures)||!n.includes(t))&&(await os(r,{CompletedAdventures:ol(t),updatedAt:oa()}),!0)},oX=async e=>{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);return!!(n.exists()&&Array.isArray(n.data().Bag))&&n.data().Bag.includes("RB")},oJ=async e=>{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);return!!(n.exists()&&Array.isArray(n.data().Bag))&&n.data().Bag.includes("TTT")},oZ=async e=>{if(!e)throw Error("Email is required");return!await oJ(e)&&(await os(sw(oA,"users",e),{Bag:ol("TTT"),updatedAt:oa()}),!0)},o0=async e=>{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);return!!(n.exists()&&Array.isArray(n.data().Bag))&&n.data().Bag.includes("LU")},o1=async e=>{if(!e)throw Error("Email is required");return!await oX(e)&&(await os(sw(oA,"users",e),{Bag:ol("LU"),updatedAt:oa()}),!0)},o2=async e=>{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);return!!(n.exists()&&Array.isArray(n.data().Bag))&&n.data().Bag.includes("LU")},o3=async e=>{if(!e)throw Error("Email is required");return!await oX(e)&&(await os(sw(oA,"users",e),{Bag:ol("RA"),updatedAt:oa()}),!0)},o5=async(e,t)=>{if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().Bag))&&r.data().Bag.includes(t)},o6=async e=>{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);return!!(n.exists()&&Array.isArray(n.data().Bag))&&n.data().Bag.includes("SSLG")},o4=async e=>{if(!e)throw Error("Email is required");return!await oJ(e)&&(await os(sw(oA,"users",e),{Bag:ol("SSLG"),updatedAt:oa()}),!0)},o8=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"CQL";if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().Bag))&&r.data().Bag.includes(t)},o7=async e=>{if(!e)throw Error("Email is required");return!await oX(e)&&(await os(sw(oA,"users",e),{Bag:ol("CQL"),updatedAt:oa()}),!0)},o9=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"PC";if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().Bag))&&r.data().Bag.includes(t)},ae=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"SW";if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().Bag))&&r.data().Bag.includes(t)},at=async e=>{if(!e)throw Error("Email is required");return!await ae(e)&&(await os(sw(oA,"users",e),{Bag:ol("SW"),updatedAt:oa()}),!0)},an=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"PC";if(!e)throw Error("Email is required");let n=sw(oA,"users",e),r=await ot(n);return!!(r.exists()&&Array.isArray(r.data().Bag))&&r.data().Bag.includes(t)},ar=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;try{let r=sw(oA,"Games/".concat(e,"/Leaderboard/Global")),i=await ot(r);if(!i.exists())return[];return(i.data().entries||[]).slice(n,n+t).map((e,t)=>{var r,i;return{...e,rank:n+t+1,timestamp:(null==(i=e.timestamp)||null==(r=i.toDate)?void 0:r.call(i))||new Date}})}catch(e){throw console.error("Error fetching top scores:",e),e}},ai=async function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;try{let r=sw(oA,"Games/".concat(e,"/Leaderboard/Global")),i=await ot(r);if(!i.exists())return{scores:[],userRank:null};let s=i.data().entries||[],o=s.findIndex(e=>e.email===t);if(-1===o)return{scores:s.slice(0,2*n+1).map((e,t)=>{var n,r;return{...e,rank:t+1,timestamp:(null==(r=e.timestamp)||null==(n=r.toDate)?void 0:n.call(r))||new Date}}),userRank:null};let a=Math.max(0,o-n),l=Math.min(s.length,o+n+1);return{scores:s.slice(a,l).map((e,n)=>{var r,i;return{...e,rank:a+n+1,isCurrentUser:e.email===t,timestamp:(null==(i=e.timestamp)||null==(r=i.toDate)?void 0:r.call(i))||new Date}}),userRank:o+1}}catch(e){throw console.error("Error getting nearby scores:",e),e}},as=async(e,t)=>{try{if(!e)throw Error("Email is required");if(!t)throw Error("Story is required");let n=t.id||Date.now().toString(),r=ev.now(),i={id:n,title:t.title||"Untitled Story",content:t.content||"",genre:t.genre||"",mood:t.mood||"",wordCount:t.wordCount||0,charCount:t.charCount||0,sentenceCount:t.sentenceCount||0,paragraphCount:t.paragraphCount||0,storyteller:t.storyteller||"Anonymous Storyteller",teaser:t.teaser||(t.content?t.content.substring(0,100)+"...":""),theme:t.theme||t.genre||"Original Story",createdAt:r,updatedAt:r},s=sw(oA,"users",e);return(await ot(s)).exists()?await os(s,{stories:ol(i),updatedAt:r}):await oi(s,{email:e,stories:[i],createdAt:r,updatedAt:r}),n}catch(e){throw console.error("Error adding story:",e),oR(e,"Error adding story"),e}},ao=async e=>{try{if(!e)return console.warn("Email is required for getUserStories"),[];let t=sw(oA,"users",e),n=await ot(t);if(!n.exists())return[];let r=n.data();if(!r.stories||!Array.isArray(r.stories))return[];return r.stories}catch(e){return console.error("Error fetching user stories:",e),oR(e,"Error fetching user stories"),[]}},aa=async(e,t)=>{try{if(!e)return console.warn("Email is required for getStory"),null;if(!t)return console.warn("Story ID is required for getStory"),null;let n=await ao(e);if(!Array.isArray(n))return console.warn("getUserStories did not return an array"),null;return n.find(e=>e.id===t)||null}catch(e){return console.error("Error fetching story:",e),oR(e,"Error fetching story"),null}},al=async(e,t,n)=>{try{if(!e)throw Error("Email is required");if(!t)throw Error("Story ID is required");if(!n)throw Error("Updated story data is required");let r=sw(oA,"users",e),i=await ot(r);if(!i.exists())throw Error("User not found");let s=i.data().stories||[],o=ev.now();if(!Array.isArray(s))throw Error("Stories data is corrupted");let a=s.findIndex(e=>e.id===t);if(-1===a)throw Error("Story not found");return s[a]={...s[a],...n,id:t,createdAt:s[a].createdAt,updatedAt:o,teaser:n.content?n.content.substring(0,100)+"...":s[a].teaser},await os(r,{stories:s,updatedAt:o}),!0}catch(e){return console.error("Error updating story:",e),oR(e,"Error updating story"),!1}},au=async(e,t)=>{try{if(!e)throw Error("Email is required");if(!t)throw Error("Story ID is required");let n=sw(oA,"users",e),r=await ot(n);if(!r.exists())throw Error("User not found");let i=r.data().stories||[];if(!Array.isArray(i))throw Error("Stories data is corrupted");let s=i.filter(e=>e.id!==t);if(s.length===i.length)throw Error("Story not found");return await os(n,{stories:s}),!0}catch(e){return console.error("Error deleting story:",e),oR(e,"Error deleting story"),!1}},ah=async(e,t)=>{try{if(!e)return console.error("Email is required for saveStory"),null;if(!t)return console.error("Story is required for saveStory"),null;if(t.id&&await aa(e,t.id)){if(await al(e,t.id,t))return t.id;console.warn("Update failed, creating new story")}return await as(e,t)}catch(e){return console.error("Error saving story:",e),oR(e,"Error saving story"),null}},ac=async e=>{try{if(!e)throw Error("Email is required");let t=sw(oA,"users",e),n=await ot(t);if(!n.exists()){let n={email:e,rictionary:{Words:{},Suffixes:{},Abbreviations:{},Conjections:{},Acronyms:{},createdAt:oa(),updatedAt:oa()},createdAt:oa(),updatedAt:oa()};return await oi(t,n),n.rictionary}let r=n.data();if(!r.rictionary){let e={Words:{},Suffixes:{},Abbreviations:{},Conjections:{},Acronyms:{},createdAt:oa(),updatedAt:oa()};return await os(t,{rictionary:e,updatedAt:oa()}),e}return r.rictionary}catch(e){throw console.error("Error ensuring user rictionary:",e),Error("Failed to ensure user rictionary: ".concat(e.message))}},ad=async(e,t,n,r)=>{try{if(!e)throw Error("Email is required");if(!t)throw Error("Section is required");if(!n)throw Error("Word is required");if(!r)throw Error("Definition is required");let i=["Words","Suffixes","Abbreviations","Conjections","Acronyms"];if(!i.includes(t))throw Error("Invalid section. Must be one of: ".concat(i.join(", ")));let s=sw(oA,"users",e);await ac(e);let o={definition:r,addedBy:e,addedAt:oa(),isCustom:!0};return await os(s,{["rictionary.".concat(t,".").concat(n)]:o,"rictionary.updatedAt":oa(),updatedAt:oa()}),!0}catch(e){throw console.error("Error adding rictionary word:",e),Error("Failed to add word: ".concat(e.message))}},af=async(e,t)=>{try{if(!t)throw Error("Base rictionary is required");if(!e)return t;let n=await ac(e),r={};
8return Object.keys(t).forEach(e=>{r[e]={...t[e],...n[e]||{}}}),r}catch(e){return console.error("Error getting merged rictionary:",e),t}},ap=async e=>{try{if(!e)return{};let{createdAt:t,updatedAt:n,...r}=await ac(e);return r}catch(e){return console.error("Error getting user rictionary:",e),{}}},am=async(e,t,n)=>{try{if(!e)throw Error("Email is required");if(!t)throw Error("Section is required");if(!n)throw Error("Word is required");let r=sw(oA,"users",e),i=await ot(r);if(!i.exists())throw Error("User not found");let s=i.data().rictionary;if(!s||!s[t]||!s[t][n])throw Error("Word not found in user rictionary");let o=s[t][n];if(!o.isCustom||o.addedBy!==e)throw Error("Cannot delete non-custom words");let a={...s[t]};return delete a[n],await os(r,{["rictionary.".concat(t)]:a,"rictionary.updatedAt":oa(),updatedAt:oa()}),!0}catch(e){throw console.error("Error deleting rictionary word:",e),Error("Failed to delete word: ".concat(e.message))}},ag=async e=>{try{var t,n;if(!e)return{totalWords:0,sections:{}};let r=await ap(e),i=0,s={};return Object.keys(r).forEach(e=>{let t=r[e]||{},n=Object.keys(t).length;s[e]=n,i+=n}),{totalWords:i,sections:s,lastUpdated:(null==(n=r.updatedAt)||null==(t=n.toDate)?void 0:t.call(n))||null}}catch(e){return console.error("Error getting rictionary stats:",e),{totalWords:0,sections:{}}}}},4837:(e,t,n)=>{"use strict";n.d(t,{v:()=>i});var r=n(2656);class i{constructor(){this.subscriptions=[]}add(e){return(0,r.Kq)(this.subscriptions,e),()=>(0,r.Ai)(this.subscriptions,e)}notify(e,t,n){let r=this.subscriptions.length;if(r)if(1===r)this.subscriptions[0](e,t,n);else for(let i=0;i<r;i++){let r=this.subscriptions[i];r&&r(e,t,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}},4856:(e,t,n)=>{"use strict";let r;n.d(t,{k:()=>a});var i=n(6616),s=n(6890);function o(){r=void 0}let a={now:()=>(void 0===r&&a.set(s.uv.isProcessing||i.W.useManualTiming?s.uv.timestamp:performance.now()),r),set:e=>{r=e,queueMicrotask(o)}}},4880:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return l},getImageProps:function(){return a}});let r=n(1532),i=n(1132),s=n(9232),o=r._(n(4392));function a(e){let{props:t}=(0,i.getImgProps)(e,{defaultLoader:o.default,imgConf:{deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1}});for(let[e,n]of Object.entries(t))void 0===n&&delete t[e];return{props:t}}let l=s.Image},4928:(e,t,n)=>{"use strict";let r,i;n.d(t,{MF:()=>L,j6:()=>P,xZ:()=>N,om:()=>R,Sx:()=>j,Wp:()=>M,KO:()=>F});var s=n(5880),o=n(3279),a=n(9320);let l=new WeakMap,u=new WeakMap,h=new WeakMap,c=new WeakMap,d=new WeakMap,f={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return u.get(e);if("objectStoreNames"===t)return e.objectStoreNames||h.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return p(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function p(e){if(e instanceof IDBRequest){let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(p(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)});return t.then(t=>{t instanceof IDBCursor&&l.set(t,e)}).catch(()=>{}),d.set(t,e),t}if(c.has(e))return c.get(e);let t=function(e){if("function"==typeof e)return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(i||(i=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(m(this),t),p(l.get(this))}:function(...t){return p(e.apply(m(this),t))}:function(t,...n){let r=e.call(m(this),t,...n);return h.set(r,t.sort?t.sort():[t]),p(r)};return e instanceof IDBTransaction&&function(e){if(u.has(e))return;let t=new Promise((t,n)=>{let r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});u.set(e,t)}(e),(r||(r=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,f):e}(e);return t!==e&&(c.set(e,t),d.set(t,e)),t}let m=e=>d.get(e),g=["get","getKey","getAll","getAllKeys","count"],y=["put","add","delete","clear"],v=new Map;function _(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(v.get(t))return v.get(t);let n=t.replace(/FromIndex$/,""),r=t!==n,i=y.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||g.includes(n)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),o=s.store;
8return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return v.set(t,s),s}f=(e=>({...e,get:(t,n,r)=>_(t,n)||e.get(t,n,r),has:(t,n)=>!!_(t,n)||e.has(t,n)}))(f);class w{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(!function(e){let t=e.getComponent();return(null==t?void 0:t.type)==="VERSION"}(e))return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let b="@firebase/app",E="0.13.2",T=new o.Vy("@firebase/app"),S="[DEFAULT]",C={[b]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},I=new Map,x=new Map,A=new Map;function k(e,t){try{e.container.addComponent(t)}catch(n){T.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function R(e){let t=e.name;if(A.has(t))return T.debug(`There were multiple attempts to register component ${t}.`),!1;for(let n of(A.set(t,e),I.values()))k(n,e);for(let t of x.values())k(t,e);return!0}function P(e,t){let n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}function N(e){return null!=e&&void 0!==e.settings}let O=new a.FA("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invali
8d-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class D{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new s.uA("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw O.create("app-deleted",{appName:this._name})}}let L="11.10.0";function M(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});let r=Object.assign({name:S,automaticDataCollectionEnabled:!0},t),i=r.name;if("string"!=typeof i||!i)throw O.create("bad-app-name",{appName:String(i)});if(n||(n=(0,a.T9)()),!n)throw O.create("no-options");let o=I.get(i);if(o)if((0,a.bD)(n,o.options)&&(0,a.bD)(r,o.config))return o;else throw O.create("duplicate-app",{appName:i});let l=new s.h1(i);for(let e of A.values())l.addComponent(e);let u=new D(n,r,l);return I.set(i,u),u}function j(e=S){let t=I.get(e);if(!t&&e===S&&(0,a.T9)())return M();if(!t)throw O.create("no-app",{appName:e});return t}function F(e,t,n){var r;let i=null!=(r=C[e])?r:e;n&&(i+=`-${n}`);let o=i.match(/\s|\//),a=t.match(/\s|\//);if(o||a){let e=[`Unable to register library "${i}" with version "${t}":`];o&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),o&&a&&e.push("and"),a&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),T.warn(e.join(" "));return}R(new s.uA(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}let U="firebase-heartbeat-store",V=null;function B(){return V||(V=(function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let o=indexedDB.open(e,1),a=p(o);return r&&o.addEventListener("upgradeneeded",e=>{r(p(o.result),e.oldVersion,e.newVersion,p(o.transaction),e)}),n&&o.addEventListener("blocked",e=>n(e.oldVersion,e.newVersion,e)),a.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a})("firebase-heartbeat-database",0,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(U)}catch(e){console.warn(e)}}}).catch(e=>{throw O.create("idb-open",{originalErrorMessage:e.message})})),V}async function q(e){try{let t=(await B()).transaction(U),n=await t.objectStore(U).get(z(e));return await t.done,n}catch(e){if(e instanceof a.g)T.warn(e.message);else{let t=O.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});T.warn(t.message)}}}async function $(e,t){try{let n=(await B()).transaction(U,"readwrite"),r=n.objectStore(U);await r.put(t,z(e)),await n.done}catch(e){if(e instanceof a.g)T.warn(e.message);else{let t=O.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});T.warn(t.message)}}}function z(e){return`${e.name}!${e.options.appId}`}class W{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new G(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=H();if((null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,(null==(t=this._heartbeatsCache)?void 0:t.heartbeats)==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(e=>e.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,n=e[0].date;for(let r=1;r<e.length;r++)e[r].date<n&&(n=e[r].date,t=r);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){T.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)==null||0===this._heartbeatsCache.heartbeats.length)return"";let t=H(),{heartbeatsToSend:n,unsentEntries:r}=function(e,t=1024){let n=[],r=e.slice();for(let i of e){let e=n.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),K(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),K(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),i=(0,a.Uj)(JSON.stringify({version:2,heartbeats:n}));return this._heartbeatsCache.lastSentHeartbeatDate=t,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return T.warn(e),""}}}function H(){return new Date().toISOString().substring(0,10)}class G{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,a.zW)()&&(0,a.eX)().then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await q(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return $(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){let n=await this.read();return $(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function K(e){return(0,a.Uj)(JSON.stringify({version:2,heartbeats:e})).length}R(new s.uA("platform-logger",e=>new w(e),"PRIVATE")),R(new s.uA("heartbeat",e=>new W(e),"PRIVATE")),F(b,E,""),F(b,E,"esm2017"),F("fire-js","")},5055:(e,t,n)=>{"use strict";n.d(t,{N:()=>y});var r=n(3798),i=n(1462),s=n(2530),o=n(8101),a=n(1389),l=n(1776);class u extends i.Component{getSnapshotBeforeUpdate(e){let t=this.props.childRef.current;if(t&&e.isPresent&&!this.props.isPresent){let e=this.props.sizeRef.current;e.height=t.offsetHeight||0,e.width=t.offsetWidth||0,e.top=t.offsetTop,e.left=t.offsetLeft}return null}componentDidUpdate(){}render(){return this.props.children}}function h({children:e,isPresent:t}){let n=(0,i.useId)(),s=(0,i.useRef)(null),o=(0,i.useRef)({width:0,height:0,top:0,left:0}),{nonce:a}=(0,i.useContext)(l.Q);return(0,i.useInsertionEffect)(()=>{let{width:e,height:r,top:i,left:l}=o.current;if(t||!s.current||!e||!r)return;s.current.dataset.motionPopId=n;let u=document.createElement("style");return a&&(u.nonce=a),document.head.appendChild(u),u.sheet&&u.sheet.insertRule(` 9 [data-motion-pop-id="${n}"] { 10 position: absolute !important; 11 width: ${e}px !important; 12 height: ${r}px !important; 13 top: ${i}px !important; 14 left: ${l}px !important; 15 } 16 `),()=>{document.head.removeChild(u)}},[t]),(0,r.jsx)(u,{isPresent:t,childRef:s,sizeRef:o,children:i.cloneElement(e,{ref:s})})}let c=({children:e,initial:t,isPresent:n,onExitComplete:s,custom:l,presenceAffectsLayout:u,mode:c})=>{let f=(0,o.M)(d),p=(0,i.useId)(),m=(0,i.useCallback)(e=>
16{for(let t of(f.set(e,!0),f.values()))if(!t)return;s&&s()},[f,s]),g=(0,i.useMemo)(()=>({id:p,initial:t,isPresent:n,custom:l,onExitComplete:m,register:e=>(f.set(e,!1),()=>f.delete(e))}),u?[Math.random(),m]:[n,m]);return(0,i.useMemo)(()=>{f.forEach((e,t)=>f.set(t,!1))},[n]),i.useEffect(()=>{n||f.size||!s||s()},[n]),"popLayout"===c&&(e=(0,r.jsx)(h,{isPresent:n,children:e})),(0,r.jsx)(a.t.Provider,{value:g,children:e})};function d(){return new Map}var f=n(4690);let p=e=>e.key||"";function m(e){let t=[];return i.Children.forEach(e,e=>{(0,i.isValidElement)(e)&&t.push(e)}),t}var g=n(9566);let y=({children:e,custom:t,initial:n=!0,onExitComplete:a,presenceAffectsLayout:l=!0,mode:u="sync",propagate:h=!1})=>{let[d,y]=(0,f.xQ)(h),v=(0,i.useMemo)(()=>m(e),[e]),_=h&&!d?[]:v.map(p),w=(0,i.useRef)(!0),b=(0,i.useRef)(v),E=(0,o.M)(()=>new Map),[T,S]=(0,i.useState)(v),[C,I]=(0,i.useState)(v);(0,g.E)(()=>{w.current=!1,b.current=v;for(let e=0;e<C.length;e++){let t=p(C[e]);_.includes(t)?E.delete(t):!0!==E.get(t)&&E.set(t,!1)}},[C,_.length,_.join("-")]);let x=[];if(v!==T){let e=[...v];for(let t=0;t<C.length;t++){let n=C[t],r=p(n);_.includes(r)||(e.splice(t,0,n),x.push(n))}"wait"===u&&x.length&&(e=x),I(m(e)),S(v);return}let{forceRender:A}=(0,i.useContext)(s.L);return(0,r.jsx)(r.Fragment,{children:C.map(e=>{let i=p(e),s=(!h||!!d)&&(v===C||_.includes(i));return(0,r.jsx)(c,{isPresent:s,initial:(!w.current||!!n)&&void 0,custom:s?void 0:t,presenceAffectsLayout:l,mode:u,onExitComplete:s?void 0:()=>{if(!E.has(i))return;E.set(i,!0);let e=!0;E.forEach(t=>{t||(e=!1)}),e&&(null==A||A(),I(b.current),h&&(null==y||y()),a&&a())},children:e},i)})})}},5120:(e,t,n)=>{"use strict";n.d(t,{P6:()=>o,vG:()=>c,tu:()=>u,KZ:()=>g,rU:()=>a,PT:()=>T,DW:()=>d,WH:()=>h,Mc:()=>C,yL:()=>y,TU:()=>function e(t,n){if(t)return"function"==typeof t&&p()?g(t,n):d(t)?v(t):Array.isArray(t)?t.map(t=>e(t,n)||_.easeOut):_[t]},YE:()=>l,c$:()=>P,Wp:()=>N,nL:()=>p});var r=n(6704);let i=(0,r.p)(()=>void 0!==window.ScrollTimeline);class s{constructor(e){this.stop=()=>this.runAll("stop"),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>"finished"in e?e.finished:e))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e,t){let n=this.animations.map(n=>i()&&n.attachTimeline?n.attachTimeline(e):"function"==typeof t?t(n):void 0);return()=>{n.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll("time")}set time(e){this.setAll("time",e)}get speed(){return this.getAll("speed")}set speed(e){this.setAll("speed",e)}get startTime(){return this.getAll("startTime")}get duration(){let e=0;for(let t=0;t<this.animations.length;t++)e=Math.max(e,this.animations[t].duration);return e}runAll(e){this.animations.forEach(t=>t[e]())}flatten(){this.runAll("flatten")}play(){this.runAll("play")}pause(){this.runAll("pause")}cancel(){this.runAll("cancel")}complete(){this.runAll("complete")}}class o extends s{then(e,t){return Promise.all(this.animations).then(e).catch(t)}}function a(e,t){return e?e[t]||e.default||e:void 0}let l=2e4;function u(e){let t=0,n=e.next(t);for(;!n.done&&t<l;)t+=50,n=e.next(t);return t>=l?1/0:t}function h(e){return"function"==typeof e}function c(e,t){e.timeline=t,e.onfinish=null}let d=e=>Array.isArray(e)&&"number"==typeof e[0],f={linearEasing:void 0},p=function(e,t){let n=(0,r.p)(e);return()=>{var e;return null!=(e=f[t])?e:n()}}(()=>{try{document.createElement("div").animate({opacity:0}
16,{easing:"linear(0, 1)"})}catch(e){return!1}return!0},"linearEasing");var m=n(8955);let g=(e,t,n=10)=>{let r="",i=Math.max(Math.round(t/n),2);for(let t=0;t<i;t++)r+=e((0,m.q)(0,i-1,t))+", ";return`linear(${r.substring(0,r.length-2)})`};function y(e){return!!("function"==typeof e&&p()||!e||"string"==typeof e&&(e in _||p())||d(e)||Array.isArray(e)&&e.every(y))}let v=([e,t,n,r])=>`cubic-bezier(${e}, ${t}, ${n}, ${r})`,_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:v([0,.65,.55,1]),circOut:v([.55,0,1,.45]),backIn:v([.31,.01,.66,-.59]),backOut:v([.33,1.53,.69,.99])},w={x:!1,y:!1};function b(e,t){let n=function(e,t,n){if(e instanceof Element)return[e];if("string"==typeof e){let t=document.querySelectorAll(e);return t?Array.from(t):[]}return Array.from(e)}(e),r=new AbortController;return[n,{passive:!0,...t,signal:r.signal},()=>r.abort()]}function E(e){return t=>{"touch"===t.pointerType||w.x||w.y||e(t)}}function T(e,t,n={}){let[r,i,s]=b(e,n),o=E(e=>{let{target:n}=e,r=t(e);if("function"!=typeof r||!n)return;let s=E(e=>{r(e),n.removeEventListener("pointerleave",s)});n.addEventListener("pointerleave",s,i)});return r.forEach(e=>{e.addEventListener("pointerenter",o,i)}),s}let S=(e,t)=>!!t&&(e===t||S(e,t.parentElement)),C=e=>
16"mouse"===e.pointerType?"number"!=typeof e.button||e.button<=0:!1!==e.isPrimary,I=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),x=new WeakSet;function A(e){return t=>{"Enter"===t.key&&e(t)}}function k(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}function R(e){return C(e)&&!(w.x||w.y)}function P(e,t,n={}){let[r,i,s]=b(e,n),o=e=>{let r=e.currentTarget;if(!R(e)||x.has(r))return;x.add(r);let s=t(e),o=(e,t)=>{window.removeEventListener("pointerup",a),window.removeEventListener("pointercancel",l),R(e)&&x.has(r)&&(x.delete(r),"function"==typeof s&&s(e,{success:t}))},a=e=>{o(e,n.useGlobalTarget||S(r,e.target))},l=e=>{o(e,!1)};window.addEventListener("pointerup",a,i),window.addEventListener("pointercancel",l,i)};return r.forEach(e=>{I.has(e.tagName)||-1!==e.tabIndex||null!==e.getAttribute("tabindex")||(e.tabIndex=0),(n.useGlobalTarget?window:e).addEventListener("pointerdown",o,i),e.addEventListener("focus",e=>((e,t)=>{let n=e.currentTarget;if(!n)return;let r=A(()=>{if(x.has(n))return;k(n,"down");let e=A(()=>{k(n,"up")});n.addEventListener("keyup",e,t),n.addEventListener("blur",()=>k(n,"cancel"),t)});n.addEventListener("keydown",r,t),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),t)})(e,i),i)}),s}function N(e){if("x"===e||"y"===e)if(w[e])return null;else return w[e]=!0,()=>{w[e]=!1};return w.x||w.y?null:(w.x=w.y=!0,()=>{w.x=w.y=!1})}n(488),n(4670)},5213:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"errorOnce",{enumerable:!0,get:function(){return n}});let n=e=>{}},5228:(e,t,n)=>{"use strict";function r(e){return null!==e&&"object"==typeof e&&"function"==typeof e.start}n.d(t,{P:()=>nZ});var i,s,o=n(7838);function a(e,t){if(!Array.isArray(t))return!1;let n=t.length;if(n!==e.length)return!1;for(let r=0;r<n;r++)if(t[r]!==e[r])return!1;return!0}function l(e){return"string"==typeof e||Array.isArray(e)}var u=n(6311);let h=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],c=["initial",...h];var d=n(2624);let f=c.length,p=[...h].reverse(),m=h.length;function g(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function y(){return{animate:g(!0),whileInView:g(),whileHover:g(),whileTap:g(),whileDrag:g(),whileFocus:g(),exit:g()}}class v{constructor(e){this.isMounted=!1,this.node=e}update(){}}class _ extends v{constructor(e){super(e),e.animationState||(e.animationState=function(e){let t=t=>Promise.all(t.map(({animation:t,options:n})=>(0,d._)(e,t,n))),n=y(),i=!0,s=t=>(n,r)=>{var i;let s=(0,u.K)(e,r,"exit"===t?null==(i=e.presenceContext)?void 0:i.custom:void 0);if(s){let{transition:e,transitionEnd:t,...r}=s;n={...n,...r,...t}}return n};function h(u){let{props:h}=e,d=function e(t){if(!t)return;if(!t.isControllingVariants){let n=t.parent&&e(t.parent)||{};return void 0!==t.props.initial&&(n.initial=t.props.initial),n}let n={};for(let e=0;e<f;e++){let r=c[e],i=t.props[r];(l(i)||!1===i)&&(n[r]=i)}return n}(e.parent)||{},g=[],y=new Set,v={},_=1/0;for(let t=0;t<m;t++){var w,b;let c=p[t],f=n[c],m=void 0!==h[c]?h[c]:d[c],E=l(m),T=c===u?f.isActive:null;!1===T&&(_=t);let S=m===d[c]&&m!==h[c]&&E;if(S&&i&&e.manuallyAnimateOnMount&&(S=!1),f.protectedKeys={...v},!f.isActive&&null===T||!m&&!f.prevProp||r(m)||"boolean"==typeof m)continue;let C=(w=f.prevProp,"string"==typeof(b=m)?b!==w:!!Array.isArray(b)&&!a(b,w)),I=C||c===u&&f.isActive&&!S&&E||t>_&&E,x=!1,A=Array.isArray(m)?m:[m],k=A.reduce(s(c),{});!1===T&&(k={});let{prevResolvedValues:R={}}=f,P={...R,...k},N=t=>{I=!0,y.has(t)&&(x=!0,y.delete(t)),f.needsAnimating[t]=!0;let n=e.getValue(t);n&&(n.liveStyle=!1)};for(let e in P){let t=k[e],n=R[e];if(!v.hasOwnProperty(e))((0,o.p)(t)&&(0,o.p)(n)?a(t,n):t===n)?void 0!==t&&y.has(e)?N(e):f.protectedKeys[e]=!0:null!=t?N(e):y.add(e)}f.prevProp=m,f.prevResolvedValues=k,f.isActive&&(v={...v,...k}),i&&e.blockInitialAnimation&&(I=!1);let O=!(S&&C)||x;I&&O&&g.push(...A.map(e=>({animation:e,options:{type:c}})))}if(y.size){let t={};y.forEach(n=>{let r=e.getBaseTarget(n),i=e.getValue(n);i&&(i.liveStyle=!0),t[n]=null!=r?r:null}),g.push({animation:t})}let E=!!g.length;return i&&(!1===h.initial||h.initial===h.animate)&&!e.manuallyAnimateOnMount&&(E=!1),i=!1,E?t(g):Prom
16ise.resolve()}return{animateChanges:h,setActive:function(t,r){var i;if(n[t].isActive===r)return Promise.resolve();null==(i=e.variantChildren)||i.forEach(e=>{var n;return null==(n=e.animationState)?void 0:n.setActive(t,r)}),n[t].isActive=r;let s=h(t);for(let e in n)n[e].protectedKeys={};return s},setAnimateFunction:function(n){t=n(e)},getState:()=>n,reset:()=>{n=y(),i=!0}}}(e))}updateAnimationControlsSubscription(){let{animate:e}=this.node.getProps();r(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:e}=this.node.getProps(),{animate:t}=this.node.prevProps||{};e!==t&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),null==(e=this.unmountControls)||e.call(this)}}let w=0;class b extends v{constructor(){super(...arguments),this.id=w++}update(){if(!this.node.presenceContext)return;let{isPresent:e,onExitComplete:t}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===n)return;let r=this.node.animationState.setActive("exit",!e);t&&!e&&r.then(()=>t(this.id))}mount(){let{register:e}=this.node.presenceContext||{};e&&(this.unmount=e(this.id))}unmount(){}}var E=n(4670),T=n(1927),S=n(5120),C=n(488);function I(e,t,n,r={passive:!0}){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n)}function x(e){return{point:{x:e.pageX,y:e.pageY}}}function A(e,t,n,r){return I(e,t,e=>(0,S.Mc)(e)&&n(e,x(e)),r)}let k=(e,t)=>Math.abs(e-t);var R=n(4571),P=n(6890);class N{constructor(e,t,{transformPagePoint:n,contextWindow:r,dragSnapToOrigin:i=!1}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let e=L(this.lastMoveEventInfo,this.history),t=null!==this.startEvent,n=function(e,t){return Math.sqrt(k(e.x,t.x)**2+k(e.y,t.y)**2)}(e.offset,{x:0,y:0})>=3;if(!t&&!n)return;let{point:r}=e,{timestamp:i}=P.uv;this.history.push({...r,timestamp:i});let{onStart:s,onMove:o}=this.handlers;t||(s&&s(this.lastMoveEvent,e),this.startEvent=this.lastMoveEvent),o&&o(this.lastMoveEvent,e)},this.handlePointerMove=(e,t)=>{this.lastMoveEvent=e,this.lastMoveEventInfo=O(t,this.transformPagePoint),P.Gt.update(this.updatePoint,!0)},this.handlePointerUp=(e,t)=>{this.end();let{onEnd:n,onSessionEnd:r,resumeAnimation:i}=this.handlers;if(this.dragSnapToOrigin&&i&&i(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;let s=L("pointercancel"===e.type?this.lastMoveEventInfo:O(t,this.transformPagePoint),this.history);this.startEvent&&n&&n(e,s),r&&r(e,s)},!(0,S.Mc)(e))return;this.dragSnapToOrigin=i,this.handlers=t,this.transformPagePoint=n,this.contextWindow=r||window;let s=O(x(e),this.transformPagePoint),{point:o}=s,{timestamp:a}=P.uv;this.history=[{...o,timestamp:a}];let{onSessionStart:l}=t;l&&l(e,L(s,this.history)),this.removeListeners=(0,R.F)(A(this.contextWindow,"pointermove",this.handlePointerMove),A(this.contextWindow,"pointerup",this.handlePointerUp),A(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),(0,P.WG)(this.updatePoint)}}function O(e,t){return t?{point:t(e.point)}:e}function D(e,t){return{x:e.x-t.x,y:e.y-t.y}}function L({point:e},t){return{point:e,delta:D(e,M(t)),offset:D(e,t[0]),velocity:function(e,t){if(e.length<2)return{x:0,y:0};let n=e.length-1,r=null,i=M(e);for(;n>=0&&(r=e[n],!(i.timestamp-r.timestamp>(0,C.f)(.1)));)n--;if(!r)return{x:0,y:0};let s=(0,C.X)(i.timestamp-r.timestamp);if(0===s)return{x:0,y:0};let o={x:(i.x-r.x)/s,y:(i.y-r.y)/s};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}(t,.1)}}function M(e){return e[e.length-1]}function j(e){return e&&"object"==typeof e&&Object.prototype.hasOwnProperty.call(e,"current")}var F=n(8955),U=n(6949);function V(e){return e.max-e.min}function B(e,t,n,r=.5){e.origin=r,e.originPoint=(0,U.k)(t.min,t.max,e.origin),e.scale=V(n)/V(t),e.translate=(0,U.k)(n.min,n.max,e.origin)-e.originPoint,(e.scale>=.9999&&e.scale<=1.0001||isNaN(e.scale))&&(e.scale=1),(e.translate>=-.01&&e.translate<=.01||isNaN(e.translate))&&(e.translate=0)}function q(e,t,n,r){B(e.x,t.x,n.x,r?r.originX:void 0),B(e.y,t.y,n.y,r?r.originY:void 0)}function $(e,t,n){e.min=n.min+t.min,e.max=e.min+V(t)}function z(e,t,n){e.min=t.min-n.min,e.max=e.min+V(t)}function W(e,t,n){z(e.x,t.x,n.x),z(e.y,t.y,n.y)}var H=n(2318);function G(e,t,n){return{min:void 0!==t?e.min+t:void 0,max:void 0!==n?e.max+n-(e.max-e.min):void 0}}function K(e,t){let n=t.min-e.min,r=t.max-e.max;return t.max-t.min<e.max-e.min&&([n,r]=[r,n]),{min:n,max:r}}function Y(e,t,n){return{min:Q(e,t),max:Q(e,n)}}function Q(e,t){return"number"==typeof e?e:e[t]||0}let X=()=>({translate:0,scale:1,origin:0,originPoint:0}),J=()=>({x:X(),y:X()}),Z=()=>({min:0,max:0}),ee=()=>({x:Z(),y:Z()});function et(e){return[e("x"),e("y")]}function en({top:e,left:t,right:n,bottom:r}){return{x:{min:t,max:n},y:{min:e,max:r}}}function er(e){return void 0===e||1===e}function ei({scale:e,scaleX:t,scaleY:n}){return!er(e)||!er(t)||!er(n)}function es(e){return ei(e)||eo(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function eo(e){var t,n;
16return(t=e.x)&&"0%"!==t||(n=e.y)&&"0%"!==n}function ea(e,t,n,r,i){return void 0!==i&&(e=r+i*(e-r)),r+n*(e-r)+t}function el(e,t=0,n=1,r,i){e.min=ea(e.min,t,n,r,i),e.max=ea(e.max,t,n,r,i)}function eu(e,{x:t,y:n}){el(e.x,t.translate,t.scale,t.originPoint),el(e.y,n.translate,n.scale,n.originPoint)}function eh(e,t){e.min=e.min+t,e.max=e.max+t}function ec(e,t,n,r,i=.5){let s=(0,U.k)(e.min,e.max,i);el(e,t,n,s,r)}function ed(e,t){ec(e.x,t.x,t.scaleX,t.scale,t.originX),ec(e.y,t.y,t.scaleY,t.scale,t.originY)}function ef(e,t){return en(function(e,t){if(!t)return e;let n=t({x:e.left,y:e.top}),r=t({x:e.right,y:e.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}(e.getBoundingClientRect(),t))}var ep=n(6811),em=n(2899);let eg=({current:e})=>e?e.ownerDocument.defaultView:null;var ey=n(2568);let ev=new WeakMap;class e_{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ee(),this.visualElement=e}start(e,{snapToCursor:t=!1}={}){let{presenceContext:n}=this.visualElement;if(n&&!1===n.isPresent)return;let r=e=>{let{dragSnapToOrigin:n}=this.getProps();n?this.pauseAnimation():this.stopAnimation(),t&&this.snapToCursor(x(e).point)},i=(e,t)=>{let{drag:n,dragPropagation:r,onDragStart:i}=this.getProps();if(n&&!r&&(this.openDragLock&&this.openDragLock(),this.openDragLock=(0,S.Wp)(n),!this.openDragLock))return;this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),et(e=>{let t=this.getAxisMotionValue(e).get()||0;if(ep.KN.test(t)){let{projection:n}=this.visualElement;if(n&&n.layout){let r=n.layout.layoutBox[e];r&&(t=V(r)*(parseFloat(t)/100))}}this.originPoint[e]=t}),i&&P.Gt.postRender(()=>i(e,t)),(0,ey.g)(this.visualElement,"transform");let{animationState:s}=this.visualElement;s&&s.setActive("whileDrag",!0)},s=(e,t)=>{let{dragPropagation:n,dragDirectionLock:r,onDirectionLock:i,onDrag:s}=this.getProps();if(!n&&!this.openDragLock)return;let{offset:o}=t;if(r&&null===this.currentDirection){this.currentDirection=function(e,t=10){let n=null;return Math.abs(e.y)>t?n="y":Math.abs(e.x)>t&&(n="x"),n}(o),null!==this.currentDirection&&i&&i(this.currentDirection);return}this.updateAxis("x",t.point,o),this.updateAxis("y",t.point,o),this.visualElement.render(),s&&s(e,t)},o=(e,t)=>this.stop(e,t),a=()=>et(e=>{var t;return"paused"===this.getAnimationState(e)&&(null==(t=this.getAxisMotionValue(e).animation)?void 0:t.play())}),{dragSnapToOrigin:l}=this.getProps();this.panSession=new N(e,{onSessionStart:r,onStart:i,onMove:s,onSessionEnd:o,resumeAnimation:a},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:l,contextWindow:eg(this.visualElement)})}stop(e,t){let n=this.isDragging;if(this.cancel(),!n)return;let{velocity:r}=t;this.startAnimation(r);let{onDragEnd:i}=this.getProps();i&&P.Gt.postRender(()=>i(e,t))}cancel(){this.isDragging=!1;let{projection:e,animationState:t}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;let{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),t&&t.setActive("whileDrag",!1)}updateAxis(e,t,n){let{drag:r}=this.getProps();if(!n||!ew(e,r,this.currentDirection))return;let i=this.getAxisMotionValue(e),s=this.originPoint[e]+n[e];this.constraints&&this.constraints[e]&&(s=function(e,{min:t,max:n},r){return void 0!==t&&e<t?e=r?(0,U.k)(t,e,r.min):Math.max(e,t):void 0!==n&&e>n&&(e=r?(0,U.k)(n,e,r.max):Math.min(e,n)),e}(s,this.constraints[e],this.elastic[e])),i.set(s)}resolveConstraints(){var e;let{dragConstraints:t,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):null==(e=this.visualElement.projection)?void 0:e.layout,i=this.constraints;t&&j(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&r?this.constraints=function(e,{top:t,left:n,bottom:r,right:i}){return{x:G(e.x,n,i),y:G(e.y,t,r)}}(r.layoutBox,t):this.constraints=!1,this.elastic=function(e=.35){return!1===e?e=0:!0===e&&(e=.35),{x:Y(e,"left","right"),y:Y(e,"top","bottom")}}(n),i!==this.constraints&&r&&this.constraints&&!this.hasMutatedConstraints&&et(e=>{!1!==this.constraints&&this.getAxisMotionValue(e)&&(this.constraints[e]=function(e,t){let n={};return void 0!==t.min&&(n.min=t.min-e.min),void 0!==t.max&&(n.max=t.max-e.min),n}(r.layoutBox[e],this.constraints[e]))})}resolveRefConstraints(){var e;let{dragConstraints:t,onMeasureDragConstraints:n}=this.getProps();if(!t||!j(t))return!1;let r=t.current;(0,T.V)(null!==r,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");let{projection:i}=this.visualElement;if(!i||!i.layout)return!1;let s=function(e,t,n){let r=ef(e,n),{scroll:i}=t;return i&&(eh(r.x,i.offset.x),eh(r.y,i.offset.y)),r}(r,i.root,this.visualElement.getTransformPagePoint()),o=(e=i.layout.layoutBox,{x:K(e.x,s.x),y:K(e.y,s.y)});if(n){let e=n(function({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}(o));this.hasMutatedConstraints=!!e,e&&(o=en(e))}return o}startAnimation(e){let{drag:t,dragMomentum:n,dragElastic:r,dragTransition:i,dragSnapToOrigin:s,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{};return Promise.all(et(o=>{if(!ew(o,t,this.currentDirection))return;let l=a&&a[o]||{};s&&(l={min:0,max:0});let u={type:"inertia",velocity:n?e[o]:0,bounceStiffness:r?200:1e6,bounceDamping:r?40:1e7,timeConstant:750,restDelta:1,restSpeed:10,...i,...l};return this.startAxisValueAnimation(o,u)})).then(o)}startAxisValueAnimation(e,t){let n=this.getAxisMotionValue(e);return(0,ey.g)(this.visualElement,e),n.start((0,em.f)(e,n,0,t,this.visualElement,!1))}stopAnimation(){et(e=>this.getAxisMotionValue(e).stop())}pauseAnimation(){et(e=>{var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.pause()})}getAnimationState(e){var t;return null==(t=this.getAxisMotionValue(e).animation)?void 0:t.state}getAxisMotionValue(e){let t=`_drag${e.toUpperCase()}`,n=this.visualElement.getProps();return n[t]||this.visualElement.getValue(e,(n.initial?n.initial[e]:void 0)||0)}snapToCursor(e){et(t=>{let{drag:n}=this.getProps();if(!ew(t,n,this.currentDirection))return;let{projection:r}=this.visualElement,i=this.getAxisMotionValue(t);if(r&&r.layout){let{min:n,max:s}=r.layout.layoutBox[t];i.set(e[t]-(0,U.k)(n,s,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;let{drag:e,dragConstraints:t}=this.getProps(),{projection:n}=this.visualElement;if(!j(t)||!n||!this.constraints)return;this.stopAnimation();let r={x:0,y:0};et(e=>{let t=this.getAxisMotionValue(e);if(t&&!1!==this.constraints){let n=t.get();r[e]=function(e,t){let n=.5,r=V(e),i=V(t);return i>r?n=(0,F.q)(t.min,t.max-r,e.min):r>i&&(n=(0,F.q)(e.min,e.max-i,t.min)),(0,H.q)(0,1,n)}({min:n,max:n},this.constraints[e])}});let{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),et(t=>{if(!ew(t,e,null))return;let n=this.getAxisMotionValue(t),{min:i,max:s}=this.constraints[t];n.set((0,U.k)(i,s,r[t]))})}addListeners(){if(!this.visualElement.current)return;ev.set(this.visualElement,this);let e=A(this.visualElement.current,"pointerdown",e=>{let{drag:t,dragListener:n=!0}
16=this.getProps();t&&n&&this.start(e)}),t=()=>{let{dragConstraints:e}=this.getProps();j(e)&&e.current&&(this.constraints=this.resolveRefConstraints())},{projection:n}=this.visualElement,r=n.addEventListener("measure",t);n&&!n.layout&&(n.root&&n.root.updateScroll(),n.updateLayout()),P.Gt.read(t);let i=I(window,"resize",()=>this.scalePositionWithinConstraints()),s=n.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t})=>{this.isDragging&&t&&(et(t=>{let n=this.getAxisMotionValue(t);n&&(this.originPoint[t]+=e[t].translate,n.set(n.get()+e[t].translate))}),this.visualElement.render())});return()=>{i(),e(),r(),s&&s()}}getProps(){let e=this.visualElement.getProps(),{drag:t=!1,dragDirectionLock:n=!1,dragPropagation:r=!1,dragConstraints:i=!1,dragElastic:s=.35,dragMomentum:o=!0}=e;return{...e,drag:t,dragDirectionLock:n,dragPropagation:r,dragConstraints:i,dragElastic:s,dragMomentum:o}}}function ew(e,t,n){return(!0===t||t===e)&&(null===n||n===e)}class eb extends v{constructor(e){super(e),this.removeGroupControls=E.l,this.removeListeners=E.l,this.controls=new e_(e)}mount(){let{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||E.l}unmount(){this.removeGroupControls(),this.removeListeners()}}let eE=e=>(t,n)=>{e&&P.Gt.postRender(()=>e(t,n))};class eT extends v{constructor(){super(...arguments),this.removePointerDownListener=E.l}onPointerDown(e){this.session=new N(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:eg(this.node)})}createPanHandlers(){let{onPanSessionStart:e,onPanStart:t,onPan:n,onPanEnd:r}=this.node.getProps();return{onSessionStart:eE(e),onStart:eE(t),onMove:n,onEnd:(e,t)=>{delete this.session,r&&P.Gt.postRender(()=>r(e,t))}}}mount(){this.removePointerDownListener=A(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}var eS=n(3798),eC=n(1462),eI=n(4690),ex=n(2530);let eA=(0,eC.createContext)({}),ek={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function eR(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}let eP={correct:(e,t)=>{if(!t.target)return e;if("string"==typeof e)if(!ep.px.test(e))return e;else e=parseFloat(e);let n=eR(e,t.target.x),r=eR(e,t.target.y);return`${n}% ${r}%`}};var eN=n(8623);let eO={},{schedule:eD,cancel:eL}=(0,n(6591).I)(queueMicrotask,!1);class eM extends eC.Component{componentDidMount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n,layoutId:r}=this.props,{projection:i}=e;Object.assign(eO,eF),i&&(t.group&&t.group.add(i),n&&n.register&&r&&n.register(i),i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,onExitComplete:()=>this.safeToRemove()})),ek.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){let{layoutDependency:t,visualElement:n,drag:r,isPresent:i}=this.props,s=n.projection;return s&&(s.isPresent=i,r||e.layoutDependency!==t||void 0===t?s.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?s.promote():s.relegate()||P.Gt.postRender(()=>{let e=s.getStack();e&&e.members.length||this.safeToRemove()}))),null}componentDidUpdate(){let{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),eD.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){let{visualElement:e,layoutGroup:t,switchLayoutGroup:n}=this.props,{projection:r}=e;r&&(r.scheduleCheckAfterUnmount(),t&&t.group&&t.group.remove(r),n&&n.deregister&&n.deregister(r))}safeToRemove(){let{safeToRemove:e}=this.props;e&&e()}render(){return null}}function ej(e){let[t,n]=(0,eI.xQ)(),r=(0,eC.useContext)(ex.L);return(0,eS.jsx)(eM,{...e,layoutGroup:r,switchLayoutGroup:(0,eC.useContext)(eA),isPresent:t,safeToRemove:n})}let eF={borderRadius:{...eP,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:eP,borderTopRightRadius:eP,borderBottomLeftRadius:eP,borderBottomRightRadius:eP,boxShadow:{correct:(e,{treeScale:t,projectionDelta:n})=>{let r=eN.f.parse(e);if(r.length>5)return e;let i=eN.f.createTransformer(e),s=+("number"!=typeof r[0]),o=n.x.scale*t.x,a=n.y.scale*t.y;r[0+s]/=o,r[1+s]/=a;let l=(0,U.k)(o,a,.5);return"number"==typeof r[2+s]&&(r[2+s]/=l),"number"==typeof r[3+s]&&(r[3+s]/=l),i(r)}}};var eU=n(2599),eV=n(5274),eB=n(8166),eq=n(4856),e$=n(2656);let ez=(e,t)=>e.depth-t.depth;class eW{constructor(){this.children=[],this.isDirty=!1}add(e){(0,e$.Kq)(this.children,e),this.isDirty=!0}remove(e){(0,e$.Ai)(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(ez),this.isDirty=!1,this.children.forEac
16h(e)}}var eH=n(4837),eG=n(9583);function eK(e){let t=(0,eV.S)(e)?e.get():e;return(0,eG.B)(t)?t.toValue():t}var eY=n(2517);let eQ=["TopLeft","TopRight","BottomLeft","BottomRight"],eX=eQ.length,eJ=e=>"string"==typeof e?parseFloat(e):e,eZ=e=>"number"==typeof e||ep.px.test(e);function e0(e,t){return void 0!==e[t]?e[t]:e.borderRadius}let e1=e3(0,.5,eY.yT),e2=e3(.5,.95,E.l);function e3(e,t,n){return r=>r<e?0:r>t?1:n((0,F.q)(e,t,r))}function e5(e,t){e.min=t.min,e.max=t.max}function e6(e,t){e5(e.x,t.x),e5(e.y,t.y)}function e4(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function e8(e,t,n,r,i){return e-=t,e=r+1/n*(e-r),void 0!==i&&(e=r+1/i*(e-r)),e}function e7(e,t,[n,r,i],s,o){!function(e,t=0,n=1,r=.5,i,s=e,o=e){if(ep.KN.test(t)&&(t=parseFloat(t),t=(0,U.k)(o.min,o.max,t/100)-o.min),"number"!=typeof t)return;let a=(0,U.k)(s.min,s.max,r);e===s&&(a-=t),e.min=e8(e.min,t,n,a,i),e.max=e8(e.max,t,n,a,i)}(e,t[n],t[r],t[i],t.scale,s,o)}let e9=["x","scaleX","originX"],te=["y","scaleY","originY"];function tt(e,t,n,r){e7(e.x,t,e9,n?n.x:void 0,r?r.x:void 0),e7(e.y,t,te,n?n.y:void 0,r?r.y:void 0)}function tn(e){return 0===e.translate&&1===e.scale}function tr(e){return tn(e.x)&&tn(e.y)}function ti(e,t){return e.min===t.min&&e.max===t.max}function ts(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function to(e,t){return ts(e.x,t.x)&&ts(e.y,t.y)}function ta(e){return V(e.x)/V(e.y)}function tl(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class tu{constructor(){this.members=[]}add(e){(0,e$.Kq)(this.members,e),e.scheduleRender()}remove(e){if((0,e$.Ai)(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){let e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(e){let t,n=this.members.findIndex(t=>e===t);if(0===n)return!1;for(let e=n;e>=0;e--){let n=this.members[e];if(!1!==n.isPresent){t=n;break}}return!!t&&(this.promote(t),!0)}promote(e,t){let n=this.lead;if(e!==n&&(this.prevLead=n,this.lead=e,e.show(),n)){n.instance&&n.scheduleRender(),e.scheduleRender(),e.resumeFrom=n,t&&(e.resumeFrom.preserveOpacity=!0),n.snapshot&&(e.snapshot=n.snapshot,e.snapshot.latestValues=n.animationValues||n.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0);let{crossfade:r}=e.options;!1===r&&n.hide()}}exitAnimationComplete(){this.members.forEach(e=>{let{options:t,resumingFrom:n}=e;t.onExitComplete&&t.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}let th={type:"projectionFrame",totalNodes:0,resolvedTargetDeltas:0,recalculatedProjection:0},tc="undefined"!=typeof window&&void 0!==window.MotionDebug,td=["","X","Y","Z"],tf={visibility:"hidden"},tp=0;function tm(e,t,n,r){let{latestValues:i}=t;i[e]&&(n[e]=i[e],t.setStaticValue(e,0),r&&(r[e]=0))}function tg({attachResizeListener:e,defaultParent:t,measureScroll:n,checkIsScrollRoot:r,resetTransform:i}){return class{constructor(e={},n=null==t?void 0:t()){this.id=tp++,this.animationId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,tc&&(th.totalNodes=th.resolvedTargetDeltas=th.recalculatedProjection=0),this.nodes.forEach(t_),this.nodes.forEach(tI),this.nodes.forEach(tx),this.nodes.forEach(tw),tc&&window.MotionDebug.record(th)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=e,this.root=n?n.root||n:this,this.path=n?[...n.path,n]:[],this.parent=n,this.depth=n?n.depth+1:0;for(let e=0;e<this.path.length;e++)this.path[e].shouldResetTransform=!0;this.root===this&&(this.nodes=new eW)}addEventListener(e,t){return this.eventHandlers.has(e)||this.eventHandlers.set(e,new eH.v),this.eventHandlers.get(e).add(t)}notifyListeners(e,...t){let n=this.eventHandlers.get(e);n&&n.notify(...t)}hasListeners(e){return this.eventHandlers.has(e)}mount(t,n=this.root.hasTreeAnimated){if(this.instance)return;this.isSVG=t instanceof SVGElement&&"svg"!==t.tagName,this.instance=t;let{layoutId:r,layout:i,visualElement:s}=this.options;if(s&&!s.current&&s.mount(t),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),n&&(i||r)&&(this.isLayoutDirty=!0),e){let n,r=()=>this.root.updateBlockedByResize=!1;e(t,()=>{this.root.updateBlockedByResize=!0,n&&n(),n=function(e,t){let n=eq.k.now(),r=({timestamp:t})=>{let i=t-n;i>=250&&((0,P.WG)(r),e(i-250))};return P.Gt.read(r,!0),()=>(0,P.WG)(r)}
16(r,250),ek.hasAnimatedSinceResize&&(ek.hasAnimatedSinceResize=!1,this.nodes.forEach(tC))})}r&&this.root.registerSharedNode(r,this),!1!==this.options.animate&&s&&(r||i)&&this.addEventListener("didUpdate",({delta:e,hasLayoutChanged:t,hasRelativeTargetChanged:n,layout:r})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}let i=this.options.transition||s.getDefaultTransition()||tO,{onLayoutAnimationStart:o,onLayoutAnimationComplete:a}=s.getProps(),l=!this.targetLayout||!to(this.targetLayout,r)||n,u=!t&&n;if(this.options.layoutRoot||this.resumeFrom&&this.resumeFrom.instance||u||t&&(l||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0),this.setAnimationOrigin(e,u);let t={...(0,S.rU)(i,"layout"),onPlay:o,onComplete:a};(s.shouldReduceMotion||this.options.layoutRoot)&&(t.delay=0,t.type=!1),this.startAnimation(t)}else t||tC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=r})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);let e=this.getStack();e&&e.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,(0,P.WG)(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){!this.isUpdateBlocked()&&(this.isUpdating=!0,this.nodes&&this.nodes.forEach(tA),this.animationId++)}getTransformTemplate(){let{visualElement:e}=this.options;return e&&e.getProps().transformTemplate}willUpdate(e=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&function e(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;let{visualElement:n}=t.options;if(!n)return;let r=(0,eB.P)(n);if(window.MotionHasOptimisedAnimation(r,"transform")){let{layout:e,layoutId:n}=t.options;window.MotionCancelOptimisedAnimation(r,"transform",P.Gt,!(e||n))}let{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&e(i)}(this),this.root.isUpdating||this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let e=0;e<this.path.length;e++){let t=this.path[e];t.shouldResetTransform=!0,t.updateScroll("snapshot"),t.options.layoutRoot&&t.willUpdate(!1)}let{layoutId:t,layout:n}=this.options;if(void 0===t&&!n)return;let r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),e&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(tE);return}this.isUpdating||this.nodes.forEach(tT),this.isUpdating=!1,this.nodes.forEach(tS),this.nodes.forEach(ty),this.nodes.forEach(tv),this.clearAllSnapshots();let e=eq.k.now();P.uv.delta=(0,H.q)(0,1e3/60,e-P.uv.timestamp),P.uv.timestamp=e,P.uv.isProcessing=!0,P.PP.update.process(P.uv),P.PP.preRender.process(P.uv),P.PP.render.process(P.uv),P.uv.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,eD.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(tb),this.sharedNodes.forEach(tk)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,P.Gt.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){P.Gt.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){!this.snapshot&&this.instance&&(this.snapshot=this.measure())}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let e=0;e<this.path.length;e++)this.path[e].updateScroll();let e=this.layout;this.layout=this.measure(!1),this.layoutCorrected=ee(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);let{visualElement:t}=this.options;t&&t.notify("LayoutMeasure",this.layout.layoutBox,e?e.layoutBox:void 0)}updateScroll(e="measure"){let t=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===e&&(t=!1),t){let t=r(this.instance);this.scroll={animationId:this.root.animationId,phase:e,isRoot:t,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:t}}}resetTransform(){if(!i)return;let e=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,t=this.projectionDelta&&!tr(this.projectionDelta),n=this.getTransformTemplate(),r=n?n(this.latestValues,""):void 0,s=r!==this.prevTransformTemplateValue;e&&(t||es(this.latestValues)||s)&&(i(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(e=!0){var t;let n=this.measurePageBox(),r=this.removeElementScroll(n);return e&&(r=this.removeTransform(r)),tM((t=r).x),tM(t.y),{animationId:this.root.animationId,measuredBox:n,layoutBox:r,latestValues:{},source:this.id}}measurePageBox(){var e;let{visualElement:t}=this.options;if(!t)return ee();let n=t.measureViewportBox();if(!((null==(e=this.scroll)?void 0:e.wasRoot)||this.path.some(tF))){let{scroll:e}=this.root;e&&(eh(n.x,e.offset.x),eh(n.y,e.offset.y))}return n}removeElementScroll(e){var t;let n=ee();if(e6(n,e),null==(t=this.scroll)?void 0:t.wasRoot)return n;for(let t=0;t<this.path.length;t++){let r=this.path[t],{scroll:i,options:s}=r;r!==this.root&&i&&s.layoutScroll&&(i.wasRoot&&e6(n,e),eh(n.x,i.offset.x),eh(n.y,i.offset.y))}return n}applyTransform(e,t=!1){let n=ee();e6(n,e);for(let e=0;e<this.path.length;e++){let r=this.path[e];!t&&r.options.layoutScroll&&r.scroll&&r!==r.root&&ed(n,{x:-r.scroll.offset.x,y:-r.scroll.offset.y}),es(r.latestValues)&&ed(n,r.latestValues)}return es(this.latestValues)&&ed(n,this.latestValues),n}removeTransform(e){let t=ee();e6(t,e);for(let e=0;e<this.path.length;e++){let n=this.path[e];if(!n.instance||!es(n.latestValues))continue;ei(n.latestValues)&&n.updateSnapshot();let r=ee();e6(r,n.measurePageBox()),tt(t,n.latestValues,n.snapshot?n.snapshot.layoutBox:void 0,r)}return es(this.latestValues)&&tt(t,this.latestValues),t}setTargetDelta(e){this.targetDelta=e,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(e){this.options={...this.options,...e,crossfade:void 0===e.crossfade||e.crossfade}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==P.uv.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(e=!1){var t,n,r,i;let s=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=s.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=s.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=s.isS
16haredProjectionDirty);let o=!!this.resumingFrom||this!==s;if(!(e||o&&this.isSharedProjectionDirty||this.isProjectionDirty||(null==(t=this.parent)?void 0:t.isProjectionDirty)||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;let{layout:a,layoutId:l}=this.options;if(this.layout&&(a||l)){if(this.resolvedRelativeTargetAt=P.uv.timestamp,!this.targetDelta&&!this.relativeTarget){let e=this.getClosestProjectingParent();e&&e.layout&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ee(),this.relativeTargetOrigin=ee(),W(this.relativeTargetOrigin,this.layout.layoutBox,e.layout.layoutBox),e6(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(this.relativeTarget||this.targetDelta){if((this.target||(this.target=ee(),this.targetWithTransforms=ee()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target)?(this.forceRelativeParentToResolveTarget(),n=this.target,r=this.relativeTarget,i=this.relativeParent.target,$(n.x,r.x,i.x),$(n.y,r.y,i.y)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):e6(this.target,this.layout.layoutBox),eu(this.target,this.targetDelta)):e6(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget){this.attemptToResolveRelativeTarget=!1;let e=this.getClosestProjectingParent();e&&!!e.resumingFrom==!!this.resumingFrom&&!e.options.layoutScroll&&e.target&&1!==this.animationProgress?(this.relativeParent=e,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ee(),this.relativeTargetOrigin=ee(),W(this.relativeTargetOrigin,this.target,e.target),e6(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}tc&&th.resolvedTargetDeltas++}}}getClosestProjectingParent(){if(!(!this.parent||ei(this.parent.latestValues)||eo(this.parent.latestValues)))if(this.parent.isProjecting())return this.parent;else return this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var e;let t=this.getLead(),n=!!this.resumingFrom||this!==t,r=!0;if((this.isProjectionDirty||(null==(e=this.parent)?void 0:e.isProjectionDirty))&&(r=!1),n&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(r=!1),this.resolvedRelativeTargetAt===P.uv.timestamp&&(r=!1),r)return;let{layout:i,layoutId:s}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(i||s))return;e6(this.layoutCorrected,this.layout.layoutBox);let o=this.treeScale.x,a=this.treeScale.y;!function(e,t,n,r=!1){let i,s,o=n.length;if(o){t.x=t.y=1;for(let a=0;a<o;a++){s=(i=n[a]).projectionDelta;let{visualElement:o}=i.options;(!o||!o.props.style||"contents"!==o.props.style.display)&&(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&ed(e,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),s&&(t.x*=s.x.scale,t.y*=s.y.scale,eu(e,s)),r&&es(i.latestValues)&&ed(e,i.latestValues))}t.x<1.0000000000001&&t.x>.999999999999&&(t.x=1),t.y<1.0000000000001&&t.y>.999999999999&&(t.y=1)}}(this.layoutCorrected,this.treeScale,this.path,n),t.layout&&!t.target&&(1!==this.treeScale.x||1!==this.treeScale.y)&&(t.target=t.layout.layoutBox,t.targetWithTransforms=ee());let{target:l}=t;if(!l){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}this.projectionDelta&&this.prevProjectionDelta?(e4(this.prevProjectionDelta.x,this.projectionDelta.x),e4(this.prevProjectionDelta.y,this.projectionDelta.y)):this.createProjectionDeltas(),q(this.projectionDelta,this.layoutCorrected,l,this.latestValues),this.treeScale.x===o&&this.treeScale.y===a&&tl(this.projectionDelta.x,this.prevProjectionDelta.x)&&tl(this.projectionDelta.y,this.prevProjectionDelta.y)||(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",l)),tc&&th.recalculatedProjection++}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(e=!0){var t;if(null==(t=this.options.visualElement)||t.scheduleRender(),e){let e=this.getStack();e&&e.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=J(),this.projectionDelta=J(),this.projectionDeltaWithTransform=J()}setAnimationOrigin(e,t=!1){let n,r=this.snapshot,i=r?r.latestValues:{},s={...this.latestValues},o=J();this.relativeParent&&this.relativeParent.options.layoutRoot||(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!t;let a=ee(),l=(r?r.source:void 0)!==(this.layout?this.layout.source:void 0),u=this.getStack(),h=!u||u.members.length<=1,c=!!(l&&!h&&
16!0===this.options.crossfade&&!this.path.some(tN));this.animationProgress=0,this.mixTargetDelta=t=>{let r=t/1e3;if(tR(o.x,e.x,r),tR(o.y,e.y,r),this.setTargetDelta(o),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout){var u,d,f,p,m,g;W(a,this.layout.layoutBox,this.relativeParent.layout.layoutBox),f=this.relativeTarget,p=this.relativeTargetOrigin,m=a,g=r,tP(f.x,p.x,m.x,g),tP(f.y,p.y,m.y,g),n&&(u=this.relativeTarget,d=n,ti(u.x,d.x)&&ti(u.y,d.y))&&(this.isProjectionDirty=!1),n||(n=ee()),e6(n,this.relativeTarget)}l&&(this.animationValues=s,function(e,t,n,r,i,s){i?(e.opacity=(0,U.k)(0,void 0!==n.opacity?n.opacity:1,e1(r)),e.opacityExit=(0,U.k)(void 0!==t.opacity?t.opacity:1,0,e2(r))):s&&(e.opacity=(0,U.k)(void 0!==t.opacity?t.opacity:1,void 0!==n.opacity?n.opacity:1,r));for(let i=0;i<eX;i++){let s=`border${eQ[i]}Radius`,o=e0(t,s),a=e0(n,s);(void 0!==o||void 0!==a)&&(o||(o=0),a||(a=0),0===o||0===a||eZ(o)===eZ(a)?(e[s]=Math.max((0,U.k)(eJ(o),eJ(a),r),0),(ep.KN.test(a)||ep.KN.test(o))&&(e[s]+="%")):e[s]=a)}(t.rotate||n.rotate)&&(e.rotate=(0,U.k)(t.rotate||0,n.rotate||0,r))}(s,i,this.latestValues,r,c,h)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=r},this.mixTargetDelta(1e3*!!this.options.layoutRoot)}startAnimation(e){this.notifyListeners("animationStart"),this.currentAnimation&&this.currentAnimation.stop(),this.resumingFrom&&this.resumingFrom.currentAnimation&&this.resumingFrom.currentAnimation.stop(),this.pendingAnimation&&((0,P.WG)(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=P.Gt.update(()=>{ek.hasAnimatedSinceResize=!0,this.currentAnimation=function(e,t,n){let r=(0,eV.S)(0)?0:(0,eU.OQ)(e);return r.start((0,em.f)("",r,1e3,n)),r.animation}(0,0,{...e,onUpdate:t=>{this.mixTargetDelta(t),e.onUpdate&&e.onUpdate(t)},onComplete:()=>{e.onComplete&&e.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);let e=this.getStack();e&&e.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(1e3),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){let e=this.getLead(),{targetWithTransforms:t,target:n,layout:r,latestValues:i}=e;if(t&&n&&r){if(this!==e&&this.layout&&r&&tj(this.options.animationType,this.layout.layoutBox,r.layoutBox)){n=this.target||ee();let t=V(this.layout.layoutBox.x);n.x.min=e.target.x.min,n.x.max=n.x.min+t;let r=V(this.layout.layoutBox.y);n.y.min=e.target.y.min,n.y.max=n.y.min+r}e6(t,n),ed(t,i),q(this.projectionDeltaWithTransform,this.layoutCorrected,t,i)}}registerSharedNode(e,t){this.sharedNodes.has(e)||this.sharedNodes.set(e,new tu),this.sharedNodes.get(e).add(t);let n=t.options.initialPromotionConfig;t.promote({transition:n?n.transition:void 0,preserveFollowOpacity:n&&n.shouldPreserveFollowOpacity?n.shouldPreserveFollowOpacity(t):void 0})}isLead(){let e=this.getStack();return!e||e.lead===this}getLead(){var e;let{layoutId:t}=this.options;return t&&(null==(e=this.getStack())?void 0:e.lead)||this}getPrevLead(){var e;let{layoutId:t}=this.options;return t?null==(e=this.getStack())?void 0:e.prevLead:void 0}getStack(){let{layoutId:e}=this.options;if(e)return this.root.sharedNodes.get(e)}promote({needsReset:e,transition:t,preserveFollowOpacity:n}={}){let r=this.getStack();r&&r.promote(this,n),e&&(this.projectionDelta=void 0,this.needsReset=!0),t&&this.setOptions({transition:t})}relegate(){let e=this.getStack();return!!e&&e.relegate(this)}resetSkewAndRotation(){let{visualElement:e}=this.options;if(!e)return;let t=!1,{latestValues:n}=e;if((n.z||n.rotate||n.rotateX||n.rotateY||n.rotateZ||n.skewX||n.skewY)&&(t=!0),!t)return;let r={};n.z&&tm("z",e,r,this.animationValues);for(let t=0;t<td.length;t++)tm(`rotate${td[t]}`,e,r,this.animationValues),tm(`skew${td[t]}`,e,r,this.animationValues);for(let t in e.render(),r)e.setStaticValue(t,r[t]),this.animationValues&&(this.animationValues[t]=r[t]);e.scheduleRender()}getProjectionStyles(e){var t,n;if(!this.instance||this.isSVG)return;if(!this.isVisible)return tf;let r={visibility:""},i=this.getTransformTemplate();if(this.needsReset)return this.needsReset=!1,r.opacity="",r.pointerEvents=eK(null==e?void 0:e.pointerEvents)||"",r.transform=i?i(this.latestValues,""):"none",r;let s=this.getLead();if(!this.projectionDelta||!this.layout||!s.target){let t={};return this.options.layoutId&&(t.opacity=void 0!==this.latestValues.opacity?this.latestValues.opacity:1,t.pointerEvents=eK(null==e?void 0:e.pointerEvents)||""),this.hasProjected&&!es(this.latestValues)&&(t.transform=i?i({},""):"none",this.hasProjected=!1),t}let o=s.animationValues||s.latestValues;this.applyTransformsToTarget(),r.transform=function(e,t,n){let r="",i=e.x.translate/t.x,s=e.y.translate/t.y,o=(null==n?void 0:n.z)||0;if((i||s||o)&&(r=`translate3d(${i}px, ${s}px, ${o}px) `),(1!==t.x||1!==t.y)&&(r+=`scale(${1/t.x}, ${1/t.y}) `),n){let{transformPerspective:e,rotate:t,rotateX:i,rotateY:s,skewX:o,skewY:a}=n;e&&(r=`perspective(${e}px) ${r}`),t&&(r+=`rotate(${t}deg) `),i&&(r+=`rotateX(${i}deg) `),s&&(r+=`rotateY(${s}deg) `),o&&(r+=`skewX(${o}deg) `),a&&(r+=`skewY(${a}deg) `)}let a=e.x.scale*t.x,l=e.y.scale*t.y;return(1!==a||1!==l)&&(r+=`scale(${a}, ${l}
16)`),r||"none"}(this.projectionDeltaWithTransform,this.treeScale,o),i&&(r.transform=i(o,r.transform));let{x:a,y:l}=this.projectionDelta;for(let e in r.transformOrigin=`${100*a.origin}% ${100*l.origin}% 0`,s.animationValues?r.opacity=s===this?null!=(n=null!=(t=o.opacity)?t:this.latestValues.opacity)?n:1:this.preserveOpacity?this.latestValues.opacity:o.opacityExit:r.opacity=s===this?void 0!==o.opacity?o.opacity:"":void 0!==o.opacityExit?o.opacityExit:0,eO){if(void 0===o[e])continue;let{correct:t,applyTo:n}=eO[e],i="none"===r.transform?o[e]:t(o[e],s);if(n){let e=n.length;for(let t=0;t<e;t++)r[n[t]]=i}else r[e]=i}return this.options.layoutId&&(r.pointerEvents=s===this?eK(null==e?void 0:e.pointerEvents)||"":"none"),r}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(e=>{var t;return null==(t=e.currentAnimation)?void 0:t.stop()}),this.root.nodes.forEach(tE),this.root.sharedNodes.clear()}}}function ty(e){e.updateLayout()}function tv(e){var t;let n=(null==(t=e.resumeFrom)?void 0:t.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&n&&e.hasListeners("didUpdate")){let{layoutBox:t,measuredBox:r}=e.layout,{animationType:i}=e.options,s=n.source!==e.layout.source;"size"===i?et(e=>{let r=s?n.measuredBox[e]:n.layoutBox[e],i=V(r);r.min=t[e].min,r.max=r.min+i}):tj(i,n.layoutBox,t)&&et(r=>{let i=s?n.measuredBox[r]:n.layoutBox[r],o=V(t[r]);i.max=i.min+o,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[r].max=e.relativeTarget[r].min+o)});let o=J();q(o,t,n.layoutBox);let a=J();s?q(a,e.applyTransform(r,!0),n.measuredBox):q(a,t,n.layoutBox);let l=!tr(o),u=!1;if(!e.resumeFrom){let r=e.getClosestProjectingParent();if(r&&!r.resumeFrom){let{snapshot:i,layout:s}=r;if(i&&s){let o=ee();W(o,n.layoutBox,i.layoutBox);let a=ee();W(a,t,s.layoutBox),to(o,a)||(u=!0),r.options.layoutRoot&&(e.relativeTarget=a,e.relativeTargetOrigin=o,e.relativeParent=r)}}}e.notifyListeners("didUpdate",{layout:t,snapshot:n,delta:a,layoutDelta:o,hasLayoutChanged:l,hasRelativeTargetChanged:u})}else if(e.isLead()){let{onExitComplete:t}=e.options;t&&t()}e.options.transition=void 0}function t_(e){tc&&th.totalNodes++,e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function tw(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function tb(e){e.clearSnapshot()}function tE(e){e.clearMeasurements()}function tT(e){e.isLayoutDirty=!1}function tS(e){let{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function tC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function tI(e){e.resolveTargetDelta()}function tx(e){e.calcProjection()}function tA(e){e.resetSkewAndRotation()}function tk(e){e.removeLeadSnapshot()}function tR(e,t,n){e.translate=(0,U.k)(t.translate,0,n),e.scale=(0,U.k)(t.scale,1,n),e.origin=t.origin,e.originPoint=t.originPoint}function tP(e,t,n,r){e.min=(0,U.k)(t.min,n.min,r),e.max=(0,U.k)(t.max,n.max,r)}function tN(e){return e.animationValues&&void 0!==e.animationValues.opacityExit}let tO={duration:.45,ease:[.4,0,.1,1]},tD=e=>"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),tL=tD("applewebkit/")&&!tD("chrome/")?Math.round:E.l;function tM(e){e.min=tL(e.min),e.max=tL(e.max)}function tj(e,t,n){return"position"===e||"preserve-aspect"===e&&!(.2>=Math.abs(ta(t)-ta(n)))}function tF(e){var t;return e!==e.root&&(null==(t=e.scroll)?void 0:t.wasRoot)}let tU=tg({attachResizeListener:(e,t)=>I(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),tV={current:void 0},tB=tg({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!tV.current){let e=new tU({});e.mount(window),e.setOptions({layoutScroll:!0}),tV.current=e}return tV.current},resetTransform:(e,t)=>
16{e.style.transform=void 0!==t?t:"none"},checkIsScrollRoot:e=>"fixed"===window.getComputedStyle(e).position});function tq(e,t,n){let{props:r}=e;e.animationState&&r.whileHover&&e.animationState.setActive("whileHover","Start"===n);let i=r["onHover"+n];i&&P.Gt.postRender(()=>i(t,x(t)))}class t$ extends v{mount(){let{current:e}=this.node;e&&(this.unmount=(0,S.PT)(e,e=>(tq(this.node,e,"Start"),e=>tq(this.node,e,"End"))))}unmount(){}}class tz extends v{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch(t){e=!0}e&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=(0,R.F)(I(this.node.current,"focus",()=>this.onFocus()),I(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function tW(e,t,n){let{props:r}=e;e.animationState&&r.whileTap&&e.animationState.setActive("whileTap","Start"===n);let i=r["onTap"+("End"===n?"":n)];i&&P.Gt.postRender(()=>i(t,x(t)))}class tH extends v{mount(){let{current:e}=this.node;e&&(this.unmount=(0,S.c$)(e,e=>(tW(this.node,e,"Start"),(e,{success:t})=>tW(this.node,e,t?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}let tG=new WeakMap,tK=new WeakMap,tY=e=>{let t=tG.get(e.target);t&&t(e)},tQ=e=>{e.forEach(tY)},tX={some:0,all:1};class tJ extends v{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:e={}}=this.node.getProps(),{root:t,margin:n,amount:r="some",once:i}=e,s={root:t?t.current:void 0,rootMargin:n,threshold:"number"==typeof r?r:tX[r]},o=e=>{let{isIntersecting:t}=e;if(this.isInView===t||(this.isInView=t,i&&!t&&this.hasEnteredView))return;t&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",t);let{onViewportEnter:n,onViewportLeave:r}=this.node.getProps(),s=t?n:r;s&&s(e)};var a=this.node.current;let l=function({root:e,...t}){let n=e||document;tK.has(n)||tK.set(n,{});let r=tK.get(n),i=JSON.stringify(t);return r[i]||(r[i]=new IntersectionObserver(tQ,{root:e,...t})),r[i]}(s);return tG.set(a,o),l.observe(a),()=>{tG.delete(a),l.unobserve(a)}}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;let{props:e,prevProps:t}=this.node;["amount","margin","root"].some(function({viewport:e={}},{viewport:t={}}={}){return n=>e[n]!==t[n]}(e,t))&&this.startObserver()}unmount(){}}let tZ=(0,eC.createContext)({strict:!1});var t0=n(1776);let t1=(0,eC.createContext)({});function t2(e){return r(e.animate)||c.some(t=>l(e[t]))}function t3(e){return!!(t2(e)||e.variants)}function t5(e){return Array.isArray(e)?e.join(" "):e}var t6=n(6504);let t4={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]},t8={};for(let e in t4)t8[e]={isEnabled:t=>t4[e].some(e=>!!t[e])};let t7=Symbol.for("motionComponentSymbol");var t9=n(1389),ne=n(9566),nt=n(8840);let nn=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nr(e){if("string"!=typeof e||e.includes("-"));else if(nn.indexOf(e)>-1||/[A-Z]/u.test(e))return!0;return!1}var ni=n(2459),ns=n(8101);let no=e=>(t,n)=>{let i=(0,eC.useContext)(t1),s=(0,eC.useContext)(t9.t),o=()=>(function({scrapeMotionValuesFromProps:e,createRenderState:t,onUpdate:n},i,s,o){let a={latestValues:function(e,t,n,i){let s={},o=i(e,{});for(let e in o)s[e]=eK(o[e]);let{initial:a,animate:l}=e,u=t2(e),h=t3(e);t&&h&&!u&&!1!==e.inherit&&(void 0===a&&(a=t.initial),void 0===l&&(l=t.animate));let c=!!n&&!1===n.initial,d=(c=c||!1===a)?l:a;if(d&&"boolean"!=typeof d&&!r(d)){let t=Array.isArray(d)?d:[d];for(let n=0;n<t.length;n++){let r=(0,ni.a)(e,t[n]);if(r){let{transitionEnd:e,transition:t,...n}=r;for(let e in n){let t=n[e];if(Array.isArray(t)){let e=c?t.length-1:0;t=t[e]}null!==t&&(s[e]=t)}for(let t in e)s[t]=e[t]}}}return s}(i,s,o,e),renderState:t()};return n&&(a.onMount=e=>n({props:i,current:e,...a}),a.onUpdate=e=>n(e)),a})(e,t,i,s);return n?o():(0,ns.M)(o)};var na=n(5615),nl=n(2744);let nu=(e,t)=>t&&"number"==typeof e?t.transform(e):e;var nh=n(8753);let nc={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},nd=na.U.length;function nf(e,t,n){let{style:r,vars:i,transformOrigin:s}=e,o=!1,a=!1;for(let e in t){let n=t[e];if(na.f.has(e)){o=!0;continue}if((0,nl.j)(e)){i[e]=n;continue}{let t=nu(n,nh.W[e]);e.startsWith("origin")?(a=!0,s[e]=t):r[e]=t}}if(!t.transform&&(o||n?r.transform=function(e,t,n){let r="",i=!0;for(let s=0;s<nd;s++){let o=na.U[s],a=e[o];if(void 0===a)continue;let l=!0;if(!(l="number"==typeof a?a===+!!o.startsWith("scale"):0===parseFloat(a))||n){let e=nu(a,nh.W[o]);if(!l){i=!1;let t=nc[o]||o;r+=`${t}(${e}) `}n&&(t[o]=e)}}return r=r.trim(),n?r=n(t,i?"":r):i&&(r="none"),r}(t,e.transform,n):r.transform&&(r.transform="none")),a){let{originX:e="50%",originY:t="50%",originZ:n=0}=s;r.transformOrigin=`${e} ${t} ${n}`}}let np={offset:"stroke-dashoffset",array:"stroke-dasharray"},nm={offset:"strokeDashoffset",array:"strokeDasharray"};function ng(e,t,n){return"string"==typeof e?e:ep.px.transform(t+n*e)}function ny(e,{attrX:t,attrY:n,attrScale:r,originX:i,originY:s,pathLength:o,pathSpacing:a=1,pathOffset:l=0,...u}
16,h,c){if(nf(e,u,c),h){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};let{attrs:d,style:f,dimensions:p}=e;d.transform&&(p&&(f.transform=d.transform),delete d.transform),p&&(void 0!==i||void 0!==s||f.transform)&&(f.transformOrigin=function(e,t,n){let r=ng(t,e.x,e.width),i=ng(n,e.y,e.height);return`${r} ${i}`}(p,void 0!==i?i:.5,void 0!==s?s:.5)),void 0!==t&&(d.x=t),void 0!==n&&(d.y=n),void 0!==r&&(d.scale=r),void 0!==o&&function(e,t,n=1,r=0,i=!0){e.pathLength=1;let s=i?np:nm;e[s.offset]=ep.px.transform(-r);let o=ep.px.transform(t),a=ep.px.transform(n);e[s.array]=`${o} ${a}`}(d,o,a,l,!1)}let nv=()=>({style:{},transform:{},transformOrigin:{},vars:{}}),n_=()=>({...nv(),attrs:{}}),nw=e=>"string"==typeof e&&"svg"===e.toLowerCase();var nb=n(5746);function nE(e,{style:t,vars:n},r,i){for(let s in Object.assign(e.style,t,i&&i.getProjectionStyles(r)),n)e.style.setProperty(s,n[s])}let nT=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);function nS(e,t,n,r){for(let n in nE(e,t,void 0,r),t.attrs)e.setAttribute(nT.has(n)?n:(0,nb.I)(n),t.attrs[n])}function nC(e,{layout:t,layoutId:n}){return na.f.has(e)||e.startsWith("origin")||(t||void 0!==n)&&(!!eO[e]||"opacity"===e)}function nI(e,t,n){var r;let{style:i}=e,s={};for(let o in i)((0,eV.S)(i[o])||t.style&&(0,eV.S)(t.style[o])||nC(o,e)||(null==(r=null==n?void 0:n.getValue(o))?void 0:r.liveStyle)!==void 0)&&(s[o]=i[o]);return s}function nx(e,t,n){let r=nI(e,t,n);for(let n in e)((0,eV.S)(e[n])||(0,eV.S)(t[n]))&&(r[-1!==na.U.indexOf(n)?"attr"+n.charAt(0).toUpperCase()+n.substring(1):n]=e[n]);return r}let nA=["x","y","width","height","cx","cy","r"],nk={useVisualState:no({scrapeMotionValuesFromProps:nx,createRenderState:n_,onUpdate:({props:e,prevProps:t,current:n,renderState:r,latestValues:i})=>{if(!n)return;let s=!!e.drag;if(!s){for(let e in i)if(na.f.has(e)){s=!0;break}}if(!s)return;let o=!t;if(t)for(let n=0;n<nA.length;n++){let r=nA[n];e[r]!==t[r]&&(o=!0)}o&&P.Gt.read(()=>{!function(e,t){try{t.dimensions="function"==typeof e.getBBox?e.getBBox():e.getBoundingClientRect()}catch(e){t.dimensions={x:0,y:0,width:0,height:0}}}(n,r),P.Gt.render(()=>{ny(r,i,nw(n.tagName),e.transformTemplate),nS(n,r)})})}})},nR={useVisualState:no({scrapeMotionValuesFromProps:nI,createRenderState:nv})};function nP(e,t,n){for(let r in t)(0,eV.S)(t[r])||nC(r,n)||(e[r]=t[r])}let nN=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","ignoreStrict","viewport"]);function nO(e){return e.startsWith("while")||e.startsWith("drag")&&"draggable"!==e||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||nN.has(e)}let nD=e=>!nO(e);try{!function(e){e&&(nD=t=>t.startsWith("on")?!nO(t):e(t))}(require("@emotion/is-prop-valid").default)}catch(e){}var nL=n(2054),nM=n(492);let nj={current:null},nF={current:!1};var nU=n(7200),nV=n(9033),nB=n(3432),nq=n(2727);let n$=[...nB.T,nV.y,eN.f],nz=new WeakMap;var nW=n(6303);let nH=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class nG{scrapeMotionValuesFromProps(e,t,n){return{}}constructor({parent:e,props:t,presenceContext:n,reducedMotionConfig:r,blockInitialAnimation:i,visualState:s},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=nW.h,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let e=eq.k.now();this.renderScheduledAt<e&&(this.renderScheduledAt=e,P.Gt.render(this.render,!1,!0))};let{latestValues:a,renderState:l,onUpdate:u}=s;this.onUpdate=u,this.latestValues=a,this.baseTarget={...a},this.initialValues=t.initial?{...a}:{},this.renderState=l,this.parent=e,this.props=t,this.presenceContext=n,this.depth=e?e.depth+1:0,this.reducedMotionConfig=r,this.options=o,this.blockInitialAnimation=!!i,this.isControllingVariants=t2(t),this.isVariantNode=t3(t),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);let{willChange:h,...c}=this.scrapeMotionValuesFromProps(t,{},this);for(let e in c){let t=c[e];void 0!==a[e]&&(0,eV.S)(t)&&t.set(a[e],!1)}}mount(e){this.current=e,nz.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEac
16h((e,t)=>this.bindToMotionValue(t,e)),nF.current||function(){if(nF.current=!0,t6.B)if(window.matchMedia){let e=window.matchMedia("(prefers-reduced-motion)"),t=()=>nj.current=e.matches;e.addListener(t),t()}else nj.current=!1}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||nj.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){for(let e in nz.delete(this.current),this.projection&&this.projection.unmount(),(0,P.WG)(this.notifyUpdate),(0,P.WG)(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this),this.events)this.events[e].clear();for(let e in this.features){let t=this.features[e];t&&(t.unmount(),t.isMounted=!1)}this.current=null}bindToMotionValue(e,t){let n;this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)();let r=na.f.has(e),i=t.on("change",t=>{this.latestValues[e]=t,this.props.onUpdate&&P.Gt.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0)}),s=t.on("renderRequest",this.scheduleRender);window.MotionCheckAppearSync&&(n=window.MotionCheckAppearSync(this,e,t)),this.valueSubscriptions.set(e,()=>{i(),s(),n&&n(),t.owner&&t.stop()})}sortNodePosition(e){return this.current&&this.sortInstanceNodePosition&&this.type===e.type?this.sortInstanceNodePosition(this.current,e.current):0}updateFeatures(){let e="animation";for(e in t8){let t=t8[e];if(!t)continue;let{isEnabled:n,Feature:r}=t;if(!this.features[e]&&r&&n(this.props)&&(this.features[e]=new r(this)),this.features[e]){let t=this.features[e];t.isMounted?t.update():(t.mount(),t.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ee()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,t){this.latestValues[e]=t}update(e,t){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=t;for(let t=0;t<nH.length;t++){let n=nH[t];this.propEventSubscriptions[n]&&(this.propEventSubscriptions[n](),delete this.propEventSubscriptions[n]);let r=e["on"+n];r&&(this.propEventSubscriptions[n]=this.on(n,r))}this.prevMotionValues=function(e,t,n){for(let r in t){let i=t[r],s=n[r];if((0,eV.S)(i))e.addValue(r,i);else if((0,eV.S)(s))e.addValue(r,(0,eU.OQ)(i,{owner:e}));else if(s!==i)if(e.hasValue(r)){let t=e.getValue(r);!0===t.liveStyle?t.jump(i):t.hasAnimated||t.set(i)}else{let t=e.getStaticValue(r);e.addValue(r,(0,eU.OQ)(void 0!==t?t:i,{owner:e}))}}for(let r in n)void 0===t[r]&&e.removeValue(r);return t}(this,this.scrapeMotionValuesFromProps(e,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue(),this.onUpdate&&this.onUpdate(this)}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){let t=this.getClosestVariantNode();if(t)return t.variantChildren&&t.variantChildren.add(e),()=>t.variantChildren.delete(e)}addValue(e,t){let n=this.values.get(e);t!==n&&(n&&this.removeValue(e),this.bindToMotionValue(e,t),this.values.set(e,t),this.latestValues[e]=t.get())}removeValue(e){this.values.delete(e);let t=this.valueSubscriptions.get(e);t&&(t(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,t){if(this.props.values&&this.props.values[e])return this.props.values[e];let n=this.values.get(e);return void 0===n&&void 0!==t&&(n=(0,eU.OQ)(null===t?void 0:t,{owner:this}),this.addValue(e,n)),n}readValue(e,t){var n;let r=void 0===this.latestValues[e]&&this.current?null!=(n=this.getBaseTargetFromProps(this.props,e))?n:this.readValueFromInstance(this.current,e,this.options):this.latestValues[e];if(null!=r){if("string"==typeof r&&((0,nL.i)(r)||(0,nM.$)(r)))r=parseFloat(r);else{let n;n=r,!n$.find((0,nq.w)(n))&&eN.f.test(t)&&(r=(0,nU.J)(e,t))}this.setBaseTarget(e,(0,eV.S)(r)?r.get():r)}return(0,eV.S)(r)?r.get():r}setBaseTarget(e,t){this.baseTarget[e]=t}getBaseTarget(e){var t;let n,{initial:r}=this.props;if("string"==typeof r||"object"==typeof r){let i=(0,ni.a)(this.props,r,null==(t=this.presenceContext)?void 0:t.custom);i&&(n=i[e])}if(r&&void 0!==n)return n;let i=this.getBaseTargetFromProps(this.props,e);return void 0===i||(0,eV.S)(i)?void 0!==this.initialValues[e]&&void 0===n?void 0:this.baseTarget[e]:i}on(e,t){return this.events[e]||(this.events[e]=new eH.v),this.events[e].add(t)}notify(e,...t){this.events[e]&&this.events[e].notify(...t)}}var nK=n(6125);
16class nY extends nG{constructor(){super(...arguments),this.KeyframeResolver=nK.K}sortInstanceNodePosition(e,t){return 2&e.compareDocumentPosition(t)?1:-1}getBaseTargetFromProps(e,t){return e.style?e.style[t]:void 0}removeValueFromRenderState(e,{vars:t,style:n}){delete t[e],delete n[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:e}=this.props;(0,eV.S)(e)&&(this.childSubscription=e.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}var nQ=n(1457);class nX extends nY{constructor(){super(...arguments),this.type="html",this.renderInstance=nE}readValueFromInstance(e,t){if(na.f.has(t)){let e=(0,nQ.D)(t);return e&&e.default||0}{let n=window.getComputedStyle(e),r=((0,nl.j)(t)?n.getPropertyValue(t):n[t])||0;return"string"==typeof r?r.trim():r}}measureInstanceViewportBox(e,{transformPagePoint:t}){return ef(e,t)}build(e,t,n){nf(e,t,n.transformTemplate)}scrapeMotionValuesFromProps(e,t,n){return nI(e,t,n)}}class nJ extends nY{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ee}getBaseTargetFromProps(e,t){return e[t]}readValueFromInstance(e,t){if(na.f.has(t)){let e=(0,nQ.D)(t);return e&&e.default||0}return t=nT.has(t)?t:(0,nb.I)(t),e.getAttribute(t)}scrapeMotionValuesFromProps(e,t,n){return nx(e,t,n)}
16build(e,t,n){ny(e,t,this.isSVGTag,n.transformTemplate)}renderInstance(e,t,n,r){nS(e,t,n,r)}mount(e){this.isSVGTag=nw(e.tagName),super.mount(e)}}let nZ=function(e){if("undefined"==typeof Proxy)return e;let t=new Map;return new Proxy((...t)=>e(...t),{get:(n,r)=>"create"===r?e:(t.has(r)||t.set(r,e(r)),t.get(r))})}((i={animation:{Feature:_},exit:{Feature:b},inView:{Feature:tJ},tap:{Feature:tH},focus:{Feature:tz},hover:{Feature:t$},pan:{Feature:eT},drag:{Feature:eb,ProjectionNode:tB,MeasureLayout:ej},layout:{ProjectionNode:tB,MeasureLayout:ej}},s=(e,t)=>nr(e)?new nJ(t):new nX(t,{allowProjection:e!==eC.Fragment}),function(e,{forwardMotionProps:t}={forwardMotionProps:!1}){return function({preloadedFeatures:e,createVisualElement:t,useRender:n,useVisualState:r,Component:i}){var s,o;function a(e,s){var o;let a,u={...(0,eC.useContext)(t0.Q),...e,layoutId:function({layoutId:e}){let t=(0,eC.useContext)(ex.L).id;return t&&void 0!==e?t+"-"+e:e}(e)},{isStatic:h}=u,c=function(e){let{initial:t,animate:n}=function(e,t){if(t2(e)){let{initial:t,animate:n}=e;return{initial:!1===t||l(t)?t:void 0,animate:l(n)?n:void 0}}return!1!==e.inherit?t:{}}(e,(0,eC.useContext)(t1));return(0,eC.useMemo)(()=>({initial:t,animate:n}),[t5(t),t5(n)])}(e),d=r(e,h);if(!h&&t6.B){(0,eC.useContext)(tZ).strict;let e=function(e){let{drag:t,layout:n}=t8;if(!t&&!n)return{};let r={...t,...n};return{MeasureLayout:(null==t?void 0:t.isEnabled(e))||(null==n?void 0:n.isEnabled(e))?r.MeasureLayout:void 0,ProjectionNode:r.ProjectionNode}}(u);a=e.MeasureLayout,c.visualElement=function(e,t,n,r,i){var s,o;let{visualElement:a}=(0,eC.useContext)(t1),l=(0,eC.useContext)(tZ),u=(0,eC.useContext)(t9.t),h=(0,eC.useContext)(t0.Q).reducedMotion,c=(0,eC.useRef)(null);r=r||l.renderer,!c.current&&r&&(c.current=r(e,{visualState:t,parent:a,props:n,presenceContext:u,blockInitialAnimation:!!u&&!1===u.initial,reducedMotionConfig:h}));let d=c.current,f=(0,eC.useContext)(eA);d&&!d.projection&&i&&("html"===d.type||"svg"===d.type)&&function(e,t,n,r){let{layoutId:i,layout:s,drag:o,dragConstraints:a,layoutScroll:l,layoutRoot:u}=t;e.projection=new n(e.latestValues,t["data-framer-portal-id"]?void 0:function e(t){if(t)return!1!==t.options.allowProjection?t.projection:e(t.parent)}(e.parent)),e.projection.setOptions({layoutId:i,layout:s,alwaysMeasureLayout:!!o||a&&j(a),visualElement:e,animationType:"string"==typeof s?s:"both",initialPromotionConfig:r,layoutScroll:l,layoutRoot:u})}(c.current,n,i,f);let p=(0,eC.useRef)(!1);(0,eC.useInsertionEffect)(()=>{d&&p.current&&d.update(n,u)});let m=n[nt.n],g=(0,eC.useRef)(!!m&&!(null==(s=window.MotionHandoffIsComplete)?void 0:s.call(window,m))&&(null==(o=window.MotionHasOptimisedAnimation)?void 0:o.call(window,m)));return(0,ne.E)(()=>{d&&(p.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),eD.render(d.render),g.current&&d.animationState&&d.animationState.animateChanges())}),(0,eC.useEffect)(()=>{d&&(!g.current&&d.animationState&&d.animationState.animateChanges(),g.current&&(queueMicrotask(()=>{var e;null==(e=window.MotionHandoffMarkAsComplete)||e.call(window,m)}),g.current=!1))}),d}(i,d,u,t,e.ProjectionNode)}return(0,eS.jsxs)(t1.Provider,{value:c,children:[a&&c.visualElement?(0,eS.jsx)(a,{visualElement:c.visualElement,...u}):null,n(i,e,(o=c.visualElement,(0,eC.useCallback)(e=>{e&&d.onMount&&d.onMount(e),o&&(e?o.mount(e):o.unmount()),s&&("function"==typeof s?s(e):j(s)&&(s.current=e))},[o])),d,h,c.visualElement)]})}e&&function(e){for(let t in e)t8[t]={...t8[t],...e[t]}}(e),a.displayName=`motion.${"string"==typeof i?i:`create(${null!=(o=null!=(s=i.displayName)?s:i.name)?o:""})`}`;let u=(0,eC.forwardRef)(a);return u[t7]=i,u}({...nr(e)?nk:nR,preloadedFeatures:i,useRender:function(e=!1){return(t,n,r,{latestValues:i},s)=>{let o=(nr(t)?function(e,t,n,r){let i=(0,eC.useMemo)(()=>{let n=n_();return ny(n,t,nw(r),e.transformTemplate),{...n.attrs,style:{...n.style}}},[t]);if(e.style){let t={};nP(t,e.style,e),i.style={...t,...i.style}}return i}:function(e,t){let n={},r=function(e,t){let n=e.style||{},r={};return nP(r,n,e),Object.assign(r,function({transformTemplate:e},t){return(0,eC.useMemo)(()=>{let n=nv();return nf(n,t,e),Object.assign({},n.vars,n.style)},[t])}(e,t)),r}(e,t);return e.drag&&!1!==e.dragListener&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=!0===e.drag?"none":`pan-${"x"===e.drag?"y":"x"}
16`),void 0===e.tabIndex&&(e.onTap||e.onTapStart||e.whileTap)&&(n.tabIndex=0),n.style=r,n})(n,i,s,t),a=function(e,t,n){let r={};for(let i in e)("values"!==i||"object"!=typeof e.values)&&(nD(i)||!0===n&&nO(i)||!t&&!nO(i)||e.draggable&&i.startsWith("onDrag"))&&(r[i]=e[i]);return r}(n,"string"==typeof t,e),l=t!==eC.Fragment?{...a,...o,ref:r}:{},{children:u}=n,h=(0,eC.useMemo)(()=>(0,eV.S)(u)?u.get():u,[u]);return(0,eC.createElement)(t,{...l,children:h})}}(t),createVisualElement:s,Component:e})}))},5274:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});let r=e=>!!(e&&e.getVelocity)},5564:(e,t)=>{"use strict";t.byteLength=function(e){var t=l(e),n=t[0],r=t[1];return(n+r)*3/4-r},t.toByteArray=function(e){var t,n,s=l(e),o=s[0],a=s[1],u=new i((o+a)*3/4-a),h=0,c=a>0?o-4:o;for(n=0;n<c;n+=4)t=r[e.charCodeAt(n)]<<18|r[e.charCodeAt(n+1)]<<12|r[e.charCodeAt(n+2)]<<6|r[e.charCodeAt(n+3)],u[h++]=t>>16&255,u[h++]=t>>8&255,u[h++]=255&t;return 2===a&&(t=r[e.charCodeAt(n)]<<2|r[e.charCodeAt(n+1)]>>4,u[h++]=255&t),1===a&&(t=r[e.charCodeAt(n)]<<10|r[e.charCodeAt(n+1)]<<4|r[e.charCodeAt(n+2)]>>2,u[h++]=t>>8&255,u[h++]=255&t),u},t.fromByteArray=function(e){for(var t,r=e.length,i=r%3,s=[],o=0,a=r-i;o<a;o+=16383)s.push(function(e,t,r){for(var i,s=[],o=t;o<r;o+=3)i=(e[o]<<16&0xff0000)+(e[o+1]<<8&65280)+(255&e[o+2]),s.push(n[i>>18&63]+n[i>>12&63]+n[i>>6&63]+n[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(n[(t=e[r-1])>>2]+n[t<<4&63]+"=="):2===i&&s.push(n[(t=(e[r-2]<<8)+e[r-1])>>10]+n[t>>4&63]+n[t<<2&63]+"="),s.join("")};for(var n=[],r=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=s.length;o<a;++o)n[o]=s[o],r[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");-1===n&&(n=t);var r=n===t?0:4-n%4;return[n,r]}r[45]=62,r[95]=63},5615:(e,t,n)=>{"use strict";n.d(t,{U:()=>r,f:()=>i});let r=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],i=new Set(r)},5633:(e,t,n)=>{e.exports=n(2716)},5746:(e,t,n)=>{"use strict";n.d(t,{I:()=>r});let r=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase()},5836:(e,t,n)=>{"use strict";n.d(t,{O:()=>r});let r=e=>{if("string"!=typeof e)throw Error("Invalid input: imagePath must be a string.");if(!e.endsWith(".svg"))throw Error("Invalid input: imagePath must end with .svg.");return e.replace(/\.svg$/,".webp")}},5880:(e,t,n)=>{"use strict";n.d(t,{h1:()=>a,uA:()=>i});var r=n(9320);class i{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let s="[DEFAULT]";class o{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let e=new r.cY;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;let n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!=(t=null==e?void 0:e.optional)&&t;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}if(r)return null;throw Error(`Service ${this.name} is not available`)}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:s})}catch(e){}for(let[e,t]of this.instancesDeferred.entries()){let n=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=s){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=s){return this.instances.has(e)}getOptions(e=s){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(let[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){var n;let r=this.normalizeInstanceIdentifier(t),i=null!=(n=this.onInitCallbacks.get(r))?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){let n=this.onInitCallbacks.get(t);if(n)for(let r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var n;let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===s?void 0:n,options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}return r||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class a{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new o(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},5881:(e,t)=>{"use strict";function n(e){let{widthInt:t,heightInt:n,blurWidth:r,blurHeight:i,blurDataURL:s,objectFit:o}=e,a=r?40*r:t,l=i?40*i:n,u=a&&l?"viewBox='0 0 "+a+" "+l+"'":"";return"%3Csvg xmlns='http://www.w3.org/2000/svg' "+u+"%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3Cfe
16ColorMatrix values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1' result='s'/%3E%3CfeFlood x='0' y='0' width='100%25' height='100%25'/%3E%3CfeComposite operator='out' in='s'/%3E%3CfeComposite in2='SourceGraphic'/%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage width='100%25' height='100%25' x='0' y='0' preserveAspectRatio='"+(u?"none":"contain"===o?"xMidYMid":"cover"===o?"xMidYMid slice":"none")+"' style='filter: url(%23b);' href='"+s+"'/%3E%3C/svg%3E"}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getImageBlurSvg",{enumerable:!0,get:function(){return n}})},6091:(e,t,n)=>{"use strict";n.d(t,{HF:()=>e1,eJ:()=>tl,xI:()=>nE,hg:()=>th,J1:()=>ta,x9:()=>tu,df:()=>tG});var r=n(4928),i=n(9320),s=n(3279);function o(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}Object.create;Object.create;var a=("function"==typeof SuppressedError&&SuppressedError,n(5880));function l(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}}let u=new i.FA("auth","Firebase",l()),h=new s.Vy("@firebase/auth");function c(e,...t){h.logLevel<=s.$b.ERROR&&h.error(`Auth (${r.MF}): ${e}`,...t)}function d(e,...t){throw g(e,...t)}function f(e,...t){return g(e,...t)}function p(e,t,n){let r=Object.assign(Object.assign({},l()),{[t]:n});return new i.FA("auth","Firebase",r).create(t,{appName:e.name})}function m(e){return p(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function g(e,...t){if("string"!=typeof e){let n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return u.create(e,...t)}function y(e,t,...n){if(!e)throw g(t,...n)}function v(e){let t="INTERNAL ASSERTION FAILED: "+e;throw c(t),Error(t)}function _(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.href)||""}function w(){var e;return"undefined"!=typeof self&&(null==(e=self.location)?void 0:e.protocol)||null}class b{constructor(e,t){var n;this.shortDelay=e,this.longDelay=t,n="Short delay should be less than long delay!",t>e||v(n),this.isMobile=(0,i.jZ)()||(0,i.lV)()}get(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===w()||"https:"===w()||(0,i.sr)()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function E(e,t){var n,r;n=e.emulator,r="Emulator should always be set here",n||v(r);let{url:i}=e.emulator;return t?`${i}${t.startsWith("/")?t.slice(1):t}`:i}class T{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:"undefined"!=typeof globalThis&&globalThis.fetch?globalThis.fetch:"undefined"!=typeof fetch?fetch:void v("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:"undefined"!=typeof globalThis&&globalThis.Headers?globalThis.Headers:"undefined"!=typeof Headers?Headers:void v("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:"undefined"!=typeof globalThis&&globalThis.Response?globalThis.Response:"undefined"!=typeof Response?Response:void v("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let S={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVA
16LID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},C=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],I=new b(3e4,6e4);function x(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function A(e,t,n,r,s={}){return k(e,s,async()=>{let s={},o={};r&&("GET"===t?o=r:s={body:JSON.stringify(r)});let a=(0,i.Am)(Object.assign({key:e.config.apiKey},o)).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);let u=Object.assign({method:t,headers:l},s);return(0,i.c1)()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&(0,i.zJ)(e.emulatorConfig.host)&&(u.credentials="include"),T.fetch()(await P(e,e.config.apiHost,n,a),u)})}async function k(e,t,n){e._canInitEmulator=!1;let r=Object.assign(Object.assign({},S),t);try{let t=new N(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();let s=await i.json();if("needConfirmation"in s)throw O(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{let[t,n]=(i.ok?s.errorMessage:s.error.message).split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===t)throw O(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===t)throw O(e,"email-already-in-use",s);if("USER_DISABLED"===t)throw O(e,"user-disabled",s);let o=r[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(n)throw p(e,o,n);d(e,o)}}catch(t){if(t instanceof i.g)throw t;d(e,"network-request-failed",{message:String(t)})}}async function R(e,t,n,r,i={}){let s=await A(e,t,n,r,i);return"mfaPendingCredential"in s&&d(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function P(e,t,n,r){let i=`${t}${n}?${r}`,s=e.config.emulator?E(e.config,i):`${e.config.apiScheme}://${i}`;return C.includes(n)&&(await e._persistenceManagerAvailable,"COOKIE"===e._getPersistenceType())?e._getPersistence()._getFinalTarget(s).toString():s}class N{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>
16{this.timer=setTimeout(()=>t(f(this.auth,"network-request-failed")),I.get())})}}function O(e,t,n){let r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=f(e,t,r);return i.customData._tokenResponse=n,i}function D(e){return void 0!==e&&void 0!==e.enterprise}class L{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],void 0===e.recaptchaKey)throw Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||0===this.recaptchaEnforcementState.length)return null;for(let t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)switch(t.enforcementState){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}return null}isProviderEnabled(e){return"ENFORCE"===this.getProviderEnforcementState(e)||"AUDIT"===this.getProviderEnforcementState(e)}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}}async function M(e,t){return A(e,"GET","/v2/recaptchaConfig",x(e,t))}async function j(e,t){return A(e,"POST","/v1/accounts:delete",t)}async function F(e,t){return A(e,"POST","/v1/accounts:lookup",t)}function U(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function V(e,t=!1){let n=(0,i.Ku)(e),r=await n.getIdToken(t),s=q(r);y(s&&s.exp&&s.auth_time&&s.iat,n.auth,"internal-error");let o="object"==typeof s.firebase?s.firebase:void 0,a=null==o?void 0:o.sign_in_provider;return{claims:s,token:r,authTime:U(B(s.auth_time)),issuedAtTime:U(B(s.iat)),expirationTime:U(B(s.exp)),signInProvider:a||null,signInSecondFactor:(null==o?void 0:o.sign_in_second_factor)||null}}function B(e){return 1e3*Number(e)}function q(e){let[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return c("JWT malformed, contained fewer than 3 sections"),null;try{let e=(0,i.u)(n);if(!e)return c("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return c("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}function $(e){let t=q(e);return y(t,"internal-error"),y(void 0!==t.exp,"internal-error"),y(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function z(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof i.g&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class W{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(!e)return this.errorBackoff=3e4,Math.max(0,(null!=(t=this.user.stsTokenManager.expirationTime)?t:0)-Date.now()-3e5);{let e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(null==e?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}class H{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=U(this.lastLoginAt),this.creationTime=U(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function G(e){var t,n,r;let i=e.auth,s=await e.getIdToken(),o=await z(e,F(i,{idToken:s}));y(null==o?void 0:o.users.length,i,"internal-error");let a=o.users[0];e._notifyReloadListener(a);let l=(null==(t=a.providerUserInfo)?void 0:t.length)?Y(a.providerUserInfo):[],u=(n=e.providerData,r=l,[...n.filter(e=>!r.some(t=>t.providerId===e.providerId)),...r]),h=e.isAnonymous,c=!(e.email&&a.passwordHash)&&!(null==u?void 0:u.length);Object.assign(e,{uid:a.localId,displayName:a.displayName||null,photoURL:a.photoUrl||null,email:a.email||null,emailVerified:a.emailVerified||!1,phoneNumber:a.phoneNumber||null,tenantId:a.tenantId||null,providerData:u,metadata:new H(a.createdAt,a.lastLoginAt),isAnonymous:!!h&&c})}async function K(e){let t=(0,i.Ku)(e);await G(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function Y(e){return e.map(e=>{var{providerId:t}=e,n=o(e,["providerId"]);
16return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}})}async function Q(e,t){let n=await k(e,{},async()=>{let n=(0,i.Am)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:s}=e.config,o=await P(e,r,"/v1/token",`key=${s}`),a=await e._getAdditionalHeaders();a["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:a,body:n};return e.emulatorConfig&&(0,i.zJ)(e.emulatorConfig.host)&&(l.credentials="include"),T.fetch()(o,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function X(e,t){return A(e,"POST","/v2/accounts:revokeToken",x(e,t))}class J{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){y(e.idToken,"internal-error"),y(void 0!==e.idToken,"internal-error"),y(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):$(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){y(0!==e.length,"internal-error");let t=$(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(y(this.refreshToken,e,"user-token-expired"),this.refreshToken)?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){let{accessToken:n,refreshToken:r,expiresIn:i}=await Q(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){let{refreshToken:n,accessToken:r,expirationTime:i}=t,s=new J;return n&&(y("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),r&&(y("string"==typeof r,"internal-error",{appName:e}),s.accessToken=r),i&&(y("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new J,this.toJSON())}_performRefresh(){return v("not implemented")}}function Z(e,t){y("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ee{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=o(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new W(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new H(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let t=await z(this,this.stsTokenManager.getToken(this.auth,e));return y(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return V(this,e)}reload(){return K(this)}_assign(e){this!==e&&(y(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map(e=>Object.assign({},e)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new ee(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){y(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await G(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){if((0,r.xZ)(this.auth.app))return Promise.reject(m(this.auth));let e=await this.getIdToken();return await z(this,j(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
16nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>Object.assign({},e)),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var n,r,i,s,o,a,l,u;let h=null!=(n=t.displayName)?n:void 0,c=null!=(r=t.email)?r:void 0,d=null!=(i=t.phoneNumber)?i:void 0,f=null!=(s=t.photoURL)?s:void 0,p=null!=(o=t.tenantId)?o:void 0,m=null!=(a=t._redirectEventId)?a:void 0,g=null!=(l=t.createdAt)?l:void 0,v=null!=(u=t.lastLoginAt)?u:void 0,{uid:_,emailVerified:w,isAnonymous:b,providerData:E,stsTokenManager:T}=t;y(_&&T,e,"internal-error");let S=J.fromJSON(this.name,T);y("string"==typeof _,e,"internal-error"),Z(h,e.name),Z(c,e.name),y("boolean"==typeof w,e,"internal-error"),y("boolean"==typeof b,e,"internal-error"),Z(d,e.name),Z(f,e.name),Z(p,e.name),Z(m,e.name),Z(g,e.name),Z(v,e.name);let C=new ee({uid:_,auth:e,email:c,emailVerified:w,displayName:h,isAnonymous:b,photoURL:f,phoneNumber:d,tenantId:p,stsTokenManager:S,createdAt:g,lastLoginAt:v});return E&&Array.isArray(E)&&(C.providerData=E.map(e=>Object.assign({},e))),m&&(C._redirectEventId=m),C}static async _fromIdTokenResponse(e,t,n=!1){let r=new J;r.updateFromServerResponse(t);let i=new ee({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await G(i),i}static async _fromGetAccountInfoResponse(e,t,n){let r=t.users[0];y(void 0!==r.localId,"internal-error");let i=void 0!==r.providerUserInfo?Y(r.providerUserInfo):[],s=!(r.email&&r.passwordHash)&&!(null==i?void 0:i.length),o=new J;o.updateFromIdToken(n);let a=new ee({uid:r.localId,auth:e,stsTokenManager:o,isAnonymous:s});return Object.assign(a,{uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:i,metadata:new H(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!(null==i?void 0:i.length)}),a}}let et=new Map;function en(e){var t,n;t="Expected a class definition",e instanceof Function||v(t);let r=et.get(e);return r?(n="Instance stored in cache mismatched with class",r instanceof e||v(n)):(r=new e,et.set(e,r)),r}class er{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}function ei(e,t,n){return`firebase:${e}:${t}:${n}`}er.type="NONE";class es{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;let{config:r,name:i}=this.auth;this.fullUserKey=ei(this.userKey,r.apiKey,i),this.fullPersistenceKey=ei("persistence",r.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if("string"==typeof e){let t=await F(this.auth,{idToken:e}).catch(()=>void 0);return t?ee._fromGetAccountInfoResponse(this.auth,t,e):null}return ee._fromJSON(this.auth,e)}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;let t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,n="authUser"){if(!t.length)return new es(en(er),e,n);let r=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),i=r[0]||en(er),s=ei(n,e.config.apiKey,e.name),o=null;for(let n of t)try{let t=await n._get(s);if(t){let r;if("string"==typeof t){let n=await F(e,{idToken:t}).catch(()=>void 0);if(!n)break;r=await ee._fromGetAccountInfoResponse(e,n,t)}else r=ee._fromJSON(e,t);n!==i&&(o=r),i=n;break}}catch(e){}let a=r.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&a.length&&(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch(e){}}))),new es(i,e,n)}}function eo(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";{if(eh(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(ea(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ed(t))return"Blackberry";if(ef(t))return"Webos";if(el(t))return"Safari";
16if((t.includes("chrome/")||eu(t))&&!t.includes("edge/"))return"Chrome";if(ec(t))return"Android";let n=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if((null==n?void 0:n.length)===2)return n[1]}return"Other"}function ea(e=(0,i.ZQ)()){return/firefox\//i.test(e)}function el(e=(0,i.ZQ)()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function eu(e=(0,i.ZQ)()){return/crios\//i.test(e)}function eh(e=(0,i.ZQ)()){return/iemobile/i.test(e)}function ec(e=(0,i.ZQ)()){return/android/i.test(e)}function ed(e=(0,i.ZQ)()){return/blackberry/i.test(e)}function ef(e=(0,i.ZQ)()){return/webos/i.test(e)}function ep(e=(0,i.ZQ)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function em(e=(0,i.ZQ)()){return ep(e)||ec(e)||ef(e)||ed(e)||/windows phone/i.test(e)||eh(e)}function eg(e,t=[]){let n;switch(e){case"Browser":n=eo((0,i.ZQ)());break;case"Worker":n=`${eo((0,i.ZQ)())}-${e}`;break;default:n=e}let s=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${r.MF}/${s}`}class ey{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let n=t=>new Promise((n,r)=>{try{let r=e(t);n(r)}catch(e){r(e)}});n.onAbort=t,this.queue.push(n);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}async function ev(e,t={}){return A(e,"GET","/v2/passwordPolicy",x(e,t))}class e_{constructor(e){var t,n,r,i;let s=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=null!=(t=s.minPasswordLength)?t:6,s.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=s.maxPasswordLength),void 0!==s.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=s.containsLowercaseCharacter),void 0!==s.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=s.containsUppercaseCharacter),void 0!==s.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=s.containsNumericCharacter),void 0!==s.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=s.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=null!=(r=null==(n=e.allowedNonAlphanumericCharacters)?void 0:n.join(""))?r:"",this.forceUpgradeOnSignin=null!=(i=e.forceUpgradeOnSignin)&&i,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,n,r,i,s,o;let a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=null==(t=a.meetsMinPasswordLength)||t),a.isValid&&(a.isValid=null==(n=a.meetsMaxPasswordLength)||n),a.isValid&&(a.isValid=null==(r=a.containsLowercaseLetter)||r),a.isValid&&(a.isValid=null==(i=a.containsUppercaseLetter)||i),a.isValid&&(a.isValid=null==(s=a.containsNumericCharacter)||s),a.isValid&&(a.isValid=null==(o=a.containsNonAlphanumericCharacter)||o),a}validatePasswordLengthOptions(e,t){let n=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;n&&(t.meetsMinPasswordLength=e.length>=n),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){let n;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let r=0;r<e.length;r++)n=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,n>="a"&&n<="z",n>="A"&&n<="Z",n>="0"&&n<="9",this.allowedNonAlphanumericCharacters.includes(n))}updatePasswordCharacterOptionsStatuses(e,t,n,r,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=n)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class ew{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new eE(this),this.idTokenSubscription=new eE(this),this.beforeStateQueue=new ey(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=u,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=en(t)),this._initializationPromise=this.queue(async()=>{var n,r,i;if(!this._deleted){if(this.persistenceManager=await es.create(this,e),null==(n=this._resolvePersistenceManagerAvailable)||n.call(this),!this._deleted){if(null==(r=this._popupRedirectResolver)?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null==(i=this.currentUser)?void 0:i.uid)||null,this._deleted||(this._isInitialized=!0)}}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let e=await this.assertedPersistence.getCurrentUser();if(this.currentUser||e){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUserFromIdToken(e){try{let t=await F(this,{idToken:e}),n=await ee._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(n)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){var t;if((0,r.xZ)(this.app)){let e=this.app.settings.authIdToken;return e?new Promise(t=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(e).then(t,t))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),i=n,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let n=null==(t=this.redirectUser)?void 0:t._redirectEventId,r=null==i?void 0:i._redirectEventId,o=await this.tryRedirectSignIn(e);(!n||n===r)&&(null==o?void 0:o.user)&&(i=o.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);
16if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(e){i=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return(y(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId)?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await G(e)}catch(e){if((null==e?void 0:e.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;let e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if((0,r.xZ)(this.app))return Promise.reject(m(this));let t=e?(0,i.Ku)(e):null;return t&&y(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&y(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return(0,r.xZ)(this.app)?Promise.reject(m(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return(0,r.xZ)(this.app)?Promise.reject(m(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(en(e))})}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return null===this.tenantId?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=new e_(await ev(this));null===this.tenantId?this._projectPasswordPolicy=e:this._tenantPasswordPolicies[this.tenantId]=e}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new i.FA("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let n=this.onAuthStateChanged(()=>{n(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:await this.currentUser.getIdToken()};null!=this.tenantId&&(t.tenantId=this.tenantId),await X(this,t)}}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null==(e=this._currentUser)?void 0:e.toJSON()}}async _setRedirectUser(e,t){let n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&en(e)||this._popupRedirectResolver;y(t,this,"argument-error"),this.redirectPersistenceManager=await es.create(this,[en(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return(this._isInitialized&&await this.queue(async()=>{}),(null==(t=this._currentUser)?void 0:t._redirectEventId)===e)?this._currentUser:(null==(n=this.redirectUser)?void 0:n._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue(async()=>this.directlySetCurrentUser(e))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let n=null!=(t=null==(e=this.currentUser)?void 0:e.uid)?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};let i="function"==typeof t?t:t.next.bind(t),s=!1,o=this._isInitialized?Promise.resolve():this._initializationPromise;if(y(o,this,"internal-error"),o.then(()=>{s||i(this.currentUser)}),"function"==typeof t){let i=e.addObserver(t,n,r);return()=>{s=!0,i()}}{let n=e.addObserver(t);return()=>{s=!0,n()}}}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh(),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return y(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=eg(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;let t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);let n=await (null==(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;if((0,r.xZ)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let t=await (null==(e=this.appCheckServiceProvider.getImmediate({optional:!0}))?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){h.logLevel<=s.$b.WARN&&h.warn(`Auth (${r.MF}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function eb(e){return(0,i.Ku)(e)}class eE{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,i.tD)(e=>this.observer=e)}get next(){return y(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let eT={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function eS(e){return`__${e}${Math.floor(1e6*Math.random())}`}class eC{constructor(){this.enterprise=new eI}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class eI{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}let ex="NO_RECAPTCHA";class eA{constructor(e){this.type="recaptcha-enterprise",this.auth=eb(e)}async verify(e="verify",t=!1){async function n(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise(async(t,n)=>
16{M(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(r=>{if(void 0===r.recaptchaKey)n(Error("recaptcha Enterprise site key undefined"));else{let n=new L(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}}).catch(e=>{n(e)})})}function r(t,n,r){let i=window.grecaptcha;D(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{n(e)}).catch(()=>{n(ex)})}):r(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new eC().execute("siteKey",{action:"verify"}):new Promise((e,i)=>{n(this.auth).then(n=>{if(!t&&D(window.grecaptcha))r(n,e,i);else{var s;if("undefined"==typeof window)return void i(Error("RecaptchaVerifier is only supported in browser"));let t=eT.recaptchaEnterpriseScript;0!==t.length&&(t+=n),(s=t,eT.loadJS(s)).then(()=>{r(n,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function ek(e,t,n,r=!1,i=!1){let s,o=new eA(e);if(i)s=ex;else try{s=await o.verify(n)}catch(e){s=await o.verify(n,!0)}let a=Object.assign({},t);if("mfaSmsEnrollment"===n||"mfaSmsSignIn"===n){if("phoneEnrollmentInfo"in a){let e=a.phoneEnrollmentInfo.phoneNumber,t=a.phoneEnrollmentInfo.recaptchaToken;Object.assign(a,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in a){let e=a.phoneSignInInfo.recaptchaToken;Object.assign(a,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return a}return r?Object.assign(a,{captchaResp:s}):Object.assign(a,{captchaResponse:s}),Object.assign(a,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(a,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),a}async function eR(e,t,n,r,i){var s,o;if("EMAIL_PASSWORD_PROVIDER"===i)if(null==(s=e._getRecaptchaConfig())||!s.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))return r(e,t).catch(async i=>{if("auth/missing-recaptcha-token"!==i.code)return Promise.reject(i);{console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let i=await ek(e,t,n,"getOobCode"===n);return r(e,i)}});else{let i=await ek(e,t,n,"getOobCode"===n);return r(e,i)}if("PHONE_PROVIDER"!==i)return Promise.reject(i+" provider is not supported.");if(null==(o=e._getRecaptchaConfig())?void 0:o.isProviderEnabled("PHONE_PROVIDER")){let i=await ek(e,t,n);return r(e,i).catch(async i=>{var s;if((null==(s=e._getRecaptchaConfig())?void 0:s.getProviderEnforcementState("PHONE_PROVIDER"))==="AUDIT"&&("auth/missing-recaptcha-token"===i.code||"auth/invalid-app-credential"===i.code)){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);let i=await ek(e,t,n,!1,!0);return r(e,i)}return Promise.reject(i)})}{let i=await ek(e,t,n,!1,!0);return r(e,i)}}async function eP(e){let t=eb(e),n=new L(await M(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==t.tenantId?t._agentRecaptchaConfig=n:t._tenantRecaptchaConfigs[t.tenantId]=n,n.isAnyProviderEnabled()&&new eA(t).verify()}function eN(e){let t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function eO(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class eD{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return v("not implemented")}_getIdTokenResponse(e){return v("not implemented")}_linkToIdToken(e,t){return v("not implemented")}_getReauthenticationResolver(e){return v("not implemented")}}async function eL(e,t){return A(e,"POST","/v1/accounts:signUp",t)}async function eM(e,t){return R(e,"POST","/v1/accounts:signInWithPassword",x(e,t))}async function ej(e,t){return A(e,"POST","/v1/accounts:sendOobCode",x(e,t))}async function eF(e,t){return ej(e,t)}async function eU(e,t){return R(e,"POST","/v1/accounts:signInWithEmailLink",x(e,t))}async function eV(e,t){return R(e,"POST","/v1/accounts:signInWithEmailLink",x(e,t))}class eB extends eD{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new eB(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new eB(e,t,"emailLink",n)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);else if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return eR(e,{returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signInWithPassword",eM,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return eU(e,{email:this._email,oobCode:this._password});default:d(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return eR(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",eL,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return eV(e,{idToken:t,email:this._email,oobCode:this._password});default:d(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function eq(e,t){return R(e,"POST","/v1/accounts:signInWithIdp",x(e,t))}class e$ extends eD{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new e$(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&
16(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):d("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t="string"==typeof e?JSON.parse(e):e,{providerId:n,signInMethod:r}=t,i=o(t,["providerId","signInMethod"]);if(!n||!r)return null;let s=new e$(n,r);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(e){return eq(e,this.buildRequest())}_linkToIdToken(e,t){let n=this.buildRequest();return n.idToken=t,eq(e,n)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,eq(e,t)}buildRequest(){let e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=(0,i.Am)(t)}return e}}async function ez(e,t){return A(e,"POST","/v1/accounts:sendVerificationCode",x(e,t))}async function eW(e,t){return R(e,"POST","/v1/accounts:signInWithPhoneNumber",x(e,t))}async function eH(e,t){let n=await R(e,"POST","/v1/accounts:signInWithPhoneNumber",x(e,t));if(n.temporaryProof)throw O(e,"account-exists-with-different-credential",n);return n}let eG={USER_NOT_FOUND:"user-not-found"};async function eK(e,t){return R(e,"POST","/v1/accounts:signInWithPhoneNumber",x(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),eG)}class eY extends eD{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new eY({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new eY({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return eW(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return eH(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return eK(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}toJSON(){let e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));let{verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}=e;return n||t||r||i?new eY({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}):null}}class eQ{constructor(e){var t,n,r,s,o,a;let l=(0,i.I9)((0,i.hp)(e)),u=null!=(t=l.apiKey)?t:null,h=null!=(n=l.oobCode)?n:null,c=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!=(r=l.mode)?r:null);y(u&&h&&c,"argument-error"),this.apiKey=u,this.operation=c,this.code=h,this.continueUrl=null!=(s=l.continueUrl)?s:null,this.languageCode=null!=(o=l.lang)?o:null,this.tenantId=null!=(a=l.tenantId)?a:null}static parseLink(e){let t=function(e){let t=(0,i.I9)((0,i.hp)(e)).link,n=t?(0,i.I9)((0,i.hp)(t)).deep_link_id:null,r=(0,i.I9)((0,i.hp)(e)).deep_link_id;return(r?(0,i.I9)((0,i.hp)(r)).link:null)||r||n||t||e}(e);try{return new eQ(t)}catch(e){return null}}}class eX{constructor(){this.providerId=eX.PROVIDER_ID}static credential(e,t){return eB._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let n=eQ.parseLink(t);return y(n,"argument-error"),eB._fromEmailAndCode(e,n.code,n.tenantId)}}eX.PROVIDER_ID="password",eX.EMAIL_PASSWORD_SIGN_IN_METHOD="password",eX.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class eJ{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class eZ extends eJ{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class e0 extends eZ{constructor(){super("facebook.com")}static credential(e){return e$._fromParams({providerId:e0.PROVIDER_ID,signInMethod:e0.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e0.credentialFromTaggedObject(e)}static credentialFromError(e){return e0.credentialFromTaggedObject(e.customData||{})}
16static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e0.credential(e.oauthAccessToken)}catch(e){return null}}}e0.FACEBOOK_SIGN_IN_METHOD="facebook.com",e0.PROVIDER_ID="facebook.com";class e1 extends eZ{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return e$._fromParams({providerId:e1.PROVIDER_ID,signInMethod:e1.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return e1.credentialFromTaggedObject(e)}static credentialFromError(e){return e1.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return e1.credential(t,n)}catch(e){return null}}}e1.GOOGLE_SIGN_IN_METHOD="google.com",e1.PROVIDER_ID="google.com";class e2 extends eZ{constructor(){super("github.com")}static credential(e){return e$._fromParams({providerId:e2.PROVIDER_ID,signInMethod:e2.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e2.credentialFromTaggedObject(e)}static credentialFromError(e){return e2.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e2.credential(e.oauthAccessToken)}catch(e){return null}}}e2.GITHUB_SIGN_IN_METHOD="github.com",e2.PROVIDER_ID="github.com";class e3 extends eZ{constructor(){super("twitter.com")}static credential(e,t){return e$._fromParams({providerId:e3.PROVIDER_ID,signInMethod:e3.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return e3.credentialFromTaggedObject(e)}static credentialFromError(e){return e3.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return e3.credential(t,n)}catch(e){return null}}}async function e5(e,t){return R(e,"POST","/v1/accounts:signUp",x(e,t))}e3.TWITTER_SIGN_IN_METHOD="twitter.com",e3.PROVIDER_ID="twitter.com";class e6{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){return new e6({user:await ee._fromIdTokenResponse(e,n,r),providerId:e4(n),_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){return await e._updateTokensIfNecessary(n,!0),new e6({user:e,providerId:e4(n),_tokenResponse:n,operationType:t})}}function e4(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class e8 extends i.g{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,e8.prototype),this.customData={appName:e.name,tenantId:null!=(i=e.tenantId)?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new e8(e,t,n,r)}}function e7(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch(n=>{if("auth/multi-factor-auth-required"===n.code)throw e8._fromErrorAndOperation(e,n,t,r);throw n})}async function e9(e,t,n=!1){let r=await z(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return e6._forOperation(e,"link",r)}async function te(e,t,n=!1){let{auth:i}=e;if((0,r.xZ)(i.app))return Promise.reject(m(i));let s="reauthenticate";try{let r=await z(e,e7(i,s,t,e),n);y(r.idToken,i,"internal-error");let o=q(r.idToken);y(o,i,"internal-error");let{sub:a}=o;return y(e.uid===a,i,"user-mismatch"),e6._forOperation(e,s,r)}catch(e){throw(null==e?void 0:e.code)==="auth/user-not-found"&&d(i,"user-mismatch"),e}}async function tt(e,t,n=!1){if((0,r.xZ)(e.app))return Promise.reject(m(e));let i="signIn",s=await e7(e,i,t),o=await e6._fromIdTokenResponse(e,i,s);return n||await e._updateCurrentUser(o.user),o}async function tn(e,t){return tt(eb(e),t)}class tr{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?ti._fromServerResponse(e,t):"totpInfo"in t?ts._fromServerResponse(e,t):d(e,"internal-error")}}class ti extends tr{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new ti(t)}}class ts extends tr{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new ts(t)}}async function to(e){let t=eb(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function ta(e,t,n){var r;let i=eb(e),s={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};
16n&&(y((null==(r=n.url)?void 0:r.length)>0,i,"invalid-continue-uri"),y(void 0===n.dynamicLinkDomain||n.dynamicLinkDomain.length>0,i,"invalid-dynamic-link-domain"),y(void 0===n.linkDomain||n.linkDomain.length>0,i,"invalid-hosting-link-domain"),s.continueUrl=n.url,s.dynamicLinkDomain=n.dynamicLinkDomain,s.linkDomain=n.linkDomain,s.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(y(n.iOS.bundleId.length>0,i,"missing-ios-bundle-id"),s.iOSBundleId=n.iOS.bundleId),n.android&&(y(n.android.packageName.length>0,i,"missing-android-pkg-name"),s.androidInstallApp=n.android.installApp,s.androidMinimumVersionCode=n.android.minimumVersion,s.androidPackageName=n.android.packageName)),await eR(i,s,"getOobCode",eF,"EMAIL_PASSWORD_PROVIDER")}async function tl(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(m(e));let i=eb(e),s=eR(i,{returnSecureToken:!0,email:t,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",e5,"EMAIL_PASSWORD_PROVIDER"),o=await s.catch(t=>{throw"auth/password-does-not-meet-requirements"===t.code&&to(e),t}),a=await e6._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(a.user),a}function tu(e,t,n){return(0,r.xZ)(e.app)?Promise.reject(m(e)):tn((0,i.Ku)(e),eX.credential(t,n)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&to(e),t})}function th(e,t,n,r){return(0,i.Ku)(e).onAuthStateChanged(t,n,r)}function tc(e,t){return A(e,"POST","/v2/accounts/mfaEnrollment:start",x(e,t))}new WeakMap;let td="__sak";class tf{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(td,"1"),this.storage.removeItem(td),Promise.resolve(!0)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class tp extends tf{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=em(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,n)=>{this.notifyListeners(e,n)});let n=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},s=this.storage.getItem(n);(0,i.lT)()&&10===document.documentMode&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,10):r()}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!0)})},1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}function tm(e){var t,n;let r=e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),i=RegExp(`${r}=([^;]+)`);return null!=(n=null==(t=document.cookie.match(i))?void 0:t[1])?n:null}function tg(e){let t="http:"===window.location.protocol;return`${t?"__dev_":"__HOST-"}FIREBASE_${e.split(":")[3]}`}tp.type="LOCAL";class ty{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){var e;return("boolean"!=typeof isSecureContext||!!isSecureContext)&&"undefined"!=typeof navigator&&"undefined"!=typeof document&&(null==(e=navigator.cookieEnabled)||e)}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=tg(e);if(window.cookieStore){let e=await window.cookieStore.get(t);return null==e?void 0:e.value}return tm(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let t=tg(e);document.cookie=`${t}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;
16Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>void 0)}_addListener(e,t){if(!this._isAvailable())return;let n=tg(e);if(window.cookieStore){let e=e=>{let r=e.changed.find(e=>e.name===n);r&&t(r.value),e.deleted.find(e=>e.name===n)&&t(null)};return this.listenerUnsubscribes.set(t,()=>window.cookieStore.removeEventListener("change",e)),window.cookieStore.addEventListener("change",e)}let r=tm(n),i=setInterval(()=>{let e=tm(n);e!==r&&(t(e),r=e)},1e3);this.listenerUnsubscribes.set(t,()=>clearInterval(i))}_removeListener(e,t){let n=this.listenerUnsubscribes.get(t);n&&(n(),this.listenerUnsubscribes.delete(t))}}ty.type="COOKIE";class tv extends tf{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}tv.type="SESSION";class t_{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(t=>t.isListeningto(e));if(t)return t;let n=new t_(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:n,data:r}=e.data,i=this.handlersMap[n];if(!(null==i?void 0:i.size))return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:n});let s=Array.from(i).map(async t=>t(e.origin,r)),o=await Promise.all(s.map(async e=>{try{let t=await e;return{fulfilled:!0,value:t}}catch(e){return{fulfilled:!1,reason:e}}}));e.ports[0].postMessage({status:"done",eventId:t,eventType:n,response:o})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function tw(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}t_.receivers=[];class tb{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,n=50){let r,i,s="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((o,a)=>{let l=tw("",20);s.port1.start();let u=setTimeout(()=>{a(Error("unsupported_event"))},n);i={messageChannel:s,onMessage(e){if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(u),r=setTimeout(()=>{a(Error("timeout"))},3e3);break;case"done":clearTimeout(r),o(e.data.response);break;default:clearTimeout(u),clearTimeout(r),a(Error("invalid_response"))}}},this.handlers.add(i),s.port1.addEventListener("message",i.onMessage),this.target.postMessage({eventType:e,eventId:l,data:t},[s.port2])}).finally(()=>{i&&this.removeMessageHandler(i)})}}function tE(){return window}function tT(){return void 0!==tE().WorkerGlobalScope&&"function"==typeof tE().importScripts}async function tS(){if(!(null==navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}let tC="firebaseLocalStorageDb",tI="firebaseLocalStorage",tx="fbase_key";class tA{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}}function tk(e,t){return e.transaction([tI],t?"readwrite":"readonly").objectStore(tI)}function tR(){let e=indexedDB.open(tC,1);return new Promise((t,n)=>{e.addEventListener("error",()=>{n(e.error)}),e.addEventListener("upgradeneeded",()=>{let t=e.result;try{t.createObjectStore(tI,{keyPath:tx})}catch(e){n(e)}}),e.addEventListener("success",async()=>{let n=e.result;n.objectStoreNames.contains(tI)?t(n):(n.close(),await new tA(indexedDB.deleteDatabase(tC)).toPromise(),t(await tR()))})})}
16async function tP(e,t,n){return new tA(tk(e,!0).put({[tx]:t,value:n})).toPromise()}async function tN(e,t){let n=tk(e,!1).get(t),r=await new tA(n).toPromise();return void 0===r?null:r.value}function tO(e,t){return new tA(tk(e,!0).delete(t)).toPromise()}class tD{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then(()=>{},()=>{})}async _openDb(){return this.db||(this.db=await tR()),this.db}async _withRetries(e){let t=0;for(;;)try{let t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return tT()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=t_._getInstance(tT()?self:null),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){var e,t;if(this.activeServiceWorker=await tS(),!this.activeServiceWorker)return;this.sender=new tb(this.activeServiceWorker);let n=await this.sender._send("ping",{},800);n&&(null==(e=n[0])?void 0:e.fulfilled)&&(null==(t=n[0])?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null==(t=null==navigator?void 0:navigator.serviceWorker)?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(e){}}async _isAvailable(){try{if(!indexedDB)return!1;let e=await tR();return await tP(e,td,"1"),await tO(e,td),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(n=>tP(n,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>tN(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>tO(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new tA(tk(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],n=new Set;if(0!==e.length)for(let{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(let e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let n=this.listeners[e];if(n)for(let e of Array.from(n))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}function tL(e,t){return A(e,"POST","/v2/accounts/mfaSignIn:start",x(e,t))}tD.type="LOCAL",eS("rcb"),new b(3e4,6e4);let tM="recaptcha";async function tj(e,t,n){var r;if(!e._getRecaptchaConfig())try{await eP(e)}catch(e){console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let i;if(i="string"==typeof t?{phoneNumber:t}:t,"session"in i){let t=i.session;if("phoneNumber"in i){y("enroll"===t.type,e,"internal-error");let r={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===ex){y((null==n?void 0:n.type)===tM,e,"argument-error");let r=await tF(e,t,n);return tc(e,r)}return tc(e,t)}
16,o=eR(e,r,"mfaSmsEnrollment",s,"PHONE_PROVIDER");return(await o.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{y("signin"===t.type,e,"internal-error");let s=(null==(r=i.multiFactorHint)?void 0:r.uid)||i.multiFactorUid;y(s,e,"missing-multi-factor-info");let o={mfaPendingCredential:t.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===ex){y((null==n?void 0:n.type)===tM,e,"argument-error");let r=await tF(e,t,n);return tL(e,r)}return tL(e,t)},l=eR(e,o,"mfaSmsSignIn",a,"PHONE_PROVIDER");return(await l.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{let t={phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"},r=async(e,t)=>{if(t.captchaResponse===ex){y((null==n?void 0:n.type)===tM,e,"argument-error");let r=await tF(e,t,n);return ez(e,r)}return ez(e,t)},s=eR(e,t,"sendVerificationCode",r,"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{null==n||n._reset()}}async function tF(e,t,n){y(n.type===tM,e,"argument-error");let r=await n.verify();y("string"==typeof r,e,"argument-error");let i=Object.assign({},t);if("phoneEnrollmentInfo"in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,n=i.phoneEnrollmentInfo.clientType,s=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:r,captchaResponse:t,clientType:n,recaptchaVersion:s}}),i}if(!("phoneSignInInfo"in i))return Object.assign(i,{recaptchaToken:r}),i;{let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,n=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:e,clientType:t,recaptchaVersion:n}}),i}}class tU{constructor(e){this.providerId=tU.PROVIDER_ID,this.auth=eb(e)}verifyPhoneNumber(e,t){return tj(this.auth,e,(0,i.Ku)(t))}static credential(e,t){return eY._fromVerification(e,t)}static credentialFromResult(e){return tU.credentialFromTaggedObject(e)}static credentialFromError(e){return tU.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:n}=e;return t&&n?eY._fromTokenResponse(t,n):null}}function tV(e,t){return t?en(t):(y(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}tU.PROVIDER_ID="phone",tU.PHONE_SIGN_IN_METHOD="phone";class tB extends eD{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return eq(e,this._buildIdpRequest())}_linkToIdToken(e,t){return eq(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return eq(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function tq(e){return tt(e.auth,new tB(e),e.bypassAuthState)}function t$(e){let{auth:t,user:n}=e;return y(n,t,"internal-error"),te(n,new tB(e),e.bypassAuthState)}async function tz(e){let{auth:t,user:n}=e;return y(n,t,"internal-error"),e9(n,new tB(e),e.bypassAuthState)}class tW{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:n,postBody:r,tenantId:i,error:s,type:o}=e;if(s)return void this.reject(s);let a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return tq;case"linkViaPopup":case"linkViaRedirect":return tz;case"reauthViaPopup":case"reauthViaRedirect":return t$;default:d(this.auth,"internal-error")}}resolve(e){var t,n;t=this.pendingPromise,n="Pending promise was never set",t||v(n),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,n;t=this.pendingPromise,n="Pending promise was never set",t||v(n),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let tH=new b(2e3,1e4);async function tG(e,t,n){if((0,r.xZ)(e.app))return Promise.reject(f(e,"operation-not-supported-in-this-environment"));let i=eb(e);if(!(t instanceof eJ))throw eJ.name!==t.constructor.name&&d(e,"argument-error"),p(e,"argument-error",`Type of ${t.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`);let s=tV(i,n);return new tK(i,"signInViaPopup",t,s).executeNotNull()}
16class tK extends tW{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,tK.currentPopupAction&&tK.currentPopupAction.cancel(),tK.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return y(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||v(t);let n=tw();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],n),this.authWindow.associatedEvent=n,this.resolver._originValidation(this.auth).catch(e=>{this.reject(e)}),this.resolver._isIframeWebStorageSupported(this.auth,e=>{e||this.reject(f(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return(null==(e=this.authWindow)?void 0:e.associatedEvent)||null}cancel(){this.reject(f(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,tK.currentPopupAction=null}pollUserCancellation(){let e=()=>{var t,n;if(null==(n=null==(t=this.authWindow)?void 0:t.window)?void 0:n.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(f(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,tH.get())};e()}}tK.currentPopupAction=null;let tY=new Map;class tQ extends tW{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=tY.get(this.auth._key());if(!e){try{let t=await tX(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}tY.set(this.auth._key(),e)}return this.bypassAuthState||tY.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"===e.type)return void this.resolve(null);if(e.eventId){let t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function tX(e,t){var n;let r=ei("pendingRedirect",(n=t).config.apiKey,n.name),i=en(e._redirectPersistence);if(!await i._isAvailable())return!1;let s=await i._get(r)==="true";return await i._remove(r),s}function tJ(e,t){tY.set(e._key(),t)}async function tZ(e,t,n=!1){if((0,r.xZ)(e.app))return Promise.reject(m(e));let i=eb(e),s=tV(i,t),o=new tQ(i,s,n),a=await o.execute();return a&&!n&&(delete a.user._redirectEventId,await i._persistUserIfCurrent(a.user),await i._setRedirectUser(null,t)),a}class t0{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach(n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return t2(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!t2(e)){let r=(null==(n=e.error.code)?void 0:n.split("auth/")[1])||"internal-error";t.onError(f(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(t1(e))}saveEventToCache(e){this.cachedEventUids.add(t1(e)),this.lastProcessedEventTime=Date.now()}}function t1(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function t2({type:e,error:t}){return"unknown"===e&&(null==t?void 0:t.code)==="auth/no-auth-event"}async function t3(e,t={}){return A(e,"GET","/v1/projects",t)}let t5=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,t6=/^https?/;async function t4(e){if(e.config.emulator)return;let{authorizedDomains:t}=await t3(e);for(let e of t)try{if(function(e){let t=_(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){let i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!t6.test(n))return!1;if(t5.test(e))return r===e;let i=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}(e))return}catch(e){}d(e,"unauthorized-domain")}
16let t8=new b(3e4,6e4);function t7(){let e=tE().___jsl;if(null==e?void 0:e.H){for(let t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}}let t9=null,ne=new b(5e3,15e3),nt={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},nn=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function nr(e){let t=await (t9=t9||new Promise((t,n)=>{var r,i,s,o;function a(){t7(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{t7(),n(f(e,"network-request-failed"))},timeout:t8.get()})}if(null==(i=null==(r=tE().gapi)?void 0:r.iframes)?void 0:i.Iframe)t(gapi.iframes.getContext());else if(null==(s=tE().gapi)?void 0:s.load)a();else{let t=eS("iframefcb");return tE()[t]=()=>{gapi.load?a():n(f(e,"network-request-failed"))},(o=`${eT.gapiScript}?onload=${t}`,eT.loadJS(o)).catch(e=>n(e))}}).catch(e=>{throw t9=null,e})),n=tE().gapi;return y(n,e,"internal-error"),t.open({where:document.body,url:function(e){let t=e.config;y(t.authDomain,e,"auth-domain-config-required");let n=t.emulator?E(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,s={apiKey:t.apiKey,appName:e.name,v:r.MF},o=nn.get(e.config.apiHost);o&&(s.eid=o);let a=e._getFrameworks();return a.length&&(s.fw=a.join(",")),`${n}?${(0,i.Am)(s).slice(1)}`}(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:nt,dontclear:!0},t=>new Promise(async(n,r)=>{await t.restyle({setHideOnLeave:!1});let i=f(e,"network-request-failed"),s=tE().setTimeout(()=>{r(i)},ne.get());function o(){tE().clearTimeout(s),n(t)}t.ping(o).then(o,()=>{r(i)})}))}let ni={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class ns{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let no=encodeURIComponent("fac");async function na(e,t,n,s,o,a){y(e.config.authDomain,e,"auth-domain-config-required"),y(e.config.apiKey,e,"invalid-api-key");let l={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:s,v:r.MF,eventId:o};if(t instanceof eJ)for(let[n,r]of(t.setDefaultLanguage(e.languageCode),l.providerId=t.providerId||"",(0,i.Im)(t.getCustomParameters())||(l.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(a||{})))l[n]=r;if(t instanceof eZ){let e=t.getScopes().filter(e=>""!==e);e.length>0&&(l.scopes=e.join(","))}for(let t of(e.tenantId&&(l.tid=e.tenantId),Object.keys(l)))void 0===l[t]&&delete l[t];let u=await e._getAppCheckToken(),h=u?`#${no}=${encodeURIComponent(u)}`:"";return`${function({config:e}){return e.emulator?E(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${(0,i.Am)(l).slice(1)}${h}`}let nl="webStorageSupport";class nu{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=tv,this._completeRedirectFn=tZ,this._overrideRedirectResult=tJ}async _openPopup(e,t,n,r){var s,o,a;o=null==(s=this.eventManagers[e._key()])?void 0:s.manager,a="_initialize() not called before _openPopup()",o||v(a);let l=await na(e,t,n,_(),r);return function(e,t,n,r=500,s=600){let o=Math.max((window.screen.availHeight-s)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),l="",u=Object.assign(Object.assign({},ni),{width:r.toString(),height:s.toString(),top:o,left:a}),h=(0,i.ZQ)().toLowerCase();n&&(l=eu(h)?"_blank":n),ea(h)&&(t=t||"http://localhost",u.scrollbars="yes");let c=Object.entries(u).reduce((e,[t,n])=>`${e}${t}=${n},`,"");if(function(e=(0,i.ZQ)()){var t;return ep(e)&&!!(null==(t=window.navigator)?void 0:t.standalone)}(h)&&"_self"!==l)return function(e,t){let n=document.createElement("a");n.href=e,n.target=t;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",l),new ns(null);let d=window.open(t||"",l,c);y(d,e,"popup-blocked");try{d.focus()}catch(e){}return new ns(d)}
16(e,l,tw())}async _openRedirect(e,t,n,r){var i;return await this._originValidation(e),i=await na(e,t,n,_(),r),tE().location.href=i,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var n;let{manager:e,promise:r}=this.eventManagers[t];return e?Promise.resolve(e):(n="If manager is not set, promise should be",r||v(n),r)}let r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){let t=await nr(e),n=new t0(e);return t.register("authEvent",t=>(y(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:n.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(nl,{type:nl},n=>{var r;let i=null==(r=null==n?void 0:n[0])?void 0:r[nl];void 0!==i&&t(!!i),d(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=t4(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return em()||el()||ep()}}class nh{constructor(e){this.factorId=e}_process(e,t,n){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,n);case"signin":return this._finalizeSignIn(e,t.credential);default:return v("unexpected MultiFactorSessionType")}}}class nc extends nh{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new nc(e)}_finalizeEnroll(e,t,n){return A(e,"POST","/v2/accounts/mfaEnrollment:finalize",x(e,{idToken:t,displayName:n,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}_finalizeSignIn(e,t){return A(e,"POST","/v2/accounts/mfaSignIn:finalize",x(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}}class nd{constructor(){}static assertion(e){return nc._fromCredential(e)}}nd.FACTOR_ID="phone";class nf{static assertionForEnrollment(e,t){return np._fromSecret(e,t)}static assertionForSignIn(e,t){return np._fromEnrollmentId(e,t)}static async generateSecret(e){var t,n;y(void 0!==(null==(t=e.user)?void 0:t.auth),"internal-error");let r=await A(n=e.user.auth,"POST","/v2/accounts/mfaEnrollment:start",x(n,{idToken:e.credential,totpEnrollmentInfo:{}}));return nm._fromStartTotpMfaEnrollmentResponse(r,e.user.auth)}}nf.FACTOR_ID="totp";class np extends nh{constructor(e,t,n){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=n}static _fromSecret(e,t){return new np(t,void 0,e)}static _fromEnrollmentId(e,t){return new np(t,e)}async _finalizeEnroll(e,t,n){return y(void 0!==this.secret,e,"argument-error"),A(e,"POST","/v2/accounts/mfaEnrollment:finalize",x(e,{idToken:t,displayName:n,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)}))}async _finalizeSignIn(e,t){y(void 0!==this.enrollmentId&&void 0!==this.otp,e,"argument-error");let n={verificationCode:this.otp};return A(e,"POST","/v2/accounts/mfaSignIn:finalize",x(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:n}))}}class nm{constructor(e,t,n,r,i,s,o){this.sessionInfo=s,this.auth=o,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=n,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(e,t){return new nm(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){var n;let r=!1;return(ng(e)||ng(t))&&(r=!0),r&&(ng(e)&&(e=(null==(n=this.auth.currentUser)?void 0:n.email)||"unknownuser"),ng(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}}function ng(e){return void 0===e||(null==e?void 0:e.length)===0}var ny="@firebase/auth",nv="1.10.8";class n_{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null==(e=this.auth.currentUser)?void 0:e.uid)||null}async getToken(e){return(this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser)?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;let t=this.auth.onIdTokenChanged(t=>{e((null==t?void 0:t.stsTokenManager.accessToken)||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){y(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let nw=(0,i.XA)("authIdTokenMaxAge")||300,nb=null;function nE(e=(0,r.Sx)()){let t=(0,r.j6)(e,"auth");if(t.isInitialized())return t.getImmediate();let n=function(e,t){let n=(0,r.j6)(e,"auth");if(n.isInitialized()){let e=n.getImmediate(),r=n.getOptions();if((0,i.bD)(r,null!=t?t:{}))return e;d(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:nu,persistence:[tD,tp,tv]}),s=(0,i.XA)("authTokenSyncURL");if(s&&"boolean"==typeof isSecureContext&&isSecureContext){let e=new URL(s,location.origin);if(location.origin===e.origin){let t,r=(t=e.toString(),async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>nw)return;let i=null==n?void 0:n.token;nb!==i&&(nb=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});(0,i.Ku)(n).beforeAuthStateChanged(r,()=>r(n.currentUser)),(0,i.Ku)(n).onIdTokenChanged(e=>r(e),void 0,void 0)}}let o=(0,i.Tj)("auth");return o&&function(e,t,n){let r=eb(e);
16y(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");let s=eN(t),{host:o,port:a}=function(e){let t=eN(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let e=i[1];return{host:e,port:eO(r.substr(e.length+1))}}{let[e,t]=r.split(":");return{host:e,port:eO(t)}}}(t),l=null===a?"":`:${a}`,u={url:`${s}//${o}${l}/`},h=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:!1})});if(!r._canInitEmulator){y(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),y((0,i.bD)(u,r.config.emulator)&&(0,i.bD)(h,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=u,r.emulatorConfig=h,r.settings.appVerificationDisabledForTesting=!0,(0,i.zJ)(o)?((0,i.gE)(`${s}//${o}${l}`),(0,i.P1)("Auth",!0)):function(){function e(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}(n,`http://${o}`),n}eT={loadJS:e=>new Promise((t,n)=>{let r=document.createElement("script");r.setAttribute("src",e),r.onload=t,r.onerror=e=>{let t=f("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(function(){var e,t;return null!=(t=null==(e=document.getElementsByTagName("head"))?void 0:e[0])?t:document})().appendChild(r)}),gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="},function(e){(0,r.om)(new a.uA("auth",(t,{options:n})=>{let r=t.getProvider("app").getImmediate(),i=t.getProvider("heartbeat"),s=t.getProvider("app-check-internal"),{apiKey:o,authDomain:a}=r.options;y(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});let l=new ew(r,i,s,{apiKey:o,authDomain:a,clientPlatform:e,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:eg(e)}),u=(null==n?void 0:n.persistence)||[],h=(Array.isArray(u)?u:[u]).map(en);return(null==n?void 0:n.errorMap)&&l._updateErrorMap(n.errorMap),l._initializeWithPersistence(h,null==n?void 0:n.popupRedirectResolver),l},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,n)=>{e.getProvider("auth-internal").initialize()})),(0,r.om)(new a.uA("auth-internal",e=>new n_(eb(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,r.KO)(ny,nv,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}(e)),(0,r.KO)(ny,nv,"esm2017")}("Browser")},6125:(e,t,n)=>{"use strict";n.d(t,{K:()=>m});var r=n(492),i=n(9670),s=n(8623),o=n(7200);let a=new Set(["auto","none","0"]);var l=n(6303),u=n(1927),h=n(2054),c=n(2744);let d=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;var f=n(1140),p=n(3432);class m extends l.h{constructor(e,t,n,r,i){super(e,t,n,r,i,!0)}readKeyframes(){let{unresolvedKeyframes:e,element:t,name:n}=this;if(!t||!t.current)return;super.readKeyframes();for(let n=0;n<e.length;n++){let r=e[n];if("string"==typeof r&&(r=r.trim(),(0,c.p)(r))){let i=function e(t,n,r=1){(0,u.V)(r<=4,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`);let[i,s]=function(e){let t=d.exec(e);if(!t)return[,];let[,n,r,i]=t;return[`--${null!=n?n:r}`,i]}(t);if(!i)return;let o=window.getComputedStyle(n).getPropertyValue(i);if(o){let e=o.trim();return(0,h.i)(e)?parseFloat(e):e}return(0,c.p)(s)?e(s,n,r+1):s}(r,t.current);void 0!==i&&(e[n]=i),n===e.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!i.$.has(n)||2!==e.length)return;let[r,s]=e,o=(0,p.n)(r),a=(0,p.n)(s);if(o!==a)if((0,f.E4)(o)&&(0,f.E4)(a))for(let t=0;t<e.length;t++){let n=e[t];"string"==typeof n&&(e[t]=parseFloat(n))}else this.needsMeasurement=!0}resolveNoneKeyframes(){let{unresolvedKeyframes:e,name:t}=this,n=[];for(let t=0;t<e.length;t++){var i;("number"==typeof(i=e[t])?0===i:null===i||"none"===i||"0"===i||(0,r.$)(i))&&n.push(t)}n.length&&function(e,t,n){let r,i=0;for(;i<e.length&&!r;){let t=e[i];"string"==typeof t&&!a.has(t)&&(0,s.V)(t).values.length&&(r=e[i]),i++}if(r&&n)for(let i of t)e[i]=(0,o.J)(n,r)}(e,n,t)}measureInitialState(){let{element:e,unresolvedKeyframes:t,name:n}=this;if(!e||!e.current)return;"height"===n&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=f.Hr[n](e.measureViewportBox(),window.getComputedStyle(e.current)),t[0]=this.measuredOrigin;let r=t[t.length-1];void 0!==r&&e.getValue(n,r).jump(r,!1)}measureEndState(){var e;let{element:t,name:n,unresolvedKeyframes:r}=this;if(!t||!t.current)return;let i=t.getValue(n);i&&i.jump(this.measuredOrigin,!1);let s=r.length-1,o=r[s];r[s]=f.Hr[n](t.measureViewportBox(),window.getComputedStyle(t.current)),null!==o&&void 0===this.finalKeyframe&&(this.finalKeyframe=o),(null==(e=this.removedTransforms)?void 0:e.length)&&this.removedTransforms.forEac
16h(([e,n])=>{t.getValue(e).set(n)}),this.resolveNoneKeyframes()}}},6150:(e,t,n)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return n(9730)}])},6245:(e,t,n)=>{e.exports=n(4880)},6303:(e,t,n)=>{"use strict";n.d(t,{h:()=>c,q:()=>h});var r=n(1140),i=n(6890);let s=new Set,o=!1,a=!1;function l(){if(a){let e=Array.from(s).filter(e=>e.needsMeasurement),t=new Set(e.map(e=>e.element)),n=new Map;t.forEach(e=>{let t=(0,r.W9)(e);t.length&&(n.set(e,t),e.render())}),e.forEach(e=>e.measureInitialState()),t.forEach(e=>{e.render();let t=n.get(e);t&&t.forEach(([t,n])=>{var r;null==(r=e.getValue(t))||r.set(n)})}),e.forEach(e=>e.measureEndState()),e.forEach(e=>{void 0!==e.suspendedScrollY&&window.scrollTo(0,e.suspendedScrollY)})}a=!1,o=!1,s.forEach(e=>e.complete()),s.clear()}function u(){s.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(a=!0)})}function h(){u(),l()}class c{constructor(e,t,n,r,i,s=!1){this.isComplete=!1,this.isAsync=!1,this.needsMeasurement=!1,this.isScheduled=!1,this.unresolvedKeyframes=[...e],this.onComplete=t,this.name=n,this.motionValue=r,this.element=i,this.isAsync=s}scheduleResolve(){this.isScheduled=!0,this.isAsync?(s.add(this),o||(o=!0,i.Gt.read(u),i.Gt.resolveKeyframes(l))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:e,name:t,element:n,motionValue:r}=this;for(let i=0;i<e.length;i++)if(null===e[i])if(0===i){let i=null==r?void 0:r.get(),s=e[e.length-1];if(void 0!==i)e[0]=i;else if(n&&t){let r=n.readValue(t,s);null!=r&&(e[0]=r)}void 0===e[0]&&(e[0]=s),r&&void 0===i&&r.set(e[0])}else e[i]=e[i-1]}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(){this.isComplete=!0,this.onComplete(this.unresolvedKeyframes,this.finalKeyframe),s.delete(this)}cancel(){this.isComplete||(this.isScheduled=!1,s.delete(this))}resume(){this.isComplete||this.scheduleResolve()}}},6311:(e,t,n)=>{"use strict";n.d(t,{K:()=>i});var r=n(2459);function i(e,t,n){let i=e.getProps();return(0,r.a)(i,t,void 0!==n?n:i.custom,e)}},6397:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{default:function(){return E},useLinkStatus:function(){return b}});let r=n(8781),i=n(3798),s=r._(n(1462)),o=n(9531),a=n(4291),l=n(9110),u=n(5332),h=n(4521),c=n(1878),d=n(1374),f=n(2587),p=n(
165810),m=n(4319);n(5213);let g=new Set;function y(e,t,n,r){if((0,a.isLocalURL)(t)){if(!r.bypassPrefetchedCheck){let i=t+"%"+n+"%"+(void 0!==r.locale?r.locale:"locale"in e?e.locale:void 0);if(g.has(i))return;g.add(i)}e.prefetch(t,n,r).catch(e=>{})}}function v(e){return"string"==typeof e?e:(0,l.formatUrl)(e)}let _=s.default.forwardRef(function(e,t){let n,r,{href:l,as:g,children:_,prefetch:w=null,passHref:b,replace:E,shallow:T,scroll:S,locale:C,onClick:I,onNavigate:x,onMouseEnter:A,onTouchStart:k,legacyBehavior:R=!1,...P}=e;n=_,R&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let N=s.default.useContext(c.RouterContext),O=!1!==w,{href:D,as:L}=s.default.useMemo(()=>{if(!N){let e=v(l);return{href:e,as:g?v(g):e}}let[e,t]=(0,o.resolveHref)(N,l,!0);return{href:e,as:g?(0,o.resolveHref)(N,g):t||e}},[N,l,g]),M=s.default.useRef(D),j=s.default.useRef(L);R&&(r=s.default.Children.only(n));let F=R?r&&"object"==typeof r&&r.ref:t,[U,V,B]=(0,d.useIntersection)({rootMargin:"200px"}),q=s.default.useCallback(e=>{(j.current!==L||M.current!==D)&&(B(),j.current=L,M.current=D),U(e)},[L,D,B,U]),$=(0,m.useMergedRef)(q,F);s.default.useEffect(()=>{N&&V&&O&&y(N,D,L,{locale:C})},[L,D,V,C,O,null==N?void 0:N.locale,N]);let z={ref:$,onClick(e){R||"function"!=typeof I||I(e),R&&r.props&&"function"==typeof r.props.onClick&&r.props.onClick(e),N&&(e.defaultPrevented||function(e,t,n,r,i,s,o,l,u){let{nodeName:h}=e.currentTarget;if(!("A"===h.toUpperCase()&&function(e){let t=e.currentTarget.getAttribute("target");return t&&"_self"!==t||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which}(e)||e.currentTarget.hasAttribute("download"))){if(!(0,a.isLocalURL)(n)){i&&(e.preventDefault(),location.replace(n));return}e.preventDefault(),(()=>{if(u){let e=!1;if(u({preventDefault:()=>{e=!0}}),e)return}let e=null==o||o;"beforePopState"in t?t[i?"replace":"push"](n,r,{shallow:s,locale:l,scroll:e}):t[i?"replace":"push"](r||n,{scroll:e})})()}}(e,N,D,L,E,T,S,C,x))},onMouseEnter(e){R||"function"!=typeof A||A(e),R&&r.props&&"function"==typeof r.props.onMouseEnter&&r.props.onMouseEnter(e),N&&y(N,D,L,{locale:C,priority:!0,bypassPrefetchedCheck:!0})},onTouchStart:function(e){R||"function"!=typeof k||k(e),R&&r.props&&"function"==typeof r.props.onTouchStart&&r.props.onTouchStart(e),N&&y(N,D,L,{locale:C,priority:!0,bypassPrefetchedCheck:!0})}};if((0,u.isAbsoluteUrl)(L))z.href=L;else if(!R||b||"a"===r.type&&!("href"in r.props)){let e=void 0!==C?C:null==N?void 0:N.locale;z.href=(null==N?void 0:N.isLocaleDomain)&&(0,f.getDomainLocale)(L,e,null==N?void 0:N.locales,null==N?void 0:N.domainLocales)||(0,p.addBasePath)((0,h.addLocale)(L,e,null==N?void 0:N.defaultLocale))}return R?s.default.cloneElement(r,z):(0,i.jsx)("a",{...P,...z,children:n})}),w=(0,s.createContext)({pending:!1}),b=()=>(0,s.useContext)(w),E=_;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},6427:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ServerInsertedHTMLContext:function(){return i},useServerInsertedHTML:function(){return s}});let r=n(8781)._(n(1462)),i=r.default.createContext(null);function s(e){let t=(0,r.useContext)(i);t&&t(e)}},6504:(e,t,n)=>{"use strict";n.d(t,{B:()=>r});let r="undefined"!=typeof window},6591:(e,t,n)=>{"use strict";n.d(t,{I:()=>s});var r=n(6616);let i=["read","resolveKeyframes","update","preRender","render","postRender"];function s(e,t){let n=!1,s=!0,o={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,l=i.reduce((e,t)=>(e[t]=function(e){let t=new Set,n=new Set,r=!1,i=!1,s=new WeakSet,o={delta:0,timestamp:0,isProcessing:!1};function a(t){s.has(t)&&(l.schedule(t),e()),t(o)}let l={schedule:(e,i=!1,o=!1)=>{let a=o&&r?t:n;return i&&s.add(e),a.has(e)||a.add(e),e},cancel:e=>{n.delete(e),s.delete(e)},process:e=>{if(o=e,r){i=!0;return}r=!0,[t,n]=[n,t],t.forEach(a),t.clear(),r=!1,i&&(i=!1,l.process(e))}};return l}(a),e),{}),{read:u,resolveKeyframes:h,update:c,preRender:d,render:f,postRender:p}=l,m=()=>{let i=r.W.useManualTiming?o.timestamp:performance.now();n=!1,o.delta=s?1e3/60:Math.max(Math.min(i-o.timestamp,40),1),o.timestamp=i,o.isProcessing=!0,u.process(o),h.process(o),c.process(o),d.process(o),f.process(o),p.process(o),o.isProcessing=!1,n&&t&&(s=!1,e(m))};return{schedule:i.reduce((t,r)=>{let i=l[r];return t[r]=(t,r=!1,a=!1)=>(!n&&(n=!0,s=!0,o.isProcessing||e(m)),i.schedule(t,r,a)),t},{}),cancel:e=>{for(let t=0;t<i.length;t++)l[i[t]].cancel(e)},state:o,steps:l}}},6616:(e,t,n)=>{"use strict";n.d(t,{W:()=>r});let r={skipAnimations:!1,useManualTiming:!1}}
16,6704:(e,t,n)=>{"use strict";function r(e){let t;return()=>(void 0===t&&(t=e()),t)}n.d(t,{p:()=>r})},6811:(e,t,n)=>{"use strict";n.d(t,{KN:()=>s,gQ:()=>u,px:()=>o,uj:()=>i,vh:()=>a,vw:()=>l});let r=e=>({test:t=>"string"==typeof t&&t.endsWith(e)&&1===t.split(" ").length,parse:parseFloat,transform:t=>`${t}${e}`}),i=r("deg"),s=r("%"),o=r("px"),a=r("vh"),l=r("vw"),u={...s,parse:e=>s.parse(e)/100,transform:e=>s.transform(100*e)}},6890:(e,t,n)=>{"use strict";n.d(t,{Gt:()=>i,PP:()=>a,WG:()=>s,uv:()=>o});var r=n(4670);let{schedule:i,cancel:s,state:o,steps:a}=(0,n(6591).I)("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:r.l,!0)},6949:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});let r=(e,t,n)=>e+(t-e)*n},7155:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{ReadonlyURLSearchParams:function(){return h},RedirectType:function(){return i.RedirectType},forbidden:function(){return o.forbidden},notFound:function(){return s.notFound},permanentRedirect:function(){return r.permanentRedirect},redirect:function(){return r.redirect},unauthorized:function(){return a.unauthorized},unstable_isUnrecognizedActionError:function(){return c},unstable_rethrow:function(){return l.unstable_rethrow}});let r=n(8542),i=n(7229),s=n(7262),o=n(8823),a=n(3356),l=n(7432);class u extends Error{constructor(){super("Method unavailable on `ReadonlyURLSearchParams`. Read more: https://nextjs.org/docs/app/api-reference/functions/use-search-params#updating-searchparams")}}class h extends URLSearchParams{append(){throw new u}delete(){throw new u}set(){throw new u}sort(){throw new u}}function c(){throw Object.defineProperty(Error("`unstable_isUnrecognizedActionError` can only be used on the client."),"__NEXT_ERROR_CODE",{value:"E776",enumerable:!1,configurable:!0})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7200:(e,t,n)=>{"use strict";n.d(t,{J:()=>o});var r=n(8623),i=n(3200),s=n(1457);function o(e,t){let n=(0,s.D)(e);return n!==i.p&&(n=r.f),n.getAnimatableNone?n.getAnimatableNone(t):void 0}},7221:(e,t)=>{"use strict";function n(e){return Array.isArray(e)?e[1]:e}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"getSegmentValue",{enumerable:!0,get:function(){return n}}),("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7262:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"notFound",{enumerable:!0,get:function(){return i}});let r=""+n(6695).HTTP_ERROR_FALLBACK_ERROR_CODE+";404";function i(){let e=Object.defineProperty(Error(r),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});throw e.digest=r,e}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7270:(e,t,n)=>{"use strict";let r,i,s,o,a,l,u,h,c,d;n.d(t,{C3:()=>nW});var f,p=n(4928),m=n(5880),g=n(9320),y=n(3279),v=n(7706);let _="@firebase/database",w="1.0.20",b="";class E{constructor(e){this.domStorage_=e,this.prefix_="firebase:"}set(e,t){null==t?this.domStorage_.removeItem(this.prefixedName_(e)):this.domStorage_.setItem(this.prefixedName_(e),(0,g.As)(t))}get(e){let t=this.domStorage_.getItem(this.prefixedName_(e));return null==t?null:(0,g.$L)(t)}remove(e){this.domStorage_.removeItem(this.prefixedName_(e))}prefixedName_(e){return this.prefix_+e}toString(){return this.domStorage_.toString()}}class T{constructor(){this.cache_={},this.isInMemoryStorage=!0}set(e,t){null==t?delete this.cache_[e]:this.cache_[e]=t}get(e){return(0,g.gR)(this.cache_,e)?this.cache_[e]:null}remove(e){delete this.cache_[e]}}let S=function(e){try{if("undefined"!=typeof window&&void 0!==window[e]){let t=window[e];return t.setItem("firebase:sentinel","cache"),t.removeItem("firebase:sentinel"),new E(t)}}catch(e){}return new T},C=S("localStorage"),I=S("sessionStorage"),x=new y.Vy("@firebase/database"),A=function(){let e=1;return function(){return e++}}(),k=function(e){let t=(0,g.kj)(e),n=new g.gz;n.update(t);let r=n.digest();return g.K3.encodeByteArray(r)},R=function(...e){let t="";for(let n=0;n<e.length;n++){let r=e[n];Array.isArray(r)||r&&"object"==typeof r&&"number"==typeof r.length?t+=R.apply(null,r):"object"==typeof r?t+=(0,g.As)(r):t+=r,t+=" "}return t},P=null,N=!0,O=function(e,t){(0,g.vA)(!t||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(x.logLevel=y.$b.VERBOSE,P=x.log.bind(x),t&&I.set("logging_enabled",!0)):"function"==typeof e?P=e:(P=null,I.remove("logging_enabled"))},D=function(...e){if(!0===N&&(N=!1,null===P&&!0===I.get("logging_enabled")&&O(!0)),P){let t=R.apply(null,e);P(t)}},L=function(e){return function(...t){D(e,...t)}},M=function(...e){let t="FIREBASE INTERNAL ERROR: "+R(...e);x.error(t)},j=function(...e){let t=`FIREBASE FATAL ERROR: ${R(...e)}`;throw x.error(t),Error(t)},F=function(...e){let t="FIREBASE WARNING: "+R(...e);x.warn(t)},U=function(){"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&F("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},V=function(e){return"number"==typeof e&&(e!=e||e===1/0||e===-1/0)},B=function(e){if((0,g.$g)()||"complete"===document.readyState)e();else{let t=!1,n=function(){if(!document.body)return void setTimeout(n,Math.floor(10));t||(t=!0,e())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",()=>{"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}},q="[MIN_NAME]",$="[MAX_NAME]",z=function(e,t){if(e===t)return 0;{if(e===q||t===$)return -1;if(t===q||e===$)return 1;let n=J(e),r=J(t);if(null!==n)if(null!==r)return n-r==0?e.length-t.length:n-r;else return -1;return null!==r?1:e<t?-1:1}},W=function(e,t){return e===t?0:e<t?-1:1},H=function(e,t){if(t&&e in t)return t[e];throw Error("Missing required key ("+e+") in object: "+(0,g.As)(t))},G=function(e){if("object"!=typeof e||null===e)return(0,g.As)(e);let t=[];for(let n in e)t.push(n);
16t.sort();let n="{";for(let r=0;r<t.length;r++)0!==r&&(n+=","),n+=(0,g.As)(t[r]),n+=":",n+=G(e[t[r]]);return n+"}"},K=function(e,t){let n=e.length;if(n<=t)return[e];let r=[];for(let i=0;i<n;i+=t)i+t>n?r.push(e.substring(i,n)):r.push(e.substring(i,i+t));return r};function Y(e,t){for(let n in e)e.hasOwnProperty(n)&&t(n,e[n])}let Q=function(e){let t,n,r,i,s;(0,g.vA)(!V(e),"Invalid JSON number");0===e?(n=0,r=0,t=+(1/e==-1/0)):(t=e<0,(e=Math.abs(e))>=22250738585072014e-324?(n=(i=Math.min(Math.floor(Math.log(e)/Math.LN2),1023))+1023,r=Math.round(e*Math.pow(2,52-i)-0x10000000000000)):(n=0,r=Math.round(e/5e-324)));let o=[];for(s=52;s;s-=1)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;s-=1)o.push(n%2?1:0),n=Math.floor(n/2);o.push(+!!t),o.reverse();let a=o.join(""),l="";for(s=0;s<64;s+=8){let e=parseInt(a.substr(s,8),2).toString(16);1===e.length&&(e="0"+e),l+=e}return l.toLowerCase()},X=RegExp("^-?(0*)\\d{1,10}$"),J=function(e){if(X.test(e)){let t=Number(e);if(t>=-0x80000000&&t<=0x7fffffff)return t}return null},Z=function(e){try{e()}catch(e){setTimeout(()=>{throw F("Exception was thrown by user callback.",e.stack||""),e},Math.floor(0))}},ee=function(e,t){let n=setTimeout(e,t);return"number"==typeof n&&"undefined"!=typeof Deno&&Deno.unrefTimer?Deno.unrefTimer(n):"object"==typeof n&&n.unref&&n.unref(),n};class et{constructor(e,t){this.appCheckProvider=t,this.appName=e.name,(0,p.xZ)(e)&&e.settings.appCheckToken&&(this.serverAppAppCheckToken=e.settings.appCheckToken),this.appCheck=null==t?void 0:t.getImmediate({optional:!0}),this.appCheck||null==t||t.get().then(e=>this.appCheck=e)}getToken(e){if(this.serverAppAppCheckToken){if(e)throw Error("Attempted reuse of `FirebaseServerApp.appCheckToken` after previous usage failed.");return Promise.resolve({token:this.serverAppAppCheckToken})}return this.appCheck?this.appCheck.getToken(e):new Promise((t,n)=>{setTimeout(()=>{this.appCheck?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){var t;null==(t=this.appCheckProvider)||t.get().then(t=>t.addTokenListener(e))}notifyForInvalidToken(){F(`Provided AppCheck credentials for the app named "${this.appName}" are invalid. This usually indicates your app was not initialized correctly.`)}}class en{constructor(e,t,n){this.appName_=e,this.firebaseOptions_=t,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(e=>this.auth_=e)}getToken(e){return this.auth_?this.auth_.getToken(e).catch(e=>e&&"auth/token-not-initialized"===e.code?(D("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(e)):new Promise((t,n)=>{setTimeout(()=>{this.auth_?this.getToken(e).then(t,n):t(null)},0)})}addTokenChangeListener(e){this.auth_?this.auth_.addAuthTokenListener(e):this.authProvider_.get().then(t=>t.addAuthTokenListener(e))}removeTokenChangeListener(e){this.authProvider_.get().then(t=>t.removeAuthTokenListener(e))}notifyForInvalidToken(){let e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',F(e)}}class er{constructor(e){this.accessToken=e}getToken(e){return Promise.resolve({accessToken:this.accessToken})}addTokenChangeListener(e){e(this.accessToken)}removeTokenChangeListener(e){}notifyForInvalidToken(){}}er.OWNER="owner";let ei=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,es="websocket",eo="long_polling";class ea{constructor(e,t,n,r,i=!1,s="",o=!1,a=!1,l=null){this.secure=t,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=s,this.includeNamespaceInQueryParams=o,this.isUsingEmulator=a,this.emulatorOptions=l,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=C.get("host:"+e)||this._host}isCacheableHost(){return"s-"===this.internalHost.substr(0,2)}isCustomHost(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain}get host(){return this._host}set host(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&C.set("host:"+this._host,this.internalHost))}toString(){let e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e}toURLString(){let e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?`?ns=${this.namespace}`:"";return`${e}${this.host}/${t}`}}function el(e,t,n){let r;if((0,g.vA)("string"==typeof t,"typeof type must == string"),(0,g.vA)("object"==typeof n,"typeof params must == object"),t===es)r=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else if(t===eo)r=(e.secure?"https://":"http://")+e.internalHost+"/.lp?";else throw Error("Unknown connection type: "+t);(e.host!==e.internalHost||e.isCustomHost()||e.includeNamespaceInQueryParams)&&
16(n.ns=e.namespace);let i=[];return Y(n,(e,t)=>{i.push(e+"="+t)}),r+i.join("&")}class eu{constructor(){this.counters_={}}incrementCounter(e,t=1){(0,g.gR)(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t}get(){return(0,g.A4)(this.counters_)}}let eh={},ec={};function ed(e){let t=e.toString();return eh[t]||(eh[t]=new eu),eh[t]}class ef{constructor(e){this.onMessage_=e,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}closeAfter(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)}handleResponse(e,t){for(this.pendingResponses[e]=t;this.pendingResponses[this.currentResponseNum];){let e=this.pendingResponses[this.currentResponseNum];delete this.pendingResponses[this.currentResponseNum];for(let t=0;t<e.length;++t)e[t]&&Z(()=>{this.onMessage_(e[t])});if(this.currentResponseNum===this.closeAfterResponse){this.onClose&&(this.onClose(),this.onClose=null);break}this.currentResponseNum++}}}let ep="start";class em{constructor(e,t,n,r,i,s,o){this.connId=e,this.repoInfo=t,this.applicationId=n,this.appCheckToken=r,this.authToken=i,this.transportSessionId=s,this.lastSessionId=o,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=L(e),this.stats_=ed(t),this.urlFn=e=>(this.appCheckToken&&(e.ac=this.appCheckToken),el(t,eo,e))}open(e,t){this.curSegmentNum=0,this.onDisconnect_=t,this.myPacketOrderer=new ef(e),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(()=>{this.log_("Timed out trying to connect."),this.onClosed_(),this.connectTimeoutTimer_=null},Math.floor(3e4)),B(()=>{if(this.isClosed_)return;this.scriptTagHolder=new eg((...e)=>{let[t,n,r,i,s]=e;if(this.incrementIncomingBytes_(e),this.scriptTagHolder)if(this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null),this.everConnected_=!0,t===ep)this.id=n,this.password=r;else if("close"===t)n?(this.scriptTagHolder.sendNewPolls=!1,this.myPacketOrderer.closeAfter(n,()=>{this.onClosed_()})):this.onClosed_();else throw Error("Unrecognized command received: "+t)},(...e)=>{let[t,n]=e;this.incrementIncomingBytes_(e),this.myPacketOrderer.handleResponse(t,n)},()=>{this.onClosed_()},this.urlFn);let e={};e[ep]="t",e.ser=Math.floor(1e8*Math.random()),this.scriptTagHolder.uniqueCallbackIdentifier&&(e.cb=this.scriptTagHolder.uniqueCallbackIdentifier),e.v="5",this.transportSessionId&&(e.s=this.transportSessionId),this.lastSessionId&&(e.ls=this.lastSessionId),this.applicationId&&(e.p=this.applicationId),this.appCheckToken&&(e.ac=this.appCheckToken),"undefined"!=typeof location&&location.hostname&&ei.test(location.hostname)&&(e.r="f");let t=this.urlFn(e);this.log_("Connecting via long-poll to "+t),this.scriptTagHolder.addTag(t,()=>{})})}start(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)}static forceAllow(){em.forceAllow_=!0}static forceDisallow(){em.forceDisallow_=!0}static isAvailable(){return!(0,g.$g)()&&(!!em.forceAllow_||!em.forceDisallow_&&"undefined"!=typeof document&&null!=document.createElement&&!("object"==typeof window&&window.chrome&&window.chrome.extension&&!/^chrome/.test(window.location.href))&&("object"!=typeof Windows||"object"!=typeof Windows.UI))}markConnectionHealthy(){}shutdown_(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)}onClosed_(){!this.isClosed_&&(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))}close(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())}send(e){let t=(0,g.As)(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=K((0,g.KA)(t),1840);for(let e=0;e<n.length;e++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,n.length,n[e]),this.curSegmentNum++}addDisconnectPingFrame(e,t){if((0,g.$g)())return;this.myDisconnFrame=document.createElement("iframe");let n={};n.dframe="t",n.id=e,n.pw=t,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}incrementIncomingBytes_(e){let t=(0,g.As)(e).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)}}class eg{constructor(e,t,n,r){if(this.onDisconnect=n,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,(0,g.$g)())this.commandCB=e,this.onMessageCB=t;else{this.uniqueCallbackIdentifier=A(),window["pLPCommand"+this.uniqueCallbackIdentifier]=e,window["pRTLPCB"+this.uniqueCallbackIdentifier]=t,this.myIFrame=eg.createI
16Frame_();let n="";this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,11)&&(n='<script>document.domain="'+document.domain+'";<\/script>');let r="<html><body>"+n+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(r),this.myIFrame.doc.close()}catch(e){D("frame writing exception"),e.stack&&D(e.stack),D(e)}}}static createIFrame_(){let e=document.createElement("iframe");if(e.style.display="none",document.body){document.body.appendChild(e);try{e.contentWindow.document||D("No IE domain setting required")}catch(t){e.src="javascript:void((function(){document.open();document.domain='"+document.domain+"';document.close();})())"}}else throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&&(e.doc=e.document),e}close(){this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.textContent="",setTimeout(()=>{null!==this.myIFrame&&(document.body.removeChild(this.myIFrame),this.myIFrame=null)},Math.floor(0)));let e=this.onDisconnect;e&&(this.onDisconnect=null,e())}startLongPoll(e,t){for(this.myID=e,this.myPW=t,this.alive=!0;this.newRequest_(););}newRequest_(){if(!this.alive||!this.sendNewPolls||!(this.outstandingRequests.size<(this.pendingSegs.length>0?2:1)))return!1;{this.currentSerial++;let e={};e.id=this.myID,e.pw=this.myPW,e.ser=this.currentSerial;let t=this.urlFn(e),n="",r=0;for(;this.pendingSegs.length>0;)if(this.pendingSegs[0].d.length+30+n.length<=1870){let e=this.pendingSegs.shift();n=n+"&seg"+r+"="+e.seg+"&ts"+r+"="+e.ts+"&d"+r+"="+e.d,r++}else break;return t+=n,this.addLongPollTag_(t,this.currentSerial),!0}}enqueueSegment(e,t,n){this.pendingSegs.push({seg:e,ts:t,d:n}),this.alive&&this.newRequest_()}addLongPollTag_(e,t){this.outstandingRequests.add(t);let n=()=>{this.outstandingRequests.delete(t),this.newRequest_()},r=setTimeout(n,Math.floor(25e3));this.addTag(e,()=>{clearTimeout(r),n()})}addTag(e,t){(0,g.$g)()?this.doNodeLongPoll(e,t):setTimeout(()=>{try{if(!this.sendNewPolls)return;let n=this.myIFrame.doc.createElement("script");n.type="text/javascript",n.async=!0,n.src=e,n.onload=n.onreadystatechange=function(){let e=n.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,n.parentNode&&n.parentNode.removeChild(n),t())},n.onerror=()=>{D("Long-poll script failed to load: "+e),this.sendNewPolls=!1,this.close()},this.myIFrame.doc.body.appendChild(n)}catch(e){}},Math.floor(1))}}let ey=null;"undefined"!=typeof MozWebSocket?ey=MozWebSocket:"undefined"!=typeof WebSocket&&(ey=WebSocket);class ev{constructor(e,t,n,r,i,s,o){this.connId=e,this.applicationId=n,this.appCheckToken=r,this.authToken=i,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=L(this.connId),this.stats_=ed(t),this.connURL=ev.connectionURL_(t,s,o,r,n),this.nodeAdmin=t.nodeAdmin}static connectionURL_(e,t,n,r,i){let s={};return s.v="5",!(0,g.$g)()&&"undefined"!=typeof location&&location.hostname&&ei.test(location.hostname)&&(s.r="f"),t&&(s.s=t),n&&(s.ls=n),r&&(s.ac=r),i&&(s.p=i),el(e,es,s)}open(e,t){this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,C.set("previous_websocket_failure",!0);try{let e;if((0,g.$g)()){let t=this.nodeAdmin?"AdminNode":"Node";e={headers:{"User-Agent":`Firebase/5/${b}/${v.platform}/${t}`,"X-Firebase-GMPID":this.applicationId||""}},this.authToken&&(e.headers.Authorization=`Bearer ${this.authToken}`),this.appCheckToken&&(e.headers["X-Firebase-AppCheck"]=this.appCheckToken);let n=v.env,r=0===this.connURL.indexOf("wss://")?n.HTTPS_PROXY||n.https_proxy:n.HTTP_PROXY||n.http_proxy;r&&(e.proxy={origin:r})}this.mySock=new ey(this.connURL,[],e)}catch(t){this.log_("Error instantiating WebSocket.");let e=t.message||t.data;e&&this.log_(e),this.onClosed_();return}this.mySock.onopen=()=>{this.log_("Websocket connected."),this.everConnected_=!0},this.mySock.onclose=()=>{this.log_("Websocket connection was disconnected."),this.mySock=null,this.onClosed_()},this.mySock.onmessage=e=>{this.handleIncomingFrame(e)},this.mySock.onerror=e=>{this.log_("WebSocket error. Closing connection.");let t=e.message||e.data;t&&this.log_(t),this.onClosed_()}}start(){}static forceDisallow(){ev.forceDisallow_=!0}static isAvailable(){let e=!1;if("undefined"!=typeof navigator&&navigator.userAgent){let t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);t&&t.length>1&&4.4>parseFloat(t[1])&&(e=!0)}return!e&&null!==ey&&!ev.forceDisallow_}static previouslyFailed(){return C.isInMemoryStorage||!0===C.get("previous_websocket_failure")}markConnectionHealthy(){C.remove("previous_websocket_failure")}appendFrame_(e){if(this.frames.push(e),this.frames.length===this.totalFrames){let e=this.frames.join("");this.frames=null;let t=(0,g.$L)(e);this.onMessage(t)}}handleNewFrameCount_(e){this.totalFrames=e,this.frames=[]}extractFrameCount_(e){if((0,g.vA)(null===this.frames,"We already have a frame buffer"),e.length<=6){let t=Number(e);if(!isNaN(t))return this.handleNewFrameCount_(t),null}return this.handleNewFrameCount_(1),e}handleIncomingFrame(e){if(null===this.mySock)return;let t=e.data;if(this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(t);else{let e=this.extractFrameCount_(t);null!==e&&this.appendFrame_(e)}}send(e){this.resetKeepAlive();let t=(0,g.As)(e);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);let n=K(t,16384);n.length>1&&this.sendString_(String(n.length));for(let e=0;e<n.length;e++)this.sendString_(n[e])}shutdown_(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)}onClosed_(){!this.isClosed_&&(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))}close(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())}resetKeepAlive(){clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(()=>{this.mySock&&this.sendString_("0"),this.resetKeepAlive()},Math.floor(45e3))}sendString_(e){try{this.mySock.send(e)}catch(e){this.log_("Exception thrown from WebSocket.send():",e.message||e.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}}}ev.responsesRequiredToBeHealthy=2,ev.healthyTimeout=3e4;class e_{static get ALL_TRANSPORTS(){return[em,ev]}static get IS_TRANSPORT_INITIALIZED(){return this.globalTransportInitialized_}constructor(e){this.initTransports_(e)}initTransports_(e){let t=ev&&ev.isAvailable(),n=t&&!ev.previouslyFailed();if(e.webSocketOnly&&(t||F("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),n=!0),n)this.transports_=[ev];else{let e=this.transports_=[];for(let t of e_.ALL_TRANSPORTS)t&&t.isAvailable()&&e.push(t);e_.globalTransportInitialized_=!0}}initialTransport(){if(this.transports_.length>0)return this.transports_[0];throw Error("No transports available")}upgradeTransport(){return this.transports_.length>1?this.transports_[1]:null}}e_.globalTransportInitialized_=!1;class ew{constructor(e,t,n,r,i,s,o,a,l,u){this.id=e,this.repoInfo_=t,this.applicationId_=n,this.appCheckToken_=r,this.authToken_=i,this.onMessage_=s,this.onReady_=o,this.onDisconnect_=a,this.onKill_=l,this.lastSessionId=u,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=L("c:"+this.id+":"),this.transportManager_=new e_(t),this.log_("Connection created"),this.start_()}start_(){let e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,null,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let t=this.connReceiver_(this.conn_),n=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(()=>{this.conn_&&this.conn_.open(t,n)},Math.floor(0));let r=e.healthyTimeout||0;r>0&&(this.healthyTimeout_=ee(()=>{this.healthyTimeout_=null,this.isHealthy_||(this.conn_&&this.conn_.bytesReceived>102400?(this.log_("Connection exceeded healthy timeout but has received "+this.conn_.bytesReceived+" bytes. Marking connection healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()):this.conn_&&this.conn_.bytesSent>10240?this.log_("Connection exceeded healthy timeout but has sent "+this.conn_.bytesSent+" bytes. Leaving connection alive."):(this.log_("Closing unhealthy connection after timeout."),this.close()))},Math.floor(r)))}nextTransportId_(){return"c:"+this.id+":"+this.connectionCount++}disconnReceiver_(e){return t=>{e===this.conn_?this.onConnectionLost_(t):e===this.secondaryConn_?(this.log_("Secondary connection lost."),this.onSecondaryConnectionLost_()):this.log_("closing an old connection")}}connReceiver_(e){return t=>{2!==this.state_&&(e===this.rx_?this.onPrimaryMessageReceived_(t):e===this.secondaryConn_?this.onSecondaryMessageReceived_(t):this.log_("message on old connection"))}}sendRequest(e){this.sendData_({t:"d",d:e})}tryCleanupConnection(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)}onSecondaryControl_(e){if("t"in e){let t=e.t;"a"===t?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),(this.tx_===this.secondaryConn_||this.rx_===this.secondaryConn_)&&this.close()):"o"===t&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}}onSecondaryMessageReceived_(e){let t=H("t",e),n=H("d",e);if("c"===t)this.onSecondaryControl_(n);else if("d"===t)this.pendingDataMessages.push(n);else throw Error("Unknown protocol layer: "+t)}upgradeIfSecondaryHealthy_(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t
16:"c",d:{t:"p",d:{}}}))}proceedWithUpgrade_(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()}onPrimaryMessageReceived_(e){let t=H("t",e),n=H("d",e);"c"===t?this.onControl_(n):"d"===t&&this.onDataMessage_(n)}onDataMessage_(e){this.onPrimaryResponse_(),this.onMessage_(e)}onPrimaryResponse_(){!this.isHealthy_&&(this.primaryResponsesRequired_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))}onControl_(e){let t=H("t",e);if("d"in e){let n=e.d;if("h"===t){let e=Object.assign({},n);this.repoInfo_.isUsingEmulator&&(e.h=this.repoInfo_.host),this.onHandshake_(e)}else if("n"===t){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(let e=0;e<this.pendingDataMessages.length;++e)this.onDataMessage_(this.pendingDataMessages[e]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===t?this.onConnectionShutdown_(n):"r"===t?this.onReset_(n):"e"===t?M("Server Error: "+n):"o"===t?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):M("Unknown control packet command: "+t)}}onHandshake_(e){let t=e.ts,n=e.v,r=e.h;this.sessionId=e.s,this.repoInfo_.host=r,0===this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,t),"5"!==n&&F("Protocol version mismatch detected"),this.tryStartUpgrade_())}tryStartUpgrade_(){let e=this.transportManager_.upgradeTransport();e&&this.startUpgrade_(e)}startUpgrade_(e){this.secondaryConn_=new e(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,this.sessionId),this.secondaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;let t=this.connReceiver_(this.secondaryConn_),n=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(t,n),ee(()=>{this.secondaryConn_&&(this.log_("Timed out trying to upgrade."),this.secondaryConn_.close())},Math.floor(6e4))}onReset_(e){this.log_("Reset packet received. New host: "+e),this.repoInfo_.host=e,1===this.state_?this.close():(this.closeConnections_(),this.start_())}onConnectionEstablished_(e,t){this.log_("Realtime connection established."),this.conn_=e,this.state_=1,this.onReady_&&(this.onReady_(t,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):ee(()=>{this.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))}sendPingOnPrimaryIfNecessary_(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))}onSecondaryConnectionLost_(){let e=this.secondaryConn_;this.secondaryConn_=null,(this.tx_===e||this.rx_===e)&&this.close()}onConnectionLost_(e){this.conn_=null,e||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(C.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()}onConnectionShutdown_(e){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(e),this.onKill_=null),this.onDisconnect_=null,this.close()}sendData_(e){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(e)}close(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))}closeConnections_(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)}}class eb{put(e,t,n,r){}merge(e,t,n,r){}refreshAuthToken(e){}refreshAppCheckToken(e){}onDisconnectPut(e,t,n){}onDisconnectMerge(e,t,n){}onDisconnectCancel(e,t){}reportStats(e){}}class eE{constructor(e){this.allowedEvents_=e,this.listeners_={},(0,g.vA)(Array.isArray(e)&&e.length>0,"Requires a non-empty array")}trigger(e,...t){if(Array.isArray(this.listeners_[e])){let n=[...this.listeners_[e]];for(let e=0;e<n.length;e++)n[e].callback.apply(n[e].context,t)}}on(e,t,n){this.validateEventType_(e),this.listeners_[e]=this.listeners_[e]||[],this.listeners_[e].push({callback:t,context:n});let r=this.getInitialEvent(e);r&&t.apply(n,r)}off(e,t,n){this.validateEventType_(e);let r=this.listeners_[e]||[];for(let e=0;e<r.length;
16e++)if(r[e].callback===t&&(!n||n===r[e].context))return void r.splice(e,1)}validateEventType_(e){(0,g.vA)(this.allowedEvents_.find(t=>t===e),"Unknown event: "+e)}}class eT extends eE{static getInstance(){return new eT}constructor(){super(["online"]),this.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||(0,g.jZ)()||(window.addEventListener("online",()=>{this.online_||(this.online_=!0,this.trigger("online",!0))},!1),window.addEventListener("offline",()=>{this.online_&&(this.online_=!1,this.trigger("online",!1))},!1))}getInitialEvent(e){return(0,g.vA)("online"===e,"Unknown event type: "+e),[this.online_]}currentlyOnline(){return this.online_}}class eS{constructor(e,t){if(void 0===t){this.pieces_=e.split("/");let t=0;for(let e=0;e<this.pieces_.length;e++)this.pieces_[e].length>0&&(this.pieces_[t]=this.pieces_[e],t++);this.pieces_.length=t,this.pieceNum_=0}else this.pieces_=e,this.pieceNum_=t}toString(){let e="";for(let t=this.pieceNum_;t<this.pieces_.length;t++)""!==this.pieces_[t]&&(e+="/"+this.pieces_[t]);return e||"/"}}function eC(){return new eS("")}function eI(e){return e.pieceNum_>=e.pieces_.length?null:e.pieces_[e.pieceNum_]}function ex(e){return e.pieces_.length-e.pieceNum_}function eA(e){let t=e.pieceNum_;return t<e.pieces_.length&&t++,new eS(e.pieces_,t)}function ek(e){return e.pieceNum_<e.pieces_.length?e.pieces_[e.pieces_.length-1]:null}function eR(e,t=0){return e.pieces_.slice(e.pieceNum_+t)}function eP(e){if(e.pieceNum_>=e.pieces_.length)return null;let t=[];for(let n=e.pieceNum_;n<e.pieces_.length-1;n++)t.push(e.pieces_[n]);return new eS(t,0)}function eN(e,t){let n=[];for(let t=e.pieceNum_;t<e.pieces_.length;t++)n.push(e.pieces_[t]);if(t instanceof eS)for(let e=t.pieceNum_;e<t.pieces_.length;e++)n.push(t.pieces_[e]);else{let e=t.split("/");for(let t=0;t<e.length;t++)e[t].length>0&&n.push(e[t])}return new eS(n,0)}function eO(e){return e.pieceNum_>=e.pieces_.length}function eD(e,t){let n=eI(e),r=eI(t);if(null===n)return t;if(n===r)return eD(eA(e),eA(t));throw Error("INTERNAL ERROR: innerPath ("+t+") is not within outerPath ("+e+")")}function eL(e,t){if(ex(e)!==ex(t))return!1;for(let n=e.pieceNum_,r=t.pieceNum_;n<=e.pieces_.length;n++,r++)if(e.pieces_[n]!==t.pieces_[r])return!1;return!0}function eM(e,t){let n=e.pieceNum_,r=t.pieceNum_;if(ex(e)>ex(t))return!1;for(;n<e.pieces_.length;){if(e.pieces_[n]!==t.pieces_[r])return!1;++n,++r}return!0}class ej{constructor(e,t){this.errorPrefix_=t,this.parts_=eR(e,0),this.byteLength_=Math.max(1,this.parts_.length);for(let e=0;e<this.parts_.length;e++)this.byteLength_+=(0,g.OE)(this.parts_[e]);eF(this)}}function eF(e){if(e.byteLength_>768)throw Error(e.errorPrefix_+"has a key path longer than 768 bytes ("+e.byteLength_+").");if(e.parts_.length>32)throw Error(e.errorPrefix_+"path specified exceeds the maximum depth that can be written (32) or object contains a cycle "+eU(e))}function eU(e){return 0===e.parts_.length?"":"in property '"+e.parts_.join(".")+"'"}class eV extends eE{static getInstance(){return new eV}constructor(){let e,t;super(["visible"]),"undefined"!=typeof document&&void 0!==document.addEventListener&&(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&&(t="webkitvisibilitychange",e="webkitHidden")),this.visible_=!0,t&&document.addEventListener(t,()=>{let t=!document[e];t!==this.visible_&&(this.visible_=t,this.trigger("visible",t))},!1)}getInitialEvent(e){return(0,g.vA)("visible"===e,"Unknown event type: "+e),[this.visible_]}}class eB extends eb{constructor(e,t,n,r,i,s,o,a){if(super(),this.repoInfo_=e,this.applicationId_=t,this.onDataUpdate_=n,this.onConnectStatus_=r,this.onServerInfoUpdate_=i,this.authTokenProvider_=s,this.appCheckTokenProvider_=o,this.authOverride_=a,this.id=eB.nextPersistentConnectionId_++,this.log_=L("p:"+this.id+":"),this.interruptReasons_={},this.listens=new Map,this.outstandingPuts_=[],this.outstandingGets_=[],this.outstandingPutCount_=0,this.outstandingGetCount_=0,this.onDisconnectRequestQueue_=[],this.connected_=!1,this.reconnectDelay_=1e3,this.maxReconnectDelay_=3e5,this.securityDebugCallback_=null,this.lastSessionId=null,this.establishConnectionTimer_=null,this.visible_=!1,this.requestCBHash_={},this.requestNumber_=0,this.realtime_=null,this.authToken_=null,this.appCheckToken_=null,this.forceTokenRefresh_=!1,this.invalidAuthTokenCount_=0,this.invalidAppCheckTokenCount_=0,this.firstConnection_=!0,this.lastConnectionAttemptTime_=null,this.lastConnectionEstablishedTime_=null,a&&!(0,g.$g)())throw Error("Auth override specified in options, but not supported on non Node.js platforms");eV.getInstance().on("visible",this.onVisible_,this),-1===e.host.indexOf("fblocal")&&eT.getInstance().on("online",this.onOnline_,this)}sendRequest(e,t,n){let r=++this.requestNumber_,i={r:r,a:e,b:t};this.log_((0,g.As)(i)),(0,g.vA)(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)}get(e){this.initConnection_();let t=new g.cY,n={p:e._path.toString(),q:e._queryObject};this.outstandingGets_.push({action:"g",request:n,onComplete:e=>{let n=e.d;"ok"===e.s?t.resolve(n):t.reject(n)}}),this.outstandingGetCount_++;let r=this.outstandingGets_.length-1;return this.connected_&&this.sendGet_(r),t.promise}listen(e,t,n,r){this.initConnection_();let i=e._queryIdentifier,s=e._path.toString();this.log_("Listen called for "+s+" "+i),this.listens.has(s)||this.listens.set(s,new Map),(0,g.vA)(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"listen() called for non-default but complete query"),(0,g.vA)(!this.listens.get(s).has(i),"listen() called twice for same path/queryId.");let o={onComplete:r,hashFn:t,query:e,tag:n};this.listens.get(s).set(i,o),this.connected_&&this.sendListen_(o)}sendGet_(e){let t=this.outstandingGets_[e];this.sendRequest("g",t.request,n=>{delete this.outstandingGets_[e],this.outstandingGetCount_--,0===this.outstandingGetCount_&&(this.outstandingGets_=[]),t.onComplete&&t.onComplete(n)})}sendListen_(e){let t=e.query,n=t._path.toString(),r=t._queryIdentifier;this.log_("Listen on "+n+" for "+r);let i={p:n};e.tag&&(i.q=t._queryObject,i.t=e.tag),i.h=e.hashFn(),this.sendRequest("q",i,i=>{let s=i.d,o=i.s;eB.warnOnListenWarnings_(s,t),(this.listens.get(n)&&this.listens.get(n).get(r))===e&&(this.log_("listen response",i),"ok"!==o&&this.removeListen_(n,r),e.onComplete&&e.onComplete(o,s))})}static warnOnListenWarnings_(e,t){if(e&&"object"==typeof e&&(0,g.gR)(e,"w")){let n=(0,g.yw)(e,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){let e='".indexOn": "'+t._queryParams.getIndex().toString()+'"',n=t._path.toString();F(`Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ${e} at ${n} to your security rules for better performance.`)}}}refreshAuthToken(e){this.authToken_=e,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},()=>{}),this.reduceReconnectDelayIfAdminCredential_(e)}reduceReconnectDelayIfAdminCredential_(e){(e&&40===e.length||(0,g.qc)(e))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)}refreshAppCheckToken(e){this.appCheckToken_=e,this.log_("App check token refreshed"),this.appCheckToken_?this.tryAppCheck():this.connected_&&this.sendRequest("unappeck",{},()=>{})}tryAuth(){if(this.connected_&&this.authToken_){let e=this.authToken_,t=(0,g.Cv)(e)?"auth":"gauth",n={cred:e};null===this.authOverride_?n.noauth=!0:"object"==typeof this.authOverride_&&(n.authvar=this.authOverride_),this.sendRequest(t,n,t=>{let n=t.s,r=t.d||"error";this.authToken_===e&&("ok"===n?this.invalidAuthTokenCount_=0:this.onAuthRevoked_(n,r))})}}tryAppCheck(){this.connected_&&this.appCheckToken_&&this.sendRequest("appcheck",{token:this.appCheckToken_},e=>{let t=e.s,n=e.d||"error";"ok"===t?this.invalidAppCheckTokenCount_=0:this.onAppCheckRevoked_(t,n)})}unlisten(e,t){let n=e._path.toString(),r=e._queryIdentifier;this.log_("Unlisten called for "+n+" "+r),(0,g.vA)(e._queryParams.isDefault()||!e._queryParams.loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,e._queryObject,t)}sendUnlisten_(e,t,n,r){this.log_("Unlisten on "+e+" for "+t);let i={p:e};r&&(i.q=n,i.t=r),this.sendRequest("n",i)}onDisconnectPut(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("o",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"o",data:t,onComplete:n})}onDisconnectMerge(e,t,n){this.initConnection_(),this.connected_?this.sendOnDisconnect_("om",e,t,n):this.onDisconnectRequestQueue_.push({pathString:e,action:"om",data:t,onComplete:n})}onDisconnectCancel(e,t){this.initConnection_(),this.connected_?this.sendOnDisconnect_("oc",e,null,t):this.onDisconnectRequestQueue_.push({pathString:e,action:"oc",data:null,onComplete:t})}sendOnDisconnect_(e,t,n,r){let i={p:t,d:n};this.log_("onDisconnect "+e,i),this.sendRequest(e,i,e=>{r&&setTimeout(()=>{r(e.s,e.d)},Math.floor(0))})}put(e,t,n,r){this.putInternal("p",e,t,n,r)}merge(e,t,n,r){this.putInternal("m",e,t,n,r)}putInternal(e,t,n,r,i){this.initConnection_();let s={p:t,d:n};void 0!==i&&(s.h=i),this.outstandingPuts_.push({action:e,request:s,onComplete:r}),this.outstandingPutCount_++;let o=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(o):this.log_("Buffering put: "+t)}sendPut_(e){let t=this.outstandingPuts_[e].action,n=this.outstandingPuts_[e].request,r=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(t,n,n=>{this.log_(t+" response",n),delete this.outstandingPuts_[e],this.outstandingPutCount_--,0===this.outstandingPutCount_&&(this.outstandingPuts_=[]),r&&r(n.s,n.d)})}reportStats(e){if(this.connected_){let t={c:e};this.log_("reportStats",t),this.sendRequest("s",t,e=>{if("ok"!==e.s){let t=e.d;this.log_("reportStats","Error sending stats: "+t)}})}}onDataMessage_(e){if("r"in e){this.log_("from server: "+(0,g.As)(e));let t=e.r,n=this.requestCBHash_[t];n&&(delete this.requestCBHash_[t],n(e.b))}else if("error"in e)throw"A server-side error has occurred: "+e.error;else"a"in e&&this.onDataPush_(e.a,e.b)}onDataPush_(e,t){this.log_("handleServerMessage",e,t),"d"===e?this.onDataUpdate_(t.p,t.d,!1,t.t):"m"===e?this.onDataUpdate_(t.p,t.d,!0,t.t):"c"===e?this.onListenRevoked_(t.p,t.q):"ac"===e?this.onAuthRevoked_(t.s,t.d):"apc"===e?this.onAppCheckRevoked_(t.s,t.d):"sd"===e?this.onSecurityDebugPacket_(t):M("Unrecognized action received from server: "+(0,g.As)(e)+"\nAre you using the latest client?")}onReady_(e,t){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=new Date().getTime(),this.handleTimestamp_(e),this.lastSessionId=t,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)}scheduleConnect_(e){(0,g.vA)(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(()=>{this.establishConnectionTimer_=null,this.establishConnection_()},Math.floor(e))}initConnection_(){!this.realtime_&&this.firstConnection_&&this.scheduleConnect_(0)}onVisible_(e){e&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)),this.visible_=e}onOnline_(e){e?(this.log_("Browser went online."),this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())}onRealtimeDisconnect_(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){this.visible_?this.lastConnectionEstablishedTime_&&(new Date().getTime()-this.lastConnectionEstablishedTime_>3e4&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=new Date().getTime());let e=Math.max(0,new Date().getTime()-this.lastConnectionAttemptTime_),t=Math.max(0,this.reconnectDelay_-e);
16t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)}async establishConnection_(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=new Date().getTime(),this.lastConnectionEstablishedTime_=null;let e=this.onDataMessage_.bind(this),t=this.onReady_.bind(this),n=this.onRealtimeDisconnect_.bind(this),r=this.id+":"+eB.nextConnectionId_++,i=this.lastSessionId,s=!1,o=null,a=function(){o?o.close():(s=!0,n())};this.realtime_={close:a,sendRequest:function(e){(0,g.vA)(o,"sendRequest call when we're not connected not allowed."),o.sendRequest(e)}};let l=this.forceTokenRefresh_;this.forceTokenRefresh_=!1;try{let[a,u]=await Promise.all([this.authTokenProvider_.getToken(l),this.appCheckTokenProvider_.getToken(l)]);s?D("getToken() completed but was canceled"):(D("getToken() completed. Creating connection."),this.authToken_=a&&a.accessToken,this.appCheckToken_=u&&u.token,o=new ew(r,this.repoInfo_,this.applicationId_,this.appCheckToken_,this.authToken_,e,t,n,e=>{F(e+" ("+this.repoInfo_.toString()+")"),this.interrupt("server_kill")},i))}catch(e){this.log_("Failed to get token: "+e),s||(this.repoInfo_.nodeAdmin&&F(e),a())}}}interrupt(e){D("Interrupting connection for reason: "+e),this.interruptReasons_[e]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())}resume(e){D("Resuming connection for reason: "+e),delete this.interruptReasons_[e],(0,g.Im)(this.interruptReasons_)&&(this.reconnectDelay_=1e3,this.realtime_||this.scheduleConnect_(0))}handleTimestamp_(e){let t=e-new Date().getTime();this.onServerInfoUpdate_({serverTimeOffset:t})}cancelSentTransactions_(){for(let e=0;e<this.outstandingPuts_.length;e++){let t=this.outstandingPuts_[e];t&&"h"in t.request&&t.queued&&(t.onComplete&&t.onComplete("disconnect"),delete this.outstandingPuts_[e],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])}onListenRevoked_(e,t){let n;n=t?t.map(e=>G(e)).join("$"):"default";let r=this.removeListen_(e,n);r&&r.onComplete&&r.onComplete("permission_denied")}removeListen_(e,t){let n,r=new eS(e).toString();if(this.listens.has(r)){let e=this.listens.get(r);n=e.get(t),e.delete(t),0===e.size&&this.listens.delete(r)}else n=void 0;return n}onAuthRevoked_(e,t){D("Auth token revoked: "+e+"/"+t),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),("invalid_token"===e||"permission_denied"===e)&&(this.invalidAuthTokenCount_++,this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))}onAppCheckRevoked_(e,t){D("App check token revoked: "+e+"/"+t),this.appCheckToken_=null,this.forceTokenRefresh_=!0,("invalid_token"===e||"permission_denied"===e)&&(this.invalidAppCheckTokenCount_++,this.invalidAppCheckTokenCount_>=3&&this.appCheckTokenProvider_.notifyForInvalidToken())}onSecurityDebugPacket_(e){this.securityDebugCallback_?this.securityDebugCallback_(e):"msg"in e&&console.log("FIREBASE: "+e.msg.replace("\n","\nFIREBASE: "))}restoreState_(){for(let e of(this.tryAuth(),this.tryAppCheck(),this.listens.values()))for(let t of e.values())this.sendListen_(t);for(let e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){let e=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(e.action,e.pathString,e.data,e.onComplete)}for(let e=0;e<this.outstandingGets_.length;e++)this.outstandingGets_[e]&&this.sendGet_(e)}sendConnectStats_(){let e={},t="js";(0,g.$g)()&&(t=this.repoInfo_.nodeAdmin?"admin_node":"node"),e["sdk."+t+"."+b.replace(/\./g,"-")]=1,(0,g.jZ)()?e["framework.cordova"]=1:(0,g.lV)()&&(e["framework.reactnative"]=1),this.reportStats(e)}shouldReconnect_(){let e=eT.getInstance().currentlyOnline();return(0,g.Im)(this.interruptReasons_)&&e}}eB.nextPersistentConnectionId_=0,eB.nextConnectionId_=0;class eq{constructor(e,t){this.name=e,this.node=t}static Wrap(e,t){return new eq(e,t)}}class e${getCompare(){return this.compare.bind(this)}indexedValueChanged(e,t){let n=new eq(q,e),r=new eq(q,t);return 0!==this.compare(n,r)}
16minPost(){return eq.MIN}}class ez extends e${static get __EMPTY_NODE(){return r}static set __EMPTY_NODE(e){r=e}compare(e,t){return z(e.name,t.name)}isDefinedOn(e){throw(0,g.Hk)("KeyIndex.isDefinedOn not expected to be called.")}indexedValueChanged(e,t){return!1}minPost(){return eq.MIN}maxPost(){return new eq($,r)}makePost(e,t){return(0,g.vA)("string"==typeof e,"KeyIndex indexValue must always be a string."),new eq(e,r)}toString(){return".key"}}let eW=new ez;class eH{constructor(e,t,n,r,i=null){this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];let s=1;for(;!e.isEmpty();)if(s=t?n(e.key,t):1,r&&(s*=-1),s<0)e=this.isReverse_?e.left:e.right;else if(0===s){this.nodeStack_.push(e);break}else this.nodeStack_.push(e),e=this.isReverse_?e.right:e.left}getNext(){let e;if(0===this.nodeStack_.length)return null;let t=this.nodeStack_.pop();if(e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value},this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e}hasNext(){return this.nodeStack_.length>0}peek(){if(0===this.nodeStack_.length)return null;let e=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value}}}class eG{constructor(e,t,n,r,i){this.key=e,this.value=t,this.color=null!=n?n:eG.RED,this.left=null!=r?r:eY.EMPTY_NODE,this.right=null!=i?i:eY.EMPTY_NODE}copy(e,t,n,r,i){return new eG(null!=e?e:this.key,null!=t?t:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)}count(){return this.left.count()+1+this.right.count()}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,t,n){let r=this,i=n(e,r.key);return(r=i<0?r.copy(null,null,null,r.left.insert(e,t,n),null):0===i?r.copy(null,t,null,null,null):r.copy(null,null,null,null,r.right.insert(e,t,n))).fixUp_()}removeMin_(){if(this.left.isEmpty())return eY.EMPTY_NODE;let e=this;return e.left.isRed_()||e.left.left.isRed_()||(e=e.moveRedLeft_()),(e=e.copy(null,null,null,e.left.removeMin_(),null)).fixUp_()}remove(e,t){let n,r;if(n=this,0>t(e,n.key))n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(e,t),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===t(e,n.key))if(n.right.isEmpty())return eY.EMPTY_NODE;else r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_());n=n.copy(null,null,null,null,n.right.remove(e,t))}return n.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=(e=e.copy(null,null,null,null,e.right.rotateRight_())).rotateLeft_()).colorFlip_()),e}moveRedRight_(){let e=this.colorFlip_();return e.left.left.isRed_()&&(e=(e=e.rotateRight_()).colorFlip_()),e}rotateLeft_(){let e=this.copy(null,null,eG.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight_(){let e=this.copy(null,null,eG.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)}colorFlip_(){let e=this.left.copy(null,null,!this.left.color,null,null),t=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,e,t)}checkMaxDepth_(){return Math.pow(2,this.check_())<=this.count()+1}check_(){if(this.isRed_()&&this.left.isRed_())throw Error("Red node has red child("+this.key+","+this.value+")");
16if(this.right.isRed_())throw Error("Right child of ("+this.key+","+this.value+") is red");let e=this.left.check_();if(e===this.right.check_())return e+ +!this.isRed_();throw Error("Black depths differ")}}eG.RED=!0,eG.BLACK=!1;class eK{copy(e,t,n,r,i){return this}insert(e,t,n){return new eG(e,t,null)}remove(e,t){return this}count(){return 0}isEmpty(){return!0}inorderTraversal(e){return!1}reverseTraversal(e){return!1}minKey(){return null}maxKey(){return null}check_(){return 0}isRed_(){return!1}}class eY{constructor(e,t=eY.EMPTY_NODE){this.comparator_=e,this.root_=t}insert(e,t){return new eY(this.comparator_,this.root_.insert(e,t,this.comparator_).copy(null,null,eG.BLACK,null,null))}remove(e){return new eY(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,eG.BLACK,null,null))}get(e){let t,n=this.root_;for(;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))return n.value;t<0?n=n.left:t>0&&(n=n.right)}return null}getPredecessorKey(e){let t,n=this.root_,r=null;for(;!n.isEmpty();){if(0===(t=this.comparator_(e,n.key)))if(n.left.isEmpty())if(r)return r.key;else return null;else{for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}t<0?n=n.left:t>0&&(r=n,n=n.right)}throw Error("Attempted to find predecessor key for a nonexistent key. What gives?")}isEmpty(){return this.root_.isEmpty()}count(){return this.root_.count()}minKey(){return this.root_.minKey()}maxKey(){return this.root_.maxKey()}inorderTraversal(e){return this.root_.inorderTraversal(e)}reverseTraversal(e){return this.root_.reverseTraversal(e)}getIterator(e){return new eH(this.root_,null,this.comparator_,!1,e)}getIteratorFrom(e,t){return new eH(this.root_,e,this.comparator_,!1,t)}getReverseIteratorFrom(e,t){return new eH(this.root_,e,this.comparator_,!0,t)}getReverseIterator(e){return new eH(this.root_,null,this.comparator_,!0,e)}}function eQ(e,t){return z(e.name,t.name)}function eX(e,t){return z(e,t)}eY.EMPTY_NODE=new eK;let eJ=function(e){return"number"==typeof e?"number:"+Q(e):"string:"+e},eZ=function(e){if(e.isLeafNode()){let t=e.val();(0,g.vA)("string"==typeof t||"number"==typeof t||"object"==typeof t&&(0,g.gR)(t,".sv"),"Priority must be a string or number.")}else(0,g.vA)(e===i||e.isEmpty(),"priority of unexpected type.");(0,g.vA)(e===i||e.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")};class e0{static set __childrenNodeConstructor(e){s=e}static get __childrenNodeConstructor(){return s}constructor(e,t=e0.__childrenNodeConstructor.EMPTY_NODE){this.value_=e,this.priorityNode_=t,this.lazyHash_=null,(0,g.vA)(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),eZ(this.priorityNode_)}isLeafNode(){return!0}getPriority(){return this.priorityNode_}updatePriority(e){return new e0(this.value_,e)}getImmediateChild(e){return".priority"===e?this.priorityNode_:e0.__childrenNodeConstructor.EMPTY_NODE}getChild(e){return eO(e)?this:".priority"===eI(e)?this.priorityNode_:e0.__childrenNodeConstructor.EMPTY_NODE}hasChild(){return!1}getPredecessorChildName(e,t){return null}updateImmediateChild(e,t){return".priority"===e?this.updatePriority(t):t.isEmpty()&&".priority"!==e?this:e0.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,t).updatePriority(this.priorityNode_)}updateChild(e,t){let n=eI(e);return null===n?t:t.isEmpty()&&".priority"!==n?this:((0,g.vA)(".priority"!==n||1===ex(e),".priority must be the last token in a path"),this.updateImmediateChild(n,e0.__childrenNodeConstructor.EMPTY_NODE.updateChild(eA(e),t)))}isEmpty(){return!1}numChildren(){return 0}forEachChild(e,t){return!1}val(e){return e&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()}hash(){if(null===this.lazyHash_){let e="";this.priorityNode_.isEmpty()||(e+="priority:"+eJ(this.priorityNode_.val())+":");let t=typeof this.value_;e+=t+":","number"===t?e+=Q(this.value_):e+=this.value_,this.lazyHash_=k(e)}return this.lazyHash_}getValue(){return this.value_}compareTo(e){return e===e0.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof e0.__childrenNodeConstructor?-1:((0,g.vA)(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))}compareToLeafNode_(e){let t=typeof e.value_,n=typeof this.value_,r=e0.VALUE_TYPE_ORDER.indexOf(t),i=e0.VALUE_TYPE_ORDER.indexOf(n);return((0,g.vA)(r>=0,"Unknown leaf type: "+t),(0,g.vA)(i>=0,"Unknown leaf type: "+n),r!==i)?i-r:"object"===n?0:this.value_<e.value_?-1:1*(this.value_!==e.value_)}withIndex(){return this}isIndexed(){return!0}equals(e){return e===this||!!e.isLeafNode()&&this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}}e0.VALUE_TYPE_ORDER=["object","boolean","number","string"];class e1 extends e${compare(e,t){let n=e.node.getPriority(),r=t.no
16de.getPriority(),i=n.compareTo(r);return 0===i?z(e.name,t.name):i}isDefinedOn(e){return!e.getPriority().isEmpty()}indexedValueChanged(e,t){return!e.getPriority().equals(t.getPriority())}minPost(){return eq.MIN}maxPost(){return new eq($,new e0("[PRIORITY-POST]",a))}makePost(e,t){return new eq(t,new e0("[PRIORITY-POST]",o(e)))}toString(){return".priority"}}let e2=new e1,e3=Math.log(2);class e5{constructor(e){this.count=parseInt(Math.log(e+1)/e3,10),this.current_=this.count-1;let t=parseInt(Array(this.count+1).join("1"),2);this.bits_=e+1&t}nextBitIsOne(){let e=!(this.bits_&1<<this.current_);return this.current_--,e}}let e6=function(e,t,n,r){e.sort(t);let i=function(t,r){let s,o=r-t;if(0===o)return null;if(1===o)return s=e[t],new eG(n?n(s):s,s.node,eG.BLACK,null,null);{let a=parseInt(o/2,10)+t,l=i(t,a),u=i(a+1,r);return s=e[a],new eG(n?n(s):s,s.node,eG.BLACK,l,u)}};return new eY(r||t,function(t){let r=null,s=null,o=e.length,a=function(t,r){let s=o-t,a=o;o-=t;let u=i(s+1,a),h=e[s];l(new eG(n?n(h):h,h.node,r,null,u))},l=function(e){r?r.left=e:s=e,r=e};for(let e=0;e<t.count;++e){let n=t.nextBitIsOne(),r=Math.pow(2,t.count-(e+1));n?a(r,eG.BLACK):(a(r,eG.BLACK),a(r,eG.RED))}return s}(new e5(e.length)))},e4={};class e8{static get Default(){return(0,g.vA)(e4&&e2,"ChildrenNode.ts has not been loaded"),l=l||new e8({".priority":e4},{".priority":e2})}constructor(e,t){this.indexes_=e,this.indexSet_=t}get(e){let t=(0,g.yw)(this.indexes_,e);if(!t)throw Error("No index defined for "+e);return t instanceof eY?t:null}hasIndex(e){return(0,g.gR)(this.indexSet_,e.toString())}addIndex(e,t){let n;(0,g.vA)(e!==eW,"KeyIndex always exists and isn't meant to be added to the IndexMap.");let r=[],i=!1,s=t.getIterator(eq.Wrap),o=s.getNext();for(;o;)i=i||e.isDefinedOn(o.node),r.push(o),o=s.getNext();n=i?e6(r,e.getCompare()):e4;let a=e.toString(),l=Object.assign({},this.indexSet_);l[a]=e;let u=Object.assign({},this.indexes_);return u[a]=n,new e8(u,l)}addToIndexes(e,t){return new e8((0,g.kH)(this.indexes_,(n,r)=>{let i=(0,g.yw)(this.indexSet_,r);if((0,g.vA)(i,"Missing index implementation for "+r),n===e4)if(!i.isDefinedOn(e.node))return e4;else{let n=[],r=t.getIterator(eq.Wrap),s=r.getNext();for(;s;)s.name!==e.name&&n.push(s),s=r.getNext();return n.push(e),e6(n,i.getCompare())}{let r=t.get(e.name),i=n;return r&&(i=i.remove(new eq(e.name,r))),i.insert(e,e.node)}}),this.indexSet_)}removeFromIndexes(e,t){return new e8((0,g.kH)(this.indexes_,n=>{if(n===e4)return n;{let r=t.get(e.name);return r?n.remove(new eq(e.name,r)):n}}),this.indexSet_)}}class e7{static get EMPTY_NODE(){return u||(u=new e7(new eY(eX),null,e8.Default))}constructor(e,t,n){this.children_=e,this.priorityNode_=t,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&eZ(this.priorityNode_),this.children_.isEmpty()&&(0,g.vA)(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}isLeafNode(){return!1}getPriority(){return this.priorityNode_||u}updatePriority(e){return this.children_.isEmpty()?this:new e7(this.children_,e,this.indexMap_)}getImmediateChild(e){if(".priority"===e)return this.getPriority();{let t=this.children_.get(e);return null===t?u:t}}getChild(e){let t=eI(e);return null===t?this:this.getImmediateChild(t).getChild(eA(e))}hasChild(e){return null!==this.children_.get(e)}updateImmediateChild(e,t){if((0,g.vA)(t,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(t);{let n,r,i=new eq(e,t);t.isEmpty()?(n=this.children_.remove(e),r=this.indexMap_.removeFromIndexes(i,this.children_)):(n=this.children_.insert(e,t),r=this.indexMap_.addToIndexes(i,this.children_));let s=n.isEmpty()?u:this.priorityNode_;return new e7(n,s,r)}}updateChild(e,t){let n=eI(e);if(null===n)return t;{(0,g.vA)(".priority"!==eI(e)||1===ex(e),".priority must be the last token in a path");let r=this.getImmediateChild(n).updateChild(eA(e),t);return this.updateImmediateChild(n,r)}}isEmpty(){return this.children_.isEmpty()}numChildren(){return this.children_.count()}val(e){if(this.isEmpty())return null;let t={},n=0,r=0,i=!0;if(this.forEachChild(e2,(s,o)=>{t[s]=o.val(e),n++,i&&e7.INTEGER_REGEXP_.test(s)?r=Math.max(r,Number(s)):i=!1}
16),e||!i||!(r<2*n))return e&&!this.getPriority().isEmpty()&&(t[".priority"]=this.getPriority().val()),t;{let e=[];for(let n in t)e[n]=t[n];return e}}hash(){if(null===this.lazyHash_){let e="";this.getPriority().isEmpty()||(e+="priority:"+eJ(this.getPriority().val())+":"),this.forEachChild(e2,(t,n)=>{let r=n.hash();""!==r&&(e+=":"+t+":"+r)}),this.lazyHash_=""===e?"":k(e)}return this.lazyHash_}getPredecessorChildName(e,t,n){let r=this.resolveIndex_(n);if(!r)return this.children_.getPredecessorKey(e);{let n=r.getPredecessorKey(new eq(e,t));return n?n.name:null}}getFirstChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.minKey();{let e=t.minKey();return e&&e.name}}getFirstChild(e){let t=this.getFirstChildName(e);return t?new eq(t,this.children_.get(t)):null}getLastChildName(e){let t=this.resolveIndex_(e);if(!t)return this.children_.maxKey();{let e=t.maxKey();return e&&e.name}}getLastChild(e){let t=this.getLastChildName(e);return t?new eq(t,this.children_.get(t)):null}forEachChild(e,t){let n=this.resolveIndex_(e);return n?n.inorderTraversal(e=>t(e.name,e.node)):this.children_.inorderTraversal(t)}getIterator(e){return this.getIteratorFrom(e.minPost(),e)}getIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getIteratorFrom(e,e=>e);{let n=this.children_.getIteratorFrom(e.name,eq.Wrap),r=n.peek();for(;null!=r&&0>t.compare(r,e);)n.getNext(),r=n.peek();return n}}getReverseIterator(e){return this.getReverseIteratorFrom(e.maxPost(),e)}getReverseIteratorFrom(e,t){let n=this.resolveIndex_(t);if(n)return n.getReverseIteratorFrom(e,e=>e);{let n=this.children_.getReverseIteratorFrom(e.name,eq.Wrap),r=n.peek();for(;null!=r&&t.compare(r,e)>0;)n.getNext(),r=n.peek();return n}}compareTo(e){if(this.isEmpty())if(e.isEmpty())return 0;else return -1;return e.isLeafNode()||e.isEmpty()?1:e===te?-1:0}withIndex(e){if(e===eW||this.indexMap_.hasIndex(e))return this;{let t=this.indexMap_.addIndex(e,this.children_);return new e7(this.children_,this.priorityNode_,t)}}isIndexed(e){return e===eW||this.indexMap_.hasIndex(e)}equals(e){if(e===this)return!0;if(e.isLeafNode()||!this.getPriority().equals(e.getPriority()))return!1;if(this.children_.count()!==e.children_.count())return!1;{let t=this.getIterator(e2),n=e.getIterator(e2),r=t.getNext(),i=n.getNext();for(;r&&i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=t.getNext(),i=n.getNext()}return null===r&&null===i}}resolveIndex_(e){return e===eW?null:this.indexMap_.get(e.toString())}}e7.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/;class e9 extends e7{constructor(){super(new eY(eX),e7.EMPTY_NODE,e8.Default)}compareTo(e){return+(e!==this)}equals(e){return e===this}getPriority(){return this}getImmediateChild(e){return e7.EMPTY_NODE}isEmpty(){return!1}}let te=new e9;function tt(e,t=null){if(null===e)return e7.EMPTY_NODE;if("object"==typeof e&&".priority"in e&&(t=e[".priority"]),(0,g.vA)(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&&".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof e&&".value"in e&&null!==e[".value"]&&(e=e[".value"]),"object"!=typeof e||".sv"in e)return new e0(e,tt(t));if(e instanceof Array){let n=e7.EMPTY_NODE;return Y(e,(t,r)=>{if((0,g.gR)(e,t)&&"."!==t.substring(0,1)){let e=tt(r);(e.isLeafNode()||!e.isEmpty())&&(n=n.updateImmediateChild(t,e))}}),n.updatePriority(tt(t))}{let n=[],r=!1;if(Y(e,(e,t)=>{if("."!==e.substring(0,1)){let i=tt(t);i.isEmpty()||(r=r||!i.getPriority().isEmpty(),n.push(new eq(e,i)))}}),0===n.length)return e7.EMPTY_NODE;let i=e6(n,eQ,e=>e.name,eX);if(!r)return new e7(i,tt(t),e8.Default);{let e=e6(n,e2.getCompare());return new e7(i,tt(t),new e8({".priority":e},{".priority":e2}))}}}Object.defineProperties(eq,{MIN:{value:new eq(q,e7.EMPTY_NODE)},MAX:{value:new eq($,te)}}),ez.__EMPTY_NODE=e7.EMPTY_NODE,e0.__childrenNodeConstructor=e7,i=te,a=te,o=tt;class tn extends e${constructor(e){super(),this.indexPath_=e,(0,g.vA)(!eO(e)&&".priority"!==eI(e),"Can't create PathIndex with empty path or .priority key")}extractChild(e){return e.getChild(this.indexPath_)}isDefinedOn(e){return!e.getChild(this.indexPath_).isEmpty()}compare(e,t){let n=this.extractChild(e.node),r=this.extractChild(t.node),i=n.compareTo(r);return 0===i?z(e.name,t.name):i}makePost(e,t){let n=tt(e);return new eq(t,e7.EMPTY_NODE.updateChild(this.indexPath_,n))}maxPost(){return new eq($,e7.EMPTY_NODE.updateChild(this.indexPath_,te))}toString(){return eR(this.indexPath_,0).join("/")}}class tr extends e${compare(e,t){let n=e.node.compareTo(t.node);return 0===n?z(e.name,t.name):n}isDefinedOn(e){return!0}indexedValueChanged(e,t){return!e.equals(t)}
16minPost(){return eq.MIN}maxPost(){return eq.MAX}makePost(e,t){return new eq(t,tt(e))}toString(){return".value"}}let ti=new tr;function ts(e,t,n){return{type:"child_changed",snapshotNode:t,childName:e,oldSnap:n}}class to{constructor(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.startAfterSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.endBeforeSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=e2}hasStart(){return this.startSet_}isViewFromLeft(){return""===this.viewFrom_?this.startSet_:"l"===this.viewFrom_}getIndexStartValue(){return(0,g.vA)(this.startSet_,"Only valid if start has been set"),this.indexStartValue_}getIndexStartName(){return((0,g.vA)(this.startSet_,"Only valid if start has been set"),this.startNameSet_)?this.indexStartName_:q}hasEnd(){return this.endSet_}getIndexEndValue(){return(0,g.vA)(this.endSet_,"Only valid if end has been set"),this.indexEndValue_}getIndexEndName(){return((0,g.vA)(this.endSet_,"Only valid if end has been set"),this.endNameSet_)?this.indexEndName_:$}hasLimit(){return this.limitSet_}hasAnchoredLimit(){return this.limitSet_&&""!==this.viewFrom_}getLimit(){return(0,g.vA)(this.limitSet_,"Only valid if limit has been set"),this.limit_}getIndex(){return this.index_}loadsAllData(){return!(this.startSet_||this.endSet_||this.limitSet_)}isDefault(){return this.loadsAllData()&&this.index_===e2}copy(){let e=new to;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.startAfterSet_=this.startAfterSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.endBeforeSet_=this.endBeforeSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e}}function ta(e){let t,n={};if(e.isDefault())return n;if(e.index_===e2?t="$priority":e.index_===ti?t="$value":e.index_===eW?t="$key":((0,g.vA)(e.index_ instanceof tn,"Unrecognized index type!"),t=e.index_.toString()),n.orderBy=(0,g.As)(t),e.startSet_){let t=e.startAfterSet_?"startAfter":"startAt";n[t]=(0,g.As)(e.indexStartValue_),e.startNameSet_&&(n[t]+=","+(0,g.As)(e.indexStartName_))}if(e.endSet_){let t=e.endBeforeSet_?"endBefore":"endAt";n[t]=(0,g.As)(e.indexEndValue_),e.endNameSet_&&(n[t]+=","+(0,g.As)(e.indexEndName_))}return e.limitSet_&&(e.isViewFromLeft()?n.limitToFirst=e.limit_:n.limitToLast=e.limit_),n}function tl(e){let t={};if(e.startSet_&&(t.sp=e.indexStartValue_,e.startNameSet_&&(t.sn=e.indexStartName_),t.sin=!e.startAfterSet_),e.endSet_&&(t.ep=e.indexEndValue_,e.endNameSet_&&(t.en=e.indexEndName_),t.ein=!e.endBeforeSet_),e.limitSet_){t.l=e.limit_;let n=e.viewFrom_;""===n&&(n=e.isViewFromLeft()?"l":"r"),t.vf=n}return e.index_!==e2&&(t.i=e.index_.toString()),t}class tu extends eb{reportStats(e){throw Error("Method not implemented.")}static getListenId_(e,t){return void 0!==t?"tag$"+t:((0,g.vA)(e._queryParams.isDefault(),"should have a tag if it's not a default query."),e._path.toString())}constructor(e,t,n,r){super(),this.repoInfo_=e,this.onDataUpdate_=t,this.authTokenProvider_=n,this.appCheckTokenProvider_=r,this.log_=L("p:rest:"),this.listens_={}}listen(e,t,n,r){let i=e._path.toString();this.log_("Listen called for "+i+" "+e._queryIdentifier);let s=tu.getListenId_(e,n),o={};this.listens_[s]=o;let a=ta(e._queryParams);this.restRequest_(i+".json",a,(e,t)=>{let a=t;(404===e&&(a=null,e=null),null===e&&this.onDataUpdate_(i,a,!1,n),(0,g.yw)(this.listens_,s)===o)&&r(e?401===e?"permission_denied":"rest_error:"+e:"ok",null)})}unlisten(e,t){let n=tu.getListenId_(e,t);delete this.listens_[n]}get(e){let t=ta(e._queryParams),n=e._path.toString(),r=new g.cY;return this.restRequest_(n+".json",t,(e,t)=>{let i=t;404===e&&(i=null,e=null),null===e?(this.onDataUpdate_(n,i,!1,null),r.resolve(i)):r.reject(Error(i))}),r.promise}refreshAuthToken(e){}restRequest_(e,t={},n){return t.format="export",Promise.all([this.authTokenProvider_.getToken(!1),this.appCheckTokenProvider_.getToken(!1)]).then(([r,i])=>{r&&r.accessToken&&(t.auth=r.accessToken),i&&i.token&&(t.ac=i.token);let s=(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host+e+"?ns="+this.repoInfo_.namespace+(0,g.Am)(t);this.log_("Sending REST request for "+s);let o=new XMLHttpRequest;o.onreadystatechange=()=>{if(n&&4===o.readyState){this.log_("REST Response for "+s+" received. status:",o.status,"response:",o.responseText);let e=null;if(o.status>=200&&o.status<300){try{e=(0,g.$L)(o.responseText)}catch(e){F("Failed to parse JSON response for "+s+": "+o.responseText)}n(null,e)}else 401!==o.status&&404!==o.status&&F("Got unsuccessful REST response for "+s+" Status: "+o.status),n(o.status);n=null}},o.open("GET",s,!0),o.send()})}}class th{constructor(){this.rootNode_=e7.EMPTY_NODE}getNode(e){return this.rootNode_.getChild(e)}updateSnapshot(e,t){this.rootNode_=this.rootNode_.updateChild(e,t)}}function tc(){return{value:null,children:new Map}}function td(e,t,n){var r,i;null!==e.value?n(t,e.value):(r=e,i=(e,r)=>{td(r,new eS(t.toString()+"/"+e),n)}
16,r.children.forEach((e,t)=>{i(t,e)}))}class tf{constructor(e){this.collection_=e,this.last_=null}get(){let e=this.collection_.get(),t=Object.assign({},e);return this.last_&&Y(this.last_,(e,n)=>{t[e]=t[e]-n}),this.last_=e,t}}class tp{constructor(e,t){this.server_=t,this.statsToReport_={},this.statsListener_=new tf(e);let n=1e4+2e4*Math.random();ee(this.reportStats_.bind(this),Math.floor(n))}reportStats_(){let e=this.statsListener_.get(),t={},n=!1;Y(e,(e,r)=>{r>0&&(0,g.gR)(this.statsToReport_,e)&&(t[e]=r,n=!0)}),n&&this.server_.reportStats(t),ee(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))}}function tm(){return{fromUser:!0,fromServer:!1,queryId:null,tagged:!1}}function tg(){return{fromUser:!1,fromServer:!0,queryId:null,tagged:!1}}function ty(e){return{fromUser:!1,fromServer:!0,queryId:e,tagged:!0}}!function(e){e[e.OVERWRITE=0]="OVERWRITE",e[e.MERGE=1]="MERGE",e[e.ACK_USER_WRITE=2]="ACK_USER_WRITE",e[e.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(f||(f={}));class tv{constructor(e,t,n){this.path=e,this.affectedTree=t,this.revert=n,this.type=f.ACK_USER_WRITE,this.source=tm()}operationForChild(e){if(!eO(this.path))return(0,g.vA)(eI(this.path)===e,"operationForChild called for unrelated child."),new tv(eA(this.path),this.affectedTree,this.revert);if(null!=this.affectedTree.value)return(0,g.vA)(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;{let t=this.affectedTree.subtree(new eS(e));return new tv(eC(),t,this.revert)}}}class t_{constructor(e,t,n){this.source=e,this.path=t,this.snap=n,this.type=f.OVERWRITE}operationForChild(e){return eO(this.path)?new t_(this.source,eC(),this.snap.getImmediateChild(e)):new t_(this.source,eA(this.path),this.snap)}}class tw{constructor(e,t,n){this.source=e,this.path=t,this.children=n,this.type=f.MERGE}operationForChild(e){if(!eO(this.path))return(0,g.vA)(eI(this.path)===e,"Can't get a merge for a child not on the path of the operation"),new tw(this.source,eA(this.path),this.children);{let t=this.children.subtree(new eS(e));return t.isEmpty()?null:t.value?new t_(this.source,eC(),t.value):new tw(this.source,eC(),t)}}toString(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"}}class tb{constructor(e,t,n){this.node_=e,this.fullyInitialized_=t,this.filtered_=n}isFullyInitialized(){return this.fullyInitialized_}isFiltered(){return this.filtered_}isCompleteForPath(e){if(eO(e))return this.isFullyInitialized()&&!this.filtered_;let t=eI(e);return this.isCompleteForChild(t)}isCompleteForChild(e){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(e)}getNode(){return this.node_}}function tE(e,t,n,r,i,s){let o=r.filter(e=>e.type===n);o.sort((t,n)=>(function(e,t,n){if(null==t.childName||null==n.childName)throw(0,g.Hk)("Should only compare child_ events.");let r=new eq(t.childName,t.snapshotNode),i=new eq(n.childName,n.snapshotNode);return e.index_.compare(r,i)})(e,t,n)),o.forEach(n=>{var r,o,a;let l=(r=e,o=n,a=s,"value"===o.type||"child_removed"===o.type||(o.prevName=a.getPredecessorChildName(o.childName,o.snapshotNode,r.index_)),o);i.forEach(r=>{r.respondsTo(n.type)&&t.push(r.createEvent(l,e.query_))})})}function tT(e,t){return{eventCache:e,serverCache:t}}function tS(e,t,n,r){return tT(new tb(t,n,r),e.serverCache)}function tC(e,t,n,r){return tT(e.eventCache,new tb(t,n,r))}function tI(e){return e.eventCache.isFullyInitialized()?e.eventCache.getNode():null}function tx(e){return e.serverCache.isFullyInitialized()?e.serverCache.getNode():null}class tA{static fromObject(e){let t=new tA(null);return Y(e,(e,n)=>{t=t.set(new eS(e),n)}),t}constructor(e,t=(!h&&(h=new eY(W)),h)){this.value=e,this.children=t}isEmpty(){return null===this.value&&this.children.isEmpty()}findRootMostMatchingPathAndValue(e,t){if(null!=this.value&&t(this.value))return{path:eC(),value:this.value};{if(eO(e))return null;let n=eI(e),r=this.children.get(n);if(null===r)return null;{let i=r.findRootMostMatchingPathAndValue(eA(e),t);return null!=i?{path:eN(new eS(n),i.path),value:i.value}:null}}}findRootMostValueAndPath(e){return this.findRootMostMatchingPathAndValue(e,()=>!0)}subtree(e){if(eO(e))return this;{let t=eI(e),n=this.children.get(t);return null!==n?n.subtree(eA(e)):new tA(null)}}set(e,t){if(eO(e))return new tA(t,this.children);{let n=eI(e),r=(this.children.get(n)||new tA(null)).set(eA(e),t),i=this.children.insert(n,r);return new tA(this.value,i)}}remove(e){if(eO(e))if(this.children.isEmpty())return new tA(null);else return new tA(null,this.children);{let t=eI(e),n=this.children.get(t);if(!n)return this;{let r,i=n.remove(eA(e));return(r=i.isEmpty()?this.children.remove(t):this.children.insert(t,i),null===this.value&&r.isEmpty())?new tA(null):new tA(this.value,r)}}}get(e){if(eO(e))return this.value;{let t=eI(e),n=this.children.get(t);return n?n.get(eA(e)):null}}setTree(e,t){if(eO(e))return t;{let n,r=eI(e),i=(this.children.get(r)||new tA(null)).setTree(eA(e),t);return n=i.isEmpty()?this.children.remove(r):this.children.insert(r,i),new tA(this.value,
16n)}}fold(e){return this.fold_(eC(),e)}fold_(e,t){let n={};return this.children.inorderTraversal((r,i)=>{n[r]=i.fold_(eN(e,r),t)}),t(e,this.value,n)}findOnPath(e,t){return this.findOnPath_(e,eC(),t)}findOnPath_(e,t,n){let r=!!this.value&&n(t,this.value);if(r)return r;{if(eO(e))return null;let r=eI(e),i=this.children.get(r);return i?i.findOnPath_(eA(e),eN(t,r),n):null}}foreachOnPath(e,t){return this.foreachOnPath_(e,eC(),t)}foreachOnPath_(e,t,n){if(eO(e))return this;{this.value&&n(t,this.value);let r=eI(e),i=this.children.get(r);return i?i.foreachOnPath_(eA(e),eN(t,r),n):new tA(null)}}foreach(e){this.foreach_(eC(),e)}foreach_(e,t){this.children.inorderTraversal((n,r)=>{r.foreach_(eN(e,n),t)}),this.value&&t(e,this.value)}foreachChild(e){this.children.inorderTraversal((t,n)=>{n.value&&e(t,n.value)})}}class tk{constructor(e){this.writeTree_=e}static empty(){return new tk(new tA(null))}}function tR(e,t,n){if(eO(t))return new tk(new tA(n));{let r=e.writeTree_.findRootMostValueAndPath(t);if(null!=r){let i=r.path,s=r.value,o=eD(i,t);return s=s.updateChild(o,n),new tk(e.writeTree_.set(i,s))}{let r=new tA(n);return new tk(e.writeTree_.setTree(t,r))}}}function tP(e,t,n){let r=e;return Y(n,(e,n)=>{r=tR(r,eN(t,e),n)}),r}function tN(e,t){return eO(t)?tk.empty():new tk(e.writeTree_.setTree(t,new tA(null)))}function tO(e,t){return null!=tD(e,t)}function tD(e,t){let n=e.writeTree_.findRootMostValueAndPath(t);return null!=n?e.writeTree_.get(n.path).getChild(eD(n.path,t)):null}function tL(e){let t=[],n=e.writeTree_.value;return null!=n?n.isLeafNode()||n.forEachChild(e2,(e,n)=>{t.push(new eq(e,n))}):e.writeTree_.children.inorderTraversal((e,n)=>{null!=n.value&&t.push(new eq(e,n.value))}),t}function tM(e,t){if(eO(t))return e;{let n=tD(e,t);return new tk(null!=n?new tA(n):e.writeTree_.subtree(t))}}function tj(e){return e.writeTree_.isEmpty()}function tF(e,t){return function e(t,n,r){if(null!=n.value)return r.updateChild(t,n.value);{let i=null;return n.children.inorderTraversal((n,s)=>{".priority"===n?((0,g.vA)(null!==s.value,"Priority writes must always be leaf nodes"),i=s.value):r=e(eN(t,n),s,r)}),r.getChild(t).isEmpty()||null===i||(r=r.updateChild(eN(t,".priority"),i)),r}}(eC(),e.writeTree_,t)}function tU(e){return e.visible}function tV(e,t,n){let r=tk.empty();for(let i=0;i<e.length;++i){let s=e[i];if(t(s)){let e,t=s.path;if(s.snap)eM(n,t)?r=tR(r,e=eD(n,t),s.snap):eM(t,n)&&(e=eD(t,n),r=tR(r,eC(),s.snap.getChild(e)));else if(s.children){if(eM(n,t))r=tP(r,e=eD(n,t),s.children);else if(eM(t,n))if(eO(e=eD(t,n)))r=tP(r,eC(),s.children);else{let t=(0,g.yw)(s.children,eI(e));if(t){let n=t.getChild(eA(e));r=tR(r,eC(),n)}}}else throw(0,g.Hk)("WriteRecord should have .snap or .children")}}return r}function tB(e,t,n,r,i){if(r||i){let s=tM(e.visibleWrites,t);return!i&&tj(s)?n:i||null!=n||tO(s,eC())?tF(tV(e.allWrites,function(e){return(e.visible||i)&&(!r||!~r.indexOf(e.writeId))&&(eM(e.path,t)||eM(t,e.path))},t),n||e7.EMPTY_NODE):null}{let r=tD(e.visibleWrites,t);if(null!=r)return r;{let r=tM(e.visibleWrites,t);return tj(r)?n:null!=n||tO(r,eC())?tF(r,n||e7.EMPTY_NODE):null}}}function tq(e,t,n,r){return tB(e.writeTree,e.treePath,t,n,r)}function t$(e,t){return function(e,t,n){let r=e7.EMPTY_NODE,i=tD(e.visibleWrites,t);if(i)return i.isLeafNode()||i.forEachChild(e2,(e,t)=>{r=r.updateImmediateChild(e,t)}),r;
16if(!n)return tL(tM(e.visibleWrites,t)).forEach(e=>{r=r.updateImmediateChild(e.name,e.node)}),r;{let i=tM(e.visibleWrites,t);return n.forEachChild(e2,(e,t)=>{let n=tF(tM(i,new eS(e)),t);r=r.updateImmediateChild(e,n)}),tL(i).forEach(e=>{r=r.updateImmediateChild(e.name,e.node)}),r}}(e.writeTree,e.treePath,t)}function tz(e,t,n,r){return function(e,t,n,r,i){(0,g.vA)(r||i,"Either existingEventSnap or existingServerSnap must exist");let s=eN(t,n);if(tO(e.visibleWrites,s))return null;{let t=tM(e.visibleWrites,s);return tj(t)?i.getChild(n):tF(t,i.getChild(n))}}(e.writeTree,e.treePath,t,n,r)}function tW(e,t){var n,r;return n=e.writeTree,r=eN(e.treePath,t),tD(n.visibleWrites,r)}function tH(e,t,n){return function(e,t,n,r){let i=eN(t,n),s=tD(e.visibleWrites,i);return null!=s?s:r.isCompleteForChild(n)?tF(tM(e.visibleWrites,i),r.getNode().getImmediateChild(n)):null}(e.writeTree,e.treePath,t,n)}function tG(e,t){return tK(eN(e.treePath,t),e.writeTree)}function tK(e,t){return{treePath:e,writeTree:t}}class tY{constructor(){this.changeMap=new Map}trackChildChange(e){let t=e.type,n=e.childName;(0,g.vA)("child_added"===t||"child_changed"===t||"child_removed"===t,"Only child changes supported for tracking"),(0,g.vA)(".priority"!==n,"Only non-priority child changes can be tracked.");let r=this.changeMap.get(n);if(r){let i=r.type;if("child_added"===t&&"child_removed"===i)this.changeMap.set(n,ts(n,e.snapshotNode,r.snapshotNode));else if("child_removed"===t&&"child_added"===i)this.changeMap.delete(n);else if("child_removed"===t&&"child_changed"===i)this.changeMap.set(n,{type:"child_removed",snapshotNode:r.oldSnap,childName:n});else if("child_changed"===t&&"child_added"===i)this.changeMap.set(n,{type:"child_added",snapshotNode:e.snapshotNode,childName:n});else if("child_changed"===t&&"child_changed"===i)this.changeMap.set(n,ts(n,e.snapshotNode,r.oldSnap));else throw(0,g.Hk)("Illegal combination of changes: "+e+" occurred after "+r)}else this.changeMap.set(n,e)}getChanges(){return Array.from(this.changeMap.values())}}class tQ{getCompleteChild(e){return null}getChildAfterChild(e,t,n){return null}}let tX=new tQ;class tJ{constructor(e,t,n=null){this.writes_=e,this.viewCache_=t,this.optCompleteServerCache_=n}getCompleteChild(e){let t=this.viewCache_.eventCache;if(t.isCompleteForChild(e))return t.getNode().getImmediateChild(e);{let t=null!=this.optCompleteServerCache_?new tb(this.optCompleteServerCache_,!0,!1):this.viewCache_.serverCache;return tH(this.writes_,e,t)}}getChildAfterChild(e,t,n){var r;let i=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:tx(this.viewCache_),s=(r=this.writes_,function(e,t,n,r,i,s,o){let a,l=tM(e.visibleWrites,t),u=tD(l,eC());if(null!=u)a=u;else{if(null==n)return[];a=tF(l,n)}if((a=a.withIndex(o)).isEmpty()||a.isLeafNode())return[];{let e=[],t=o.getCompare(),n=s?a.getReverseIteratorFrom(r,o):a.getIteratorFrom(r,o),i=n.getNext();for(;i&&e.length<1;)0!==t(i,r)&&e.push(i),i=n.getNext();return e}}(r.writeTree,r.treePath,i,t,1,n,e));return 0===s.length?null:s[0]}}function tZ(e,t,n,r,i,s){let o=t.eventCache;if(null!=tW(r,n))return t;{let a,l;if(eO(n))if((0,g.vA)(t.serverCache.isFullyInitialized(),"If change path is empty, we must have complete server data"),t.serverCache.isFiltered()){let n=tx(t),i=t$(r,n instanceof e7?n:e7.EMPTY_NODE);a=e.filter.updateFullNode(t.eventCache.getNode(),i,s)}else{let n=tq(r,tx(t));a=e.filter.updateFullNode(t.eventCache.getNode(),n,s)}else{let u=eI(n);if(".priority"===u){(0,g.vA)(1===ex(n),"Can't have a priority with additional path components");let i=o.getNode(),s=tz(r,n,i,l=t.serverCache.getNode());a=null!=s?e.filter.updatePriority(i,s):o.getNode()}else{let h,c=eA(n);if(o.isCompleteForChild(u)){l=t.serverCache.getNode();let e=tz(r,n,o.getNode(),l);h=null!=e?o.getNode().getImmediateChild(u).updateChild(c,e):o.getNode().getImmediateChild(u)}else h=tH(r,u,t.serverCache);a=null!=h?e.filter.updateChild(o.getNode(),u,h,c,i,s):o.getNode()}}return tS(t,a,o.isFullyInitialized()||eO(n),e.filter.filtersNodes())}}function t0(e,t,n,r,i,s,o,a){let l,u=t.serverCache,h=o?e.filter:e.filter.getIndexedFilter();if(eO(n))l=h.updateFullNode(u.getNode(),r,null);else if(h.filtersNodes()&&!u.isFiltered()){let e=u.getNode().updateChild(n,r);l=h.updateFullNode(u.getNode(),e,null)}else{let e=eI(n);if(!u.isCompleteForPath(n)&&ex(n)>1)return t;let i=eA(n),s=u.getNode().getImmediateChild(e).updateChild(i,r);l=".priority"===e?h.updatePriority(u.getNode(),s):h.updateChild(u.getNode(),e,s,i,tX,null)}let c=tC(t,l,u.isFullyInitialized()||eO(n),h.filtersNodes()),d=new tJ(i,c,s);return tZ(e,c,n,i,d,a)}function t1(e,t,n,r,i,s,o){let a,l,u=t.eventCache,h=new tJ(i,t,s);if(eO(n))l=e.filter.updateFullNode(t.eventCache.getNode(),r,o),a=tS(t,l,!0,e.filter.filtersNodes());else{let i=eI(n);if(".priority"===i)l=e.filter.updatePriority(t.eventCache.getNode(),r),a=tS(t,l,u.isFullyInitialized(),u.isFiltered());else{let s,l=eA(n),c=u.getNode().getImmediateChild(i);if(eO(l))s=r;else{let e=h.getCompleteChild(i);s=null!=e?".priority"===ek(l)&&e.getChild(eP(l)).isEmpty()?e:e.updateChild(l,r):e7.EMPTY_NODE}a=c.equals(s)?t:tS(t,e.filter.updateChild(u.getNode(),i,s,l,h,o),u.isFullyInitialized(),e.filter.filtersNodes())}}return a}function t2(e,t){return e.eventCache.isCompleteForChild(t)}function t3(e,t,n){return n.foreach((e,n)=>{t=t.updateChild(e,n)}),t}function t5(e,t,n,r,i,s,o,a){let l;if(t.serverCache.getNode().isEmpty()&&!t.serverCache.isFullyInitialized())return t;let u=t;l=eO(n)?r:new tA(null).setTree(n,r);let h=t.serverCache.getNode();return l.children.inorderTraversal((n,r)=>{if(h.hasChild(n)){let l=t3(e,t.serverCache.getNode().getImmediateChild(n),r);u=t0(e,u,new eS(n),l,i,s,o,a)}}),l.children.inorderTraversal((n,r)=>{let l=!t.serverCache.isCompleteForChild(n)&&null===r.value;if(!h.hasChild(n)&&!l){let l=t3(e,t.serverCache.getNode().getImmediateChild(n),r);u=t0(e,u,new eS(n),l,i,s,o,a)}}),u}function t6(e,t,n,r){var i,s;t.type===f.MERGE&&null!==t.source.queryId&&((0,g.vA)(tx(e.viewCache_),"We should always have a full c
16ache before handling merges"),(0,g.vA)(tI(e.viewCache_),"Missing event cache, even though we have a server cache"));let o=e.viewCache_,a=function(e,t,n,r,i){let s,o,a=new tY;if(n.type===f.OVERWRITE)n.source.fromUser?s=t1(e,t,n.path,n.snap,r,i,a):((0,g.vA)(n.source.fromServer,"Unknown source."),o=n.source.tagged||t.serverCache.isFiltered()&&!eO(n.path),s=t0(e,t,n.path,n.snap,r,i,o,a));else if(n.type===f.MERGE){var l,u,h,c,d,p,m;let f;n.source.fromUser?(l=e,u=t,h=n.path,c=n.children,d=r,p=i,m=a,f=u,c.foreach((e,t)=>{let n=eN(h,e);t2(u,eI(n))&&(f=t1(l,f,n,t,d,p,m))}),c.foreach((e,t)=>{let n=eN(h,e);t2(u,eI(n))||(f=t1(l,f,n,t,d,p,m))}),s=f):((0,g.vA)(n.source.fromServer,"Unknown source."),o=n.source.tagged||t.serverCache.isFiltered(),s=t5(e,t,n.path,n.children,r,i,o,a))}else if(n.type===f.ACK_USER_WRITE)s=n.revert?function(e,t,n,r,i,s){let o;if(null!=tW(r,n))return t;{let a,l=new tJ(r,t,i),u=t.eventCache.getNode();if(eO(n)||".priority"===eI(n)){let n;if(t.serverCache.isFullyInitialized())n=tq(r,tx(t));else{let e=t.serverCache.getNode();(0,g.vA)(e instanceof e7,"serverChildren would be complete if leaf node"),n=t$(r,e)}a=e.filter.updateFullNode(u,n,s)}else{let i=eI(n),h=tH(r,i,t.serverCache);null==h&&t.serverCache.isCompleteForChild(i)&&(h=u.getImmediateChild(i)),(a=null!=h?e.filter.updateChild(u,i,h,eA(n),l,s):t.eventCache.getNode().hasChild(i)?e.filter.updateChild(u,i,e7.EMPTY_NODE,eA(n),l,s):u).isEmpty()&&t.serverCache.isFullyInitialized()&&(o=tq(r,tx(t))).isLeafNode()&&(a=e.filter.updateFullNode(a,o,s))}return o=t.serverCache.isFullyInitialized()||null!=tW(r,eC()),tS(t,a,o,e.filter.filtersNodes())}}(e,t,n.path,r,i,a):function(e,t,n,r,i,s,o){if(null!=tW(i,n))return t;let a=t.serverCache.isFiltered(),l=t.serverCache;if(null!=r.value)if(eO(n)&&l.isFullyInitialized()||l.isCompleteForPath(n))return t0(e,t,n,l.getNode().getChild(n),i,s,a,o);else{if(!eO(n))return t;let r=new tA(null);return l.getNode().forEachChild(eW,(e,t)=>{r=r.set(new eS(e),t)}),t5(e,t,n,r,i,s,a,o)}{let u=new tA(null);return r.foreach((e,t)=>{let r=eN(n,e);l.isCompleteForPath(r)&&(u=u.set(e,l.getNode().getChild(r)))}),t5(e,t,n,u,i,s,a,o)}}(e,t,n.path,n.affectedTree,r,i,a);else if(n.type===f.LISTEN_COMPLETE)s=function(e,t,n,r,i){let s=t.serverCache;return tZ(e,tC(t,s.getNode(),s.isFullyInitialized()||eO(n),s.isFiltered()),n,r,tX,i)}(e,t,n.path,r,a);else throw(0,g.Hk)("Unknown operation type: "+n.type);let y=a.getChanges();return function(e,t,n){let r=t.eventCache;if(r.isFullyInitialized()){let i=r.getNode().isLeafNode()||r.getNode().isEmpty(),s=tI(e);!(n.length>0)&&e.eventCache.isFullyInitialized()&&(!i||r.getNode().equals(s))&&r.getNode().getPriority().equals(s.getPriority())||n.push({type:"value",snapshotNode:tI(t)})}}(t,s,y),{viewCache:s,changes:y}}(e.processor_,o,t,n,r);return i=e.processor_,s=a.viewCache,(0,g.vA)(s.eventCache.getNode().isIndexed(i.filter.getIndex()),"Event snap not indexed"),(0,g.vA)(s.serverCache.getNode().isIndexed(i.filter.getIndex()),"Server snap not indexed"),(0,g.vA)(a.viewCache.serverCache.isFullyInitialized()||!o.serverCache.isFullyInitialized(),"Once a server snap is complete, it should never go back"),e.viewCache_=a.viewCache,function(e,t,n,r){let i=(0,e.eventRegistrations_);var s=e.eventGenerator_;let o=[],a=[];return t.forEach(e=>{var t;"child_changed"===e.type&&s.index_.indexedValueChanged(e.oldSnap,e.snapshotNode)&&a.push((t=e.childName,{type:"child_moved",snapshotNode:e.snapshotNode,childName:t}))}),tE(s,o,"child_removed",t,i,n),tE(s,o,"child_added",t,i,n),tE(s,o,"child_moved",a,i,n),tE(s,o,"child_changed",t,i,n),tE(s,o,"value",t,i,n),o}(e,a.changes,a.viewCache.eventCache.getNode(),null)}function t4(e,t,n,r){let i=t.source.queryId;if(null!==i){let s=e.views.get(i);return(0,g.vA)(null!=s,"SyncTree gave us an op for an invalid query."),t6(s,t,n,r)}{let i=[];for(let s of e.views.values())i=i.concat(t6(s,t,n,r));return i}}function t8(e,t){let n=null;for(let r of e.views.values())n=n||function(e,t){let n=tx(e.viewCache_);return n&&(e.query._queryParams.loadsAllData()||!eO(t)&&!n.getImmediateChild(eI(t)).isEmpty())?n.getChild(t):null}(r,t);return n}
16class t7{constructor(e){this.listenProvider_=e,this.syncPointTree_=new tA(null),this.pendingWriteTree_={visibleWrites:tk.empty(),allWrites:[],lastWriteId:-1},this.tagToQueryMap=new Map,this.queryToTagMap=new Map}}function t9(e,t,n=!1){let r=function(e,t){for(let n=0;n<e.allWrites.length;n++){let r=e.allWrites[n];if(r.writeId===t)return r}return null}(e.pendingWriteTree_,t);if(!function(e,t){var n;let r=e.allWrites.findIndex(e=>e.writeId===t);(0,g.vA)(r>=0,"removeWrite called with nonexistent writeId.");let i=e.allWrites[r];e.allWrites.splice(r,1);let s=i.visible,o=!1,a=e.allWrites.length-1;for(;s&&a>=0;){let t=e.allWrites[a];t.visible&&(a>=r&&function(e,t){if(e.snap)return eM(e.path,t);for(let n in e.children)if(e.children.hasOwnProperty(n)&&eM(eN(e.path,n),t))return!0;return!1}(t,i.path)?s=!1:eM(i.path,t.path)&&(o=!0)),a--}return!!s&&(o?((n=e).visibleWrites=tV(n.allWrites,tU,eC()),n.allWrites.length>0?n.lastWriteId=n.allWrites[n.allWrites.length-1].writeId:n.lastWriteId=-1):i.snap?e.visibleWrites=tN(e.visibleWrites,i.path):Y(i.children,t=>{e.visibleWrites=tN(e.visibleWrites,eN(i.path,t))}),!0)}(e.pendingWriteTree_,t))return[];{let t=new tA(null);return null!=r.snap?t=t.set(eC(),!0):Y(r.children,e=>{t=t.set(new eS(e),!0)}),nn(e,new tv(r.path,t,n))}}function ne(e,t,n){return nn(e,new t_(tg(),t,n))}function nt(e,t,n){let r=e.pendingWriteTree_,i=e.syncPointTree_.findOnPath(t,(e,n)=>{let r=t8(n,eD(e,t));if(r)return r});return tB(r,t,i,n,!0)}function nn(e,t){var n;return function e(t,n,r,i){if(eO(t.path))return function e(t,n,r,i){let s=n.get(eC());null==r&&null!=s&&(r=t8(s,eC()));let o=[];return n.children.inorderTraversal((n,s)=>{let a=r?r.getImmediateChild(n):null,l=tG(i,n),u=t.operationForChild(n);u&&(o=o.concat(e(u,s,a,l)))}),s&&(o=o.concat(t4(s,t,i,r))),o}(t,n,r,i);{let s=n.get(eC());null==r&&null!=s&&(r=t8(s,eC()));let o=[],a=eI(t.path),l=t.operationForChild(a),u=n.children.get(a);if(u&&l){let t=r?r.getImmediateChild(a):null,n=tG(i,a);o=o.concat(e(l,u,t,n))}return s&&(o=o.concat(t4(s,t,i,r))),o}}(t,e.syncPointTree_,null,(n=e.pendingWriteTree_,tK(eC(),n)))}function nr(e,t){return e.tagToQueryMap.get(t)}function ni(e){let t=e.indexOf("$");return(0,g.vA)(-1!==t&&t<e.length-1,"Bad queryKey."),{queryId:e.substr(t+1),path:new eS(e.substr(0,t))}}function ns(e,t,n){let r=e.syncPointTree_.get(t);return(0,g.vA)(r,"Missing sync point for query tag that we're tracking"),t4(r,n,tK(t,e.pendingWriteTree_),null)}class no{constructor(e){this.node_=e}getImmediateChild(e){return new no(this.node_.getImmediateChild(e))}node(){return this.node_}}class na{constructor(e,t){this.syncTree_=e,this.path_=t}getImmediateChild(e){let t=eN(this.path_,e);return new na(this.syncTree_,t)}node(){return nt(this.syncTree_,this.path_)}}let nl=function(e,t,n){return e&&"object"==typeof e?((0,g.vA)(".sv"in e,"Unexpected leaf node or priority contents"),"string"==typeof e[".sv"])?nu(e[".sv"],t,n):"object"==typeof e[".sv"]?nh(e[".sv"],t):void(0,g.vA)(!1,"Unexpected server value: "+JSON.stringify(e,null,2)):e},nu=function(e,t,n){if("timestamp"===e)return n.timestamp;(0,g.vA)(!1,"Unexpected server value: "+e)},nh=function(e,t,n){e.hasOwnProperty("increment")||(0,g.vA)(!1,"Unexpected server value: "+JSON.stringify(e,null,2));let r=e.increment;"number"!=typeof r&&(0,g.vA)(!1,"Unexpected increment value: "+r);let i=t.node();if((0,g.vA)(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;let s=i.getValue();return"number"!=typeof s?r:s+r};function nc(e,t,n){let r,i=nl(e.getPriority().val(),t.getImmediateChild(".priority"),n);if(!e.isLeafNode())return r=e,i!==e.getPriority().val()&&(r=r.updatePriority(new e0(i))),e.forEachChild(e2,(e,i)=>{let s=nc(i,t.getImmediateChild(e),n);s!==i&&(r=r.updateImmediateChild(e,s))}),r;{let r=nl(e.getValue(),t,n);return r!==e.getValue()||i!==e.getPriority().val()?new e0(r,tt(i)):e}}class nd{constructor(e="",t=null,n={children:{},childCount:0}){this.name=e,this.parent=t,this.node=n}}function nf(e,t){let n=t instanceof eS?t:new eS(t),r=e,i=eI(n);for(;null!==i;){let e=(0,g.yw)(r.node.children,i)||{children:{},childCount:0};r=new nd(i,r,e),i=eI(n=eA(n))}return r}
16function np(e){return e.node.value}function nm(e,t){e.node.value=t,function e(t){null!==t.parent&&function(t,n,r){let i=void 0===np(r)&&!ng(r),s=(0,g.gR)(t.node.children,n);i&&s?(delete t.node.children[n],t.node.childCount--,e(t)):i||s||(t.node.children[n]=r.node,t.node.childCount++,e(t))}(t.parent,t.name,t)}(e)}function ng(e){return e.node.childCount>0}function ny(e,t){Y(e.node.children,(n,r)=>{t(new nd(n,e,r))})}function nv(e){return new eS(null===e.parent?e.name:nv(e.parent)+"/"+e.name)}let n_=/[\[\].#$\/\u0000-\u001F\u007F]/,nw=/[\[\].#$\u0000-\u001F\u007F]/,nb=function(e){return"string"==typeof e&&0!==e.length&&!n_.test(e)},nE=function(e){var t;return e&&(e=e.replace(/^\/*\.info(\/|$)/,"/")),"string"==typeof(t=e)&&0!==t.length&&!nw.test(t)},nT=function(e,t,n){let r=n instanceof eS?new ej(n,e):n;if(void 0===t)throw Error(e+"contains undefined "+eU(r));if("function"==typeof t)throw Error(e+"contains a function "+eU(r)+" with contents = "+t.toString());if(V(t))throw Error(e+"contains "+t.toString()+" "+eU(r));if("string"==typeof t&&t.length>3495253.3333333335&&(0,g.OE)(t)>0xa00000)throw Error(e+"contains a string greater than 10485760 utf8 bytes "+eU(r)+" ('"+t.substring(0,50)+"...')");if(t&&"object"==typeof t){let n=!1,i=!1;if(Y(t,(t,s)=>{if(".value"===t)n=!0;else if(".priority"!==t&&".sv"!==t&&(i=!0,!nb(t)))throw Error(e+" contains an invalid key ("+t+") "+eU(r)+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.parts_.length>0&&(r.byteLength_+=1),r.parts_.push(t),r.byteLength_+=(0,g.OE)(t),eF(r),nT(e,s,r);let o=r.parts_.pop();r.byteLength_-=(0,g.OE)(o),r.parts_.length>0&&(r.byteLength_-=1)}),n&&i)throw Error(e+' contains ".value" child '+eU(r)+" in addition to actual children.")}},nS=function(e,t){let n=t.path.toString();if("string"!=typeof t.repoInfo.host||0===t.repoInfo.host.length||!nb(t.repoInfo.namespace)&&"localhost"!==t.repoInfo.host.split(":")[0]||0!==n.length&&!nE(n))throw Error((0,g.dI)(e,"url")+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')};class nC{constructor(){this.eventLists_=[],this.recursionDepth_=0}}function nI(e,t,n){let r=null;for(let t=0;t<n.length;t++){let i=n[t],s=i.getPath();null===r||eL(s,r.path)||(e.eventLists_.push(r),r=null),null===r&&(r={events:[],path:s}),r.events.push(i)}r&&e.eventLists_.push(r),function(e,t){e.recursionDepth_++;let n=!0;for(let r=0;r<e.eventLists_.length;r++){let i=e.eventLists_[r];i&&(t(i.path)?(function(e){for(let t=0;t<e.events.length;t++){let n=e.events[t];if(null!==n){e.events[t]=null;let r=n.getEventRunner();P&&D("event: "+n.toString()),Z(r)}}}(e.eventLists_[r]),e.eventLists_[r]=null):n=!1)}n&&(e.eventLists_=[]),e.recursionDepth_--}(e,e=>eM(e,t)||eM(t,e))}class nx{constructor(e,t,n,r){this.repoInfo_=e,this.forceRestClient_=t,this.authTokenProvider_=n,this.appCheckProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new nC,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=tc(),this.transactionQueueTree_=new nd,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}toString(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host}}function nA(e){var t;return(t=t={timestamp:function(e){let t=e.infoData_.getNode(new eS(".info/serverTimeOffset")).val()||0;return new Date().getTime()+t}(e)}).timestamp=t.timestamp||new Date().getTime(),t}function nk(e,t,n,r,i){e.dataUpdateCount++;let s=new eS(t);n=e.interceptServerDataCallback_?e.interceptServerDataCallback_(t,n):n;let o=[];if(i)if(r){let t=(0,g.kH)(n,e=>tt(e));o=function(e,t,n,r){let i=nr(e,r);if(!i)return[];{let r=ni(i),s=r.path,o=r.queryId,a=eD(s,t),l=tA.fromObject(n);return ns(e,s,new tw(ty(o),a,l))}}(e.serverSyncTree_,s,t,i)}else{let t=tt(n);o=function(e,t,n,r){let i=nr(e,r);if(null==i)return[];{let r=ni(i),s=r.path,o=r.queryId,a=eD(s,t);return ns(e,s,new t_(ty(o),a,n))}}(e.serverSyncTree_,s,t,i)}else if(r){let t=(0,g.kH)(n,e=>tt(e));o=function(e,t,n){let r=tA.fromObject(n);return nn(e,new tw(tg(),t,r))}(e.serverSyncTree_,s,t)}else{let t=tt(n);o=ne(e.serverSyncTree_,s,t)}let a=s;o.length>0&&(a=nD(e,s)),nI(e.eventQueue_,a,o)}function nR(e,t){nP(e,"connected",t),!1===t&&function(e){nN(e,"onDisconnectEvents");let t=nA(e),n=tc();td(e.onDisconnect_,eC(),(r,i)=>{var s;let o=(s=e.serverSyncTree_,nc(i,new na(s,r),t));!function e(t,n,r){if(eO(n))t.value=r,t.children.clear();else if(null!==t.value)t.value=t.value.updateChild(n,r);else{let i=eI(n);t.children.has(i)||t.children.set(i,tc()),e(t.children.get(i),n=eA(n),r)}}(n,r,o)});let r=[];td(n,eC(),(t,n)=>{r=r.concat(ne(e.serverSyncTree_,t,n));let i=function(e,t){let n=nv(nL(e,t)),r=nf(e.transactionQueueTree_,t);return!function(e,t,n){let r=e.parent;for(;null!==r;){if(t(r))return!0;r=r.parent}}(r,t=>{nF(e,t)}),nF(e,r),!function e(t,n,r,i){r&&!i&&n(t),ny(t,t=>{e(t,n,!0,i)}),r&&i&&n(t)}(r,t=>{nF(e,t)}),n}(e,t);nD(e,i)}),e.onDisconnect_=tc(),nI(e.eventQueue_,eC(),r)}(e)}function nP(e,t,n){let r=new eS("/.info/"+t),i=tt(n);e.infoData_.updateSnapshot(r,i);let s=ne(e.infoSyncTree_,r,i);nI(e.eventQueue_,r,s)}function nN(e,...t){let n="";e.persistentConnection_&&(n=e.persistentConnection_.id+":"),D(n,...t)}function nO(e,t,n){return nt(e.serverSyncTree_,t,n)||e7.EMPTY_NODE}function nD(e,t){let n=nL(e,t),r=nv(n),i=nM(e,n);return function(e,t,n){if(0===t.length)return;let r=[],i=[],s=t.filter(e=>0===e.status).map(e=>e.currentWriteId);for(let o=0;o<t.length;o++){let a=t[o],l=eD(n,a.path),u=!1,h;if((0,g.vA)(null!==l,"rerunTransactionsUnderNode_: relativePath should not be null."),4===a.status)u=!0,h=a.abortReason,i=i.concat(t9(e.serverSyncTree_,a.currentWriteId,!0));else if(0===a.status)if(a.retryCount>=25)u=!0,h="maxretry",i=i.concat(t9(e.serverSyncTree_,a.currentWriteId,!0));else{let n=nO(e,a.path,s);a.currentInputSnapshot=n;let r=t[o].update(n.val());if(void 0!==r){nT("transaction failed: Data returned ",r,a.path);let t=tt(r);"object"==typeof r&&null!=r&&(0,g.gR)(r,".priority")||(t=t.updatePriority(n.getPri
16ority()));let o=a.currentWriteId,l=nA(e),u=nc(t,new no(n),l);a.currentOutputSnapshotRaw=t,a.currentOutputSnapshotResolved=u,a.currentWriteId=e.nextWriteId_++,s.splice(s.indexOf(o),1),i=(i=i.concat(function(e,t,n,r,i){var s,o;return(s=e.pendingWriteTree_,o=i,(0,g.vA)(r>s.lastWriteId,"Stacking an older write on top of newer ones"),void 0===o&&(o=!0),s.allWrites.push({path:t,snap:n,writeId:r,visible:o}),o&&(s.visibleWrites=tR(s.visibleWrites,t,n)),s.lastWriteId=r,i)?nn(e,new t_(tm(),t,n)):[]}(e.serverSyncTree_,a.path,u,a.currentWriteId,a.applyLocally))).concat(t9(e.serverSyncTree_,o,!0))}else u=!0,h="nodata",i=i.concat(t9(e.serverSyncTree_,a.currentWriteId,!0))}nI(e.eventQueue_,n,i),i=[],u&&(t[o].status=2,setTimeout(t[o].unwatcher,Math.floor(0)),t[o].onComplete&&("nodata"===h?r.push(()=>t[o].onComplete(null,!1,t[o].currentInputSnapshot)):r.push(()=>t[o].onComplete(Error(h),!1,null))))}nj(e,e.transactionQueueTree_);for(let e=0;e<r.length;e++)Z(r[e]);!function e(t,n=t.transactionQueueTree_){if(n||nj(t,n),np(n)){let r=nM(t,n);(0,g.vA)(r.length>0,"Sending zero length transaction queue"),r.every(e=>0===e.status)&&function(t,n,r){let i=nO(t,n,r.map(e=>e.currentWriteId)),s=i,o=i.hash();for(let e=0;e<r.length;e++){let t=r[e];(0,g.vA)(0===t.status,"tryToSendTransactionQueue_: items in queue should all be run."),t.status=1,t.retryCount++;let i=eD(n,t.path);s=s.updateChild(i,t.currentOutputSnapshotRaw)}let a=s.val(!0);t.server_.put(n.toString(),a,i=>{nN(t,"transaction put response",{path:n.toString(),status:i});let s=[];if("ok"===i){let i=[];for(let e=0;e<r.length;e++)r[e].status=2,s=s.concat(t9(t.serverSyncTree_,r[e].currentWriteId)),r[e].onComplete&&i.push(()=>r[e].onComplete(null,!0,r[e].currentOutputSnapshotResolved)),r[e].unwatcher();nj(t,nf(t.transactionQueueTree_,n)),e(t,t.transactionQueueTree_),nI(t.eventQueue_,n,s);for(let e=0;e<i.length;e++)Z(i[e])}else{if("datastale"===i)for(let e=0;e<r.length;e++)3===r[e].status?r[e].status=4:r[e].status=0;else{F("transaction at "+n.toString()+" failed: "+i);for(let e=0;e<r.length;e++)r[e].status=4,r[e].abortReason=i}nD(t,n)}},o)}(t,nv(n),r)}else ng(n)&&ny(n,n=>{e(t,n)})}(e,e.transactionQueueTree_)}(e,i,r),r}function nL(e,t){let n,r=e.transactionQueueTree_;for(n=eI(t);null!==n&&void 0===np(r);)r=nf(r,n),n=eI(t=eA(t));return r}function nM(e,t){let n=[];return function e(t,n,r){let i=np(n);if(i)for(let e=0;e<i.length;e++)r.push(i[e]);ny(n,n=>{e(t,n,r)})}(e,t,n),n.sort((e,t)=>e.order-t.order),n}function nj(e,t){let n=np(t);if(n){let e=0;for(let t=0;t<n.length;t++)2!==n[t].status&&(n[e]=n[t],e++);n.length=e,nm(t,n.length>0?n:void 0)}ny(t,t=>{nj(e,t)})}function nF(e,t){let n=np(t);if(n){let r=[],i=[],s=-1;for(let t=0;t<n.length;t++)3===n[t].status||(1===n[t].status?((0,g.vA)(s===t-1,"All SENT items should be at beginning of queue."),s=t,n[t].status=3,n[t].abortReason="set"):((0,g.vA)(0===n[t].status,"Unexpected transaction status in abort"),n[t].unwatcher(),i=i.concat(t9(e.serverSyncTree_,n[t].currentWriteId,!0)),n[t].onComplete&&r.push(n[t].onComplete.bind(null,Error("set"),!1,null))));-1===s?nm(t,void 0):n.length=s+1,nI(e.eventQueue_,nv(t),i);for(let e=0;e<r.length;e++)Z(r[e])}}let nU=function(e,t){let n=nV(e),r=n.namespace;"firebase.com"===n.domain&&j(n.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||j("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),n.secure||U();let i="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new ea(n.host,n.secure,r,i,t,"",r!==n.subdomain),path:new eS(n.pathString)}},nV=function(e){let t="",n="",r="",i="",s="",o=!0,a="https",l=443;if("string"==typeof e){let u=e.indexOf("//");u>=0&&(a=e.substring(0,u-1),e=e.substring(u+2));let h=e.indexOf("/");-1===h&&(h=e.length);let c=e.indexOf("?");-1===c&&(c=e.length),t=e.substring(0,Math.min(h,c)),h<c&&(i=function(e){let t="",n=e.split("/");for(let e=0;e<n.length;e++)if(n[e].length>0){let r=n[e];try{r=decodeURIComponent(r.replace(/\+/g," "))}catch(e){}t+="/"+r}return t}(e.substring(h,c)));let d=function(e){let t={};for(let n of("?"===e.charAt(0)&&(e=e.substring(1)),e.split("&"))){if(0===n.length)continue;let r=n.split("=");
162===r.length?t[decodeURIComponent(r[0])]=decodeURIComponent(r[1]):F(`Invalid query segment '${n}' in query '${e}'`)}return t}(e.substring(Math.min(e.length,c)));(u=t.indexOf(":"))>=0?(o="https"===a||"wss"===a,l=parseInt(t.substring(u+1),10)):u=t.length;let f=t.slice(0,u);if("localhost"===f.toLowerCase())n="localhost";else if(f.split(".").length<=2)n=f;else{let e=t.indexOf(".");r=t.substring(0,e).toLowerCase(),n=t.substring(e+1),s=r}"ns"in d&&(s=d.ns)}return{host:t,port:l,domain:n,subdomain:r,secure:o,scheme:a,pathString:i,namespace:s}};class nB{constructor(e,t,n,r){this._repo=e,this._path=t,this._queryParams=n,this._orderByCalled=r}get key(){return eO(this._path)?null:ek(this._path)}get ref(){return new nq(this._repo,this._path)}get _queryIdentifier(){let e=G(tl(this._queryParams));return"{}"===e?"default":e}get _queryObject(){return tl(this._queryParams)}isEqual(e){if(!((e=(0,g.Ku)(e))instanceof nB))return!1;let t=this._repo===e._repo,n=eL(this._path,e._path),r=this._queryIdentifier===e._queryIdentifier;return t&&n&&r}toJSON(){return this.toString()}toString(){return this._repo.toString()+function(e){let t="";for(let n=e.pieceNum_;n<e.pieces_.length;n++)""!==e.pieces_[n]&&(t+="/"+encodeURIComponent(String(e.pieces_[n])));return t||"/"}(this._path)}}class nq extends nB{constructor(e,t){super(e,t,new to,!1)}get parent(){let e=eP(this._path);return null===e?null:new nq(this._repo,e)}get root(){let e=this;for(;null!==e.parent;)e=e.parent;return e}}(0,g.vA)(!c,"__referenceConstructor has already been defined"),c=nq,(0,g.vA)(!d,"__referenceConstructor has already been defined"),d=nq;let n$={};class nz{constructor(e,t){this._repoInternal=e,this.app=t,this.type="database",this._instanceStarted=!1}get _repo(){return this._instanceStarted||(!function(e,t,n){if(e.stats_=ed(e.repoInfo_),e.forceRestClient_||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)e.server_=new tu(e.repoInfo_,(t,n,r,i)=>{nk(e,t,n,r,i)},e.authTokenProvider_,e.appCheckProvider_),setTimeout(()=>nR(e,!0),0);else{if(null!=n){if("object"!=typeof n)throw Error("Only objects are supported for option databaseAuthVariableOverride");try{(0,g.As)(n)}catch(e){throw Error("Invalid authOverride provided: "+e)}}e.persistentConnection_=new eB(e.repoInfo_,t,(t,n,r,i)=>{nk(e,t,n,r,i)},t=>{nR(e,t)},t=>{var n;n=e,Y(t,(e,t)=>{nP(n,e,t)})},e.authTokenProvider_,e.appCheckProvider_,n),e.server_=e.persistentConnection_}e.authTokenProvider_.addTokenChangeListener(t=>{e.server_.refreshAuthToken(t)}),e.appCheckProvider_.addTokenChangeListener(t=>{e.server_.refreshAppCheckToken(t.token)}),e.statsReporter_=function(e,t){let n=e.toString();return ec[n]||(ec[n]=t()),ec[n]}(e.repoInfo_,()=>new tp(e.stats_,e.server_)),e.infoData_=new th,e.infoSyncTree_=new t7({startListening:(t,n,r,i)=>{let s=[],o=e.infoData_.getNode(t._path);return o.isEmpty()||(s=ne(e.infoSyncTree_,t._path,o),setTimeout(()=>{i("ok")},0)),s},stopListening:()=>{}}),nP(e,"connected",!1),e.serverSyncTree_=new t7({startListening:(t,n,r,i)=>(e.server_.listen(t,r,n,(n,r)=>{let s=i(n,r);nI(e.eventQueue_,t._path,s)}),[]),stopListening:(t,n)=>{e.server_.unlisten(t,n)}})}(this._repoInternal,this.app.options.appId,this.app.options.databaseAuthVariableOverride),this._instanceStarted=!0),this._repoInternal}get _root(){return this._rootInternal||(this._rootInternal=new nq(this._repo,eC())),this._rootInternal}_delete(){return null!==this._rootInternal&&(!function(e,t){let n=n$[t];n&&n[e.key]===e||j(`Database ${t}(${e.repoInfo_}) has already been deleted.`),e.persistentConnection_&&e.persistentConnection_.interrupt("repo_interrupt"),delete n[e.key]}(this._repo,this.app.name),this._repoInternal=null,this._rootInternal=null),Promise.resolve()}_checkNotDeleted(e){null===this._rootInternal&&j("Cannot call "+e+" on a deleted database.")}}function nW(e=(0,p.Sx)(),t){let n=(0,p.j6)(e,"database").getImmediate({identifier:t});if(!n._instanceStarted){let e=(0,g.yU)("database");e&&function(e,t,n,r={}){let i;(e=(0,g.Ku)(e))._checkNotDeleted("useEmulator");let s=`${t}:${n}`,o=e._repoInternal;if(e._instanceStarted){if(s===e._repoInternal.repoInfo_.host&&(0,g.bD)(r,o.repoInfo_.emulatorOptions))return;j("connectDatabaseEmulator() cannot initialize or alter the emulator configuration after the database instance has started.")}o.repoInfo_.nodeAdmin?(r.mockUserToken&&j('mockUserToken is not supported by the Admin SDK. For client access with mock users, please use the "firebase" package instead of "firebase-admin".'),i=new er(er.OWNER)):r.mockUserToken&&(i=new er("string"==typeof r.mockUserToken?r.mockUserToken:(0,g.Fy)(r.mockUserToken,e.app.options.projectId))),(0,g.zJ)(t)&&((0,g.gE)(t),(0,g.P1)("Database",!0));var a=i;let l=s.lastIndexOf(":"),u=s.substring(0,l);o.repoInfo_=new ea(s,(0,g.zJ)(u),o.repoInfo_.namespace,o.repoInfo_.webSocketOnly,o.repoInfo_.nodeAdmin,o.repoInfo_.persistenceKey,o.repoInfo_.includeNamespaceInQueryParams,!0,r),a&&(o.authTokenProvider_=a)}(n,...e)}return n}eB.prototype.simpleListen=function(e,t){this.sendRequest("q",{p:e},t)},eB.prototype.echo=function(e,t){this.sendRequest("echo",{d:e},t)},b=p.MF,(0,p.om)(new m.uA("database",(e,{instanceIdentifier:t})=>{let n=e.getProvider("app").getImmediate();return function(e,t,n,r,i){var s,o,a,l;let u,h,c,d,f=r||e.options.databaseURL;void 0===f&&(e.options.projectId||j("Can't determine Firebase Database URL. Be sure to include a Project ID when calling firebase.initializeApp()."),D("Using default host for project ",e.options.projectId),f=`${e.o
16ptions.projectId}-default-rtdb.firebaseio.com`);let p=nU(f,void 0),m=p.repoInfo;void 0!==v&&v.env&&(c=v.env.FIREBASE_DATABASE_EMULATOR_HOST),c?(d=!0,m=(p=nU(f=`http://${c}?ns=${m.namespace}`,void 0)).repoInfo):d=!p.repoInfo.secure;let g=i&&d?new er(er.OWNER):new en(e.name,e.options,t);return nS("Invalid Firebase Database URL",p),eO(p.path)||j("Database URL must point to the root of a Firebase Database (not including a child path)."),new nz((s=m,o=e,a=g,l=new et(e,n),(u=n$[o.name])||(u={},n$[o.name]=u),(h=u[s.toURLString()])&&j("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),h=new nx(s,!1,a,l),u[s.toURLString()]=h,h),e)}(n,e.getProvider("auth-internal"),e.getProvider("app-check-internal"),t)},"PUBLIC").setMultipleInstances(!0)),(0,p.KO)(_,w,void 0),(0,p.KO)(_,w,"esm2017")},7432:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"unstable_rethrow",{enumerable:!0,get:function(){return r}});let r=n(266).unstable_rethrow;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},7610:(e,t,n)=>{"use strict";n.d(t,{X4:()=>s,ai:()=>i,hs:()=>o});var r=n(2318);let i={test:e=>"number"==typeof e,parse:parseFloat,transform:e=>e},s={...i,transform:e=>(0,r.q)(0,1,e)},o={...i,default:1}},7618:(e,t,n)=>{"use strict";n.d(t,{d:()=>s});var r=n(1462),i=n(4764);let s=()=>{let[e,t]=(0,r.useState)(!1),[n,s]=(0,r.useState)(null),[o,a]=(0,r.useState)(null),[l,u]=(0,r.useState)([]),[h,c]=(0,r.useState)([]),[d,f]=(0,r.useState)([]),[p,m]=(0,r.useState)([]),[g,y]=(0,r.useState)([]),[v,_]=(0,r.useState)([]),[w,b]=(0,r.useState)([]),E=(0,r.useCallback)(async()=>{try{let e=await (0,i.HW)();if(s(e),e){let[t,n]=await Promise.all([(0,i.ht)(e.email),(0,i.SL)(e.email)]);a(t),c(n)}let n=await (0,i.KO)();u(n),t(!0)}catch(e){console.error("Error fetching data:",e),t(!0)}},[]);return(0,r.useEffect)(()=>{E()},[E]),(0,r.useMemo)(()=>({isLoaded:e,user:n,userData:o,books:l,purchasedBooks:h,readingProgress:d,rictokens:p,gamesData:g,ReadingRoomData:v,QuizProgress:w}),[e,n,o,l,h,d,p,g,v,w])}},7706:(e,t,n)=>{"use strict";var r,i;e.exports=(null==(r=n.g.process)?void 0:r.env)&&"object"==typeof(null==(i=n.g.process)?void 0:i.env)?n.g.process:n(2935)},7838:(e,t,n)=>{"use strict";n.d(t,{p:()=>r});let r=e=>Array.isArray(e)},7952:()=>{},8055:(e,t,n)=>{"use strict";n.d(t,{V:()=>a});var r=n(7610),i=n(6811),s=n(1786),o=n(3511);let a={test:(0,o.$)("hsl","hue"),parse:(0,o.q)("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:n,alpha:o=1})=>"hsla("+Math.round(e)+", "+i.KN.transform((0,s.a)(t))+", "+i.KN.transform((0,s.a)(n))+", "+(0,s.a)(r.X4.transform(o))+")"}},8101:(e,t,n)=>{"use strict";n.d(t,{M:()=>i});var r=n(1462);function i(e){let t=(0,r.useRef)(null);return null===t.current&&(t.current=e()),t.current}},8166:(e,t,n)=>{"use strict";n.d(t,{P:()=>i});var r=n(8840);function i(e){return e.props[r.n]}},8494:(e,t,n)=>{"use strict";n.d(t,{Ub:()=>E});var r=n(1462),i=n(2847),s=n.n(i),o=/[A-Z]/g,a=/^ms-/,l={};function u(e){return"-"+e.toLowerCase()}let h=function(e){if(l.hasOwnProperty(e))return l[e];var t=e.replace(o,u);return l[e]=a.test(t)?"-"+t:t};var c=n(84),d=n.n(c);let f=d().oneOfType([d().string,d().number]),p={all:d().bool,grid:d().bool,aural:d().bool,braille:d().bool,handheld:d().bool,print:d().bool,projection:d().bool,screen:d().bool,tty:d().bool,tv:d().bool,embossed:d().bool},{type:m,...g}={orientation:d().oneOf(["portrait","landscape"]),scan:d().oneOf(["progressive","interlace"]),aspectRatio:d().string,deviceAspectRatio:d().string,height:f,deviceHeight:f,width:f,deviceWidth:f,color:d().bool,colorIndex:d().bool,monochrome:d().bool,resolution:f,type:Object.keys(p)},y={minAspectRatio:d().string,maxAspectRatio:d().string,minDeviceAspectRatio:d().string,maxDeviceAspectRatio:d().string,minHeight:f,maxHeight:f,minDeviceHeight:f,maxDeviceHeight:f,minWidth:f,maxWidth:f,minDeviceWidth:f,maxDeviceWidth:f,minColor:d().number,maxColor:d().number,minColorIndex:d().number,maxColorIndex:d().number,minMonochrome:d().number,maxMonochrome:d().number,minResolution:f,maxResolution:f,...g};var v={all:{...p,...y}};let _=(0,r.createContext)(void 0),w=e=>{if(e)return Object.keys(e).reduce((t,n)=>(t[h(n)]=e[n],t),{})},b=()=>{let e=(0,r.useRef)(!1);return(0,r.useEffect)(()=>{e.current=!0},[]),e.current},E=(e,t,n)=>{let i=(e=>{let t=(0,r.useContext)(_),n=()=>w(e)||w(t),[i,s]=(0,r.useState)(n);return(0,r.useEffect)(()=>{let e=n();!function(e,t){if(e===t)return!0;
16if(!e||!t)return!1;let n=Object.keys(e),r=Object.keys(t),i=n.length;if(r.length!==i)return!1;for(let r=0;r<i;r++){let i=n[r];if(e[i]!==t[i]||!Object.prototype.hasOwnProperty.call(t,i))return!1}return!0}(i,e)&&s(e)},[e,t]),i})(t),o=(e=>{let t=()=>(e=>e.query||(e=>{let t=[];return Object.keys(v.all).forEach(n=>{let r=e[n];null!=r&&t.push(((e,t)=>{let n=h(e);if("number"==typeof t&&(t=`${t}px`),!0===t)return n;if(!1===t)return`not ${n}`;return`(${n}: ${t})`})(n,r))}),t.join(" and ")})(e))(e),[n,i]=(0,r.useState)(t);return(0,r.useEffect)(()=>{let e=t();n!==e&&i(e)},[e]),n})(e);if(!o)throw Error("Invalid or missing MediaQuery!");let a=((e,t)=>{let n=()=>s()(e,t||{},!!t),[i,o]=(0,r.useState)(n),a=b();return(0,r.useEffect)(()=>{if(a){let e=n();return o(e),()=>{e&&e.dispose()}}},[e,t]),i})(o,i),l=(e=>{let[t,n]=(0,r.useState)(e.matches);return(0,r.useEffect)(()=>{let t=e=>{n(e.matches)};return e.addListener(t),n(e.matches),()=>{e.removeListener(t)}},[e]),t})(a),u=b();return(0,r.useEffect)(()=>{u&&n&&n(l)},[l]),(0,r.useEffect)(()=>()=>{a&&a.dispose()},[]),l}},8542:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),!function(e,t){for(var n in t)Object.defineProperty(e,n,{enumerable:!0,get:t[n]})}(t,{getRedirectError:function(){return o},getRedirectStatusCodeFromError:function(){return c},getRedirectTypeFromError:function(){return h},getURLFromRedirectError:function(){return u},permanentRedirect:function(){return l},redirect:function(){return a}});let r=n(5783),i=n(7229),s=void 0;function o(e,t,n){void 0===n&&(n=r.RedirectStatusCode.TemporaryRedirect);let s=Object.defineProperty(Error(i.REDIRECT_ERROR_CODE),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return s.digest=i.REDIRECT_ERROR_CODE+";"+t+";"+e+";"+n+";",s}function a(e,t){var n;throw null!=t||(t=(null==s||null==(n=s.getStore())?void 0:n.isAction)?i.RedirectType.push:i.RedirectType.replace),o(e,t,r.RedirectStatusCode.TemporaryRedirect)}function l(e,t){throw void 0===t&&(t=i.RedirectType.replace),o(e,t,r.RedirectStatusCode.PermanentRedirect)}function u(e){return(0,i.isRedirectError)(e)?e.digest.split(";").slice(2,-2).join(";"):null}function h(e){if(!(0,i.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return e.digest.split(";",2)[1]}function c(e){if(!(0,i.isRedirectError)(e))throw Object.defineProperty(Error("Not a redirect error"),"__NEXT_ERROR_CODE",{value:"E260",enumerable:!1,configurable:!0});return Number(e.digest.split(";").at(-2))}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8619:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},8623:(e,t,n)=>{"use strict";n.d(t,{V:()=>h,f:()=>p});var r=n(9033);let i=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;var s=n(315),o=n(1786);let a="number",l="color",u=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function h(e){let t=e.toString(),n=[],i={color:[],number:[],var:[]},s=[],o=0,h=t.replace(u,e=>(r.y.test(e)?(i.color.push(o),s.push(l),n.push(r.y.parse(e))):e.startsWith("var(")?(i.var.push(o),s.push("var"),n.push(e)):(i.number.push(o),s.push(a),n.push(parseFloat(e))),++o,"${}")).split("${}");return{values:n,split:h,indexes:i,types:s}}function c(e){return h(e).values}function d(e){let{split:t,types:n}=h(e),i=t.length;return e=>{let s="";for(let u=0;u<i;u++)if(s+=t[u],void 0!==e[u]){let t=n[u];t===a?s+=(0,o.a)(e[u]):t===l?s+=r.y.transform(e[u]):s+=e[u]}return s}}let f=e=>"number"==typeof e?0:e,p={test:function(e){var t,n;return isNaN(e)&&"string"==typeof e&&((null==(t=e.match(s.S))?void 0:t.length)||0)+((null==(n=e.match(i))?void 0:n.length)||0)>0},parse:c,createTransformer:d,getAnimatableNone:function(e){let t=c(e);return d(e)(t.map(f))}}},8753:(e,t,n)=>{"use strict";n.d(t,{W:()=>l});var r=n(7610),i=n(6811);let s={borderWidth:i.px,borderTopWidth:i.px,borderRightWidth:i.px,borderBottomWidth:i.px,borderLeftWidth:i.px,borderRadius:i.px,radius:i.px,borderTopLeftRadius:i.px,borderTopRightRadius:i.px,borderBottomRightRadius:i.px,borderBottomLeftRadius:i.px,width:i.px,maxWidth:i.px,height:i.px,maxHeight:i.px,top:i.px,right:i.px,bottom:i.px,left:i.px,padding:i.px,paddingTop:i.px,paddingRight:i.px,paddingBottom:i.px,paddingLeft:i.px,margin:i.px,marginTop:i.px,marginRight:i.px,marginBottom:i.px,marginLeft:i.px,backgroundPositionX:i.px,backgroundPositionY:i.px},o={rotate:i.uj,rotateX:i.uj,rotateY:i.uj,rotateZ:i.uj,scale:r.hs,scaleX:r.hs,scaleY:r.hs,scaleZ:r.hs,skew:i.uj,skewX:i.uj,skewY:i.uj,distance:i.px,translateX:i.px,translateY:i.px,translateZ:i.px,x:i.px,y:i.px,z:i.px,perspective:i.px,transformPerspective:i.px,opacity:r.X4,originX:i.gQ,originY:i.gQ,originZ:i.px},a={...r.ai,transform:Math.round},l={...s,...o,zIndex:a,size:i.px,fillOpacity:r.X4,strokeOpacity:r.X4,numOctaves:a}}
16,8823:(e,t,n)=>{"use strict";function r(){throw Object.defineProperty(Error("`forbidden()` is experimental and only allowed to be enabled when `experimental.authInterrupts` is enabled."),"__NEXT_ERROR_CODE",{value:"E488",enumerable:!1,configurable:!0})}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"forbidden",{enumerable:!0,get:function(){return r}}),n(6695).HTTP_ERROR_FALLBACK_ERROR_CODE,("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},8840:(e,t,n)=>{"use strict";n.d(t,{n:()=>r});let r="data-"+(0,n(5746).I)("framerAppearId")},8955:(e,t,n)=>{"use strict";n.d(t,{q:()=>r});let r=(e,t,n)=>{let r=t-e;return 0===r?1:(n-e)/r}},9033:(e,t,n)=>{"use strict";n.d(t,{y:()=>o});var r=n(3506),i=n(8055),s=n(179);let o={test:e=>s.B.test(e)||r.u.test(e)||i.V.test(e),parse:e=>s.B.test(e)?s.B.parse(e):i.V.test(e)?i.V.parse(e):r.u.parse(e),transform:e=>"string"==typeof e?e:e.hasOwnProperty("red")?s.B.transform(e):i.V.transform(e)}},9232:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Image",{enumerable:!0,get:function(){return w}});let r=n(1532),i=n(8781),s=n(3798),o=i._(n(1462)),a=r._(n(7993)),l=r._(n(1817)),u=n(1132),h=n(3453),c=n(419);n(5509);let d=n(1878),f=r._(n(4392)),p=n(4319),m={deviceSizes:[640,750,828,1080,1200,1920,2048,3840],imageSizes:[16,32,48,64,96,128,256,384],path:"/_next/image",loader:"default",dangerouslyAllowSVG:!1,unoptimized:!1};function g(e,t,n,r,i,s,o){let a=null==e?void 0:e.src;e&&e["data-loaded-src"]!==a&&(e["data-loaded-src"]=a,("decode"in e?e.decode():Promise.resolve()).catch(()=>{}).then(()=>{if(e.parentElement&&e.isConnected){if("empty"!==t&&i(!0),null==n?void 0:n.current){let t=new Event("load");Object.defineProperty(t,"target",{writable:!1,value:e});let r=!1,i=!1;n.current({...t,nativeEvent:t,currentTarget:e,target:e,isDefaultPrevented:()=>r,isPropagationStopped:()=>i,persist:()=>{},preventDefault:()=>{r=!0,t.preventDefault()},stopPropagation:()=>{i=!0,t.stopPropagation()}})}(null==r?void 0:r.current)&&r.current(e)}}))}function y(e){return o.use?{fetchPriority:e}:{fetchpriority:e}}let v=(0,o.forwardRef)((e,t)=>{let{src:n,srcSet:r,sizes:i,height:a,width:l,decoding:u,className:h,style:c,fetchPriority:d,placeholder:f,loading:m,unoptimized:v,fill:_,onLoadRef:w,onLoadingCompleteRef:b,setBlurComplete:E,setShowAltText:T,sizesInput:S,onLoad:C,onError:I,...x}=e,A=(0,o.useCallback)(e=>{e&&(I&&(e.src=e.src),e.complete&&g(e,f,w,b,E,v,S))},[n,f,w,b,E,I,v,S]),k=(0,p.useMergedRef)(t,A);return(0,s.jsx)("img",{...x,...y(d),loading:m,width:l,height:a,decoding:u,"data-nimg":_?"fill":"1",className:h,style:c,sizes:i,srcSet:r,src:n,ref:k,onLoad:e=>{g(e.currentTarget,f,w,b,E,v,S)},onError:e=>{T(!0),"empty"!==f&&E(!0),I&&I(e)}})});function _(e){let{isAppRouter:t,imgAttributes:n}=e,r={as:"image",imageSrcSet:n.srcSet,imageSizes:n.sizes,crossOrigin:n.crossOrigin,referrerPolicy:n.referrerPolicy,...y(n.fetchPriority)};return t&&a.default.preload?(a.default.preload(n.src,r),null):(0,s.jsx)(l.default,{children:(0,s.jsx)("link",{rel:"preload",href:n.srcSet?void 0:n.src,...r},"__nimg-"+n.src+n.srcSet+n.sizes)})}let w=(0,o.forwardRef)((e,t)=>{let n=(0,o.useContext)(d.RouterContext),r=(0,o.useContext)(c.ImageConfigContext),i=(0,o.useMemo)(()=>{var e;let t=m||r||h.imageConfigDefault,n=[...t.deviceSizes,...t.imageSizes].sort((e,t)=>e-t),i=t.deviceSizes.sort((e,t)=>e-t),s=null==(e=t.qualities)?void 0:e.sort((e,t)=>e-t);return{...t,allSizes:n,deviceSizes:i,qualities:s}},[r]),{onLoad:a,onLoadingComplete:l}=e,p=(0,o.useRef)(a);(0,o.useEffect)(()=>{p.current=a},[a]);let g=(0,o.useRef)(l);(0,o.useEffect)(()=>{g.current=l},[l]);let[y,w]=(0,o.useState)(!1),[b,E]=(0,o.useState)(!1),{props:T,meta:S}=(0,u.getImgProps)(e,{defaultLoader:f.default,imgConf:i,blurComplete:y,showAltText:b});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(v,{...T,unoptimized:S.unoptimized,placeholder:S.placeholder,fill:S.fill,onLoadRef:p,onLoadingCompleteRef:g,setBlurComplete:w,setShowAltText:E,sizesInput:e.sizes,ref:t}),S.priority?(0,s.jsx)(_,{isAppRouter:!n,imgAttributes:T}):null]})});("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esMo
16dule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},9320:(e,t,n)=>{"use strict";n.d(t,{cY:()=>b,FA:()=>B,g:()=>V,gz:()=>en,vA:()=>s,Hk:()=>o,K3:()=>u,u:()=>f,KA:()=>c,Uj:()=>d,gR:()=>K,Fy:()=>S,tD:()=>er,A4:()=>p,bD:()=>function e(t,n){if(t===n)return!0;let r=Object.keys(t),i=Object.keys(n);for(let s of r){if(!i.includes(s))return!1;let r=t[s],o=n[s];if(J(r)&&J(o)){if(!e(r,o))return!1}else if(r!==o)return!1}for(let e of i)if(!r.includes(e))return!1;return!0},dI:()=>eo,hp:()=>et,T9:()=>_,Tj:()=>y,yU:()=>v,XA:()=>w,mS:()=>m,Ku:()=>eu,ZQ:()=>A,qc:()=>G,sr:()=>N,zJ:()=>E,c1:()=>P,Im:()=>Q,lT:()=>D,zW:()=>F,jZ:()=>k,$g:()=>L,lV:()=>O,nr:()=>M,Ov:()=>j,Cv:()=>H,$L:()=>$,kH:()=>X,gE:()=>T,Am:()=>Z,I9:()=>ee,yw:()=>Y,OE:()=>el,kj:()=>ea,As:()=>z,P1:()=>x,eX:()=>U});var r=n(7706);let i={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},s=function(e,t){if(!e)throw o(t)},o=function(e){return Error("Firebase Database ("+i.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},a=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:((64512&i)==55296&&r+1<e.length&&(64512&e.charCodeAt(r+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},l=function(e){let t=[],n=0,r=0;for(;n<e.length;){let i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=e[n++],o=((7&i)<<18|(63&s)<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(o>>10)),t[r++]=String.fromCharCode(56320+(1023&o))}else{let s=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")},u={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,l=a?e[t+2]:0,u=i>>2,h=(3&i)<<4|o>>4,c=(15&o)<<2|l>>6,d=63&l;!a&&(d=64,s||(c=64)),r.push(n[u],n[h],n[c],n[d])}return r.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(a(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):l(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){let i=n[e.charAt(t++)],s=t<e.length?n[e.charAt(t)]:0,o=++t<e.length?n[e.charAt(t)]:64,a=++t<e.length?n[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==a)throw new h;let l=i<<2|s>>4;if(r.push(l),64!==o){let e=s<<4&240|o>>2;if(r.push(e),64!==a){let e=o<<6&192|a;r.push(e)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};
16class h extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let c=function(e){let t=a(e);return u.encodeByteArray(t,!0)},d=function(e){return c(e).replace(/\./g,"")},f=function(e){try{return u.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function p(e){return function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(let r in n)n.hasOwnProperty(r)&&"__proto__"!==r&&(t[r]=e(t[r],n[r]));return t}(void 0,e)}function m(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw Error("Unable to locate global object.")}let g=()=>{try{return m().__FIREBASE_DEFAULTS__||(()=>{if(void 0===r||void 0===r.env)return;let e=r.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("undefined"==typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&f(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},y=e=>{var t,n;return null==(n=null==(t=g())?void 0:t.emulatorHosts)?void 0:n[e]},v=e=>{let t=y(e);if(!t)return;let n=t.lastIndexOf(":");if(n<=0||n+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let r=parseInt(t.substring(n+1),10);return"["===t[0]?[t.substring(1,n-1),r]:[t.substring(0,n),r]},_=()=>{var e;return null==(e=g())?void 0:e.config},w=e=>{var t;return null==(t=g())?void 0:t[`_${e}`]};class b{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,n))}}}function E(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch(e){return!1}}async function T(e){return(await fetch(e,{credentials:"include"})).ok}function S(e,t){if(e.uid)throw Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');let n=t||"demo-project",r=e.iat||0,i=e.sub||e.user_id;if(!i)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s=Object.assign({iss:`https://securetoken.google.com/${n}`,aud:n,iat:r,exp:r+3600,auth_time:r,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e);return[d(JSON.stringify({alg:"none",type:"JWT"})),d(JSON.stringify(s)),""].join(".")}let C={},I=!1;function x(e,t){if("undefined"==typeof window||"undefined"==typeof document||!E(window.location.host)||C[e]===t||C[e]||I)return;function n(e){return`__firebase__banner__${e}`}C[e]=t;let r="__firebase__banner",i=function(){let e={prod:[],emulator:[]};for(let t of Object.keys(C))C[t]?e.emulator.push(t):e.prod.push(t);return e}().prod.length>0;function s(){let e,t,s=(e=document.getElementById(r),t=!1,e||((e=document.createElement("div")).setAttribute("id",r),t=!0),{created:t,element:e}),o=n("text"),a=document.getElementById(o)||document.createElement("span"),l=n("learnmore"),u=document.getElementById(l)||document.createElement("a"),h=n("preprendIcon"),c=document.getElementById(h)||document.createElementNS("http://www.w3.org/2000/svg","svg");if(s.created){let e=s.element;e.style.display="flex",e.style.background="#7faaf0",e.style.position="fixed",e.style.bottom="5px",e.style.left="5px",e.style.padding=".5em",e.style.borderRadius="5px",e.style.alignItems="center",u.setAttribute("id",l),u.innerText="Learn more",u.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",u.setAttribute("target","__blank"),u.style.paddingLeft="5px",u.style.textDecoration="underline";let t=function(){let e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" ×",e.onclick=()=>{I=!0;let e=document.getElementById(r);e&&e.remove()},e}();c.setAttribute("width","24"),c.setAttribute("id",h),c.setAttribute("height","24"),c.setAttribute("viewBox","0 0 24 24"),c.setAttribute("fill","none"),c.style.marginLeft="-6px",e.append(c,a,u,t),document.body.appendChild(e)}i?(a.innerText="Preview backend disconnected.",c.innerHTML=`<g clip-path="url(#clip0_6013_33858)"> 17<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/> 18</g> 19<defs> 20<clipPath id="clip0_6013_33858"> 21<rect width="24" height="24" fill="white"/> 22</clipPath> 23</defs>`):(c.innerHTML=`<g clip-path="url(#clip0_6083_34804)"> 24<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444
2412.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/> 25</g> 26<defs> 27<clipPath id="clip0_6083_34804"> 28<rect width="24" height="24" fill="white"/> 29</clipPath> 30</defs>`,a.innerText="Preview backend running in this workspace."),a.setAttribute("id",o)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",s):s()}function A(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function k(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(A())}function R(){var e;let t=null==(e=g())?void 0:e.forceEnvironment;if("node"===t)return!0;if("browser"===t)return!1;try{return"[object process]"===Object.prototype.toString.call(n.g.process)}catch(e){return!1}}function P(){return"undefined"!=typeof navigator&&"Cloudflare-Workers"===navigator.userAgent}function N(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function O(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function D(){let e=A();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function L(){return!0===i.NODE_CLIENT||!0===i.NODE_ADMIN}function M(){return!R()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function j(){return!R()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function F(){try{return"object"==typeof indexedDB}catch(e){return!1}}function U(){return new Promise((e,t)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var e;t((null==(e=i.error)?void 0:e.message)||"")}}catch(e){t(e)}})}class V extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,V.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,B.prototype.create)}}class B{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){var n,r;let i=t[0]||{},s=`${this.service}/${e}`,o=this.errors[e],a=o?(n=o,r=i,n.replace(q,(e,t)=>{let n=r[t];return null!=n?String(n):`<${t}?>`})):"Error",l=`${this.serviceName}: ${a} (${s}).`;return new V(s,l,i)}}let q=/\{\$([^}]+)}/g;function $(e){return JSON.parse(e)}function z(e){return JSON.stringify(e)}let W=function(e){let t={},n={},r={},i="";try{let s=e.split(".");t=$(f(s[0])||""),n=$(f(s[1])||""),i=s[2],r=n.d||{},delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:i}},H=function(e){let t=W(e).claims;return!!t&&"object"==typeof t&&t.hasOwnProperty("iat")},G=function(e){let t=W(e).claims;return"object"==typeof t&&!0===t.admin};function K(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Y(e,t){return Object.prototype.hasOwnProperty.call(e,t)?e[t]:void 0}function Q(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}
30function X(e,t,n){let r={};for(let i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=t.call(n,e[i],i,e));return r}function J(e){return null!==e&&"object"==typeof e}function Z(e){let t=[];for(let[n,r]of Object.entries(e))Array.isArray(r)?r.forEach(e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function ee(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}}),t}function et(e){let t=e.indexOf("?");if(!t)return"";let n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class en{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=0x67452301,this.chain_[1]=0xefcdab89,this.chain_[2]=0x98badcfe,this.chain_[3]=0x10325476,this.chain_[4]=0xc3d2e1f0,this.inbuf_=0,this.total_=0}compress_(e,t){let n,r;t||(t=0);let i=this.W_;if("string"==typeof e)for(let n=0;n<16;n++)i[n]=e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|e.charCodeAt(t+3),t+=4;else for(let n=0;n<16;n++)i[n]=e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3],t+=4;for(let e=16;e<80;e++){let t=i[e-3]^i[e-8]^i[e-14]^i[e-16];i[e]=t<<1|t>>>31}let s=this.chain_[0],o=this.chain_[1],a=this.chain_[2],l=this.chain_[3],u=this.chain_[4];for(let e=0;e<80;e++){e<40?e<20?(n=l^o&(a^l),r=0x5a827999):(n=o^a^l,r=0x6ed9eba1):e<60?(n=o&a|l&(o|a),r=0x8f1bbcdc):(n=o^a^l,r=0xca62c1d6);let t=(s<<5|s>>>27)+n+u+r+i[e]|0;u=l,l=a,a=o<<30|o>>>2,o=s,s=t}this.chain_[0]=this.chain_[0]+s|0,this.chain_[1]=this.chain_[1]+o|0,this.chain_[2]=this.chain_[2]+a|0,this.chain_[3]=this.chain_[3]+l|0,this.chain_[4]=this.chain_[4]+u|0}update(e,t){if(null==e)return;void 0===t&&(t=e.length);let n=t-this.blockSize,r=0,i=this.buf_,s=this.inbuf_;for(;r<t;){if(0===s)for(;r<=n;)this.compress_(e,r),r+=this.blockSize;if("string"==typeof e){for(;r<t;)if(i[s]=e.charCodeAt(r),++s,++r,s===this.blockSize){this.compress_(i),s=0;break}}else for(;r<t;)if(i[s]=e[r],++s,++r,s===this.blockSize){this.compress_(i),s=0;break}}this.inbuf_=s,this.total_+=t}digest(){let e=[],t=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let e=this.blockSize-1;e>=56;e--)this.buf_[e]=255&t,t/=256;this.compress_(this.buf_);let n=0;for(let t=0;t<5;t++)for(let r=24;r>=0;r-=8)e[n]=this.chain_[t]>>r&255,++n;return e}}function er(e,t){let n=new ei(e,t);return n.subscribe.bind(n)}class ei{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw Error("Missing Observer.");void 0===(r=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let n of t)if(n in e&&"function"==typeof e[n])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:n}:e).next&&(r.next=es),void 0===r.error&&(r.error=es),void 0===r.complete&&(r.complete=es);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}}),this.observers.push(r),i}unsubscribeOne(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function es(){}function eo(e,t){return`${e} failed: ${t} argument `}let ea=function(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);if(i>=55296&&i<=56319){let t=i-55296;s(++r<e.length,"Surrogate pair missing trail surrogate."),i=65536+(t<<10)+(e.charCodeAt(r)-56320)}i<128?t[n++]=i:(i<2048?t[n++]=i>>6|192:(i<65536?t[n++]=i>>12|224:(t[n++]=i>>18|240,t[n++]=i>>12&63|128),t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t},el=function(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:r>=55296&&r<=56319?(t+=4,n++):t+=3}return t};function eu(e){return e&&e._delegate?e._delegate:e}},9566:(e,t,n)=>{"use strict";n.d(t,{E:()=>i});var r=n(1462);let i=n(6504).B?r.useLayoutEffect:r.useEffect}
30,9583:(e,t,n)=>{"use strict";n.d(t,{B:()=>i,K:()=>s});var r=n(7838);let i=e=>!!(e&&"object"==typeof e&&e.mix&&e.toValue),s=e=>(0,r.p)(e)?e[e.length-1]||0:e},9670:(e,t,n)=>{"use strict";n.d(t,{$:()=>r});let r=new Set(["width","height","top","left","right","bottom",...n(5615).U])},9730:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>B});var r=n(3798),i=n(1462),s=n(5633),o=n(8494),a=n(5228),l=n(1016),u=n.n(l),h=n(6245),c=n.n(h),d=n(157);let f=e=>{let{links:t,isMobileMenu:n=!1}=e;return n?(0,r.jsx)(a.P.div,{variants:d.cm,initial:"hidden",animate:"visible",className:"grid grid-cols-2 gap-4",children:t.map((e,t)=>{var n;return(0,r.jsx)(a.P.div,{variants:d.Q$,whileHover:{scale:1.05},whileTap:{scale:.95},children:(0,r.jsx)(u(),{href:e.href,children:(0,r.jsxs)("div",{className:"group relative overflow-hidden rounded-2xl",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br ".concat(e.gradient||"from-blue-500 to-purple-500"," opacity-80 group-hover:opacity-100 transition-opacity duration-300")}),(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-tr from-white/0 via-white/20 to-white/0 translate-x-[-100%] group-hover:translate-x-[100%] transition-transform duration-700"}),(0,r.jsxs)("div",{className:"relative backdrop-blur-sm bg-black/20 p-6 flex flex-col items-center justify-center space-y-3 min-h-[140px] border border-white/10",children:[(0,r.jsx)("div",{className:"relative w-12 h-12 transform group-hover:scale-110 group-hover:rotate-6 transition-all duration-300",children:(null==(n=e.icon)?void 0:n.endsWith(".svg"))?(0,r.jsx)(c(),{src:e.icon,alt:e.label,width:48,height:48,className:"drop-shadow-[0_0_10px_rgba(255,255,255,0.5)]"}):(0,r.jsx)(c(),{src:e.icon,alt:e.label,width:48,height:48,className:"rounded-lg drop-shadow-[0_0_10px_rgba(255,255,255,0.5)]"})}),(0,r.jsx)("span",{className:"text-white font-semibold text-sm text-center tracking-wide drop-shadow-lg group-hover:text-yellow-200 transition-colors duration-300",children:e.label}),e.description&&(0,r.jsx)("span",{className:"text-blue-100/70 text-xs text-center font-light",children:e.description})]}),(0,r.jsx)("div",{className:"absolute inset-0 opacity-0 group-hover:opacity-100 transition-opacity duration-300",children:(0,r.jsx)("div",{className:"absolute inset-0 bg-white/10 rounded-2xl blur-xl"})})]})})},e.href)})}):(0,r.jsx)(a.P.nav,{variants:d.cm,initial:"hidden",animate:"visible",className:"flex flex-wrap items-center justify-center gap-6",children:t.map(e=>{var t;return(0,r.jsx)(a.P.div,{variants:d.Q$,whileHover:{scale:1.1,y:-5},whileTap:{scale:.95},children:(0,r.jsx)(u(),{href:e.href,children:(0,r.jsxs)("div",{className:"group relative",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br ".concat(e.gradient||"from-blue-500 to-purple-500"," opacity-0 group-hover:opacity-100 blur-xl transition-opacity duration-300 rounded-full")}),(0,r.jsxs)("div",{className:"relative backdrop-blur-md bg-white/10 rounded-2xl p-4 border border-white/20 shadow-xl group-hover:bg-white/20 transition-all duration-300 ",children:[(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("div",{className:"relative w-12 h-12 duration-300",children:(null==(t=e.icon)?void 0:t.endsWith(".svg"))?(0,r.jsx)(c(),{src:e.icon,alt:e.label,width:48,height:48,className:"drop-shadow-[0_0_8px_rgba(255,255,255,0.4)]"}):(0,r.jsx)(c(),{src:e.icon,alt:e.label,width:48,height:48,className:"rounded-lg drop-shadow-[0_0_8px_rgba(255,255,255,0.4)]"})}),(0,r.jsx)("span",{className:"text-white font-medium text-sm text-center drop-shadow-lg group-hover:text-yellow-200 transition-colors duration-300 whitespace-nowrap",children:e.label})]}),(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-tr from-white/0 via-white/10 to-white/0 duration-500 rounded-2xl"})]})]})})},e.href)})})};function p(e,t,n,r){return new(n||(n=Promise))(function(i,s){function o(e){try{l(r.next(e))}catch(e){s(e)}}function a(e){try{l(r.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(o,a)}l((r=r.apply(e,t||[])).next())})}function m(e,t){var n,r,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){var l=[s,a];if(n)throw TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&l[0]?r.return:l[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,l[1])).done)return i;switch(r=0,i&&(l=[2&l[0],i.value]),l[0]){case 0:case 1:i=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,r=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!i||l[1]>i[0]&&l[1]<i[3])){o.label=l[1];break}if(6===l[0]&&o.label<i[1]){o.label=i[1],i=l;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(l);break}i[2]&&o.ops.pop(),o.trys.pop();continue}l=t.call(e,o)}catch(e){l=[6,e],r=0}finally{n=i=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}function g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);
30if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=s.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return o}function v(e,t,n){if(n||2==arguments.length)for(var r,i=0,s=t.length;i<s;i++)!r&&i in t||(r||(r=Array.prototype.slice.call(t,0,i)),r[i]=t[i]);return e.concat(r||Array.prototype.slice.call(t))}function _(e,t,n,r,i){for(var s=[],o=5;o<arguments.length;o++)s[o-5]=arguments[o];return p(this,void 0,void 0,function(){var o,a,l,u,h;return m(this,function(c){switch(c.label){case 0:c.trys.push([0,12,13,14]),a=(o=g(s)).next(),c.label=1;case 1:if(a.done)return[3,11];switch(typeof(l=a.value)){case"string":return[3,2];case"number":return[3,4];case"function":return[3,6]}return[3,8];case 2:return[4,function(e,t,n,r,i,s){return p(this,void 0,void 0,function(){var o,a;return m(this,function(l){switch(l.label){case 0:var u,h;return u=o=e.textContent||"",h=y(n).slice(0),a=v(v([],y(u),!1),[NaN],!1).findIndex(function(e,t){return h[t]!==e}),[4,function(e,t,n,r,i){return p(this,void 0,void 0,function(){var s,o,a,l,u,h,c,d,f,p,v,_;return m(this,function(b){switch(b.label){case 0:if(s=t,i){for(o=0,a=1;a<t.length;a++)if(u=(l=y([t[a-1],t[a]],2))[0],(h=l[1]).length>u.length||""===h){o=a;break}s=t.slice(o,t.length)}b.label=1;case 1:b.trys.push([1,6,7,8]),d=(c=g(function(e){var t,n,r,i,s,o;return m(this,function(a){switch(a.label){case 0:t=function(e){return m(this,function(t){switch(t.label){case 0:return[4,{op:function(t){return requestAnimationFrame(function(){return t.textContent=e})},opCode:function(t){var n=t.textContent||"";return""===e||n.length>e.length?"DELETE":"WRITING"}}];case 1:return t.sent(),[2]}})},a.label=1;case 1:a.trys.push([1,6,7,8]),r=(n=g(e)).next(),a.label=2;case 2:return r.done?[3,5]:(i=r.value,[5,t(i)]);case 3:a.sent(),a.label=4;case 4:return r=n.next(),[3,2];case 5:return[3,8];case 6:return s={error:a.sent()},[3,8];case 7:try{r&&!r.done&&(o=n.return)&&o.call(n)}finally{if(s)throw s.error}return[7];case 8:return[2]}})}(s))).next(),b.label=2;case 2:return d.done?[3,5]:(p="WRITING"===(f=d.value).opCode(e)?n+n*(Math.random()-.5):r+r*(Math.random()-.5),f.op(e),[4,w(p)]);case 3:b.sent(),b.label=4;case 4:return d=c.next(),[3,2];case 5:return[3,8];case 6:return v={error:b.sent()},[3,8];case 7:try{d&&!d.done&&(_=c.return)&&_.call(c)}finally{if(v)throw v.error}return[7];case 8:return[2]}})})}(e,v(v([],y(function(e,t,n){var r,i;return void 0===n&&(n=0),m(this,function(s){switch(s.label){case 0:i=(r=t(e)).length,s.label=1;case 1:return i>n?[4,r.slice(0,--i).join("")]:[3,3];case 2:return s.sent(),[3,1];case 3:return[2]}})}(o,t,a)),!1),y(function(e,t,n){var r,i;return void 0===n&&(n=0),m(this,function(s){switch(s.label){case 0:i=(r=t(e)).length,s.label=1;case 1:return n<i?[4,r.slice(0,++n).join("")]:[3,3];case 2:return s.sent(),[3,1];case 3:return[2]}})}(n,t,a)),!1),r,i,s)];case 1:return l.sent(),[2]}})})}(e,t,l,n,r,i)];case 3:case 5:case 7:return c.sent(),[3,10];case 4:return[4,w(l)];case 6:return[4,l.apply(void 0,v([e,t,n,r,i],y(s),!1))];case 8:return[4,l];case 9:c.sent(),c.label=10;case 10:return a=o.next(),[3,1];case 11:return[3,14];case 12:return u={error:c.sent()},[3,14];case 13:try{a&&!a.done&&(h=o.return)&&h.call(o)}finally{if(u)throw u.error}return[7];case 14:return[2]}})})}function w(e){return p(this,void 0,void 0,function(){return m(this,function(t){switch(t.label){case 0:return[4,new Promise(function(t){return setTimeout(t,e)})];case 1:return t.sent(),[2]}})})}!function(e,t){void 0===t&&(t={});var n=t.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===n&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}
30(".index-module_type__E-SaG::after {\n content: '|';\n animation: index-module_cursor__PQg0P 1.1s infinite step-start;\n}\n\n@keyframes index-module_cursor__PQg0P {\n 50% {\n opacity: 0;\n }\n}\n");var b=(0,i.memo)((0,i.forwardRef)(function(e,t){var n=e.sequence,r=e.repeat,s=e.className,o=e.speed,a=void 0===o?40:o,l=e.deletionSpeed,u=e.omitDeletionAnimation,h=void 0!==u&&u,c=e.preRenderFirstString,d=e.wrapper,f=e.splitter,p=void 0===f?function(e){return v([],y(e),!1)}:f,m=e.cursor,g=void 0===m||m,w=e.style,b=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&0>t.indexOf(r)&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)0>t.indexOf(r[i])&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["sequence","repeat","className","speed","deletionSpeed","omitDeletionAnimation","preRenderFirstString","wrapper","splitter","cursor","style"]),E=b["aria-label"],T=b["aria-hidden"],S=b.role;l||(l=a);var C=[,,].fill(40);[a,l].forEach(function(e,t){switch(typeof e){case"number":C[t]=Math.abs(e-100);break;case"object":var n=e.type,r=e.value;if("number"!=typeof r)break;"keyStrokeDelayInMs"===n&&(C[t]=r)}});var I,x,A,k,R,P,N,O,D=C[0],L=C[1],M=(void 0===I&&(I=null),x=(0,i.useRef)(I),(0,i.useEffect)(function(){t&&("function"==typeof t?t(x.current):t.current=x.current)},[t]),x),j="index-module_type__E-SaG";A=s?"".concat(g?j+" ":"").concat(s):g?j:"",k=(0,i.useRef)(function(){var e,t=n;r===1/0?e=_:"number"==typeof r&&(t=Array(1+r).fill(n).flat());var i=e?v(v([],y(t),!1),[e],!1):v([],y(t),!1);return _.apply(void 0,v([M.current,p,D,L,h],y(i),!1)),function(){M.current}}),R=(0,i.useRef)(),P=(0,i.useRef)(!1),N=(0,i.useRef)(!1),O=y((0,i.useState)(0),2)[1],P.current&&(N.current=!0),(0,i.useEffect)(function(){return P.current||(R.current=k.current(),P.current=!0),O(function(e){return e+1}),function(){N.current&&R.current&&R.current()}},[]);var F=void 0!==c&&c?n.find(function(e){return"string"==typeof e})||"":null;return i.createElement(void 0===d?"span":d,{"aria-hidden":T,"aria-label":E,role:S,style:w,className:A,children:E?i.createElement("span",{"aria-hidden":"true",ref:M,children:F}):F,ref:E?void 0:M})}),function(e,t){return!0}),E=n(4296);n(2697);let T={animations:{"/":["Robot Ric's Extraordinary Explorations",3e3,"Learn, Search, Discover",3e3,"Explore, with Robot Ric",3e3],"/about":["Discover Robot Ric's Story",3e3,"Meet the Team Behind the Magic",3e3,"Our Journey of Discovery",3e3],"/library":["Welcome to the Digital Library",3e3,"Explore Countless Adventures",3e3,"Find Your Next Journey",3e3],"/richat":["Get in Touch with Robot Ric",3e3,"Share Your Thoughts",3e3,"We'd Love to Hear from You",3e3],"/404":["Oops! Page Not Found",3e3,"Time to Explore Somewhere New",3e3,"Let Robot Ric Guide You Home",3e3],"/login":["Welcome Back Explorer",3e3,"Begin Your Adventure",3e3,"Join Robot Ric's Community",3e3],"/Books/robot-rics-river-exploration":["River Exploration Adventure",3e3,"Discover Underwater Mysteries",3e3,"Join Robot Ric by the River",3e3],"/read":["Time for an Adventure",3e3,"Dive into the Story",3e3,"Let Your Imagination Flow",3e3],"/test":["Testing New Features",3e3,"Experimenting with Robot Ric",3e3,"Developing New Adventures",3e3],default:["Robot Ric's World of Wonder",3e3,"Endless Possibilities Await",3e3,"Start Your Journey Today",3e3]},links:[{href:"/Arcade/OurCade",label:"Arcade",sl:["/Arcade/Snake","/Arcade/OurCade","/Arcade/Saloon","/Arcade/Scratch"],icon:"/animatedSvg/mystical-arcade.svg",so:"https://sora.com/g/gen_01jjsvkg3vex8sk39msz7vrvgt"},{href:"/#Home",label:"Explorations",icon:"/animatedSvg/wateradventure.svg",so:"https://sora.com/g/gen_01jjswzy1zf26b1311naykr637"},{href:"/Tech#RicsTech",label:"Rics Tech",icon:"/animatedSvg/multi-display-tv.svg",so:"https://sora.com/g/gen_01jjsws7fvfbxv9sdfnnh388a0"},{href:"/Library#Library",label:"Library",icon:"/animatedSvg/library.svg",so:"https://sora.com/g/gen_01jjswpkb6fx2txzbzbf9ce82j"},{href:"/Classroom#QuantumClass",label:"Quantum Classs",icon:"/Learn/entanglement.webp",so:"https://sora.com/g/gen_01jjswvydherwaeq6bc7hm35ev"},{href:"/Profile",label:"Profile",icon:"/animatedSvg/home.svg",so:"https://sora.com/g/gen_01jjsxb6mdefpbkcnv7g2et1bp"}]},S=e=>{let t=T.animations,n=t[e.pathname]||t.default;return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(a.P.h1,{className:"text-4xl sm:text-5xl md:text-6xl lg:text-7xl font-extrabold mb-8 animate-gradient-x font-bangers",initial:{opacity:0,y:-20}
30,animate:{opacity:1,y:0},transition:{duration:.5},children:(0,r.jsx)(b,{sequence:n,wrapper:"span",speed:50,repeat:1/0,className:"whitespace-nowrap"})})})};var C=n(5055);n(1642);var I=n(4586);let x=e=>{let{links:t,toggleMenu:n,isOpen:i}=e;return(0,r.jsx)(C.N,{children:i&&(0,r.jsxs)(a.P.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.3},className:"fixed inset-0 z-50 overflow-hidden",children:[(0,r.jsx)(a.P.div,{initial:{scale:1.1},animate:{scale:1},exit:{scale:1.1},transition:{duration:.5},className:"absolute inset-0 bg-[url('/Clouds/clouddd.svg')] bg-no-repeat bg-cover bg-center"}),(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-black/40 via-blue-900/30 to-black/50"}),(0,r.jsxs)("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[(0,r.jsx)(a.P.div,{animate:{scale:[1,1.2,1],rotate:[0,180,360]},transition:{duration:20,repeat:1/0,ease:"linear"},className:"absolute -top-1/2 -left-1/2 w-full h-full bg-gradient-radial from-blue-500/10 to-transparent rounded-full blur-3xl"}),(0,r.jsx)(a.P.div,{animate:{scale:[1.2,1,1.2],rotate:[360,180,0]},transition:{duration:25,repeat:1/0,ease:"linear"},className:"absolute -bottom-1/2 -right-1/2 w-full h-full bg-gradient-radial from-purple-500/10 to-transparent rounded-full blur-3xl"})]}),(0,r.jsx)(a.P.div,{initial:{y:100,opacity:0},animate:{y:0,opacity:1},exit:{y:100,opacity:0},transition:{type:"spring",stiffness:100,damping:20},className:"relative h-full w-full flex items-center justify-center px-6 py-20",children:(0,r.jsxs)("div",{className:"w-full max-w-lg",children:[(0,r.jsxs)(a.P.div,{initial:{y:-20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.2},className:"text-center mb-12",children:[(0,r.jsx)("h2",{className:"text-3xl font-bold text-white drop-shadow-lg tracking-wide",children:"Explore Robot Ric's World"}),(0,r.jsx)("p",{className:"text-blue-200 mt-2 text-sm font-light tracking-wider",children:"Choose your adventure"})]}),(0,r.jsx)(a.P.div,{initial:{scale:0,rotate:-180},animate:{scale:1,rotate:0},exit:{scale:0,rotate:180},transition:{type:"spring",stiffness:260,damping:20,delay:.1},className:"relative h-full w-full flex items-center justify-center ",children:(0,r.jsxs)(I.$n,{onPress:n,className:"relative group",children:[(0,r.jsx)("div",{className:" bg-red-500/20 rounded-3xl blur-xl group-hover:bg-red-500/40 transition-all duration-300"}),(0,r.jsx)("div",{className:"relative backdrop-blur-md bg-white/10 rounded-3xl p-2 border border-white/20 shadow-2xl group-hover:bg-white/20 transition-all duration-300",children:(0,r.jsx)(E.pF,{className:"w-16 h-16 text-white drop-shadow-[0_0_10px_rgba(255,255,255,0.5)]"})})]})}),(0,r.jsxs)(a.P.div,{initial:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:{delay:.3},className:"relative",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-500/30 to-purple-500/30 rounded-3xl blur-2xl"}),(0,r.jsxs)("div",{className:"relative backdrop-blur-xl bg-white/10 rounded-3xl p-8 border border-white/20 shadow-2xl overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-br from-white/10 via-trans
30parent to-transparent pointer-events-none"}),(0,r.jsx)("div",{className:"relative z-10",children:(0,r.jsx)(f,{links:t,isMobileMenu:!0})})]})]}),(0,r.jsxs)(a.P.div,{initial:{y:20,opacity:0},animate:{y:0,opacity:1},transition:{delay:.4},className:"text-center mt-8",children:[(0,r.jsxs)("div",{className:"flex items-center justify-center space-x-2",children:[(0,r.jsx)("div",{className:"h-px w-12 bg-gradient-to-r from-transparent to-blue-400/50"}),(0,r.jsx)("span",{className:"text-blue-300/70 text-xs tracking-widest uppercase font-light",children:"Scroll to Explore"}),(0,r.jsx)("div",{className:"h-px w-12 bg-gradient-to-l from-transparent to-blue-400/50"})]}),(0,r.jsx)(a.P.div,{animate:{y:[0,8,0]},transition:{duration:2,repeat:1/0,ease:"easeInOut"},className:"mt-4",children:(0,r.jsx)("svg",{className:"w-6 h-6 mx-auto text-blue-300/70",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 14l-7 7m0 0l-7-7m7 7V3"})})})]})]})}),(0,r.jsx)("div",{className:"absolute top-1/4 left-1/4 w-64 h-64 bg-blue-500/20 rounded-full blur-[100px] pointer-events-none animate-pulse"}),(0,r.jsx)("div",{className:"absolute bottom-1/4 right-1/4 w-64 h-64 bg-purple-500/20 rounded-full blur-[100px] pointer-events-none animate-pulse delay-1000"})]})})},A=e=>{let{toggleMenu:t}=e,[n,s]=(0,i.useState)(!1),[o,l]=(0,i.useState)(!1);return(0,r.jsx)(a.P.div,{className:"relative w-24 h-36 cursor-pointer",onClick:()=>{s(e=>!e),t()},onHoverStart:()=>l(!0),onHoverEnd:()=>l(!1),whileHover:"hover",style:{perspective:1e3},children:(0,r.jsx)(C.N,{mode:"wait",children:n?(0,r.jsx)(a.P.div,{className:"absolute inset-0",initial:"initial",animate:"animate",exit:"exit",children:(0,r.jsx)(E.n6,{className:"w-full h-full ",style:{filter:o?"drop-shadow(0 0 9px rgba(255, 255, 255, 0.5))":"none"}})},"open"):(0,r.jsx)(a.P.div,{className:"absolute inset-0",initial:"initial",animate:"animate",exit:"exit",children:(0,r.jsx)(E.pF,{className:"w-full h-full",style:{filter:o?"drop-shadow(0 0 10px rgba(255,255,255,0.5))":"none"}})},"closed")})})},k=e=>{let{router:t}=e,[n,s]=(0,i.useState)(!1),[a,l]=(0,i.useState)(!1),u=(0,o.Ub)({maxWidth:767}),h=T.links,c=()=>{l(!0),s(e=>!e),setTimeout(()=>l(!1),300)};return(0,r.jsxs)("header",{className:"relative flex items-center justify-center w-full min-h-screen overflow-hidden",children:[(0,r.jsx)("div",{className:"absolute inset-0 bg-gradient-to-b from-transparent via-black/5 to-black/20 pointer-events-none z-10"}),(0,r.jsx)("div",{className:"absolute inset-0 opacity-30 z-0",children:(0,r.jsx)("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_50%_50%,rgba(76,175,255,0.1),transparent_50%)] animate-pulse"})}),(0,r.jsx)("div",{className:"relative z-40 w-full max-w-7xl px-4 sm:px-6 lg:px-8 mx-auto",children:u?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-8 py-8",children:[(0,r.jsx)("div",{className:"transform transition-all duration-500 hover:scale-105",children:(0,r.jsx)(S,{})}),(0,r.jsx)("div",{className:"transform transition-all duration-300",children:(0,r.jsx)(A,{toggleMenu:c,isOpen:n})})]}):(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-12 py-12",children:[(0,r.jsx)("div",{className:"transform transition-all duration-500 hover:scale-105 hover:drop-shadow-2xl",children:(0,r.jsx)(S,{router:t})}),(0,r.jsx)("div",{className:"w-full max-w-5xl transform transition-all duration-500",children:(0,r.jsx)(f,{links:h})})]})}),u&&(0,r.jsx)("div",{className:"fixed inset-0 z-50 transition-all duration-300 ease-out ".concat(n?"opacity-100 pointer-events-auto":"opacity-0 pointer-events-none"),children:(0,r.jsx)(x,{links:h,router:t,toggleMenu:c,isOpen:n})})]})};var R=n(7618),P=n(4447),N=n(3822),O=n(7706);function D(){return"undefined"!=typeof window}function L(){return"production"}function M(){return"development"===((D()?window.vam:L())||"production")}function j(e){return RegExp(`/${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?=[/?#]|$)`)}function F(e){return(0,i.useEffect)(()=>{var t;e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend))},[e.beforeSend]),(0,i.useEffect)(()=>{!function(e={debug:!0}){var t;if(!D())return;!function(e="auto"){if("auto"===e){window.vam=L();return}window.vam=e}(e.mode),window.va||(window.va=function(...e){(window.vaq=window.vaq||[]).push(e)}),e.beforeSend&&(null==(t=window.va)||t.call(window,"beforeSend",e.beforeSend));let n=e.scriptSrc?e.scriptSrc:M()?"https://va.vercel-scripts.com/v1/script.debug.js":e.basePath?`${e.basePath}
30/insights/script.js`:"/_vercel/insights/script.js";if(document.head.querySelector(`script[src*="${n}"]`))return;let r=document.createElement("script");r.src=n,r.defer=!0,r.dataset.sdkn="@vercel/analytics"+(e.framework?`/${e.framework}`:""),r.dataset.sdkv="1.5.0",e.disableAutoTrack&&(r.dataset.disableAutoTrack="1"),e.endpoint?r.dataset.endpoint=e.endpoint:e.basePath&&(r.dataset.endpoint=`${e.basePath}/insights`),e.dsn&&(r.dataset.dsn=e.dsn),r.onerror=()=>{let e=M()?"Please check if any ad blockers are enabled and try again.":"Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";console.log(`[Vercel Web Analytics] Failed to load script from ${n}. ${e}`)},M()&&!1===e.debug&&(r.dataset.debug="false"),document.head.appendChild(r)}({framework:e.framework||"react",basePath:e.basePath??function(){if(void 0!==O&&void 0!==O.env)return O.env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH}(),...void 0!==e.route&&{disableAutoTrack:!0},...e})},[]),(0,i.useEffect)(()=>{e.route&&e.path&&function({route:e,path:t}){var n;null==(n=window.va)||n.call(window,"pageview",{route:e,path:t})}({route:e.route,path:e.path})},[e.route,e.path]),null}function U(e){let{route:t,path:n}=(()=>{let e=(0,N.useParams)(),t=(0,N.useSearchParams)(),n=(0,N.usePathname)();return e?{route:function(e,t){if(!e||!t)return e;let n=e;try{let e=Object.entries(t);for(let[t,r]of e)if(!Array.isArray(r)){let e=j(r);e.test(n)&&(n=n.replace(e,`/[${t}]`))}for(let[t,r]of e)if(Array.isArray(r)){let e=j(r.join("/"));e.test(n)&&(n=n.replace(e,`/[...${t}]`))}return n}catch(t){return e}}(n,Object.keys(e).length?e:Object.fromEntries(t.entries())),path:n}:{route:null,path:n}})();return i.createElement(F,{path:n,route:t,...e,basePath:function(){if(void 0!==O&&void 0!==O.env)return O.env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH}(),framework:"next"})}function V(e){return i.createElement(i.Suspense,{fallback:null},i.createElement(U,{...e}))}n(7952);let B=function(e){let{Component:t,pageProps:n}=e,o=(0,s.useRouter)(),a=(0,R.d)(),l=(0,i.useMemo)(()=>({...n,booksData:P,gamesData:null==a?void 0:a.Games,ReadingRoomData:null==a?void 0:a.ReadingRoom,QuizProgress:null==a?void 0:a.QuizProgress,purchasedBooks:null==a?void 0:a.purchasedBooks,readingProgress:null==a?void 0:a.readingProgress,rictokens:null==a?void 0:a.rictokens,user:(null==a?void 0:a.user)||a}),[n,a]);return(0,i.useEffect)(()=>{let e=e=>{if(e.includes("/Adventure/Ra/Lumi")||e.includes("/Adventure/Ra/Rami")){let e=document.getElementById("main-content");e&&e.scrollIntoView({behavior:"smooth",block:"start"})}};return e(o.asPath),o.events.on("routeChangeComplete",e),()=>o.events.off("routeChangeComplete",e)},[o]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(V,{}),(0,r.jsxs)("div",{className:"app-container",children:[(0,r.jsx)("section",{className:"app-section header-section",id:"app-header",children:(0,r.jsx)(k,{router:o})}),(0,r.jsx)("section",{className:"app-section content-section",id:"main-content",children:(0,r.jsx)(t,{...l})})]})]})}}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8792],()=>(t(6150),t(2716))),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.