1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[636],{919:(e,t,r)=>{"use strict";r.d(t,{m:()=>s});let n=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});default:return t.date({width:"full"})}},i=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});default:return t.time({width:"full"})}},s={p:i,P:(e,t)=>{let r,s=e.match(/(P+)(p+)?/)||[],a=s[1],o=s[2];if(!o)return n(e,t);switch(a){case"P":r=t.dateTime({width:"short"});break;case"PP":r=t.dateTime({width:"medium"});break;case"PPP":r=t.dateTime({width:"long"});break;default:r=t.dateTime({width:"full"})}return r.replace("{{date}}",n(a,t)).replace("{{time}}",i(o,t))}}},923:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function({html:e,height:t=null,width:r=null,children:s,dataNtpc:a=""}){return(0,i.useEffect)(()=>{a&&performance.mark("mark_feature_usage",{detail:{feature:`next-third-parties-${a}`}})},[a]),(0,n.jsxs)(n.Fragment,{children:[s,e?(0,n.jsx)("div",{style:{height:null!=t?`${t}px`:"auto",width:null!=r?`${r}px`:"auto"},"data-ntpc":a,dangerouslySetInnerHTML:{__html:e}}):null]})};let n=r(26514),i=r(75834)},1887:(e,t,r)=>{"use strict";r.d(t,{o:()=>i});let n={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},i=(e,t,r,i)=>n[e]},2483:(e,t,r)=>{"use strict";let n,i;r.d(t,{l$:()=>ee,Ay:()=>et});var s,a=r(75834);let o={data:""},l=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,u=/\/\*[^]*?\*\/| +/g,c=/\n+/g,h=(e,t)=>{let r="",n="",i="";for(let s in e){let a=e[s];"@"==s[0]?"i"==s[1]?r=s+" "+a+";":n+="f"==s[1]?h(a,s):s+"{"+h(a,"k"==s[1]?"":t)+"}":"object"==typeof a?n+=h(a,t?t.replace(/([^,])+/g,e=>s.replace(/([^,]*:\S+\([^)]*\))|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+" "+t:t)):s):null!=a&&(s=/^--/.test(s)?s:s.replace(/[A-Z]/g,"-$&").toLowerCase(),i+=h.p?h.p(s,a):s+":"+a+";")}return r+(t&&i?t+"{"+i+"}":i)+n},d={},f=e=>{if("object"==typeof e){let t="";for(let r in e)t+=r+f(e[r]);return t}return e};function p(e){let t,r,n=this||{},i=e.call?e(n.p):e;return((e,t,r,n,i)=>{var s;let a=f(e),o=d[a]||(d[a]=(e=>{let t=0,r=11;for(;t<e.length;)r=101*r+e.charCodeAt(t++)>>>0;return"go"+r})(a));if(!d[o]){let t=a!==e?e:(e=>{let t,r,n=[{}];for(;t=l.exec(e.replace(u,""));)t[4]?n.shift():t[3]?(r=t[3].replace(c," ").trim(),n.unshift(n[0][r]=n[0][r]||{})):n[0][t[1]]=t[2].replace(c," ").trim();return n[0]})(e);d[o]=h(i?{["@keyframes "+o]:t}:t,r?"":"."+o)}let p=r&&d.g?d.g:null;return r&&(d.g=d[o]),s=d[o],p?t.data=t.data.replace(p,s):-1===t.data.indexOf(s)&&(t.data=n?s+t.data:t.data+s),o})(i.unshift?i.raw?(t=[].slice.call(arguments,1),r=n.p,i.reduce((e,n,i)=>{let s=t[i];if(s&&s.call){let e=s(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;s=t?"."+t:e&&"object"==typeof e?e.props?"":h(e,""):!1===e?"":e}return e+n+(null==s?"":s)},"")):i.reduce((e,t)=>Object.assign(e,t&&t.call?t(n.p):t),{}):i,(e=>{if("object"==typeof window){let t=(e?e.querySelector("#_goober"):window._goober)||Object.assign(document.createElement("style"),{innerHTML:" ",id:"_goober"});return t.nonce=window.__nonce__,t.parentNode||(e||document.head).appendChild(t),t.firstChild}return e||o})(n.target),n.g,n.o,n.k)}p.bind({g:1});let g,m,v,y=p.bind({k:1});function _(e,t){let r=this||{};return function(){let n=arguments;function i(s,a){let o=Object.assign({},s),l=o.className||i.className;r.p=Object.assign({theme:m&&m()},o),r.o=/ *go\d+/.test(l),o.className=p.apply(r,n)+(l?" "+l:""),t&&(o.ref=a);let u=e;return e[0]&&(u=o.as||e,delete o.as),v&&u[0]&&v(o),g(u,o)}return t?t(i):i}}var b=(e,t)=>"function"==typeof e?e(t):e,w=(n=0,()=>(++n).toString()),E=()=>
1{if(void 0===i&&"u">typeof window){let e=matchMedia("(prefers-reduced-motion: reduce)");i=!e||e.matches}return i},S="default",I=(e,t)=>{let{toastLimit:r}=e.settings;switch(t.type){case 0:return{...e,toasts:[t.toast,...e.toasts].slice(0,r)};case 1:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case 2:let{toast:n}=t;return I(e,{type:+!!e.toasts.find(e=>e.id===n.id),toast:n});case 3:let{toastId:i}=t;return{...e,toasts:e.toasts.map(e=>e.id===i||void 0===i?{...e,dismissed:!0,visible:!1}:e)};case 4:return void 0===t.toastId?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)};case 5:return{...e,pausedAt:t.time};case 6:let s=t.time-(e.pausedAt||0);return{...e,pausedAt:void 0,toasts:e.toasts.map(e=>({...e,pauseDuration:e.pauseDuration+s}))}}},k=[],T={toasts:[],pausedAt:void 0,settings:{toastLimit:20}},A={},C=(e,t=S)=>{A[t]=I(A[t]||T,e),k.forEach(([e,r])=>{e===t&&r(A[t])})},x=e=>Object.keys(A).forEach(t=>C(e,t)),R=(e=S)=>t=>{C(t,e)},P={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},D=e=>(t,r)=>{let n,i=((e,t="blank",r)=>({createdAt:Date.now(),visible:!0,dismissed:!1,type:t,ariaProps:{role:"status","aria-live":"polite"},message:e,pauseDuration:0,...r,id:(null==r?void 0:r.id)||w()}))(t,e,r);return R(i.toasterId||(n=i.id,Object.keys(A).find(e=>A[e].toasts.some(e=>e.id===n))))({type:2,toast:i}),i.id},O=(e,t)=>D("blank")(e,t);O.error=D("error"),O.success=D("success"),O.loading=D("loading"),O.custom=D("custom"),O.dismiss=(e,t)=>{let r={type:3,toastId:e};t?R(t)(r):x(r)},O.dismissAll=e=>O.dismiss(void 0,e),O.remove=(e,t)=>{let r={type:4,toastId:e};t?R(t)(r):x(r)},O.removeAll=e=>O.remove(void 0,e),O.promise=(e,t,r)=>{let n=O.loading(t.loading,{...r,...null==r?void 0:r.loading});return"function"==typeof e&&(e=e()),e.then(e=>{let i=t.success?b(t.success,e):void 0;return i?O.success(i,{id:n,...r,...null==r?void 0:r.success}):O.dismiss(n),e}).catch(e=>{let i=t.error?b(t.error,e):void 0;i?O.error(i,{id:n,...r,...null==r?void 0:r.error}):O.dismiss(n)}),e};var N=1e3,M=y` 2from { 3 transform: scale(0) rotate(45deg); 4 opacity: 0; 5} 6to { 7 transform: scale(1) rotate(45deg); 8 opacity: 1; 9}`,F=y` 10from { 11 transform: scale(0); 12 opacity: 0; 13} 14to { 15 transform: scale(1); 16 opacity: 1; 17}`,L=y` 18from { 19 transform: scale(0) rotate(90deg); 20 opacity: 0; 21} 22to { 23 transform: scale(1) rotate(90deg); 24 opacity: 1; 25}`,U=_("div")` 26 width: 20px; 27 opacity: 0; 28 height: 20px; 29 border-radius: 10px; 30 background: ${e=>e.primary||"#ff4b4b"}; 31 position: relative; 32 transform: rotate(45deg); 33 34 animation: ${M} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 35 forwards; 36 animation-delay: 100ms; 37 38 &:after, 39 &:before { 40 content: ''; 41 animation: ${F} 0.15s ease-out forwards; 42 animation-delay: 150ms; 43 position: absolute; 44 border-radius: 3px; 45 opacity: 0; 46 background: ${e=>e.secondary||"#fff"}; 47 bottom: 9px; 48 left: 4px; 49 height: 2px; 50 width: 12px; 51 } 52 53 &:before { 54 animation: ${L} 0.15s ease-out forwards; 55 animation-delay: 180ms; 56 transform: rotate(90deg); 57 } 58`,j=y` 59 from { 60 transform: rotate(0deg); 61 } 62 to { 63 transform: rotate(360deg); 64 } 65`,$=_("div")` 66 width: 12px; 67 height: 12px; 68 box-sizing: border-box; 69 border: 2px solid; 70 border-radius: 100%; 71 border-color: ${e=>e.secondary||"#e0e0e0"}; 72 border-right-color: ${e=>e.primary||"#616161"}; 73 animation: ${j} 1s linear infinite; 74`,V=y` 75from { 76 transform: scale(0) rotate(45deg); 77 opacity: 0; 78} 79to { 80 transform: scale(1) rotate(45deg); 81 opacity: 1; 82}`,B=y` 830% { 84 height: 0; 85 width: 0; 86 opacity: 0; 87} 8840% { 89 height: 0; 90 width: 6px; 91 opacity: 1; 92} 93100% { 94 opacity: 1; 95 height: 10px; 96}`,W=_("div")` 97 width: 20px; 98 opacity: 0; 99 height: 20px; 100 border-radius: 10px; 101 background: ${e=>e.primary||"#61d345"}; 102 position: relative; 103 transform: rotate(45deg); 104 105 animation: ${V} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) 106 forwards; 107 animation-delay: 100ms; 108 &:after { 109 content: ''; 110 box-sizing: border-box; 111 animation: ${B} 0.2s ease-out forwards; 112 opacity: 0; 113 animation-delay: 200ms; 114 position: absolute; 115 border-right: 2px solid; 116 border-bottom: 2px solid; 117 border-color: ${e=>e.secondary||"#fff"}; 118 bottom: 6px; 119 left: 6px; 120 height: 10px; 121 width: 6px; 122 } 123`,z=_("div")` 124 position: absolute; 125`,q=_("div")` 126 position: relative; 127 display: flex; 128 justify-content: center; 129 align-items: center;
130 min-width: 20px; 131 min-height: 20px; 132`,H=y` 133from { 134 transform: scale(0.6); 135 opacity: 0.4; 136} 137to { 138 transform: scale(1); 139 opacity: 1; 140}`,G=_("div")` 141 position: relative; 142 transform: scale(0.6); 143 opacity: 0.4; 144 min-width: 20px; 145 animation: ${H} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) 146 forwards; 147`,K=({toast:e})=>{let{icon:t,type:r,iconTheme:n}=e;return void 0!==t?"string"==typeof t?a.createElement(G,null,t):t:"blank"===r?null:a.createElement(q,null,a.createElement($,{...n}),"loading"!==r&&a.createElement(z,null,"error"===r?a.createElement(U,{...n}):a.createElement(W,{...n})))},Y=_("div")` 148 display: flex; 149 align-items: center; 150 background: #fff; 151 color: #363636; 152 line-height: 1.3; 153 will-change: transform; 154 box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05); 155 max-width: 350px; 156 pointer-events: auto; 157 padding: 8px 10px; 158 border-radius: 8px; 159`,J=_("div")` 160 display: flex; 161 justify-content: center; 162 margin: 4px 10px; 163 color: inherit; 164 flex: 1 1 auto; 165 white-space: pre-line; 166`,Q=a.memo(({toast:e,position:t,style:r,children:n})=>{let i=e.height?((e,t)=>{let r=e.includes("top")?1:-1,[n,i]=E()?["0%{opacity:0;} 100%{opacity:1;}","0%{opacity:1;} 100%{opacity:0;}"]:[` 1670% {transform: translate3d(0,${-200*r}%,0) scale(.6); opacity:.5;} 168100% {transform: translate3d(0,0,0) scale(1); opacity:1;} 169`,` 1700% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 171100% {transform: translate3d(0,${-150*r}%,-1px) scale(.6); opacity:0;} 172`];return{animation:t?`${y(n)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${y(i)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}})(e.position||t||"top-center",e.visible):{opacity:0},s=a.createElement(K,{toast:e}),o=a.createElement(J,{...e.ariaProps},b(e.message,e));return a.createElement(Y,{className:e.className,style:{...i,...r,...e.style}},"function"==typeof n?n({icon:s,message:o}):a.createElement(a.Fragment,null,s,o))});s=a.createElement,h.p=void 0,g=s,m=void 0,v=void 0;var X=({id:e,className:t,style:r,onHeightUpdate:n,children:i})=>{let s=a.useCallback(t=>{if(t){let r=()=>{n(e,t.getBoundingClientRect().height)};r(),new MutationObserver(r).observe(t,{subtree:!0,childList:!0,characterData:!0})}},[e,n]);return a.createElement("div",{ref:s,className:t,style:r},i)},Z=p` 173 z-index: 9999; 174 > * { 175 pointer-events: auto; 176 } 177`,ee=({reverseOrder:e,position:t="top-center",toastOptions:r,gutter:n,children:i,toasterId:s,containerStyle:o,containerClassName:l})=>{let{toasts:u,handlers:c}=((e,t="default")=>{let{toasts:r,pausedAt:n}=((e={},t=S)=>{let[r,n]=(0,a.useState)(A[t]||T),i=(0,a.useRef)(A[t]);(0,a.useEffect)(()=>(i.current!==A[t]&&n(A[t]),k.push([t,n]),()=>{let e=k.findIndex(([e])=>e===t);e>-1&&k.splice(e,1)}),[t]);let s=r.toasts.map(t=>{var r,n,i;return{...e,...e[t.type],...t,removeDelay:t.removeDelay||(null==(r=e[t.type])?void 0:r.removeDelay)||(null==e?void 0:e.removeDelay),duration:t.duration||(null==(n=e[t.type])?void 0:n.duration)||(null==e?void 0:e.duration)||P[t.type],style:{...e.style,...null==(i=e[t.type])?void 0:i.style,...t.style}}});return{...r,toasts:s}})(e,t),i=(0,a.useRef)(new Map).current,s=(0,a.useCallback)((e,t=N)=>{if(i.has(e))return;let r=setTimeout(()=>{i.delete(e),o({type:4,toastId:e})},t);i.set(e,r)},[]);(0,a.useEffect)(()=>{if(n)return;let e=Date.now(),i=r.map(r=>{if(r.duration===1/0)return;let n=(r.duration||0)+r.pauseDuration-(e-r.createdAt);if(n<0){r.visible&&O.dismiss(r.id);return}return setTimeout(()=>O.dismiss(r.id,t),n)});return()=>{i.forEach(e=>e&&clearTimeout(e))}},[r,n,t]);let o=(0,a.useCallback)(R(t),[t]),l=(0,a.useCallback)(()=>{o({type:5,time:Date.now()})},[o]),u=(0,a.useCallback)((e,t)=>{o({type:1,toast:{id:e,height:t}})},[o]),c=(0,a.useCallback)(()=>{n&&o({type:6,time:Date.now()})},[n,o]),h=(0,a.useCallback)((e,t)=>{let{reverseOrder:n=!1,gutter:i=8,defaultPosition:s}=t||{},a=r.filter(t=>(t.position||s)===(e.position||s)&&t.height),o=a.findIndex(t=>t.id===e.id),l=a.filter((e,t)=>t<o&&e.visible).length;return a.filter(e=>e.visible).slice(...n?[l+1]:[0,l]).reduce((e,t)=>e+(t.height||0)+i,0)},[r]);return(0,a.useEffect)(()=>
177{r.forEach(e=>{if(e.dismissed)s(e.id,e.removeDelay);else{let t=i.get(e.id);t&&(clearTimeout(t),i.delete(e.id))}})},[r,s]),{toasts:r,handlers:{updateHeight:u,startPause:l,endPause:c,calculateOffset:h}}})(r,s);return a.createElement("div",{"data-rht-toaster":s||"",style:{position:"fixed",zIndex:9999,top:16,left:16,right:16,bottom:16,pointerEvents:"none",...o},className:l,onMouseEnter:c.startPause,onMouseLeave:c.endPause},u.map(r=>{let s,o,l=r.position||t,u=c.calculateOffset(r,{reverseOrder:e,gutter:n,defaultPosition:t}),h=(s=l.includes("top"),o=l.includes("center")?{justifyContent:"center"}:l.includes("right")?{justifyContent:"flex-end"}:{},{left:0,right:0,display:"flex",position:"absolute",transition:E()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${u*(s?1:-1)}px)`,...s?{top:0}:{bottom:0},...o});return a.createElement(X,{id:r.id,key:r.id,onHeightUpdate:c.updateHeight,className:r.visible?Z:"",style:h},"custom"===r.type?b(r.message,r):i?i(r):a.createElement(Q,{toast:r,position:l}))}))},et=O},4992:(e,t,r)=>{"use strict";let n;r.d(t,{Jw:()=>V,Sf:()=>L,kA:()=>v,YF:()=>W,Ez:()=>y,p7:()=>U,Ww:()=>K,RC:()=>x,Iy:()=>q,xA:()=>h,YE:()=>d,HK:()=>f,X7:()=>$,Io:()=>F,c4:()=>Q,qV:()=>P,bw:()=>_,$n:()=>D,bX:()=>H,$M:()=>k,xH:()=>b,Tk:()=>T,w8:()=>w,yH:()=>A,KM:()=>E,jz:()=>X,$8:()=>I,od:()=>M,KJ:()=>S,l_:()=>Y,t5:()=>g,Q5:()=>m,Gk:()=>R,FX:()=>N,lU:()=>p,p3:()=>G,nc:()=>C,$B:()=>z,ac:()=>B,vr:()=>j,ae:()=>J,TK:()=>O});var i,s=((i=s||{}).EmailSignup="email_signup",i.GuideSignup="guide_signup",i.FundingDatabaseLead="funding_db_lead",i.PartnerReferralLead="partner_referral",i.PlatformReferral="platform_referral",i.QuickAssessment="quick_assessment",i.MarketingLandingPageSignUp="marketing_lp_signup",i),a=r(7798),o=r(25229),l=r(41040),u=r(60858),c=r(48449);function h(){return n}async function d(e,...t){let r=(0,o.H9)(n,e,...t),i=await (0,o.x7)(r);if(!i.exists())throw Error(`Document ${[e,...t].join("/")} does not exist`);return i.data()}async function f(e,...t){let r=(0,o.P)((0,o.rJ)(n,e),...t),i=await (0,o.GG)(r),s=[];return i.forEach(e=>{s.push(e.data())}),s}async function p(e,t,r){let i=(0,o.H9)(n,e);return r?r.update(i,t):(0,o.mZ)(i,t)}function g(e,t,r,...i){let s=(0,o.H9)(n,e,...i);return(0,o.aQ)(s,{next:n=>{if(!n.exists())return r(Error(`Document at path ${e} does not exist`));t(n.data())},error:r})}function m(e,t,r,...i){let s=(0,o.P)((0,o.rJ)(n,e),...i);return(0,o.aQ)(s,{next:e=>{let r=[];e.forEach(e=>r.push(e.data())),t(r,e.docChanges())},error:r})}async function v(e,...t){let r=(0,o.P)((0,o.rJ)(n,e),...t);return(await (0,o.d_)(r)).data().count}function y(){return(0,o.wP)(n)}async function _(e){let t=(0,c.Ak)(12),r=(0,o.H9)(n,"leads",t),i={id:t,email:e,createdAt:o.Dc.now(),kind:s.EmailSignup};return(0,o.BN)(r,i)}async function b(e){let t=(0,c.Ak)(12),r=(0,o.H9)(n,"leads",t),i={id:t,email:e,createdAt:o.Dc.now(),kind:s.GuideSignup};return(0,o.BN)(r,i)}async function w(e,t,r,i,a,l){let u=(0,c.Ak)(12),h=(0,o.H9)(n,"leads",u),d={id:u,email:t,hasConsentedContact:r,createdAt:o.Dc.now(),kind:s.MarketingLandingPageSignUp,slug:e};
177return i&&(d.company=i),a&&(d.firstName=a),l&&(d.lastName=l),(0,o.BN)(h,d)}async function E(e,t,r){let i=(0,c.Ak)(12),a=(0,o.H9)(n,"leads",i),l={id:i,email:e,createdAt:o.Dc.now(),kind:s.PartnerReferralLead,partnerName:t,referralKey:r};return(0,o.BN)(a,l)}async function S(e,t,r,i){let a=(0,c.Ak)(12),l=(0,o.H9)(n,"leads",a),u={id:a,email:e,createdAt:o.Dc.now(),kind:s.QuickAssessment,hasTechnicalRisks:t,isNewOrImprovedProduct:r,numRnDEmployees:i};return(0,o.BN)(l,u)}async function I(e,t){let r=(0,c.Ak)(12),i=(0,o.H9)(n,"leads",r),a={createdAt:o.Dc.now(),email:e,id:r,kind:s.PlatformReferral,referrerEmail:t.email,referrerId:t.id};return(0,o.BN)(i,a)}async function k(e){let t=(0,c.Ak)(12),r=(0,o.H9)(n,"leads",t),i={createdAt:o.Dc.now(),email:e,id:t,kind:s.FundingDatabaseLead};return(0,o.BN)(r,i)}async function T(e){let t=(0,o.H9)(n,"highscores",e.id);return(0,o.BN)(t,e)}async function A(e){let t=(0,o.H9)(n,"customers",e.customerId,"messages",e.id);return(0,o.BN)(t,e)}async function C(e,t,r,i){let s=(0,o.H9)(n,"customers",e,"messages",t);return i?i.update(s,r):(0,o.mZ)(s,r)}async function x(e,t,r){let i=(0,o.H9)(n,"customers",e,"messages",t);return r?r.delete(i):(0,o.kd)(i)}async function R(e,t,r){let i=(0,o.H9)(n,"customers",e);return r?r.update(i,t):(0,o.mZ)(i,t)}async function P(e){let t=(0,o.H9)(n,"adminEvents",e.id);return(0,o.BN)(t,e)}async function D(e,t){let r=(0,o.H9)(n,"events",e.id);return t?t.set(r,e):(0,o.BN)(r,e)}async function O(e,t,r){let i=(0,o.H9)(n,"users",e);return r?r.update(i,t):(0,o.mZ)(i,t)}async function N(e,t,r){let i=(0,o.H9)(n,"delegatedTimesheets",e);return r?r.update(i,t):(0,o.mZ)(i,t)}async function M(e){let t=(0,o.H9)(n,"projects",e.id);return(0,o.BN)(t,e)}function F({updates:e={},updatesData:t={},loggedInUser:r}){let n={lastUpdatedAt:o.Dc.now(),lastUpdatedBy:r.id,lastUpdatedByEmail:r.email,lastUpdatedByDisplayName:r.displayName,...e};return Object.entries(t).forEach(([e,t])=>{n["data."+e]=t===a.UW?(0,o.CL)():t}),n}function L({project:e,updates:t={},updatesData:r={},loggedInUser:n}){let i=U(e);return Object.entries(r).forEach(([e,t])=>{i.data[e]=t}),{...i,...t,lastUpdatedAt:o.Dc.now(),lastUpdatedBy:n.id,lastUpdatedByEmail:n.email,lastUpdatedByDisplayName:n.displayName}}function U(e){return function e(t){return Object.entries(t).forEach(([r,n])=>{var i;n&&"object"==typeof n&&(null!==(i=n)&&"object"==typeof i&&2===Object.keys(i).length&&"seconds"in i&&"nanoseconds"in i?t[r]=new o.Dc(n.seconds,n.nanoseconds):e(n))}),t}(structuredClone(e))}async function j(e,t,r){let i=(0,o.H9)(n,"projects",e);return r?r.update(i,t):(0,o.mZ)(i,t)}function $({updates:e={},updatesData:t={},loggedInUser:r}){let n={lastUpdatedAt:o.Dc.now(),lastUpdatedBy:r.id,lastUpdatedByEmail:r.email,lastUpdatedByDisplayName:r.displayName,...e};return Object.entries(t).forEach(([e,t])=>{n["data."+e]=t===a.UW?(0,o.CL)():t}),n}function V({payoutApplication:e,updates:t={},updatesData:r={},loggedInUser:n}){let i=U(e);return Object.entries(r).forEach(([e,t])=>{i.data[e]=t}),{...i,...t,lastUpdatedAt:o.Dc.now(),lastUpdatedBy:n.id,lastUpdatedByEmail:n.email,lastUpdatedByDisplayName:n.displayName}}async function B(e,t,r){let i=(0,o.H9)(n,"payoutApplications",e);return r?r.update(i,t):(0,o.mZ)(i,t)}async function W(e){return(0,o.BN)((0,o.H9)(n,"notes",e.id),e)}async function z(e,t,r){return(0,o.mZ)((0,o.H9)(n,"notes",e),{...t,lastUpdatedAt:o.Dc.now(),lastUpdatedBy:r.id,lastUpdatedByEmail:r.email,lastUpdatedByDisplayName:r.displayName})}async function q(e){return(0,o.kd)((0,o.H9)(n,"notes",e))}async function H(e,t){let r=(0,o.H9)(n,"customers",e.customerId,"files",e.id);return t?t.set(r,e):(0,o.BN)(r,e)}async function G(e,t,r,i){let s=(0,o.H9)(n,"customers",e,"files",t);return i?i.update(s,r):(0,o.mZ)(s,r)}async function K(e,t,r){let i=(0,o.H9)(n,"customers",e,"files",t);return r?r.delete(i):(0,o.kd)(i)}async function Y(e,t,r){let i=(0,o.H9)(n,"timesheets",e);return r?r.set(i,t):(0,o.BN)(i,t)}async function J({timesheetId:e,updatedBy:t,updatedByEmail:r,updatedByDisplayName:i,lastUpdatedAt:s,updates:a},l){let u=(0,o.H9)(n,"timesheets",e);return l?l.update(u,{lastUpdatedAt:s||o.Dc.fromDate(new Date),lastUpdatedBy:t,lastUpdatedByEmail
177:r,lastUpdatedByDisplayName:i,...a}):(0,o.mZ)(u,{lastUpdatedAt:s||o.Dc.fromDate(new Date),lastUpdatedBy:t,lastUpdatedByEmail:r,lastUpdatedByDisplayName:i,...a})}async function Q(e){return(0,o.c4)(n,e)}async function X(e,t){let r=(0,o.H9)(n,"payoutApplications",e.id);return t?t.set(r,e):(0,o.BN)(r,e)}n=(0,o.aU)(u.x),"localhost"===location.hostname&&(0,o.vN)(n,"localhost",l.T.EMULATOR_FIRESTORE_PORT)},6344:(e,t,r)=>{"use strict";function n(e){return(t,r={})=>{let n,i=r.width,s=i&&e.matchPatterns[i]||e.matchPatterns[e.defaultMatchWidth],a=t.match(s);if(!a)return null;let o=a[0],l=i&&e.parsePatterns[i]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(l)?function(e,t){for(let r=0;r<e.length;r++)if(t(e[r]))return r}(l,e=>e.test(o)):function(e,t){for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t(e[r]))return r}(l,e=>e.test(o));return n=e.valueCallback?e.valueCallback(u):u,{value:n=r.valueCallback?r.valueCallback(n):n,rest:t.slice(o.length)}}}r.d(t,{A:()=>n})},6792:(e,t,r)=>{"use strict";r.d(t,{a:()=>i});var n=r(95498);function i(e,t){return(0,n.w)(t||e,e)}},7459:(e,t,r)=>{"use strict";r.d(t,{Z:()=>i});var n,i=((n=i||{}).Unselected="unselected",n.InCreation="in_creation",n.Created="created",n.InReview="in_review",n.RevisionRequested="revision_requested",n.ReadyForFiling="ready_for_filing",n.Filed="filed",n.ApprovedTaxOffice="approved_tax_office",n.PayoutReceived="payout_received",n)},7798:(e,t,r)=>{"use strict";r.d(t,{Ak:()=>a,J1:()=>s,UW:()=>o,bD:()=>i,y$:()=>function e(t,r,s="",a={}){return Object.entries(r).forEach(([r,o])=>{let u=s?`${s}.${r}`:r;t[r]instanceof n.Dc&&o instanceof n.Dc?t[r].isEqual(o)||(a[u]=o):l(o)&&l(t[r])?e(t[r],o,u,a):i(t[r],o)||(a[u]=o)}),Object.keys(r).length<Object.keys(t).length&&Object.keys(t).forEach(e=>{let t=s?`${s}.${e}`:e;e in r||(a[t]=o)}),a}});var n=r(25229);function i(e,t){return e===t||JSON.stringify(e)===JSON.stringify(t)}function s(e,t){if(e===t)return!0;if(!(l(e)&&l(t)))return JSON.stringify(e)===JSON.stringify(t);{let r=Object.keys(e),n=Object.keys(t);if(r.length!==n.length)return!1;for(let n of r)if(!s(e[n],t[n]))return!1;return!0}}function a(e,t){if(e===t)return!0;if(!(l(e)&&l(t)))return JSON.stringify(e)===JSON.stringify(t);for(let r of Object.keys(e))if(!s(e[r],t[r]))return!1;return!0}let o=Symbol("deleted");function l(e){return e&&"object"==typeof e&&!Array.isArray(e)}},7822:(e,t,r)=>{"use strict";r.d(t,{x:()=>i});var n=r(95498);function i(e,...t){let r=n.w.bind(null,e||t.find(e=>"object"==typeof e));return t.map(r)}},8584:(e,t,r)=>{"use strict";r.d(t,{X:()=>i});var n,i=((n=i||{}).Unselected="unselected",n.InDiscovery="in_discovery",n.Created="created",n.InReviewAll="in_review_all",n.RejectedCoup="rejected_coup",n.RevisionRequested="revision_requested",n.AcceptedCoup="accepted_coup",n.InReviewProposal="in_review_proposal",n.ProposalRevisionRequested="proposal_revision_requested",n.ReadyForFiling="ready_for_filing",n.Filed="filed",n.ApprovedBSFZ="approved_bsfz",n.RejectedBSFZ="rejected_bsfz",n.Superseded="superseded",n)},9658:e=>{"use strict";e.exports=JSON.parse('{"id":"youtube-embed","description":"Embed a YouTube embed on your webpage.","website":"https://github.com/paulirish/lite-youtube-embed","html":{"element":"lite-youtube","attributes":{"videoid":null,"playlabel":null}},"stylesheets":["https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.css"],"scripts":[{"url":"https://cdn.jsdelivr.net/gh/paulirish/lite-youtube-embed@master/src/lite-yt-embed.js","strategy":"idle","location":"head","action":"append"}]}')},10126:(e,t,r)=>{"use strict";r.d(t,{DP:()=>d,Id:()=>g,Sx:()=>c});var n,i=r(73874),s=r(91932),a=r(46225),o=r(75834),l=r(92204);let u="coup-theme-preference";var c=((n={}).Light="light",n.Dark="dark",n);let h=(0,l.v)(e=>({theme:"dark"===(0,s.zM)(u)?"dark":"light",setTheme:t=>{(0,s.w6)(u,t),e({theme:t})}}));function d(){return{theme:h(e=>e.theme),setTheme:h(e=>e.setTheme)}}let f=[...i.l,"/super"],p=["/timesheet-table"];function g(){let{pathname:e}=(0,a.useRouter)(),{theme:t}=d();(0,o.useEffect)(()=>{document.documentElement.classList.toggle("dark",f.some(t=>e.startsWith(t))&&!p.some(t=>e.endsWith(t))&&"dark"===t)},[e,t])}},10188:(e,t,r)=>{"use strict";r.d(t,{B:()=>i});let n={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},i=(e,t,r)=>{let i,s=n[e];if(i="string"==typeof s?s:1===t?s.one:s.other.replace("{{count}}",t.toString()),r?.addSuffix)if(r.comparison&&r.comparison>0)return"in "+i;else return i+" ago";return i}},11660:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>E});var n,i=r(26514),s=r(59334),a=r(10126),o=r(17731),l=r(33208),u=r(20514),c=r(25203),h=r(36100),d=r(14363),f=r(46225),p=r(63052),g=r(75834),m=(0,g.createContext)({get client(){return n},bootstrap:void 0});function v(e){var t,r,i=e.children,s=e.client,a=e.apiKey,o=e.options,l=(0,g.useRef)(null),u=(0,g.useMemo)(function(){if(s)return a&&console.warn("[PostHog.js] You have provided both `client` and `apiKey` to `PostHogProvider`. `apiKey` will be ignored in favour of `client`."),o&&console.warn("[PostHog.js] You have provided both `client` and `options` to `PostHogProvider`. `options` will be ignored in favour of `client`."),s;var e=n;return a||console.warn("[PostHog.js] No `apiKey` or `client` were provided to `PostHogProvider`. Using default global `window.posthog` instance. You must initialize it manually. This is not recommended behavior."),e},[s,a,JSON.stringify(o)]);return(0,g.useEffect)(function(){if(!s&&a){var e=n,t=l.current;t?(a!==t.apiKey&&console.warn("[PostHog.js] You have provided a different `apiKey` to `PostHogProvider` than the one that was already initialized. This is not supported by our provider and we'll keep using the previous key. If you need to toggle between API Keys you need to control the `client` yourself and pass it in as a prop rather than an `apiKey` prop."),o&&!function e(t,r,n){if(void 0===n&&(n=new WeakMap),t===r)return!0;
177if("object"!=typeof t||null===t||"object"!=typeof r||null===r)return!1;if(n.has(t)&&n.get(t)===r)return!0;n.set(t,r);var i=Object.keys(t),s=Object.keys(r);if(i.length!==s.length)return!1;for(var a=0;a<i.length;a++){var o=i[a];if(!s.includes(o)||!e(t[o],r[o],n))return!1}return!0}(o,t.options)&&e.set_config(o)):(e.__loaded&&console.warn("[PostHog.js] `posthog` was already loaded elsewhere. This may cause issues."),e.init(a,o)),l.current={apiKey:a,options:null!=o?o:{}}}},[s,a,JSON.stringify(o)]),g.createElement(m.Provider,{value:{client:u,bootstrap:null!=(t=null==o?void 0:o.bootstrap)?t:null==(r=null==s?void 0:s.config)?void 0:r.bootstrap}},i)}var y=function(e){return"function"==typeof e},_=function(e,t){return(_=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};"function"==typeof SuppressedError&&SuppressedError;var b={componentStack:null,exceptionEvent:null,error:null};!function(e){if("function"!=typeof e&&null!==e)throw TypeError("Class extends value "+String(e)+" is not a constructor or null");function t(){this.constructor=r}function r(t){var r=e.call(this,t)||this;return r.state=b,r}_(r,e),r.prototype=null===e?Object.create(e):(t.prototype=e.prototype,new t),r.prototype.componentDidCatch=function(e,t){var r,n=this.props.additionalProperties;y(n)?r=n(e):"object"==typeof n&&(r=n);var i=this.context.client.captureException(e,r),s=t.componentStack;this.setState({error:e,componentStack:null!=s?s:null,exceptionEvent:i})},r.prototype.render=function(){var e=this.props,t=e.children,r=e.fallback,n=this.state;if(null==n.componentStack)return y(t)?t():t;var i=y(r)?g.createElement(r,{error:n.error,componentStack:n.componentStack,exceptionEvent:n.exceptionEvent}):r;return g.isValidElement(i)?i:(console.warn("[PostHog.js][PostHogErrorBoundary] Invalid fallback prop, provide a valid React element or a function that returns a valid React element."),g.createElement(g.Fragment,null))},r.contextType=m}(g.Component),n=p.Ay;var w=r(2483);r(99046),r(55e3);let E=function({Component:e,pageProps:t,err:r}){let n=(0,f.useRouter)();(0,a.Id)();let m="function"==typeof e.getLayout?e.getLayout:e=>e;return(0,g.useEffect)(()=>{if("localhost"===location.hostname)return;let e=(0,d.Ru)(),t=e?.decision?.analytics===!1,r=e?.decision?.analytics===!0,n=null;p.Ay.init("phc_wiWH3HMM25rrzT7pc6VqvqySvgFGOh4Vn5AkxOD4JfM",{api_host:"https://eu.i.posthog.com",person_profiles:"identified_only",defaults:"2026-06-25",cookieless_mode:"on_reject",opt_out_capturing_by_default:!0,session_recording:{maskAllInputs:!0},persistence:r?"localStorage+cookie":"memory",before_send:e=>{if(!e)return null;let t="$exception"===e.event||e.properties?.eventKind==="warning";return(0,u.Zl)()||t?(("$pageview"===e.event||"$pageleave"===e.event)&&(n&&(e.properties.$prev_pageview_url=n),n=window.location.href),e):null}}),r&&!(0,u.Zl)()?(0,u.Ut)():t&&(0,u.Zl)()&&(0,u.jF)()},[]),(0,g.useEffect)(()=>{function e(e){p.Ay.capture("$pageview",{$current_url:e})}return n.events.on("hashChangeComplete",e),n.events.on("routeChangeComplete",h.oe),()=>{n.events.off("hashChangeComplete",e),n.events.off("routeChangeComplete",h.oe)}},[n.events]),(0,i.jsxs)(v,{client:p.Ay,children:[(0,i.jsx)(s.GoogleTagManager,{gtmId:"GTM-MGCQJDF"}),(0,i.jsxs)(l.r,{children:[(0,i.jsx)(c.eJ,{}),(0,i.jsx)(o.l,{children:m((0,i.jsx)(e,{...t,err:r}))}),(0,i.jsx)(w.l$,{containerStyle:{top:56}})]})]})}},13002:(e,t,r)=>{"use strict";r.d(t,{Ac:()=>z,Bq:()=>S,C8:()=>j,CS:()=>R,C_:()=>W,Ew:()=>v,Fh:()=>M,Hn:()=>g,Kj:()=>A,LN:()=>F,O4:()=>y,Ol:()=>k,Pg:()=>$,RD:()=>H,U7:()=>m,Um:()=>q,Vo:()=>V,W6:()=>T,YC:()=>I,_:()=>O,_O:()=>P,_Y:()=>D,aA:()=>U,ao:()=>b,br:()=>N,gp:()=>B,io:()=>E,qF:()=>_,rF:()=>p,w9:()=>x,x5:()=>L,yP:()=>C});var n,i,s=r(25229),a=r(18389),o=r(80036),l=r(40528),u=r(31972),c=r(43247),h=r(76090),d=r(77331),f=r(8584),p=((n=p||{}).Unselected="unselected",n.Short="short",n.Medium="medium",n);let g={unselected:"Ungew\xe4hlt",short:"Kurzfristig (< 1 Jahr)",medium:"Mittelfristig (1-5 Jahre)"},m={natural_sciences:"Naturwissenschaften",engineering:"Ingenieurwissenschaften und Technologie",medical_sciences:"Medizinische und Gesundheitswissenschaften",agricultural_science:"Agrarwissenschaften und Veterin\xe4rmedizin",social_sciences:"Sozialwissenschaften",humanities:"Geisteswissenschaften und Kunst"},v={natural_sciences:{math:"Mathematik",computer_science:"Informatik und Informationswissenschaften",physics:"Physik",chemistry:"Chemie",earth_sciences:"Geowissenschaften und zugeh\xf6rigen (Umwelt-)Wissenschaften",biology:"Biologie",other_natural_sciences:"Andere Naturwissenschaften"},engineering:{civil_engineering:"Bauingenieurwesen",electrical_engineering:"Elektrotechnik, Elektronik, Informationstechnik",mechanical_engineering:"Maschinenbau",chemical_process_engineering:"Chemische Verfahrenstechnik",materials_engineering:"Werkstofftechnik",medical_technology:"Medizintechnik",environmental_engineering:"Umwelttechnik",environmental_biotechnology:"Umweltbiotechnologie",industrial_biotechnology:"Industrielle Biotechnologie",nanotechnology:"Nanotechnologie",other_engineering:"Andere Ingenieurwissenschaften und Technologien"},medical_sciences:{basic_medical_sciences:"Grundlagenmedizin",clinical_medical_sciences:"Klinische Medizin",health_sciences:"Gesundheitswissenschaften",medical_bi
177otechnology:"Medizinische Biotechnologie",other_medical_sciences:"Andere medizinische Wissenschaften"},agricultural_science:{forestry:"Land- und Forstwirtschaft, Fischerei",dairy_science:"Tierzucht sowie Milch- und Molkereiwissenschaft",veterinary_medical_science:"Veterin\xe4rmedizin",agrobiotechnology:"Agrarbiotechnologie",other_agricultural_science:"Andere Agrarwissenschaften"},social_sciences:{cognitive_science:"Psychologie und Kognitionswissenschaft",economics:"Volks- und Betriebswirtschaftslehre",educational_science:"Erziehungswissenschaften",sociology:"Soziologie",jurisprudence:"Rechtswissenschaften",political_sciences:"Politikwissenschaft",economic_geography:"Sozial- und Wirtschaftsgeografie",communication_science:"Medien- und Kommunikationswissenschaften",other_social_sciences:"Andere Sozialwissenschaften"},humanities:{history:"Geschichte und Arch\xe4ologie",literature:"Sprachen und Literatur",philosophy:"Philosophie, Ethik und Religion",arts:"Kunst (bildende Kunst, Kunstgeschichte, darstellende Kunst, Musik)",other_humanities:"Andere Geisteswissenschaften"}},y="unassigned",_="weiterer noch unbekannter Auftragnehmer",b="internal";var w=((i=w||{}).Unselected="unselected",i.IsFirstProduct="is_first_product",i.FreeText="free_text",i);function E(e){let t=e.find(e=>e.to===f.X.Filed);return!!(t&&t.createdAt.toMillis()<new Date("2024-01-24T23:00:00.000Z").getTime())}function S(){return{estimatedRnDFTEs:0,estimatedAvgRnDSalary:0,estimatedContractors:0,name:"",goals:"",startDate:null,endDate:null,goToMarketHorizon:"unselected",hasOtherFunding:null,hasOtherFundingDetails:"",fundingAssessmentBasisInternal:{},fundingAssessmentBasisExternal:{},isInnovative:!0,innovativeDetails:"",differentiatedKind:"unselected",differentiatedDetails:"",hasProjectPlan:!0,workPackages:[],companies:[],internalStaffCostRnD:{},internalInvestmentsRnD:{},personMonths:{},hasAssociatedCompanies:null,foundingDate:null,endPastFiscalYear:null,fiscalYears:[],tagging:"",researchBranch:"unselected",researchBranchSub:"unselected",hasAcceptedProposal:null,hasConsentedToExternalFZulGReviewers:null,hasConsentedToFZulGTerms:!1,hasConfirmedDocumentationRequirements:!1,hasImplementationRisks:!0,implementationRisks:[],proposals:{},bsfzInquiries:[]}}function I(e,t){let r=(0,a.Ak)(12),n=(0,a.Ak)(12),i=s.Dc.now();return{...e,id:r,revisionId:n,revisionCreatedAt:i,kind:h.x.FZulG,status:f.X.InDiscovery,statusHistory:[],createdAt:i,lastUpdatedAt:i,lastUpdatedBy:e.createdBy,lastUpdatedByEmail:e.createdByEmail,lastUpdatedByDisplayName:e.createdByDisplayName,data:{...S(),...t}}}function k(e){return e===f.X.InDiscovery||e===f.X.Created||e===f.X.RevisionRequested}function T(e){return e&&e!==f.X.InReviewProposal&&e!==f.X.ReadyForFiling&&e!==f.X.Filed&&e!==f.X.ApprovedBSFZ&&e!==f.X.RejectedBSFZ&&e!==f.X.Superseded}function A(e){return e===f.X.AcceptedCoup||e===f.X.ProposalRevisionRequested}function C(e){return e===f.X.InDiscovery||e===f.X.InReviewAll||e===f.X.AcceptedCoup||e===f.X.ProposalRevisionRequested||e===f.X.ReadyForFiling||e===f.X.Filed||e===f.X.ApprovedBSFZ}function x(e,t){let r=e.status,n=e.statusHistory[e.statusHistory.length-1]?.from;return t||r===f.X.InReviewProposal||r===f.X.ProposalRevisionRequested||r===f.X.ReadyForFiling||r===f.X.Filed||r===f.X.ApprovedBSFZ||r===f.X.RejectedBSFZ||r===f.X.Superseded&&(n===f.X.ReadyForFiling||n===f.X.Filed||n===f.X.ApprovedBSFZ||n===f.X.RejectedBSFZ)}function R(){return{id:(0,a.Ak)(12),name:"",description:"",riskMitigation:""}}function P(){return{id:(0,a.Ak)(12),name:"",startDate:null,endDate:null,contributions:[]}}function D(e){return{id:(0,a.Ak)(12),name:"",country:"",zipCode:"",city:"",streetAddress:"",steuernummer:"",isContractor:!1,isAssociatedCompany:!1,hasRequestedFZulGFunding:!1,yearlyCost:{},...e}}function O(e,t,r){let n=!1,i=e.reduce((e,i)=>{if(i.isContractor){let s=i.yearlyCost[`year_${t}`];if("number"==typeof s&&(void 0===r||"EU"===r&&(!0===u.iq[i.country]||i.id===y)||"NonEU"===r&&!u.iq[i.country]&&i.id!==y))return n=!0,e+s}return e},0);return n?i:void 0}function N(e,t,r){if(!t||!r)return{sum:null,breakdown:{}};let n=0,i={};
177return(0,o.R)((0,c.pp)(t),(0,c.pp)(r)).forEach(t=>{let r="number"==typeof e.yearlyCost[`year_${t}`]?e.yearlyCost[`year_${t}`]:0;n+=r,i[t]=r}),{sum:n,breakdown:i}}function M(e){return e.contributions.some(e=>e.contributorId===b)}function F(e){return e.contributions.some(e=>e.contributorId!==b)}function L(e,t,r="intern"){return e===y?_:e===b?r:t.find(t=>t.id===e)?.name||"Unbekannt"}function U(e,t){return e.isContractor&&(u.iq[e.country]||e.id===y)&&(e.yearlyCost[`year_${t}`]||0)>0}function j(e,t){return e.id===y?1:t.id===y?-1:e.name.localeCompare(t.name)}function $(e,t,r){let n=`${t?"/super":""}/projects/${e.id}`,i=e.createdBySuperseding?e.status:e.statusHistory[e.statusHistory.length-1]?.from;return i===f.X.ReadyForFiling||i===f.X.Filed||i===f.X.ApprovedBSFZ||i===f.X.RejectedBSFZ?n+="#proposal_review":r&&"proposal_review"!==r&&(n+=`#${r}`),n}function V(e){return!!(0,l.$)(e.goals)&&!!(0,l.$)(e.innovativeDetails)&&e.implementationRisks.length>0&&e.workPackages.length>0}function B(e,t){if("goals"===e)return{goals:t.data.goals};if("innovation"===e)return{innovativeDetails:t.data.innovativeDetails};if("differentiation"===e)return{differentiatedKind:t.data.differentiatedKind,differentiatedDetails:t.data.differentiatedDetails};if("uncertainty"===e)return{implementationRisks:t.data.implementationRisks};if("startDate"===e)return{startDate:t.data.startDate,endDate:t.data.endDate};else if("goToMarketHorizon"===e)return{goToMarketHorizon:t.data.goToMarketHorizon};else if("workPackages"===e)return{workPackages:t.data.workPackages};else if("personMonths"===e)return{personMonths:t.data.personMonths};else if("internalRnDCost"===e)return{internalStaffCostRnD:t.data.internalStaffCostRnD};else if("internalInvestmentsRnD"===e)return{internalInvestmentsRnD:t.data.internalInvestmentsRnD};else if("contractors"===e)return{companies:t.data.companies.filter(e=>e.isContractor)};else if("hasOtherFunding"===e)return{hasOtherFunding:t.data.hasOtherFunding};else if("otherFundingPrograms"===e)return{hasOtherFundingDetails:t.data.hasOtherFundingDetails};else if("fundingAssessmentBasis"===e)return{fundingAssessmentBasisInternal:t.data.fundingAssessmentBasisInternal,fundingAssessmentBasisExternal:t.data.fundingAssessmentBasisExternal};else if("hasAssociatedCompanies"===e)return{hasAssociatedCompanies:t.data.hasAssociatedCompanies};else if("associatedCompanies"===e)return{companies:t.data.companies.filter(e=>e.isAssociatedCompany)};else if("foundingDate"===e)return{foundingDate:t.data.foundingDate};else if("endPastFiscalYear"===e)return{endPastFiscalYear:t.data.endPastFiscalYear};else if((0,d.sM)(e)){let r=e.replace("fiscalYears_","").substring(0,12),n=t.data.fiscalYears.find(e=>e.id===r);if(!n)throw Error(`Cannot find fiscalYear with id ${r}`);return{fiscalYears:[n]}}else if("hasAcceptedProposal"===e)return{hasAcceptedProposal:t.data.hasAcceptedProposal,proposals:t.data.proposals};return{}}function W(e,t){let r=e.startDate,n=e.endDate;return r&&t.employmentStartDate&&t.employmentStartDate>r&&(r=t.employmentStartDate),n&&t.employmentEndDate&&t.employmentEndDate<n&&(n=t.employmentEndDate),{startDate:r,endDate:n}}function z(e){if(!e)return[];let t="startDate"in e?e.startDate:e.data.startDate,r="endDate"in e?e.endDate:e.data.endDate;return t&&r?(0,o.R)((0,c.pp)(t),(0,c.pp)(r)):[]}function q(e,t){return"string"==typeof t&&"string"==typeof e.data.startDate&&"string"==typeof e.data.endDate&&e.data.startDate.substring(0,4)<=t&&e.data.endDate.substring(0,4)>=t}function H(e,t){return(e||[]).filter(e=>q(e,t))}},14363:(e,t,r)=>{"use strict";r.d(t,{Ru:()=>l,Z5:()=>u,gK:()=>c,oQ:()=>o,of:()=>a});var n=r(20514),i=r(36100),s=r(91932);let a="coup-cookie-consent",o=1;function l(){let e=(0,s.zM)(a);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function u(e,t){let r={decision:e,decisionAt:new Date().toISOString(),revision:o};(0,s.w6)(a,JSON.stringify(r)),c(e,t),e.analytics||t?(0,n.Ut)():(0,n.jF)()}function c(e,t){(0,i.zp)()&>ag("consent","update",{ad_personalization:e.targeting?"granted":"denied",ad_storage:e.targeting?"granted":"denied",ad_user_data:e.targeting?"granted":"denied",analytics_storage:e.anal
177ytics?"granted":"denied"}),e.analytics||t||function(){for(let e of document.cookie.split(";")){let t=e.indexOf("="),r=t>-1?e.substring(0,t):e;document.cookie=r+"=;expires=Thu, 01 Jan 1970 00:00:00 GMT"}}()}},14910:(e,t,r)=>{"use strict";function n(e){return(t,r={})=>{let n=t.match(e.matchPattern);if(!n)return null;let i=n[0],s=t.match(e.parsePattern);if(!s)return null;let a=e.valueCallback?e.valueCallback(s[0]):s[0];return{value:a=r.valueCallback?r.valueCallback(a):a,rest:t.slice(i.length)}}}r.d(t,{K:()=>n})},15042:(e,t,r)=>{"use strict";r.d(t,{c:()=>u});var n=r(10188),i=r(75030);let s={date:(0,i.k)({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:(0,i.k)({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:(0,i.k)({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})};var a=r(1887),o=r(31055),l=r(35681);let u={code:"en-US",formatDistance:n.B,formatLong:s,formatRelative:a.o,localize:o.k,match:l.Y,options:{weekStartsOn:0,firstWeekContainsDate:1}}},15735:(e,t,r)=>{"use strict";r.d(t,{P:()=>s});var n=r(95498),i=r(6792);function s(e,t,r){let s=(0,i.a)(e,r?.in);if(isNaN(t))return(0,n.w)(r?.in||e,NaN);if(!t)return s;let a=s.getDate(),o=(0,n.w)(r?.in||e,s.getTime());return(o.setMonth(s.getMonth()+t+1,0),a>=o.getDate())?o:(s.setFullYear(o.getFullYear(),o.getMonth(),a),s)}},17428:(e,t,r)=>{"use strict";r.d(t,{N:()=>u});var n=r(74226),i=r(82430),s=r(59231),a=r(95498),o=r(44786),l=r(6792);function u(e,t){let r,u,c,h,d=(0,l.a)(e,t?.in);return Math.round(((0,i.k)(d,t)-(r=(0,s.q)(),u=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,c=(0,o.h)(d,t),(h=(0,a.w)(t?.in||d,0)).setFullYear(c,0,u),h.setHours(0,0,0,0),(0,i.k)(h,t)))/n.my)+1}},17731:(e,t,r)=>{"use strict";r.d(t,{l:()=>l,t:()=>u});var n=r(26514),i=r(47596),s=r(25203),a=r(75834);let o=(0,a.createContext)({});function l({children:e}){let t=(0,s.cN)(),[r,u]=(0,a.useState)(null),c=r||t?.id,h=c?`customers/${c}/messages`:null,{data:d}=(0,i.p)(h);return(0,n.jsx)(o.Provider,{value:{foreignCustomerId:r,messages:d,setForeignCustomerId:u},children:e})}let u=()=>{let e=(0,a.useContext)(o);if(void 0===e.setForeignCustomerId)throw Error("useMessagesContext requires <MessagesContextProvider> higher in the component tree");return e}},18389:(e,t,r)=>{"use strict";r.d(t,{d_:()=>i,Ak:()=>s});let n=e=>crypto.getRandomValues(new Uint8Array(e)),i=(e,t=21)=>((e,t,r)=>{let n=256-256%e.length;if(256===n){let n=e.length-1;return (i=t)=>{if(!i)return"";let s="";for(;;){let t=r(i),a=i;for(;a--;)if((s+=e[t[a]&n]).length>=i)return s}}}let i=Math.ceil(409.6*t/n);return (s=t)=>{if(!s)return"";let a="";for(;;){let t=r(i),o=i;for(;o--;)if(t[o]<n&&(a+=e[t[o]%e.length]).length>=s)return a}}})(e,0|t,n),s=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t}},19107:(e,t,r)=>{"use strict";r.d(t,{D:()=>i});var n=r(6792);function i(e,t){let r=(0,n.a)(e,t?.in);return r.setFullYear(r.getFullYear(),0,1),r.setHours(0,0,0,0),r}},19519:(e,t,r)=>{"use strict";r.d(t,{cY:()=>v,FA:()=>P,g:()=>R,K3:()=>a,u:()=>c,Uj:()=>u,p9:()=>V,Fy:()=>y,tD:()=>U,bD:()=>function e(t,r){if(t===r)return!0;let n=Object.keys(t),i=Object.keys(r);for(let s of n){if(!i.includes(s))return!1;let n=t[s],a=r[s];if(N(n)&&N(a)){if(!e(n,a))return!1}else if(n!==a)return!1}for(let e of i)if(!n.includes(e))return!1;return!0},hp:()=>L,T9:()=>g,Tj:()=>f,yU:()=>p,XA:()=>m,mS:()=>h,Ku:()=>B,ZQ:()=>_,sr:()=>S,zJ:()=>W,c1:()=>E,Im:()=>O,lT:()=>k,zW:()=>C,jZ:()=>b,lV:()=>I,nr:()=>T,Ov:()=>A,gE:()=>z,Am:()=>M,I9:()=>F,eX:()=>x});var n=r(42922);let i=function(e){let t=[],r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:((64512&i)==55296&&n+1<e.length&&(64512&e.charCodeAt(n+1))==56320?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},s=function(e){let t=[],r=0,n=0;for(;r<e.length;){let i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){let s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){let s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{let s=e[r++],a=e[r++];
177t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&a)}}return t.join("")},a={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 r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){let i=e[t],s=t+1<e.length,a=s?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,u=i>>2,c=(3&i)<<4|a>>4,h=(15&a)<<2|l>>6,d=63&l;!o&&(d=64,s||(h=64)),n.push(r[u],r[c],r[h],r[d])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(i(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):s(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();let r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){let i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0,a=++t<e.length?r[e.charAt(t)]:64,l=++t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==a||null==l)throw new o;let u=i<<2|s>>4;if(n.push(u),64!==a){let e=s<<4&240|a>>2;if(n.push(e),64!==l){let e=a<<6&192|l;n.push(e)}}}return n},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)}}};class o extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}let l=function(e){let t=i(e);return a.encodeByteArray(t,!0)},u=function(e){return l(e).replace(/\./g,"")},c=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function h(){if("u">typeof self)return self;if("u">typeof window)return window;if(void 0!==r.g)return r.g;throw Error("Unable to locate global object.")}let d=()=>{try{return h().__FIREBASE_DEFAULTS__||(()=>{if(void 0===n||void 0===n.env)return;let e=n.env.__FIREBASE_DEFAULTS__;if(e)return JSON.parse(e)})()||(()=>{let e;if("u"<typeof document)return;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}let t=e&&c(e[1]);return t&&JSON.parse(t)})()}catch(e){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);return}},f=e=>d()?.emulatorHosts?.[e],p=e=>{let t=f(e);
177if(!t)return;let r=t.lastIndexOf(":");if(r<=0||r+1===t.length)throw Error(`Invalid host ${t} with no separate hostname and port!`);let n=parseInt(t.substring(r+1),10);return"["===t[0]?[t.substring(1,r-1),n]:[t.substring(0,r),n]},g=()=>d()?.config,m=e=>d()?.[`_${e}`];class v{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,r))}}}function y(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 r=t||"demo-project",n=e.iat||0,i=e.sub||e.user_id;if(!i)throw Error("mockUserToken must contain 'sub' or 'user_id' field!");let s={iss:`https://securetoken.google.com/${r}`,aud:r,iat:n,exp:n+3600,auth_time:n,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}},...e};return[u(JSON.stringify({alg:"none",type:"JWT"})),u(JSON.stringify(s)),""].join(".")}function _(){return"u">typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function b(){return"u">typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(_())}function w(){let e=d()?.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(r.g.process)}catch(e){return!1}}function E(){return"u">typeof navigator&&"Cloudflare-Workers"===navigator.userAgent}function S(){let e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function I(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function k(){let e=_();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}function T(){return!w()&&!!navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function A(){return!w()&&!!navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function C(){try{return"object"==typeof indexedDB}catch(e){return!1}}function x(){return new Promise((e,t)=>{try{let r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{t(i.error?.message||"")}}catch(e){t(e)}})}class R extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,R.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,P.prototype.create)}}class P{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var r,n;let i=t[0]||{},s=`${this.service}/${e}`,a=this.errors[e],o=a?(r=a,n=i,r.replace(D,(e,t)=>{let r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",l=`${this.serviceName}: ${o} (${s}).`;return new R(s,l,i)}}let D=/\{\$([^}]+)}/g;function O(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function N(e){return null!==e&&"object"==typeof e}function M(e){let t=[];for(let[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function F(e){let t={};return e.replace(/^\?/,"").split("&").forEach(e=>{if(e){let[r,n]=e.split("=");
177t[decodeURIComponent(r)]=decodeURIComponent(n)}}),t}function L(e){let t=e.indexOf("?");if(!t)return"";let r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}function U(e,t){let r=new j(e,t);return r.subscribe.bind(r)}class j{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,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw Error("Missing Observer.");void 0===(n=!function(e,t){if("object"!=typeof e||null===e)return!1;for(let r of t)if(r in e&&"function"==typeof e[r])return!0;return!1}(e,["next","error","complete"])?{next:e,error:t,complete:r}:e).next&&(n.next=$),void 0===n.error&&(n.error=$),void 0===n.complete&&(n.complete=$);let i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),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){"u">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 $(){}function V(e,t=1e3,r=2){let n=t*Math.pow(r,e),i=Math.round(.5*n*(Math.random()-.5)*2);return Math.min(144e5,n+i)}function B(e){return e&&e._delegate?e._delegate:e}function W(e){try{return(e.startsWith("http://")||e.startsWith("https://")?new URL(e).hostname:e).endsWith(".cloudworkstations.dev")}catch{return!1}}async function z(e){return(await fetch(e,{credentials:"include"})).ok}},20446:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_app",function(){return r(11660)}])},20514:(e,t,r)=>{"use strict";r.d(t,{$R:()=>u,HZ:()=>h,If:()=>f,Ut:()=>a,Zl:()=>s,eD:()=>c,jF:()=>o,jY:()=>l,rD:()=>d});var n=r(76055),i=r(63052);function s(){return!0===i.Ay.__loaded&&i.Ay.has_opted_in_capturing()}function a(){i.Ay.opt_in_capturing(),i.Ay.set_config({persistence:"localStorage+cookie"})}function o(){i.Ay.opt_out_capturing(),i.Ay.set_config({persistence:"memory"})}function l(e,t,r){r!==n.gG.Super&&"super_admin"!==r||s()||a(),s()&&(i.Ay.identify(e,{customerId:t.customerId,userId:e,role:r}),i.Ay.group("customer",t.customerId))}function u(e,t){i.Ay.group("customer",e,{name:t})}function c(){let e=s();i.Ay.reset(),e&&i.Ay.opt_in_capturing({captureEventName:!1})}function h(e){p(e.kind,"data"in e?e.data:null)}function d(e,t,r){h({kind:"ai_feature_completed",data:{feature:e,succeeded:t,durationMs:Date.now()-r}})}function f(e){p(e,null)}function p(e,t){i.Ay.capture(e,t),"localhost"===location.hostname&&console.log(`â¹ï¸ event: ${e}`,t)}},25203:(e,t,r)=>{"use strict";r.d(t,{eJ:()=>D,ZY:()=>O,cN:()=>N,Pq:()=>F,o:()=>L,gj:()=>V,N8:()=>U,By:()=>$,YK:()=>j,kp:()=>M});var n=r(7459),i=r(8584),s=r(32797),a=r(93810),o=r(90035),l=r(25229),u=r(47578),c=r(41669),h=r(33208),d=r(4992),f=r(20514),p=r(36100),g=r(14363),m=r(75834),v=r(92204);let y=(e,t)=>{let r=e instanceof Map?e:new Map(e.entries()),n=t instanceof Map?t:new Map(t.entries());if(r.size!==n.size)return!1;for(let[e,t]of r)if(!n.has(e)||!Object.is(t,n.get(e)))return!1;return!0},_=(0,v.v)(e=>({userWithClaims:null,loading:!0,setData:({loading:t,userWithClaims:r})=>e(e=>({...e,loading:t,userWithClaims:r}))})),b=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),w=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),E=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),S=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),I=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),k=new Map,T=(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))})),A=new Map,C=(0,v.v)(e=>({data:!1,setData:t=>e(e=>({...e,data:t}))})),x=(0,v.v)(e=>({data:!1,setData:t=>e(e=>({...e,data:t}))}));function R(e){return k.has(e)||k.set(e,(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))}))),k.get(e)}function P(e){return A.has(e)||A.set(e,(0,v.v)(e=>({data:null,setData:t=>e(e=>({...e,data:t}))}))),A.get(e)}function D(){let e=_(e=>e.userWithClaims),t=_(e=>e.setData),r=e?.claims.customerId,a=e?.uid,u=b(e=>e.setData),v=w(e=>e.setData),y=E(e=>e.setData),D=S(e=>
177e.setData),O=I(e=>e.setData),N=T(e=>e.setData),M=C(e=>e.setData),F=x(e=>e.setData),{trackError:L}=(0,h.j)();return(0,m.useEffect)(()=>{let e=(0,o.hg)((0,c.ap)(),async e=>{if(e){let r=await e.getIdTokenResult(),n=r.claims,i=(0,c.b6)(r);t({loading:!1,userWithClaims:{...e,claims:n,actingRole:i}}),(0,g.Ru)()?.decision.analytics===!0&&(0,p.Pj)(e.uid),(0,f.jY)(e.uid,n,i)}else t({loading:!1,userWithClaims:null})});return()=>e()},[]),(0,m.useEffect)(()=>{let e,t,o,c,h;return r&&(e=(0,d.t5)(`customers/${r}`,e=>{u(e),e&&(0,f.$R)(e.id,e.name)},e=>L(`Error subscribing to customer ${r}`,e)),t=(0,d.Q5)("payoutApplications",(e,t)=>{F(!0),O([...e].sort((e,t)=>e.data.startFiscalYear.localeCompare(t.data.startFiscalYear))),t.forEach(e=>{let t=e.doc.data(),r=R(t.id);"added"===e.type?r.setState(e=>({...e,data:t})):"modified"===e.type?r.setState(e=>({...e,data:t})):r.setState(e=>({...e,data:null}))})},e=>L(`Error subscribing to payout applications of customer ${r}`,e),(0,l._M)("customerId","==",r),(0,l._M)("status","!=",n.Z.InCreation)),o=(0,d.Q5)("projects",(e,t)=>{M(!0),N(e.filter(e=>e.status!==i.X.Superseded).sort((e,t)=>t.createdAt.seconds-e.createdAt.seconds)),t.forEach(e=>{let t=e.doc.data(),r=P(t.id);"added"===e.type?r.setState(e=>({...e,data:t})):"modified"===e.type?r.setState(e=>({...e,data:t})):r.setState(e=>({...e,data:null}))})},e=>L(`Error subscribing to projects of customer ${r}`,e),(0,l._M)("customerId","==",r)),c=(0,d.Q5)("users",e=>{v(e);let t=e.find(e=>e.id===a);(0,s.jq)(t)?D(t):D(null)},e=>console.log(e),(0,l._M)("customerId","==",r)),h=(0,d.Q5)(`customers/${r}/files`,e=>y(e.sort((e,t)=>t.uploadedAt.toMillis()-e.uploadedAt.toMillis())),e=>L(`Error subscribing to files of customer ${r}`,e),(0,l._M)("isSuperOnly","==",!1))),()=>{e&&(u(null),e()),t&&(O(null),F(!1),k.clear(),t()),o&&(N(null),M(!1),A.clear(),o()),c&&(v(null),D(null),c()),h&&(y(null),h())}},[r]),null}let O=()=>{var e;let t;return _((e=e=>({loading:e.loading,authUser:e.userWithClaims}),t=m.useRef(void 0),r=>{let n=e(r);return!function(e,t){if(Object.is(e,t))return!0;if("object"!=typeof e||null===e||"object"!=typeof t||null===t||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;if(Symbol.iterator in e&&Symbol.iterator in t){if("entries"in e&&"entries"in t)return y(e,t);let r=e[Symbol.iterator](),n=t[Symbol.iterator](),i=r.next(),s=n.next();for(;!i.done&&!s.done;){if(!Object.is(i.value,s.value))return!1;i=r.next(),s=n.next()}return!!i.done&&!!s.done}return y({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}(t.current,n)?t.current=n:t.current}))},N=()=>b(e=>e.data),M=()=>w(e=>e.data),F=()=>E(e=>e.data),L=()=>S(e=>e.data),U=()=>{let e=I(e=>e.data),t=b(e=>e.data);return(0,m.useMemo)(()=>null===e||null===t?null:t.excludedFiscalYears?e.filter(e=>!(0,a.K5)(t,e.data)):e,[e,t])},j=()=>T(e=>e.data),$=e=>{let t=C(e=>e.data),r=P(e)(e=>e.data);return t?t&&null===r?{status:u.n.Error,project:null}:{status:u.n.Success,project:r}:{status:u.n.Loading,project:null}},V=e=>{let t=x(e=>e.data),r=R(e)(e=>e.data);return t?t&&null===r?{status:u.n.Error,payoutApplication:null}:{status:u.n.Success,payoutApplication:r}:{status:u.n.Loading,payoutApplication:null}}},25229:(e,t,r)=>{"use strict";r.d(t,{Dc:()=>ef,C3:()=>ac,hq:()=>au,rJ:()=>sN,vN:()=>sR,kd:()=>aY,CL:()=>al,H9:()=>sM,d_:()=>aN,x7:()=>aq,GG:()=>aH,aU:()=>s$,AB:()=>aC,aQ:()=>aJ,My:()=>aT,P:()=>aw,c4:()=>az,BN:()=>aG,mZ:()=>aK,_M:()=>aS,wP:()=>aZ});var n,i,s,a,o,l,u,c,h,d,f,p,g,m,v=r(91790),y=r(27456),_=r(19519),b="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},w={};(function(){function e(){this.blockSize=-1,this.blockSize=64,this.g=[,,,,],this.C=Array(this.blockSize),this.o=this.h=0,this.u()}var t=function(){this.blockSize=-1};function r(){}function s(e,t,r){r||(r=0);let n=Array(16);if("string"==typeof t)for(var i=0;i<16;++i)n[i]=t.charCodeAt(r++)|t.charCodeAt(r++)<<8|t.charCodeAt(r++)<<16|t.charCodeAt(r++)<<24;else for(i=0;i<16;++i)n[i]=t[r++]|t[r++]<<8|t[r++]<<16|t[r++]<<24;t=e.g[0],r=e.g[1],i=e.g[2];let s=e.g[3],a;a=t+(s^r&(i^s))+n[0]+0xd76aa478|0,a=s+(i^(t=r+(a<<7|a>>>25))&(r^i))+n[1]+0xe8c7b756|0,a=i+(r^(s=t+(a<<12|a>>>20))&(t^r))+n[2]+0x242070db|0,a=r+(t^(i=s+(a<<17|a>>>15))&(s^t))+n[3]+0xc1bdceee|0,a=t+(s^(r=i+(a<<22|a>>>10))&(i^s))+n[4]+0xf57c0faf|0,a=s+(i^(t=r+(a<<7|a>>>25))&(r^i))+n[5]+0x4787c62a|0,a=i+(r^(s=t+(a<<12|a>>>20))&(t^r))+n[6]+0xa8304613|0,a=r+(t^(i=s+(a<<17|a>>>
17715))&(s^t))+n[7]+0xfd469501|0,a=t+(s^(r=i+(a<<22|a>>>10))&(i^s))+n[8]+0x698098d8|0,a=s+(i^(t=r+(a<<7|a>>>25))&(r^i))+n[9]+0x8b44f7af|0,a=i+(r^(s=t+(a<<12|a>>>20))&(t^r))+n[10]+0xffff5bb1|0,a=r+(t^(i=s+(a<<17|a>>>15))&(s^t))+n[11]+0x895cd7be|0,a=t+(s^(r=i+(a<<22|a>>>10))&(i^s))+n[12]+0x6b901122|0,a=s+(i^(t=r+(a<<7|a>>>25))&(r^i))+n[13]+0xfd987193|0,a=i+(r^(s=t+(a<<12|a>>>20))&(t^r))+n[14]+0xa679438e|0,a=r+(t^(i=s+(a<<17|a>>>15))&(s^t))+n[15]+0x49b40821|0,r=i+(a<<22|a>>>10),a=t+(i^s&(r^i))+n[1]+0xf61e2562|0,t=r+(a<<5|a>>>27),a=s+(r^i&(t^r))+n[6]+0xc040b340|0,s=t+(a<<9|a>>>23),a=i+(t^r&(s^t))+n[11]+0x265e5a51|0,i=s+(a<<14|a>>>18),a=r+(s^t&(i^s))+n[0]+0xe9b6c7aa|0,r=i+(a<<20|a>>>12),a=t+(i^s&(r^i))+n[5]+0xd62f105d|0,t=r+(a<<5|a>>>27),a=s+(r^i&(t^r))+n[10]+0x2441453|0,s=t+(a<<9|a>>>23),a=i+(t^r&(s^t))+n[15]+0xd8a1e681|0,i=s+(a<<14|a>>>18),a=r+(s^t&(i^s))+n[4]+0xe7d3fbc8|0,r=i+(a<<20|a>>>12),a=t+(i^s&(r^i))+n[9]+0x21e1cde6|0,t=r+(a<<5|a>>>27),a=s+(r^i&(t^r))+n[14]+0xc33707d6|0,s=t+(a<<9|a>>>23),a=i+(t^r&(s^t))+n[3]+0xf4d50d87|0,i=s+(a<<14|a>>>18),a=r+(s^t&(i^s))+n[8]+0x455a14ed|0,r=i+(a<<20|a>>>12),a=t+(i^s&(r^i))+n[13]+0xa9e3e905|0,t=r+(a<<5|a>>>27),a=s+(r^i&(t^r))+n[2]+0xfcefa3f8|0,s=t+(a<<9|a>>>23),a=i+(t^r&(s^t))+n[7]+0x676f02d9|0,i=s+(a<<14|a>>>18),a=r+(s^t&(i^s))+n[12]+0x8d2a4c8a|0,a=t+((r=i+(a<<20|a>>>12))^i^s)+n[5]+0xfffa3942|0,a=s+((t=r+(a<<4|a>>>28))^r^i)+n[8]+0x8771f681|0,a=i+((s=t+(a<<11|a>>>21))^t^r)+n[11]+0x6d9d6122|0,a=r+((i=s+(a<<16|a>>>16))^s^t)+n[14]+0xfde5380c|0,a=t+((r=i+(a<<23|a>>>9))^i^s)+n[1]+0xa4beea44|0,a=s+((t=r+(a<<4|a>>>28))^r^i)+n[4]+0x4bdecfa9|0,a=i+((s=t+(a<<11|a>>>21))^t^r)+n[7]+0xf6bb4b60|0,a=r+((i=s+(a<<16|a>>>16))^s^t)+n[10]+0xbebfbc70|0,a=t+((r=i+(a<<23|a>>>9))^i^s)+n[13]+0x289b7ec6|0,a=s+((t=r+(a<<4|a>>>28))^r^i)+n[0]+0xeaa127fa|0,a=i+((s=t+(a<<11|a>>>21))^t^r)+n[3]+0xd4ef3085|0,a=r+((i=s+(a<<16|a>>>16))^s^t)+n[6]+0x4881d05|0,a=t+((r=i+(a<<23|a>>>9))^i^s)+n[9]+0xd9d4d039|0,a=s+((t=r+(a<<4|a>>>28))^r^i)+n[12]+0xe6db99e5|0,a=i+((s=t+(a<<11|a>>>21))^t^r)+n[15]+0x1fa27cf8|0,a=r+((i=s+(a<<16|a>>>16))^s^t)+n[2]+0xc4ac5665|0,r=i+(a<<23|a>>>9),a=t+(i^(r|~s))+n[0]+0xf4292244|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~i))+n[7]+0x432aff97|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~r))+n[14]+0xab9423a7|0,i=s+(a<<15|a>>>17),a=r+(s^(i|~t))+n[5]+0xfc93a039|0,r=i+(a<<21|a>>>11),a=t+(i^(r|~s))+n[12]+0x655b59c3|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~i))+n[3]+0x8f0ccc92|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~r))+n[10]+0xffeff47d|0,i=s+(a<<15|a>>>17),a=r+(s^(i|~t))+n[1]+0x85845dd1|0,r=i+(a<<21|a>>>11),a=t+(i^(r|~s))+n[8]+0x6fa87e4f|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~i))+n[15]+0xfe2ce6e0|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~r))+n[6]+0xa3014314|0,i=s+(a<<15|a>>>17),a=r+(s^(i|~t))+n[13]+0x4e0811a1|0,r=i+(a<<21|a>>>11),a=t+(i^(r|~s))+n[4]+0xf7537e82|0,t=r+(a<<6|a>>>26),a=s+(r^(t|~i))+n[11]+0xbd3af235|0,s=t+(a<<10|a>>>22),a=i+(t^(s|~r))+n[2]+0x2ad7d2bb|0,i=s+(a<<15|a>>>17),a=r+(s^(i|~t))+n[9]+0xeb86d391|0,e.g[0]=e.g[0]+t|0,e.g[1]=e.g[1]+(i+(a<<21|a>>>11))|0,e.g[2]=e.g[2]+i|0,e.g[3]=e.g[3]+s|0}function a(e,t){this.h=t;let r=[],n=!0;for(let i=e.length-1;i>=0;i--){let s=0|e[i];n&&s==t||(r[i]=s,n=!1)}this.g=r}r.prototype=t.prototype,e.F=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.D=function(e,r,n){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[r].apply(e,i)},e.prototype.u=function(){this.g[0]=0x67452301,this.g[1]=0xefcdab89,this.g[2]=0x98badcfe,this.g[3]=0x10325476,this.o=this.h=0},e.prototype.v=function(e,t){void 0===t&&(t=e.length);let r=t-this.blockSize,n=this.C,i=this.h,a=0;for(;a<t;){if(0==i)for(;a<=r;)s(this,e,a),a+=this.blockSize;if("string"==typeof e){for(;a<t;)if(n[i++]=e.charCodeAt(a++),i==this.blockSize){s(this,n),i=0;break}}else for(;a<t;)if(n[i++]=e[a++],i==this.blockSize){s(this,n),i=0;break}}this.h=i,this.o+=t},e.prototype.A=function(){var e=Array((this.h<56?this.blockSize:2*this.blockSize)-this.h);e[0]=128;for(var t=1;t<e.length-8;++t)e[t]=0;t=8*this.o;for(var r=e.length-8;r<e.length;++r)e[r]=255&t,t/=256;for(this.v(e),e=Array(16),t=0,r=0;r<4;++r)for(let n=0;n<32;n+=8)e[t++]=this.g[r]>>>n&255;return e};var o,l={};function u(e){var t;return -128<=e&&e<128?(t=function(e){return new a([0|e],e<0?-1:0)},Object.prototype.hasOwnProperty.call(l,e)?l[e]:l[e]=t(e)):new a([0|e],e<0?-1:0)}function c(e){if(isNaN(e)||!isFinite(e))return h;if(e<0)return m(c(-e));let t=[],r=1;for(let n=0;e>=r;n++)t[n]=e/r|0,r*=0x100000000;return new a(t,0)}var h=u(0),d=u(1),f=u(0x1000000);function p(e){if(0!=e.h)return!1;for(let t=0;t<e.g.length;t++)if(0!=e.g[t])return!1;return!0}function g(e){return -1==e.h}function m(e){let t=e.g.length,r=[];for(let n=0;n<t;n++)r[n]=~e.g[n];return new a(r,~e.h).add(d)}function v(e,t){return e.add(m(t))}function y(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 b(e,t){if(p(t))throw Error("division by zero");if(p(e))return new _(h,h);if(g(e))return t=b(m(e),t),new _(m(t.g),m(t.h));if(g(t))return t=b(e,m(t)),new _(m(t.g),t.h);if(e.g.length>
17730){if(g(e)||g(t))throw Error("slowDivide_ only works with positive integers.");for(var r=d,n=t;0>=n.l(e);)r=E(r),n=E(n);var i=S(r,1),s=S(n,1);for(n=S(n,2),r=S(r,2);!p(n);){var a=s.add(n);0>=a.l(e)&&(i=i.add(r),s=a),n=S(n,1),r=S(r,1)}return t=v(e,i.j(t)),new _(i,t)}for(i=h;e.l(t)>=0;){for(n=(n=Math.ceil(Math.log(r=Math.max(1,Math.floor(e.m()/t.m())))/Math.LN2))<=48?1:Math.pow(2,n-48),a=(s=c(r)).j(t);g(a)||a.l(e)>0;)r-=n,a=(s=c(r)).j(t);p(s)&&(s=d),i=i.add(s),e=v(e,a)}return new _(i,e)}function E(e){let t=e.g.length+1,r=[];for(let n=0;n<t;n++)r[n]=e.i(n)<<1|e.i(n-1)>>>31;return new a(r,e.h)}function S(e,t){let r=t>>5;t%=32;let n=e.g.length-r,i=[];for(let s=0;s<n;s++)i[s]=t>0?e.i(s+r)>>>t|e.i(s+r+1)<<32-t:e.i(s+r);return new a(i,e.h)}(o=a.prototype).m=function(){if(g(this))return-m(this).m();let e=0,t=1;for(let r=0;r<this.g.length;r++){let n=this.i(r);e+=(n>=0?n:0x100000000+n)*t,t*=0x100000000}return e},o.toString=function(e){if((e=e||10)<2||36<e)throw Error("radix out of range: "+e);if(p(this))return"0";if(g(this))return"-"+m(this).toString(e);let t=c(Math.pow(e,6));var r=this;let n="";for(;;){let i=b(r,t).g,s=(((r=v(r,i.j(t))).g.length>0?r.g[0]:r.h)>>>0).toString(e);if(p(r=i))return s+n;for(;s.length<6;)s="0"+s;n=s+n}},o.i=function(e){return e<0?0:e<this.g.length?this.g[e]:this.h},o.l=function(e){return g(e=v(this,e))?-1:+!p(e)},o.abs=function(){return g(this)?m(this):this},o.add=function(e){let t=Math.max(this.g.length,e.g.length),r=[],n=0;for(let i=0;i<=t;i++){let t=n+(65535&this.i(i))+(65535&e.i(i)),s=(t>>>16)+(this.i(i)>>>16)+(e.i(i)>>>16);n=s>>>16,t&=65535,s&=65535,r[i]=s<<16|t}return new a(r,-0x80000000&r[r.length-1]?-1:0)},o.j=function(e){if(p(this)||p(e))return h;if(g(this))return g(e)?m(this).j(m(e)):m(m(this).j(e));if(g(e))return m(this.j(m(e)));if(0>this.l(f)&&0>e.l(f))return c(this.m()*e.m());let t=this.g.length+e.g.length,r=[];for(var n=0;n<2*t;n++)r[n]=0;for(n=0;n<this.g.length;n++)for(let t=0;t<e.g.length;t++){let i=this.i(n)>>>16,s=65535&this.i(n),a=e.i(t)>>>16,o=65535&e.i(t);r[2*n+2*t]+=s*o,y(r,2*n+2*t),r[2*n+2*t+1]+=i*o,y(r,2*n+2*t+1),r[2*n+2*t+1]+=s*a,y(r,2*n+2*t+1),r[2*n+2*t+2]+=i*a,y(r,2*n+2*t+2)}for(e=0;e<t;e++)r[e]=r[2*e+1]<<16|r[2*e];for(e=t;e<2*t;e++)r[e]=0;return new a(r,0)},o.B=function(e){return b(this,e).h},o.and=function(e){let t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)&e.i(n);return new a(r,this.h&e.h)},o.or=function(e){let t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)|e.i(n);return new a(r,this.h|e.h)},o.xor=function(e){let t=Math.max(this.g.length,e.g.length),r=[];for(let n=0;n<t;n++)r[n]=this.i(n)^e.i(n);return new a(r,this.h^e.h)},e.prototype.digest=e.prototype.A,e.prototype.reset=e.prototype.u,e.prototype.update=e.prototype.v,i=w.Md5=e,a.prototype.add=a.prototype.add,a.prototype.multiply=a.prototype.j,a.prototype.modulo=a.prototype.B,a.prototype.compare=a.prototype.l,a.prototype.toNumber=a.prototype.m,a.prototype.toString=a.prototype.toString,a.prototype.getBits=a.prototype.i,a.fromNumber=c,a.fromString=function e(t,r){if(0==t.length)throw Error("number format error: empty string");if((r=r||10)<2||36<r)throw Error("radix out of range: "+r);if("-"==t.charAt(0))return m(e(t.substring(1),r));if(t.indexOf("-")>=0)throw Error('number format error: interior "-" character');let n=c(Math.pow(r,8)),i=h;for(let e=0;e<t.length;e+=8){var s=Math.min(8,t.length-e);let a=parseInt(t.substring(e,e+s),r);s<8?(s=c(Math.pow(r,s)),i=i.j(s).add(c(a))):i=(i=i.j(n)).add(c(a))}return i},n=w.Integer=a}).apply(void 0!==b?b:"u">typeof self?self:"u">typeof window?window:{});var E=r(72457),S="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof global?global:"u">typeof self?self:{},I={};(function(){var e,t,r=Object.defineProperty,n=function(e){e=["object"==typeof globalThis&&globalThis,e,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof S&&S];for(var t=0;t<e.length;++t){var r=e[t];if(r&&r.Math==Math)return r}throw Error("Cannot find global object")}(this);function i(e,t){if(t)e:{var i=n;e=e.split(".");for(var s=0;s<e.length-1;s++){var a=e[s];if(!(a in i))break e;i=i[a]}(t=t(s=i[e=e[e.length-1]]))!=s&&null!=t&&r(i,e,{configurable:!0,writable:!0,value:t})}}i("Symbol.dispose",function(e){return e||Symbol("Symbol.dispose")}),i("Array.prototype.values",function(e){return e||function(){return this[Symbol.iterator]()}}),i("Object.entries",function(e){return e||function(e){var t,r=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.push([t,e[t]]);return r}});var f=f||{},p=this||self;function g(e){var t=typeof e;return"object"==t&&null!=e||"function"==t}function m(e,t,r){return e.call.apply(e.bind,arguments)}function v(e,t,r){return(v=m).apply(null,arguments)}
177function y(e,t){var r=Array.prototype.slice.call(arguments,1);return function(){var t=r.slice();return t.push.apply(t,arguments),e.apply(this,t)}}function _(e,t){function r(){}r.prototype=t.prototype,e.Z=t.prototype,e.prototype=new r,e.prototype.constructor=e,e.Ob=function(e,r,n){for(var i=Array(arguments.length-2),s=2;s<arguments.length;s++)i[s-2]=arguments[s];return t.prototype[r].apply(e,i)}}var b="u">typeof AsyncContext&&"function"==typeof AsyncContext.Snapshot?e=>e&&AsyncContext.Snapshot.wrap(e):e=>e;function w(e){let t=e.length;if(t>0){let r=Array(t);for(let n=0;n<t;n++)r[n]=e[n];return r}return[]}function E(e,t){for(let t=1;t<arguments.length;t++){let n=arguments[t];var r=typeof n;if("array"==(r="object"!=r?r:n?Array.isArray(n)?"array":r:"null")||"object"==r&&"number"==typeof n.length){r=e.length||0;let t=n.length||0;e.length=r+t;for(let i=0;i<t;i++)e[r+i]=n[i]}else e.push(n)}}class k{constructor(e,t){this.i=e,this.j=t,this.h=0,this.g=null}get(){let e;return this.h>0?(this.h--,e=this.g,this.g=e.next,e.next=null):e=this.i(),e}}class T{constructor(){this.h=this.g=null}add(e,t){let r=A.get();r.set(e,t),this.h?this.h.next=r:this.g=r,this.h=r}}var A=new k(()=>new C,e=>e.reset());class C{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 x,R=!1,P=new T,D=()=>{let e=Promise.resolve(void 0);x=()=>{e.then(O)}};function O(){let e;for(var t;e=null,P.g&&(e=P.g,P.g=P.g.next,P.g||(P.h=null),e.next=null),t=e;){try{t.h.call(t.g)}catch(e){!function(e){p.setTimeout(()=>{throw e},0)}(e)}A.j(t),A.h<100&&(A.h++,t.next=A.g,A.g=t)}R=!1}function N(){this.u=this.u,this.C=this.C}function M(e,t){this.type=e,this.g=this.target=t,this.defaultPrevented=!1}N.prototype.u=!1,N.prototype.dispose=function(){this.u||(this.u=!0,this.N())},N.prototype[Symbol.dispose]=function(){this.dispose()},N.prototype.N=function(){if(this.C)for(;this.C.length;)this.C.shift()()},M.prototype.h=function(){this.defaultPrevented=!0};var F=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 L(e){return/^[\s\xa0]*$/.test(e)}function U(e,t){M.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&&this.init(e,t)}_(U,M),U.prototype.init=function(e,t){let r=this.type=e.type,n=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:null;this.target=e.target||e.srcElement,this.g=t,(t=e.relatedTarget)||("mouseover"==r?t=e.fromElement:"mouseout"==r&&(t=e.toElement)),this.relatedTarget=t,n?(this.clientX=void 0!==n.clientX?n.clientX:n.pageX,this.clientY=void 0!==n.clientY?n.clientY:n.pageY,this.screenX=n.screenX||0,this.screenY=n.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=e.pointerType,this.state=e.state,this.i=e,e.defaultPrevented&&U.Z.h.call(this)},U.prototype.h=function(){U.Z.h.call(this);let e=this.i;e.preventDefault?e.preventDefault():e.returnValue=!1};var j="closure_listenable_"+(1e6*Math.random()|0),$=0;function V(e,t,r,n,i){this.listener=e,this.proxy=null,this.src=t,this.type=r,this.capture=!!n,this.ha=i,this.key=++$,this.da=this.fa=!1}function B(e){e.da=!0,e.listener=null,e.proxy=null,e.src=null,e.ha=null}function W(e,t,r){for(let n in e)t.call(r,e[n],n,e)}function z(e){let t={};for(let r in e)t[r]=e[r];return t}let q="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function H(e,t){let r,n;for(let t=1;t<arguments.length;t++){for(r in n=arguments[t])e[r]=n[r];for(let t=0;t<q.length;t++)r=q[t],Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}}function G(e){this.src=e,this.g={},this.h=0}function K(e,t){let r=t.type;if(r in e.g){var n,i=e.g[r],s=Array.prototype.indexOf.call(i,t,void 0);(n=s>=0)&&Array.prototype.splice.call(i,s,1),n&&(B(t),0==e.g[r].length&&(delete e.g[r],e.h--))}}function Y(e,t,r,n){for(let i=0;i<e.length;++i){let s=e[i];if(!s.da&&s.listener==t&&!!r==s.capture&&s.ha==n)return i}return -1}G.prototype.add=function(e,t,r,n,i){let s=e.toString();(e=this.g[s])||(e=this.g[s]=[],this.h++);let a=Y(e,t,n,i);return a>-1?(t=e[a],r||(t.fa=!1)):((t=new V(t,this.src,s,!!n,i)).fa=r,e.push(t)),t};var J="closure_lm_"+(1e6*Math.random()|0),Q={};function X(e,t,r,n,i,s){if(!t)throw Error("Invalid event type");let a=g(i)?!!i.capture:!!i,o=er(e);if(o||(e[J]=o=new G(e)),(r=o.add(t,r,n,a,s)).proxy)return r;if(n=function e(t){return et.call(e.src,e.listener,t)},r.proxy=n,n.src=e,n.listener=r,e.addEventListener)F||(i=a),void 0===i&&(i=!1),e.addEventListener(t.toString(),n,i);else if(e.attachEvent)e.attachEvent(ee(t.toString()),n);else if(e.addListener&&e.removeListener)e.addListener(n);else throw Error("addEventListener and attachEvent are unavailable.");return r}function Z(e){if("number"!=typeof e&&e&&!e.da){var t=e.src;if(t&&t[j])K(t.i,e);else{var r=e.type,n=e.proxy;t.removeEventListener?t.removeEventListener(r,n,e.capture):t.detachEvent?t.detachEvent(ee(r),n):t.addListener&&t.removeListener&&t.removeListener(n),(r=er(t))?(K(r,e),0==r.h&&(r.src=null,t[J]=null)):B(e)}}}function ee(e){return e in Q?Q[e]:Q[e]="on"+e}function et(e,t){if(e.da)e=!0;else{t=new U(t,this);let r=e.listener,n=e.ha||e.src;e.fa&&Z(e),e=r.call(n,t)}return e}function er(e){return(e=e[J])instanceof G?e:null}var en="__closure_events_fn_"+(1e9*Math.random()>>>0);function ei(e){return"function"==typeof e?e:(e[en]||(e[en]=function(t){return e.handleEvent(t)}),e[en])}function es(){N.call(this),this.i=new G(this),this.M=this,this.G=null}function ea(e,t){let r,n;var i,s=e.G;if(s)for(i=[];s;s=s.G)i.push(s);if(e=e.M,s=t.type||t,"string"==typeof t)t=new M(t,e);else if(t instanceof M)t.target=t.target||e;else{var a=t;H(t=new M(s,e),a)}if(a=!0,i)for(n=i.length-1;n>=0;n--)a=eo(r=t.g=i[n],s,!0,t)&&a;if(a=eo(r=t.g=e,s,!0,t)&&a,a=eo(r,s,!1,t)&&a,i)for(n=0;n<i.length;n++)a=eo(r=t.g=i[n],s,!1,t)&&a}function eo(e,t,r,n){if(!(t=e.i.g[String(t)]))return!0;t=t.concat();let i=!0;for(let s=0;s<t.length;++s){let a=t[s];if(a&&!a.da&&a.capture==r){let t=a.listener,r=a.ha||a.src;a.fa&&K(e.i,a),i=!1!==t.call(r,n)&&i}}return i&&!n.defaultPrevented}_(es,N),es.prototype[j]=!0,es.prototype.removeEventListener=function(e,t,r,n){!function e(t,r,n,i,s){if(Array.isArray(r))for(var a=0;a<r.length;a++)e(t,r[a],n,i,s);else(i=g(i)?!!i.capture:!!i,n=ei(n),t&&t[j])?(t=t.i,(a=String(r).toString())in t.g&&(n=Y(r=t.g[a],n,i,s))>-1&&(B(r[n]),Array.prototype.splice.call(r,n,1),0==r.length&&(delete t.g[a],t.h--))):t&&(t=er(t))&&(r=t.g[r.toString()],t=-1,r&&(t=Y(r,n,i,s)
177),(n=t>-1?r[t]:null)&&Z(n))}(this,e,t,r,n)},es.prototype.N=function(){if(es.Z.N.call(this),this.i){var e=this.i;for(let t in e.g){let r=e.g[t];for(let e=0;e<r.length;e++)B(r[e]);delete e.g[t],e.h--}}this.G=null},es.prototype.J=function(e,t,r,n){return this.i.add(String(e),t,!1,r,n)},es.prototype.K=function(e,t,r,n){return this.i.add(String(e),t,!0,r,n)};class el extends N{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=function(e,t){if("function"!=typeof e)if(e&&"function"==typeof e.handleEvent)e=v(e.handleEvent,e);else throw Error("Invalid listener argument");return Number(t)>0x7fffffff?-1:p.setTimeout(e,t||0)}(()=>{t.g=null,t.i&&(t.i=!1,e(t))},t.l);let r=t.h;t.h=null,t.m.apply(null,r)}(this)}N(){super.N(),this.g&&(p.clearTimeout(this.g),this.g=null,this.i=!1,this.h=null)}}function eu(e){N.call(this),this.h=e,this.g={}}_(eu,N);var ec=[];function eh(e){W(e.g,function(e,t){this.g.hasOwnProperty(t)&&Z(e)},e),e.g={}}eu.prototype.N=function(){eu.Z.N.call(this),eh(this)},eu.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")};var ed=p.JSON.stringify,ef=p.JSON.parse,ep=class{stringify(e){return p.JSON.stringify(e,void 0)}parse(e){return p.JSON.parse(e,void 0)}};function eg(){}function em(){}var ev={OPEN:"a",hb:"b",ERROR:"c",tb:"d"};function ey(){M.call(this,"d")}function e_(){M.call(this,"c")}_(ey,M),_(e_,M);var eb={},ew=null;function eE(){return ew=ew||new es}function eS(e){M.call(this,eb.Ia,e)}function eI(e){let t=eE();ea(t,new eS(t))}function ek(e,t){M.call(this,eb.STAT_EVENT,e),this.stat=t}function eT(e){let t=eE();ea(t,new ek(t,e))}function eA(e,t){M.call(this,eb.Ja,e),this.size=t}function eC(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 ex(){this.g=!0}function eR(e,t,r,n){e.info(function(){return"XMLHTTP TEXT ("+t+"): "+function(e,t){if(!e.g)return t;if(!t)return null;try{let s=JSON.parse(t);if(s){for(e=0;e<s.length;e++)if(Array.isArray(s[e])){var r=s[e];if(!(r.length<2)){var n=r[1];if(Array.isArray(n)&&!(n.length<1)){var i=n[0];if("noop"!=i&&"stop"!=i&&"close"!=i)for(let e=1;e<n.length;e++)n[e]=""}}}}return ed(s)}catch(e){return t}}(e,r)+(n?" "+n:"")})}eb.Ia="serverreachability",_(eS,M),eb.STAT_EVENT="statevent",_(ek,M),eb.Ja="timingevent",_(eA,M),ex.prototype.ua=function(){this.g=!1},ex.prototype.info=function(){};var eP={NO_ERROR:0,cb:1,qb:2,pb:3,kb:4,ob:5,rb:6,Ga:7,TIMEOUT:8,ub:9},eD={ib:"complete",Fb:"success",ERROR:"error",Ga:"abort",xb:"ready",yb:"readystatechange",TIMEOUT:"timeout",sb:"incrementaldata",wb:"progress",lb:"downloadprogress",Nb:"uploadprogress"};function eO(){}function eN(e){return encodeURIComponent(String(e))}function eM(e,t,r,n){this.j=e,this.i=t,this.l=r,this.S=n||1,this.V=new eu(this),this.H=45e3,this.J=null,this.o=!1,this.u=this.B=this.A=this.M=this.F=this.T=this.D=null,this.G=[],this.g=null,this.C=0,this.m=this.v=null,this.X=-1,this.K=!1,this.P=0,this.O=null,this.W=this.L=this.U=this.R=!1,this.h=new eF}function eF(){this.i=null,this.g="",this.h=!1}_(eO,eg),eO.prototype.g=function(){return new XMLHttpRequest},e=new eO;var eL={},eU={};function ej(e,t,r){e.M=1,e.A=e7(e5(t)),e.u=r,e.R=!0,e$(e,null)}function e$(e,t){e.F=Date.now(),eB(e),e.B=e5(e.A);var r,n,i,s,a,o,l=e.B,u=e.S;Array.isArray(u)||(u=[String(u)]),tf(l.i,"t",u),e.C=0,l=e.j.L,e.h=new eF,e.g=tZ(e.j,l?t:null,!e.u),e.P>0&&(e.O=new el(v(e.Y,e,e.g),e.P)),t=e.V,l=e.g,u=e.ba;var c="readystatechange";Array.isArray(c)||(c&&(ec[0]=c.toString()),c=ec);for(let e=0;e<c.length;e++){let r=function e(t,r,n,i,s){if(i&&i.once)return function e(t,r,n,i,s){if(Array.isArray(r)){for(let a=0;a<r.length;a++)e(t,r[a],n,i,s);return null}return n=ei(n),t&&t[j]?t.K(r,n,g(i)?!!i.capture:!!i,s):X(t,r,n,!0,i,s)}(t,r,n,i,s);if(Array.isArray(r)){for(let a=0;a<r.length;a++)e(t,r[a],n,i,s);return null}return n=ei(n),t&&t[j]?t.J(r,n,g(i)?!!i.capture:!!i,s):X(t,r,n,!1,i,s)}(l,c[e],u||t.handleEvent,!1,t.h||t);if(!r)break;t.g[r.key]=r}t=e.J?z(e.J):{},e.u?(e.v||(e.v="POST"),t["Content-Type"]="application/x-www-form-urlencoded",e.g.ea(e.B,e.v,e.u,t)):(e.v="GET",e.g.ea(e.B,e.v,null,t)),eI(),r=e.i,n=e.v,i=e.B,s=e.l,a=e.S,o=e.u,r.info(function(){if(r.g)if(o){var e="",t=o.split("&");for(let r=0;r<t.length;r++){var l=t[r].split("=");if(l.length>1){let t=l[0];l=l[1];let r=t.split("_");e=r.length>=2&&"type"==r[1]?e+(t+"=")+l+"&":e+(t+"=redacted&")}}}else e=null;else e=o;return"XMLHTTP REQ ("+s+") [attempt "+a+"]: "+n+"\n"+i+"\n"+e})}function eV(e){return!!e.g&&"GET"==e.v&&2!=e.M&&e.j.Aa}function eB(e){e.T=Date.now()+e.H,eW(e,e.H)}function eW(e,t){if(null!=e.D)throw Error("WatchDog timer not null");e.D=eC(v(e.aa,e),t)}function ez(e){e.D&&(p.clearTimeout(e.D),e.D=null)}function eq(e){0==e.j.I||e.K||tK(e.j,e)}function eH(e){ez(e);var t=e.O;t&&"function"==typeof t.dispose&&t.dispose(),e.O=null,eh(e.V),e.g&&(t=e.g,e.g=null,t.abort(),t.dis
177pose())}function eG(e,t){try{var r=e.j;if(0!=r.I&&(r.g==e||eX(r.h,e))){if(!e.L&&eX(r.h,e)&&3==r.I){try{var n=r.Ba.g.parse(t)}catch(e){n=null}if(Array.isArray(n)&&3==n.length){var i=n;if(0==i[0]){e:if(!r.v){if(r.g)if(r.g.F+3e3<e.F)tG(r),tL(r);else break e;tz(r),eT(18)}}else r.xa=i[1],0<r.xa-r.K&&i[2]<37500&&r.F&&0==r.A&&!r.C&&(r.C=eC(v(r.Va,r),6e3));1>=eQ(r.h)&&r.ta&&(r.ta=void 0)}else tJ(r,11)}else if((e.L||r.g==e)&&tG(r),!L(t))for(i=r.Ba.g.parse(t),t=0;t<i.length;t++){let o=i[t],l=o[0];if(!(l<=r.K))if(r.K=l,o=o[1],2==r.I)if("c"==o[0]){r.M=o[1],r.ba=o[2];let t=o[3];null!=t&&(r.ka=t,r.j.info("VER="+r.ka));let i=o[4];null!=i&&(r.za=i,r.j.info("SVER="+r.za));let l=o[5];null!=l&&"number"==typeof l&&l>0&&(r.O=n=1.5*l,r.j.info("backChannelRequestTimeoutMs_="+n)),n=r;let u=e.g;if(u){let e=u.g?u.g.getResponseHeader("X-Client-Wire-Protocol"):null;if(e){var s=n.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&&(eZ(s,s.h),s.h=null))}if(n.G){let e=u.g?u.g.getResponseHeader("X-HTTP-Session-Id"):null;e&&(n.wa=e,e9(n.J,n.G,e))}}if(r.I=3,r.l&&r.l.ra(),r.aa&&(r.T=Date.now()-e.F,r.j.info("Handshake RTT: "+r.T+"ms")),(n=r).na=tX(n,n.L?n.ba:null,n.W),e.L){e0(n.h,e);var a=n.O;a&&(e.H=a),e.D&&(ez(e),eB(e)),n.g=e}else tW(n);r.i.length>0&&tj(r)}else"stop"!=o[0]&&"close"!=o[0]||tJ(r,7);else 3==r.I&&("stop"==o[0]||"close"==o[0]?"stop"==o[0]?tJ(r,7):tF(r):"noop"!=o[0]&&r.l&&r.l.qa(o),r.A=0)}}eI(4)}catch(e){}}eM.prototype.ba=function(e){e=e.target;let t=this.O;t&&3==tD(e)?t.j():this.Y(e)},eM.prototype.Y=function(e){try{if(e==this.g)e:{let d=tD(this.g),f=this.g.ya(),g=this.g.ca();if(!(d<3)&&(3!=d||this.g&&(this.h.h||this.g.la()||tO(this.g)))){this.K||4!=d||7==f||(8==f||g<=0?eI(3):eI(2)),ez(this);var t=this.g.ca();this.X=t;var r=function(e){if(!eV(e))return e.g.la();let t=tO(e.g);if(""===t)return"";let r="",n=t.length,i=4==tD(e.g);if(!e.h.i){if("u"<typeof TextDecoder)return eH(e),eq(e),"";e.h.i=new p.TextDecoder}for(let s=0;s<n;s++)e.h.h=!0,r+=e.h.i.decode(t[s],{stream:!(i&&s==n-1)});return t.length=0,e.h.g+=r,e.C=0,e.h.g}(this);if(this.o=200==t,n=this.i,i=this.v,s=this.B,a=this.l,o=this.S,n.info(function(){return"XMLHTTP RESP ("+a+") [ attempt "+o+"]: "+i+"\n"+s+"\n"+d+" "+t}),this.o){if(this.U&&!this.L){t:{if(this.g){var n,i,s,a,o,l,u=this.g;if((l=u.g?u.g.getResponseHeader("X-HTTP-Initial-Response"):null)&&!L(l)){var c=l;break t}}c=null}if(e=c)eR(this.i,this.l,e,"Initial handshake response via X-HTTP-Initial-Response"),this.L=!0,eG(this,e);else{this.o=!1,this.m=3,eT(12),eH(this),eq(this);break e}}if(this.R){let t;for(e=!0;!this.K&&this.C<r.length;)if((t=function(e,t){var r=e.C,n=t.indexOf("\n",r);return -1==n?eU:isNaN(r=Number(t.substring(r,n)))?eL:(n+=1)+r>t.length?eU:(t=t.slice(n,n+r),e.C=n+r,t)}(this,r))==eU){4==d&&(this.m=4,eT(14),e=!1),eR(this.i,this.l,null,"[Incomplete Response]");break}else if(t==eL){this.m=4,eT(15),eR(this.i,this.l,r,"[Invalid Chunk]"),e=!1;break}else eR(this.i,this.l,t,null),eG(this,t);if(eV(this)&&0!=this.C&&(this.h.g=this.h.g.slice(this.C),this.C=0),4!=d||0!=r.length||this.h.h||(this.m=1,eT(16),e=!1),this.o=this.o&&e,e){if(r.length>0&&!this.W){this.W=!0;var h=this.j;h.g==this&&h.aa&&!h.P&&(h.j.info("Great, no buffering proxy detected. Bytes received: "+r.length),tq(h),h.P=!0,eT(11))}}else eR(this.i,this.l,r,"[Invalid Chunked Response]"),eH(this),eq(this)}else eR(this.i,this.l,r,null),eG(this,r);4==d&&eH(this),this.o&&!this.K&&(4==d?tK(this.j,this):(this.o=!1,eB(this)))}else(function(e){let t={};e=(e.g&&tD(e)>=2&&e.g.getAllResponseHeaders()||"").split("\r\n");for(let n=0;n<e.length;n++){if(L(e[n]))continue;var r=function(e){var t=1;e=e.split(":");let r=[];for(;t>0&&e.length;)r.push(e.shift()),t--;return e.length&&r.push(e.join(":")),r}(e[n]);let i=r[0];if("string"!=typeof(r=r[1]))continue;r=r.trim();let s=t[i]||[];t[i]=s,s.push(r)}var n=function(e){return e.join(", ")};for(let e in t)n.call(void 0,t[e],e,t)})(this.g),400==t&&r.indexOf("Unknown SID")>0?(this.m=3,eT(12)):(this.m=0,eT(13)),eH(this),eq(this)}}}catch(e){}finally{}},eM.prototype.cancel=function(){this.K=!0,eH(this)},eM.prototype.aa=function(){var e,t;this.D=null;let r=Date.now();r-this.T>=0?(e=this.i,t=this.B,e.info(function(){return"TIMEOUT: "+t}),2!=this.M&&(eI(),eT(17)),eH(this),this.m=2,eq(this)):eW(this,this.T-r)};var eK=class{constructor(e,t){this.g=e,this.map=t}};function eY(e){this.l=e||10,e=p.PerformanceNavigationTiming?(e=p.performance.getEntriesByType("navigation")).length>0&&("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,this.j>1&&(this.g=new Set),this.h=null,this.i=[]}function eJ(e){return!!e.h||!!e.g&&e.g.size>=e.j}function eQ(e){return e.h?1:e.g?e.g.size:0}function eX(e,t){return e.h?e.h==t:!!e.g&&e.g.has(t)}function eZ(e,t){e.g?e.g.add(t):e.h=t}function e0(e,t){e.h&&e.h==t?e.h=null:e.g&&e.g.has(t)&&e.g.delete(t)}function e1(e){if(null!=e.h)return e.i.concat(e.h.G);if(null!=e.g&&0!==e.g.size){let t=e.i;for(let r of e.g.values())t=t.concat(r.G);return t}return w(e.i)}eY.prototype.cancel=function(){if(this.i=e1(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 e2=RegExp("^(?:([^:/?#.]+):)?(?://(?:([^\\\\/?#]*)@)?([^\\\\/?#]*?)(?::([0-9]+))?(?=[\\\\/?#]|$))?([^?#]+)?(?:\\?([^#]*))?(?:#([\\s\\S]*))?$");function e3(e){let t;this.g=this.o=this.j="",this.u=null,this.m=this.h="",this.l=!1,e instanceof e3?(this.l=e.l,e6(this,e.j),this.o=e.o,this.g=e.g,e4(this,e.u),this.h=e.h,e8(this,tp(e.i)),this.m=e.m):e&&(t=String(e).match(e2))?(this.l=!1,e6(this,t[1]||"",!0),this.o=te(t[2]||""),this.g=te(t[3]||"",!0),e4(this,t[4]),this.h=te(t[5]||"",!0),e8(this,t[6]||"",!0),this.m=te(t[7]||"")):(this.l=!1,this.i=new tl(null,this.l))}function e5(e){return new e3(e)}function e6(e,t,r){e.j=r?te(t,!0):t,e.j&&(e.j=e.j.replace(/:$/,""))}function e4(e,t){if(t){if(isNaN(t=Number(t))||t<0)throw Error("Bad port number "+t);e.u=t}else e.u=null}function e8(e,t,r){var n,i;t instanceof tl?(e.i=t,n=e.i,(i=e.l)&&!n.j&&(tu(n),n.i=null,n.g.forEach(function(e,t){let r=t.toLowerCase();t!=r&&(tc(this,t),tf(this,r,e))},n)),n.j=i):(r||(t=tt(t,ta)),e.i=new tl(t,e.l))}function e9(e,t,r){e.i.set(t,r)}function e7(e){return e9(e,"zx",Math.floor(0x80000000*Math.random()).toString(36)+Math.abs(Math.floor(0x80000000*Math.random())^Date.now()).toString(36)),e}function te(e,t){return e?t?decodeURI(e.replace(/%25/g,"%2525")):decodeURIComponent(e):""}function tt(e,t,r){return"string"==typeof e?(e=encodeURI(e).replace(t,tr),r&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function tr(e){return"%"+((e=e.charCodeAt(0))>>4&15).toString(16)+(15&e).toString(16)}e3.prototype.toString=function(){let e=[];var t=this.j;t&&e.push(tt(t,tn,!0),":");var r=this.g;return(r||"file"==t)&&(e.push("//"),(t=this.o)&&e.push(tt(t,tn,!0),"@"),e.push(eN(r).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(r=this.u)&&e.push(":",String(r))),(r=this.h)&&(this.g&&"/"!=r.charAt(0)&&e.push("/"),e.push(tt(r,"/"==r.charAt(0)?t
177s:ti,!0))),(r=this.i.toString())&&e.push("?",r),(r=this.m)&&e.push("#",tt(r,to)),e.join("")},e3.prototype.resolve=function(e){let t=e5(this),r=!!e.j;r?e6(t,e.j):r=!!e.o,r?t.o=e.o:r=!!e.g,r?t.g=e.g:r=null!=e.u;var n=e.h;if(r)e4(t,e.u);else if(r=!!e.h){if("/"!=n.charAt(0))if(this.g&&!this.h)n="/"+n;else{var i=t.h.lastIndexOf("/");-1!=i&&(n=t.h.slice(0,i+1)+n)}if(".."==(i=n)||"."==i)n="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){n=0==i.lastIndexOf("/",0),i=i.split("/");let e=[];for(let t=0;t<i.length;){let r=i[t++];"."==r?n&&t==i.length&&e.push(""):".."==r?((e.length>1||1==e.length&&""!=e[0])&&e.pop(),n&&t==i.length&&e.push("")):(e.push(r),n=!0)}n=e.join("/")}else n=i}return r?t.h=n:r=""!==e.i.toString(),r?e8(t,tp(e.i)):r=!!e.m,r&&(t.m=e.m),t};var tn=/[#\/\?@]/g,ti=/[#\?:]/g,ts=/[#\?]/g,ta=/[#\?@]/g,to=/#/g;function tl(e,t){this.h=this.g=null,this.i=e||null,this.j=!!t}function tu(e){e.g||(e.g=new Map,e.h=0,e.i&&function(e,t){if(e){e=e.split("&");for(let r=0;r<e.length;r++){let n=e[r].indexOf("="),i,s=null;n>=0?(i=e[r].substring(0,n),s=e[r].substring(n+1)):i=e[r],t(i,s?decodeURIComponent(s.replace(/\+/g," ")):"")}}}(e.i,function(t,r){e.add(decodeURIComponent(t.replace(/\+/g," ")),r)}))}function tc(e,t){tu(e),t=tg(e,t),e.g.has(t)&&(e.i=null,e.h-=e.g.get(t).length,e.g.delete(t))}function th(e,t){return tu(e),t=tg(e,t),e.g.has(t)}function td(e,t){tu(e);let r=[];if("string"==typeof t)th(e,t)&&(r=r.concat(e.g.get(tg(e,t))));else for(e=Array.from(e.g.values()),t=0;t<e.length;t++)r=r.concat(e[t]);return r}function tf(e,t,r){tc(e,t),r.length>0&&(e.i=null,e.g.set(tg(e,t),w(r)),e.h+=r.length)}function tp(e){let t=new tl;return t.i=e.i,e.g&&(t.g=new Map(e.g),t.h=e.h),t}function tg(e,t){return t=String(t),e.j&&(t=t.toLowerCase()),t}function tm(e,t,r,n,i){try{i&&(i.onload=null,i.onerror=null,i.onabort=null,i.ontimeout=null),n(r)}catch(e){}}function tv(){this.g=new ep}function ty(e){this.i=e.Sb||null,this.h=e.ab||!1}function t_(e,t){es.call(this),this.H=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.A=new Headers,this.h=null,this.F="GET",this.D="",this.g=!1,this.B=this.j=this.l=null,this.v=new AbortController}function tb(e){e.j.read().then(e.Ma.bind(e)).catch(e.ga.bind(e))}function tw(e){e.readyState=4,e.l=null,e.j=null,e.B=null,tE(e)}function tE(e){e.onreadystatechange&&e.onreadystatechange.call(e)}function tS(e){let t="";return W(e,function(e,r){t+=r,t+=":",t+=e,t+="\r\n"}),t}function tI(e,t,r){e:{for(n in r){var n=!1;break e}n=!0}n||(r=tS(r),"string"==typeof e?null!=r&&eN(r):e9(e,t,r))}function tk(e){es.call(this),this.headers=new Map,this.L=e||null,this.h=!1,this.g=null,this.D="",this.o=0,this.l="",this.j=this.B=this.v=this.A=!1,this.m=null,this.F="",this.H=!1}(t=tl.prototype).add=function(e,t){tu(this),this.i=null,e=tg(this,e);let r=this.g.get(e);return r||this.g.set(e,r=[]),r.push(t),this.h+=1,this},t.forEach=function(e,t){tu(this),this.g.forEach(function(r,n){r.forEach(function(r){e.call(t,r,n,this)},this)},this)},t.set=function(e,t){return tu(this),this.i=null,th(this,e=tg(this,e))&&(this.h-=this.g.get(e).length),this.g.set(e,[t]),this.h+=1,this},t.get=function(e,t){return e&&(e=td(this,e)).length>0?String(e[0]):t},t.toString=function(){if(this.i)return this.i;if(!this.g)return"";let e=[],t=Array.from(this.g.keys());for(let n=0;n<t.length;n++){var r=t[n];let i=eN(r);r=td(this,r);for(let t=0;t<r.length;t++){let n=i;""!==r[t]&&(n+="="+eN(r[t])),e.push(n)}}return this.i=e.join("&")},_(ty,eg),ty.prototype.g=function(){return new t_(this.i,this.h)},_(t_,es),(t=t_.prototype).open=function(e,t){if(0!=this.readyState)throw this.abort(),Error("Error reopening a connection");this.F=e,this.D=t,this.readyState=1,tE(this)},t.send=function(e){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");if(this.v.signal.aborted)throw this.abort(),Error("Request was aborted.");this.g=!0;let t={headers:this.A,method:this.F,credentials:this.m,cache:void 0,signal:this.v.signal};
177e&&(t.body=e),(this.H||p).fetch(new Request(this.D,t)).then(this.Pa.bind(this),this.ga.bind(this))},t.abort=function(){this.response=this.responseText="",this.A=new Headers,this.status=0,this.v.abort(),this.j&&this.j.cancel("Request was aborted.").catch(()=>{}),this.readyState>=1&&this.g&&4!=this.readyState&&(this.g=!1,tw(this)),this.readyState=0},t.Pa=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,tE(this)),this.g&&(this.readyState=3,tE(this),this.g)))if("arraybuffer"===this.responseType)e.arrayBuffer().then(this.Na.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.B=new TextDecoder;tb(this)}else e.text().then(this.Oa.bind(this),this.ga.bind(this))},t.Ma=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.B.decode(t,{stream:!e.done}))&&(this.response=this.responseText+=t)}e.done?tw(this):tE(this),3==this.readyState&&tb(this)}},t.Oa=function(e){this.g&&(this.response=this.responseText=e,tw(this))},t.Na=function(e){this.g&&(this.response=e,tw(this))},t.ga=function(){this.g&&tw(this)},t.setRequestHeader=function(e,t){this.A.append(e,t)},t.getResponseHeader=function(e){return this.h&&this.h.get(e.toLowerCase())||""},t.getAllResponseHeaders=function(){if(!this.h)return"";let e=[],t=this.h.entries();for(var r=t.next();!r.done;)e.push((r=r.value)[0]+": "+r[1]),r=t.next();return e.join("\r\n")},Object.defineProperty(t_.prototype,"withCredentials",{get:function(){return"include"===this.m},set:function(e){this.m=e?"include":"same-origin"}}),_(tk,es);var tT=/^https?$/i,tA=["POST","PUT"];function tC(e,t){e.h=!1,e.g&&(e.j=!0,e.g.abort(),e.j=!1),e.l=t,e.o=5,tx(e),tP(e)}function tx(e){e.A||(e.A=!0,ea(e,"complete"),ea(e,"error"))}function tR(e){if(e.h&&void 0!==f){if(e.v&&4==tD(e))setTimeout(e.Ca.bind(e),0);else if(ea(e,"readystatechange"),4==tD(e)){e.h=!1;try{let s=e.ca();switch(s){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var t,r,n=!0;break;default:n=!1}if(!(t=n)){if(r=0===s){let t=String(e.D).match(e2)[1]||null;!t&&p.self&&p.self.location&&(t=p.self.location.protocol.slice(0,-1)),r=!tT.test(t?t.toLowerCase():"")}t=r}if(t)ea(e,"complete"),ea(e,"success");else{e.o=6;try{var i=tD(e)>2?e.g.statusText:""}catch(e){i=""}e.l=i+" ["+e.ca()+"]",tx(e)}}finally{tP(e)}}}}function tP(e,t){if(e.g){e.m&&(clearTimeout(e.m),e.m=null);let r=e.g;e.g=null,t||ea(e,"ready");try{r.onreadystatechange=null}catch(e){}}}function tD(e){return e.g?e.g.readyState:0}function tO(e){try{if(!e.g)return null;if("response"in e.g)return e.g.response;switch(e.F){case"":case"text":return e.g.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in e.g)return e.g.mozResponseArrayBuffer}return null}catch(e){return null}}function tN(e,t,r){return r&&r.internalChannelParams&&r.internalChannelParams[e]||t}function tM(e){this.za=0,this.i=[],this.j=new ex,this.ba=this.na=this.J=this.W=this.g=this.wa=this.G=this.H=this.u=this.U=this.o=null,this.Ya=this.V=0,this.Sa=tN("failFast",!1,e),this.F=this.C=this.v=this.m=this.l=null,this.X=!0,this.xa=this.K=-1,this.Y=this.A=this.D=0,this.Qa=tN("baseRetryDelayMs",5e3,e),this.Za=tN("retryDelaySeedMs",1e4,e),this.Ta=tN("forwardChannelMaxRetries",2,e),this.va=tN("forwardChannelRequestTimeoutMs",2e4,e),this.ma=e&&e.xmlHttpFactory||void 0,this.Ua=e&&e.Rb||void 0,this.Aa=e&&e.useFetchStreams||!1,this.O=void 0,this.L=e&&e.supportsCrossDomainXhr||!1,this.M="",this.h=new eY(e&&e.concurrentRequestLimit),this.Ba=new tv,this.S=e&&e.fastHandshake||!1,this.R=e&&e.encodeInitMessageHeaders||!1,this.S&&this.R&&(this.R=!1),this.Ra=e&&e.Pb||!1,e&&e.ua&&this.j.ua(),e&&e.forceLongPolling&&(this.X=!1),this.aa=!this.S&&this.X&&e&&e.detectBufferingProxy||!1,this.ia=void 0,e&&e.longPollingTimeout&&e.longPollingTimeout>0&&(this.ia=e.longPollingTimeout),this.ta=void 0,this.T=0,this.P=!1,this.ja=this.B=null}function tF(e){if(tU(e),3==e.I){var t=e.V++,r=e5(e.J);if(e9(r,"SID",e.M),e9(r,"RID",t),e9(r,"TYPE","terminate"),tV(e,r),
177(t=new eM(e,e.j,t)).M=2,t.A=e7(e5(r)),r=!1,p.navigator&&p.navigator.sendBeacon)try{r=p.navigator.sendBeacon(t.A.toString(),"")}catch(e){}!r&&p.Image&&((new Image).src=t.A,r=!0),r||(t.g=tZ(t.j,null),t.g.ea(t.A)),t.F=Date.now(),eB(t)}tQ(e)}function tL(e){e.g&&(tq(e),e.g.cancel(),e.g=null)}function tU(e){tL(e),e.v&&(p.clearTimeout(e.v),e.v=null),tG(e),e.h.cancel(),e.m&&("number"==typeof e.m&&p.clearTimeout(e.m),e.m=null)}function tj(e){if(!eJ(e.h)&&!e.m){e.m=!0;var t=e.Ea;x||D(),R||(x(),R=!0),P.add(t,e),e.D=0}}function t$(e,t){var r;r=t?t.l:e.V++;let n=e5(e.J);e9(n,"SID",e.M),e9(n,"RID",r),e9(n,"AID",e.K),tV(e,n),e.u&&e.o&&tI(n,e.u,e.o),r=new eM(e,e.j,r,e.D+1),null===e.u&&(r.J=e.o),t&&(e.i=t.G.concat(e.i)),t=tB(e,r,1e3),r.H=Math.round(.5*e.va)+Math.round(.5*e.va*Math.random()),eZ(e.h,r),ej(r,n,t)}function tV(e,t){e.H&&W(e.H,function(e,r){e9(t,r,e)}),e.l&&W({},function(e,r){e9(t,r,e)})}function tB(e,t,r){r=Math.min(e.i.length,r);let n=e.l?v(e.l.Ka,e.l,e):null;e:{var i=e.i;let t=-1;for(;;){let e=["count="+r];-1==t?r>0?(t=i[0].g,e.push("ofs="+t)):t=0:e.push("ofs="+t);let o=!0;for(let l=0;l<r;l++){var s=i[l].g;let r=i[l].map;if((s-=t)<0)t=Math.max(0,i[l].g-100),o=!1;else try{s="req"+s+"_";try{var a=r instanceof Map?r:Object.entries(r);for(let[t,r]of a){let n=r;g(r)&&(n=ed(r)),e.push(s+t+"="+encodeURIComponent(n))}}catch(t){throw e.push(s+"type="+encodeURIComponent("_badmap")),t}}catch(e){n&&n(r)}}if(o){a=e.join("&");break e}}a=void 0}return t.G=e=e.i.splice(0,r),a}function tW(e){if(!e.g&&!e.v){e.Y=1;var t=e.Da;x||D(),R||(x(),R=!0),P.add(t,e),e.A=0}}function tz(e){return!e.g&&!e.v&&!(e.A>=3)&&(e.Y++,e.v=eC(v(e.Da,e),tY(e,e.A)),e.A++,!0)}function tq(e){null!=e.B&&(p.clearTimeout(e.B),e.B=null)}function tH(e){e.g=new eM(e,e.j,"rpc",e.Y),null===e.u&&(e.g.J=e.o),e.g.P=0;var t=e5(e.na);e9(t,"RID","rpc"),e9(t,"SID",e.M),e9(t,"AID",e.K),e9(t,"CI",e.F?"0":"1"),!e.F&&e.ia&&e9(t,"TO",e.ia),e9(t,"TYPE","xmlhttp"),tV(e,t),e.u&&e.o&&tI(t,e.u,e.o),e.O&&(e.g.H=e.O);var r=e.g;e=e.ba,r.M=1,r.A=e7(e5(t)),r.u=null,r.R=!0,e$(r,e)}function tG(e){null!=e.C&&(p.clearTimeout(e.C),e.C=null)}function tK(e,t){var r,n=null;if(e.g==t){tG(e),tq(e),e.g=null;var i=2}else{if(!eX(e.h,t))return;n=t.G,e0(e.h,t),i=1}if(0!=e.I){if(t.o)if(1==i){n=t.u?t.u.length:0,t=Date.now()-t.F;var s=e.D;ea(i=eE(),new eA(i,n)),tj(e)}else tW(e);else if(3==(s=t.m)||0==s&&t.X>0||!(1==i&&(r=t,!(eQ(e.h)>=e.h.j-!!e.m)&&(e.m?(e.i=r.G.concat(e.i),!0):1!=e.I&&2!=e.I&&!(e.D>=(e.Sa?0:e.Ta))&&(e.m=eC(v(e.Ea,e,r),tY(e,e.D)),e.D++,!0)))||2==i&&tz(e)))switch(n&&n.length>0&&((t=e.h).i=t.i.concat(n)),s){case 1:tJ(e,5);break;case 4:tJ(e,10);break;case 3:tJ(e,6);break;default:tJ(e,2)}}}function tY(e,t){let r=e.Qa+Math.floor(Math.random()*e.Za);return e.isActive()||(r*=2),r*t}function tJ(e,t){if(e.j.info("Error code "+t),2==t){let t,s,a;var r,n=v(e.bb,e),i=e.Ua;let o=!i;i=new e3(i||"//www.google.com/images/cleardot.gif"),p.location&&"http"==p.location.protocol||e6(i,"https"),e7(i),o?function(e,t){let r=new ex;if(p.Image){let n=new Image;n.onload=y(tm,r,"TestLoadImage: loaded",!0,t,n),n.onerror=y(tm,r,"TestLoadImage: error",!1,t,n),n.onabort=y(tm,r,"TestLoadImage: abort",!1,t,n),n.ontimeout=y(tm,r,"TestLoadImage: timeout",!1,t,n),p.setTimeout(function(){n.ontimeout&&n.ontimeout()},1e4),n.src=e}else t(!1)}(i.toString(),n):(r=i.toString(),t=new ex,s=new AbortController,a=setTimeout(()=>{s.abort(),tm(t,"TestPingServer: timeout",!1,n)},1e4),fetch(r,{signal:s.signal}).then(e=>{clearTimeout(a),e.ok?tm(t,"TestPingServer: ok",!0,n):tm(t,"TestPingServer: server error",!1,n)}).catch(()=>{clearTimeout(a),tm(t,"TestPingServer: error",!1,n)}))}else eT(2);e.I=0,e.l&&e.l.pa(t),tQ(e),tU(e)}function tQ(e){if(e.I=0,e.ja=[],e.l){let t=e1(e.h);(0!=t.length||0!=e.i.length)&&(E(e.ja,t),E(e.ja,e.i),e.h.i.length=0,w(e.i),e.i.length=0),e.l.oa()}}function tX(e,t,r){var n=r instanceof e3?e5(r):new e3(r);if(""!=n.g)t&&(n.g=t+"."+n.g),e4(n,n.u);else{var i=p.location;n=i.protocol,t=t?t+"."+i.hostname:i.hostname,i=+i.port;let e=new e3(null);n&&e6(e,n),t&&(e.g=t),i&&e4(e,i),r&&(e.h=r),n=e}return r=e.G,t=e.wa,r&&t&&e9(n,r,t),e9(n,"VER",e.ka),tV(e,n),n}function tZ(e,t,r){if(t&&!e.L)throw Error("Can't create secondary domain capable XhrIo object.");return(t=new tk(e.Aa&&!e.ma?new ty({ab:r}):e.ma)).Fa(e.L),t}function t0(){}function t1(){}function t2(e,t){es.call(this),this.g=new tM(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.sa&&(e?e["X-WebChannel-Client-Profile"]=t.sa:e={"X-WebChannel-Client-Profile":t.sa}),this.g.U=e,(e=t&&t.Qb)&&!L(e)&&(this.g.u=e),this.A=t&&t.supportsCrossDomainXhr||!1,this.v=t&&t.sendRawJson||!1,(t=t&&t.httpSessionIdParam)&&!L(t)&&(this.g.G=t,null!==(e=this.h)&&t in e&&t in(e=this.h)&&delete e[t]),this.j=new t6(this)}function t3(e){ey.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 r in t){e=r;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 t5(){e_.call(this),this.status=1}function t6(e){this.g=e}(t=tk.prototype).Fa=function(e){this.H=e},t.ea=function(t,r,n,i){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.D+"; newUri="+t);r=r?r.toUpperCase():"GET",this.D=t,this.l="",this.o=0,this.A=!1,this.h=!0,this.g=this.L?this.L.g():e.g(),this.g.onreadystatechange=b(v(this.Ca,this));try{this.B=!0,this.g.open(r,String(t),!0),this.B=!1}catch(e){tC(this,e);return}if(t=n||"",n=new Map(this.headers),i)if(Object.getPrototypeOf(i)===Object.prototype)for(var s in i)n.set(s,i[s]);else if("function"==typeof i.keys&&"function"==typeof i.get)for(let e of i.keys())n.set(e,i.get(e));else throw Error("Unknown input type for opt_headers: "+String(i));for(let[e,a]of(i=Array.from(n.keys()).find(e=>"content-type"==e.toLowerCase()),s=p.FormData&&t instanceof p.FormData,!(Array.prototype.indexOf.call(tA,r,void 0)>=0)||i||s||n.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),n))this.g.setRequestHeader(e,a);this.F&&(this.g.responseType=this.F),"withCredentials"in this.g&&this.g.withCredentials!==this.H&&(this.g.withCredentials=this.H);try{this.m&&(clearTimeout(this.m),this.m=null),this.v=!0,this.g.send(t),this.v=!1}catch(e){tC(this,e)}},t.abort=function(e){this.g&&this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1,this.o=e||7,ea(this,"complete"),ea(this,"abort"),tP(this))},t.N=function(){this.g&&(this.h&&(this.h=!1,this.j=!0,this.g.abort(),this.j=!1),tP(this,!0)),tk.Z.N.call(this)},t.Ca=function(){this.u||(this.B||this.v||this.j?tR(this):this.Xa())},t.Xa=function(){tR(this)},t.isActive=function(){return!!this.g},t.ca=function(){try{return tD(this)>2?this.g.status:-1}catch(e){return -1}},t.la=function(){try{return this.g?this.g.responseText:""}catch(e){return""}},t.La=function(e){if(this.g){var t=this.g.responseText;
177return e&&0==t.indexOf(e)&&(t=t.substring(e.length)),ef(t)}},t.ya=function(){return this.o},t.Ha=function(){return"string"==typeof this.l?this.l:String(this.l)},(t=tM.prototype).ka=8,t.I=1,t.connect=function(e,t,r,n){eT(0),this.W=e,this.H=t||{},r&&void 0!==n&&(this.H.OSID=r,this.H.OAID=n),this.F=this.X,this.J=tX(this,null,this.W),tj(this)},t.Ea=function(e){if(this.m)if(this.m=null,1==this.I){if(!e){this.V=Math.floor(1e5*Math.random()),e=this.V++;let i=new eM(this,this.j,e),s=this.o;if(this.U&&(s?H(s=z(s),this.U):s=this.U),null!==this.u||this.R||(i.J=s,s=null),this.S)e:{for(var t=0,r=0;r<this.i.length;r++){t:{var n=this.i[r];if("__data__"in n.map&&"string"==typeof(n=n.map.__data__)){n=n.length;break t}n=void 0}if(void 0===n)break;if((t+=n)>4096){t=r;break e}if(4096===t||r===this.i.length-1){t=r+1;break e}}t=1e3}else t=1e3;t=tB(this,i,t),e9(r=e5(this.J),"RID",e),e9(r,"CVER",22),this.G&&e9(r,"X-HTTP-Session-Id",this.G),tV(this,r),s&&(this.R?t="headers="+eN(tS(s))+"&"+t:this.u&&tI(r,this.u,s)),eZ(this.h,i),this.Ra&&e9(r,"TYPE","init"),this.S?(e9(r,"$req",t),e9(r,"SID","null"),i.U=!0,ej(i,r,null)):ej(i,r,t),this.I=2}}else 3==this.I&&(e?t$(this,e):0==this.i.length||eJ(this.h)||t$(this))},t.Da=function(){if(this.v=null,tH(this),this.aa&&!(this.P||null==this.g||this.T<=0)){var e=4*this.T;this.j.info("BP detection timer enabled: "+e),this.B=eC(v(this.Wa,this),e)}},t.Wa=function(){this.B&&(this.B=null,this.j.info("BP detection timeout reached."),this.j.info("Buffering proxy detected and switch to long-polling!"),this.F=!1,this.P=!0,eT(10),tL(this),tH(this))},t.Va=function(){null!=this.C&&(this.C=null,tL(this),tz(this),eT(19))},t.bb=function(e){e?(this.j.info("Successfully pinged google.com"),eT(2)):(this.j.info("Failed to ping google.com"),eT(1))},t.isActive=function(){return!!this.l&&this.l.isActive(this)},(t=t0.prototype).ra=function(){},t.qa=function(){},t.pa=function(){},t.oa=function(){},t.isActive=function(){return!0},t.Ka=function(){},t1.prototype.g=function(e,t){return new t2(e,t)},_(t2,es),t2.prototype.m=function(){this.g.l=this.j,this.A&&(this.g.L=!0),this.g.connect(this.l,this.h||void 0)},t2.prototype.close=function(){tF(this.g)},t2.prototype.o=function(e){var t=this.g;if("string"==typeof e){var r={};r.__data__=e,e=r}else this.v&&((r={}).__data__=ed(e),e=r);t.i.push(new eK(t.Ya++,e)),3==t.I&&tj(t)},t2.prototype.N=function(){this.g.l=null,delete this.j,tF(this.g),delete this.g,t2.Z.N.call(this)},_(t3,ey),_(t5,e_),_(t6,t0),t6.prototype.ra=function(){ea(this.g,"a")},t6.prototype.qa=function(e){ea(this.g,new t3(e))},t6.prototype.pa=function(e){ea(this.g,new t5)},t6.prototype.oa=function(){ea(this.g,"b")},t1.prototype.createWebChannel=t1.prototype.g,t2.prototype.send=t2.prototype.o,t2.prototype.open=t2.prototype.m,t2.prototype.close=t2.prototype.close,d=I.createWebChannelTransport=function(){return new t1},h=I.getStatEventTarget=function(){return eE()},c=I.Event=eb,u=I.Stat={jb:0,mb:1,nb:2,Hb:3,Mb:4,Jb:5,Kb:6,Ib:7,Gb:8,Lb:9,PROXY:10,NOPROXY:11,Eb:12,Ab:13,Bb:14,zb:15,Cb:16,Db:17,fb:18,eb:19,gb:20},eP.NO_ERROR=0,eP.TIMEOUT=8,eP.HTTP_ERROR=6,l=I.ErrorCode=eP,eD.COMPLETE="complete",o=I.EventType=eD,em.EventType=ev,ev.OPEN="a",ev.CLOSE="b",ev.ERROR="c",ev.MESSAGE="d",es.prototype.listen=es.prototype.J,a=I.WebChannel=em,I.FetchXmlHttpFactory=ty,tk.prototype.listenOnce=tk.prototype.K,tk.prototype.getLastError=tk.prototype.Ha,tk.prototype.getLastErrorCode=tk.prototype.ya,tk.prototype.getStatus=tk.prototype.ca,tk.prototype.getResponseJson=tk.prototype.La,tk.prototype.getResponseText=tk.prototype.la,tk.prototype.send=tk.prototype.ea,tk.prototype.setWithCredentials=tk.prototype.Fa,s=I.XhrIo=tk}).apply(void 0!==S?S:"u">typeof self?self:"u">typeof window?window:{}),r(42922);var k=r(71562).Buffer;class T{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}}T.UNAUTHENTICATED=new T(null),T.GOOGLE_CREDENTIALS=new T("google-credentials-uid"),T.FIRST_PARTY=new T("first-party-uid"),T.MOCK_USER=new T("mock-user");let A="12.14.0",C=new E.Vy("@firebase/firestore");function x(){return C.logLevel}function R(e,...t){if(C.logLevel<=E.$b.DEBUG){let r=t.map(O);C.debug(`Firestore (${A}): ${e}`,...r)}}function P(e,...t){if(C.logLevel<=E.$b.ERROR){let r=t.map(O);C.error(`Firestore (${A}): ${e}`,...r)}}function D(e,...t){if(C.logLevel<=E.$b.WARN){let r=t.map(O);C.warn(`Firestore (${A}): ${e}`,...r)}}function O(e){if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return e}}function N(e,t,r){let n="Unexpected state";"string"==typeof t?n=t:r=t,M(e,n,r)}function M(e,t,r){let n=`FIRESTORE (${A}) INTERNAL ASSERTION FAILED: ${t} (ID: ${e.toString(16)})`;if(void 0!==r)try{n+=" CONTEXT: "+JSON.stringify(r)}catch(e){n+=" CONTEXT: "+r}throw P(n),Error(n)}function F(e,t,r,n){let i="Unexpected state";"string"==typeof r?i=r:n=r,e||M(t,i,n)}let L={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
177ED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class U extends _.g{constructor(e,t){super(e,t),this.code=e,this.message=t,this.toString=()=>`${this.name}: [code=${this.code}]: ${this.message}`}}class j{constructor(){this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}}class ${constructor(e,t){this.user=t,this.type="OAuth",this.headers=new Map,this.headers.set("Authorization",`Bearer ${e}`)}}class V{getToken(){return Promise.resolve(null)}invalidateToken(){}start(e,t){e.enqueueRetryable(()=>t(T.UNAUTHENTICATED))}shutdown(){}}class B{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 W{constructor(e){this.t=e,this.currentUser=T.UNAUTHENTICATED,this.i=0,this.forceRefresh=!1,this.auth=null}start(e,t){F(void 0===this.o,42304);let r=this.i,n=e=>this.i!==r?(r=this.i,t(e)):Promise.resolve(),i=new j;this.o=()=>{this.i++,this.currentUser=this.u(),i.resolve(),i=new j,e.enqueueRetryable(()=>n(this.currentUser))};let s=()=>{let t=i;e.enqueueRetryable(async()=>{await t.promise,await n(this.currentUser)})},a=e=>{R("FirebaseAuthCredentialsProvider","Auth detected"),this.auth=e,this.o&&(this.auth.addAuthTokenListener(this.o),s())};this.t.onInit(e=>a(e)),setTimeout(()=>{if(!this.auth){let e=this.t.getImmediate({optional:!0});e?a(e):(R("FirebaseAuthCredentialsProvider","Auth not yet detected"),i.resolve(),i=new j)}},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?(R("FirebaseAuthCredentialsProvider","getToken aborted due to token change."),this.getToken()):t?(F("string"==typeof t.accessToken,31837,{l:t}),new $(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 F(null===e||"string"==typeof e,2055,{h:e}),new T(e)}}class z{constructor(e,t,r){this.P=e,this.T=t,this.I=r,this.type="FirstParty",this.user=T.FIRST_PARTY,this.R=new Map}A(){return this.I?this.I():null}get headers(){this.R.set("X-Goog-AuthUser",this.P);let e=this.A();return e&&this.R.set("Authorization",e),this.T&&this.R.set("X-Goog-Iam-Authorization-Token",this.T),this.R}}class q{constructor(e,t,r){this.P=e,this.T=t,this.I=r}getToken(){return Promise.resolve(new z(this.P,this.T,this.I))}start(e,t){e.enqueueRetryable(()=>t(T.FIRST_PARTY))}shutdown(){}invalidateToken(){}}class H{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 G{constructor(e,t){this.V=t,this.forceRefresh=!1,this.appCheck=null,this.m=null,this.p=null,(0,v.xZ)(e)&&e.settings.appCheckToken&&(this.p=e.settings.appCheckToken)}start(e,t){F(void 0===this.o,3512);let r=e=>{null!=e.error&&R("FirebaseAppCheckTokenProvider",`Error getting App Check token; using placeholder token instead. Error: ${e.error.message}`);let r=e.token!==this.m;return this.m=e.token,R("FirebaseAppCheckTokenProvider",`Received ${r?"new":"existing"} token.`),r?t(e.token):Promise.resolve()};this.o=t=>{e.enqueueRetryable(()=>r(t))};let n=e=>{R("FirebaseAppCheckTokenProvider","AppCheck detected"),this.appCheck=e,this.o&&this.appCheck.addTokenListener(this.o)};this.V.onInit(e=>n(e)),setTimeout(()=>{if(!this.appCheck){let e=this.V.getImmediate({optional:!0});e?n(e):R("FirebaseAppCheckTokenProvider","AppCheck not yet detected")}},0)}getToken(){if(this.p)return Promise.resolve(new H(this.p));let e=this.forceRefresh;return this.forceRefresh=!1,this.appCheck?this.appCheck.getToken(e).then(e=>e?(F("string"==typeof e.token,44558,{tokenResult:e}),this.m=e.token,new H(e.token)):null):Promise.resolve(null)}invalidateToken(){this.forceRefresh=!0}shutdown(){this.appCheck&&this.o&&this.appCheck.removeTokenListener(this.o),this.o=void 0}}class K{static newId(){let e=62*Math.floor(256/62),t="";for(;t.length<20;){let r=function(){let e="u">typeof self&&(self.crypto||self.msCrypto),t=new Uint8Array(40);if(e&&"function"==typeof e.getRandomValues)e.getRandomValues(t);else for(let e=0;e<40;
177e++)t[e]=Math.floor(256*Math.random());return t}();for(let n=0;n<r.length;++n)t.length<20&&r[n]<e&&(t+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".charAt(r[n]%62))}return t}}function Y(e,t){return e<t?-1:+(e>t)}function J(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let r=e.charAt(n),i=t.charAt(n);if(r!==i)return Q(r)===Q(i)?Y(r,i):Q(r)?1:-1}return Y(e.length,t.length)}function Q(e){let t=e.charCodeAt(0);return t>=55296&&t<=57343}function X(e,t,r){return e.length===t.length&&e.every((e,n)=>r(e,t[n]))}let Z="__name__";class ee{constructor(e,t,r){void 0===t?t=0:t>e.length&&N(637,{offset:t,range:e.length}),void 0===r?r=e.length-t:r>e.length-t&&N(1746,{length:r,range:e.length-t}),this.segments=e,this.offset=t,this.len=r}get length(){return this.len}isEqual(e){return 0===ee.comparator(this,e)}child(e){let t=this.segments.slice(this.offset,this.limit());return e instanceof ee?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,r=this.limit();t<r;t++)e(this.segments[t])}toArray(){return this.segments.slice(this.offset,this.limit())}static comparator(e,t){let r=Math.min(e.length,t.length);for(let n=0;n<r;n++){let r=ee.compareSegments(e.get(n),t.get(n));if(0!==r)return r}return Y(e.length,t.length)}static compareSegments(e,t){let r=ee.isNumericId(e),n=ee.isNumericId(t);return r&&!n?-1:!r&&n?1:r&&n?ee.extractNumericId(e).compare(ee.extractNumericId(t)):J(e,t)}static isNumericId(e){return e.startsWith("__id")&&e.endsWith("__")}static extractNumericId(e){return n.fromString(e.substring(4,e.length-2))}}class et extends ee{construct(e,t,r){return new et(e,t,r)}canonicalString(){return this.toArray().join("/")}toString(){return this.canonicalString()}toUriEncodedString(){return this.toArray().map(encodeURIComponent).join("/")}static fromString(...e){let t=[];for(let r of e){if(r.indexOf("//")>=0)throw new U(L.INVALID_ARGUMENT,`Invalid segment (${r}). Paths must not contain // in them.`);t.push(...r.split("/").filter(e=>e.length>0))}return new et(t)}static emptyPath(){return new et([])}}let er=/^[_a-zA-Z][_a-zA-Z0-9]*$/;class en extends ee{construct(e,t,r){return new en(e,t,r)}static isValidIdentifier(e){return er.test(e)}canonicalString(){return this.toArray().map(e=>(e=e.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),en.isValidIdentifier(e)||(e="`"+e+"`"),e)).join(".")}toString(){return this.canonicalString()}isKeyField(){return 1===this.length&&this.get(0)===Z}static keyField(){return new en([Z])}static fromServerFormat(e){let t=[],r="",n=0,i=()=>{if(0===r.length)throw new U(L.INVALID_ARGUMENT,`Invalid field path (${e}). Paths must not be empty, begin with '.', end with '.', or contain '..'`);t.push(r),r=""},s=!1;for(;n<e.length;){let t=e[n];if("\\"===t){if(n+1===e.length)throw new U(L.INVALID_ARGUMENT,"Path has trailing escape character: "+e);let t=e[n+1];if("\\"!==t&&"."!==t&&"`"!==t)throw new U(L.INVALID_ARGUMENT,"Path has invalid escape sequence: "+e);r+=t,n+=2}else"`"===t?s=!s:"."!==t||s?r+=t:i(),n++}if(i(),s)throw new U(L.INVALID_ARGUMENT,"Unterminated ` in path: "+e);return new en(t)}static emptyPath(){return new en([])}}class ei{constructor(e){this.path=e}static fromPath(e){return new ei(et.fromString(e))}static fromName(e){return new ei(et.fromString(e).popFirst(5))}static empty(){return new ei(et.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===et.comparator(this.path,e.path)}toString(){return this.path.toString()}static comparator(e,t){return et.comparator(e.path,t.path)}static isDocumentKey(e){return e.length%2==0}static fromSegments(e){return new ei(new et(e.slice()))}}function es(e,t,r){if(!r)throw new U(L.INVALID_ARGUMENT,`Function ${e}() cannot be called with an empty ${t}.`)}function ea(e){if(!ei.isDocumentKey(e))throw new U(L.INVALID_ARGUMENT,`Invalid document reference. Document references must have an even number of segments, but ${e} has ${e.length}.`)}function eo(e){if(ei.isDocumentKey(e))throw new U(L.INVALID_ARGUMENT,`Invalid collection reference. Collection references must have an odd number of segments, but ${e} has ${e.length}.`)}function el(e){return"object"==typeof e&&null!==e&&(Object.getPrototypeOf(e)===Object.prototype||null===Object.getPrototypeOf(e))}function eu(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 r=(t=e).constructor?t.constructor.name:null;return r?`a custom ${r} object`:"an object"}}return"function"==typeof e?"a function":N(12329,{type:typeof e})}function ec(e,t){if("_delegate"in e&&(e=e._delegate),!(e instanceof t)){if(t.name===e.constructor.name)throw new U(L.INVALID_ARGUMENT,"Type does not match the expected instance. Did you pass a reference from a different Firestore SDK?");{let r=eu(e);throw new U(L.INVALID_ARGUMENT,`Expected type '${t.name}', but it was: ${r}`)}}return e}function eh(e,t){let r={typeString:e};return t&&(r.value=t),r}function ed(e,t){let r;if(!el(e))throw new U(L.INVALID_ARGUMENT,"JSON must be an object");for(let n in t)if(t[n]){let i=t[n].typeString,s="value"in t[n]?{value:t[n].value}:void 0;if(!(n in e)){r=`JSON missing required field: '${n}'`;break}let a=e[n];if(i&&typeof a!==i){r=`JSON field '${n}' must be a ${i}.`;break}if(void 0!==s&&a!==s.value){r=`Expected '${n}' field to equal '${s.value}'`;break}}if(r)throw new U(L.INVALID_ARGUMENT,r);return!0}class ef{static now(){return ef.fromMillis(Date.now())}static fromDate(e){return ef.fromMillis(e.getTime())}static fromMillis(e){let t=Math.floor(e/1e3),r=Math.floor((e-1e3*t)*1e6);return new ef(t,r)}constructor(e,t){if(this.seconds=e,this.nanoseconds=t,t<0||t>=1e9)throw new U(L.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+t);if(e<-0xe7791f700||e>=0x3afff44180)throw new U(L.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?Y(this.nanoseconds,e.nanoseconds):Y(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:ef._jsonSchemaVersion,seconds:this.seconds,nanoseconds:this.nanoseconds}}static fromJSON(e){if(ed(e,ef._jsonSchema))return new ef(e.seconds,e.nanoseconds)}valueOf(){return String(this.seconds- -0xe7791f700).padStart(12,"0")+"."+String(this.nanoseconds).padStart(9,"0")}
177}ef._jsonSchemaVersion="firestore/timestamp/1.0",ef._jsonSchema={type:eh("string",ef._jsonSchemaVersion),seconds:eh("number"),nanoseconds:eh("number")};class ep{static fromTimestamp(e){return new ep(e)}static min(){return new ep(new ef(0,0))}static max(){return new ep(new ef(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 eg{constructor(e,t,r,n){this.indexId=e,this.collectionGroup=t,this.fields=r,this.indexState=n}}eg.UNKNOWN_ID=-1;class em{constructor(e,t,r){this.readTime=e,this.documentKey=t,this.largestBatchId=r}static min(){return new em(ep.min(),ei.empty(),-1)}static max(){return new em(ep.max(),ei.empty(),-1)}}class ev{constructor(){this.onCommittedListeners=[]}addOnCommittedListener(e){this.onCommittedListeners.push(e)}raiseOnCommittedEvent(){this.onCommittedListeners.forEach(e=>e())}}async function ey(e){if(e.code!==L.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;R("LocalStore","Unexpectedly lost primary lease")}class e_{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&&N(59440),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(t,this.error):this.wrapSuccess(e,this.result):new e_((r,n)=>{this.nextCallback=t=>{this.wrapSuccess(e,t).next(r,n)},this.catchCallback=e=>{this.wrapFailure(t,e).next(r,n)}})}toPromise(){return new Promise((e,t)=>{this.next(e,t)})}wrapUserFunction(e){try{let t=e();return t instanceof e_?t:e_.resolve(t)}catch(e){return e_.reject(e)}}wrapSuccess(e,t){return e?this.wrapUserFunction(()=>e(t)):e_.resolve(t)}wrapFailure(e,t){return e?this.wrapUserFunction(()=>e(t)):e_.reject(t)}static resolve(e){return new e_((t,r)=>{t(e)})}static reject(e){return new e_((t,r)=>{r(e)})}static waitFor(e){return new e_((t,r)=>{let n=0,i=0,s=!1;e.forEach(e=>{++n,e.next(()=>{++i,s&&i===n&&t()},e=>r(e))}),s=!0,i===n&&t()})}static or(e){let t=e_.resolve(!1);for(let r of e)t=t.next(e=>e?e_.resolve(e):r());return t}static forEach(e,t){let r=[];return e.forEach((e,n)=>{r.push(t.call(this,e,n))}),this.waitFor(r)}static mapArray(e,t){return new e_((r,n)=>{let i=e.length,s=Array(i),a=0;for(let o=0;o<i;o++){let l=o;t(e[l]).next(e=>{s[l]=e,++a===i&&r(s)},e=>n(e))}})}static doWhile(e,t){return new e_((r,n)=>{let i=()=>{!0===e()?t().next(()=>{i()},n):r()};i()})}}function eb(e){return"IndexedDbTransactionError"===e.name}class ew{constructor(e,t){this.previousValue=e,t&&(t.sequenceNumberHandler=e=>this.ae(e),this.ue=e=>t.writeSequenceNumber(e))}ae(e){return this.previousValue=Math.max(e,this.previousValue),this.previousValue}next(){let e=++this.previousValue;return this.ue&&this.ue(e),e}}function eE(e){return null==e}function eS(e){return 0===e&&1/e==-1/0}ew.ce=-1;function eI(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}function ek(e,t){for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t(r,e[r])}function eT(e){for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}class eA{constructor(e,t){this.comparator=e,this.root=t||ex.EMPTY}insert(e,t){return new eA(this.comparator,this.root.insert(e,t,this.comparator).copy(null,null,ex.BLACK,null,null))}remove(e){return new eA(this.comparator,this.root.remove(e,this.comparator).copy(null,null,ex.BLACK,null,null))}get(e){let t=this.root;for(;!t.isEmpty();){let r=this.comparator(e,t.key);if(0===r)return t.value;r<0?t=t.left:r>0&&(t=t.right)}return null}indexOf(e){let t=0,r=this.root;for(;!r.isEmpty();){let n=this.comparator(e,r.key);if(0===n)return t+r.left.size;n<0?r=r.left:(t+=r.left.size+1,r=r.right)}return -1}isEmpty(){return this.root.isEmpty()}get size(){return this.root.size}minKey(){return this.root.minKey()}maxKey(){return this.root.maxKey()}inorderTraversal(e){return this.root.inorderTraversal(e)}forEach(e){this.inorderTraversal((t,r)=>(e(t,r),!1))}toString(){let e=[];return this.inorderTraversal((t,r)=>(e.push(`${t}:${r}`),!1)),`{${e.join(", ")}}`}reverseTraversal(e){return this.root.reverseTraversal(e)}getIterator(){return new eC(this.root,null,this.comparator,!1)}getIteratorFrom(e){return new eC(this.root,e,this.comparator,!1)}getReverseIterator(){return new eC(this.root,null,this.comparator,!0)}getReverseIteratorFrom(e){return new eC(this.root,e,this.comparator,!0)}}class eC{constructor(e,t,r,n){this.isReverse=n,this.nodeStack=[];let i=1;for(;!e.isEmpty();)if(i=t?r(e.key,t):1,t&&n&&(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 ex{constructor(e,t,r,n,i){this.key=e,this.value=t,this.color=null!=r?r:ex.RED,this.left=null!=n?n:ex.EMPTY,this.right=null!=i?i:ex.EMPTY,this.size=this.left.size+1+this.right.size}copy(e,t,r,n,i){return new ex(null!=e?e:this.key,null!=t?t:this.value,
177null!=r?r:this.color,null!=n?n: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,r){let n=this,i=r(e,n.key);return(n=i<0?n.copy(null,null,null,n.left.insert(e,t,r),null):0===i?n.copy(null,t,null,null,null):n.copy(null,null,null,null,n.right.insert(e,t,r))).fixUp()}removeMin(){if(this.left.isEmpty())return ex.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 r,n=this;if(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 ex.EMPTY;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,ex.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)}rotateRight(){let e=this.copy(null,null,ex.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 N(43730,{key:this.key,value:this.value});if(this.right.isRed())throw N(14113,{key:this.key,value:this.value});let e=this.left.check();if(e!==this.right.check())throw N(27949);return e+ +!this.isRed()}}ex.EMPTY=null,ex.RED=!0,ex.BLACK=!1,ex.EMPTY=new class{constructor(){this.size=0}get key(){throw N(57766)}get value(){throw N(16141)}get color(){throw N(16727)}get left(){throw N(29726)}get right(){throw N(36894)}copy(e,t,r,n,i){return this}insert(e,t,r){return new ex(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 eR{constructor(e){this.comparator=e,this.data=new eA(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,r)=>(e(t),!1))}forEachInRange(e,t){let r=this.data.getIteratorFrom(e[0]);for(;r.hasNext();){let n=r.getNext();if(this.comparator(n.key,e[1])>=0)return;t(n.key)}}forEachWhile(e,t){let r;for(r=void 0!==t?this.data.getIteratorFrom(t):this.data.getIterator();r.hasNext();)if(!e(r.getNext().key))return}firstAfterOrEqual(e){let t=this.data.getIteratorFrom(e);return t.hasNext()?t.getNext().key:null}getIterator(){return new eP(this.data.getIterator())}getIteratorFrom(e){return new eP(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 eR)||this.size!==e.size)return!1;let t=this.data.getIterator(),r=e.data.getIterator();for(;t.hasNext();){let e=t.getNext().key,n=r.getNext().key;if(0!==this.comparator(e,n))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 eR(this.comparator);return t.data=e,t}}
177class eP{constructor(e){this.iter=e}getNext(){return this.iter.getNext().key}hasNext(){return this.iter.hasNext()}}class eD{constructor(e){this.fields=e,e.sort(en.comparator)}static empty(){return new eD([])}unionWith(e){let t=new eR(en.comparator);for(let e of this.fields)t=t.add(e);for(let r of e)t=t.add(r);return new eD(t.toArray())}covers(e){for(let t of this.fields)if(t.isPrefixOf(e))return!0;return!1}isEqual(e){return X(this.fields,e.fields,(e,t)=>e.isEqual(t))}}class eO extends Error{constructor(){super(...arguments),this.name="Base64DecodeError"}}class eN{constructor(e){this.binaryString=e}static fromBase64String(e){return new eN(function(e){try{return atob(e)}catch(e){throw"u">typeof DOMException&&e instanceof DOMException?new eO("Invalid base64 string: "+e):e}}(e))}static fromUint8Array(e){return new eN(function(e){let t="";for(let r=0;r<e.length;++r)t+=String.fromCharCode(e[r]);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 r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}approximateByteSize(){return 2*this.binaryString.length}compareTo(e){return Y(this.binaryString,e.binaryString)}isEqual(e){return this.binaryString===e.binaryString}}eN.EMPTY_BYTE_STRING=new eN("");let eM=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/);function eF(e){if(F(!!e,39018),"string"==typeof e){let t=0,r=eM.exec(e);if(F(!!r,46558,{timestamp:e}),r[1]){let e=r[1];t=Number(e=(e+"000000000").substr(0,9))}return{seconds:Math.floor(new Date(e).getTime()/1e3),nanos:t}}return{seconds:eL(e.seconds),nanos:eL(e.nanos)}}function eL(e){return"number"==typeof e?e:"string"==typeof e?Number(e):0}function eU(e){return"string"==typeof e?eN.fromBase64String(e):eN.fromUint8Array(e)}let ej="server_timestamp",e$="__type__",eV="__previous_value__",eB="__local_write_time__";function eW(e){return(e?.mapValue?.fields||{})[e$]?.stringValue===ej}function ez(e){let t=e.mapValue.fields[eV];return eW(t)?ez(t):t}function eq(e){let t=eF(e.mapValue.fields[eB].timestampValue);return new ef(t.seconds,t.nanos)}class eH{constructor(e,t,r,n,i,s,a,o,l,u,c){this.databaseId=e,this.appId=t,this.persistenceKey=r,this.host=n,this.ssl=i,this.forceLongPolling=s,this.autoDetectLongPolling=a,this.longPollingOptions=o,this.useFetchStreams=l,this.isUsingEmulator=u,this.apiKey=c}}let eG="(default)";class eK{constructor(e,t){this.projectId=e,this.database=t||eG}static empty(){return new eK("","")}get isDefaultDatabase(){return this.database===eG}isEqual(e){return e instanceof eK&&e.projectId===this.projectId&&e.database===this.database}}let eY="__type__",eJ="__max__",eQ={fields:{__type__:{stringValue:eJ}}},eX="__vector__",eZ="value";function e0(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?eW(e)?4:ta(e)?0x1fffffffffffff:ti(e)?10:11:N(28295,{value:e})}function e1(e,t){if(e===t)return!0;let r=e0(e);if(r!==e0(t))return!1;switch(r){case 0:case 0x1fffffffffffff:return!0;case 1:return e.booleanValue===t.booleanValue;case 4:return eq(e).isEqual(eq(t));case 3:if("string"==typeof e.timestampValue&&"string"==typeof t.timestampValue&&e.timestampValue.length===t.timestampValue.length)return e.timestampValue===t.timestampValue;let n=eF(e.timestampValue),i=eF(t.timestampValue);return n.seconds===i.seconds&&n.nanos===i.nanos;case 5:return e.stringValue===t.stringValue;case 6:return eU(e.bytesValue).isEqual(eU(t.bytesValue));case 7:return e.referenceValue===t.referenceValue;case 8:return eL(e.geoPointValue.latitude)===eL(t.geoPointValue.latitude)&&eL(e.geoPointValue.longitude)===eL(t.geoPointValue.longitude);case 2:if("integerValue"in e&&"integerValue"in t)return eL(e.integerValue)===eL(t.integerValue);if("doubleValue"in e&&"doubleValue"in t){let r=eL(e.doubleValue),n=eL(t.doubleValue);return r===n?eS(r)===eS(n):isNaN(r)&&isNaN(n)}return!1;case 9:return X(e.arrayValue.values||[],t.arrayValue.values||[],e1);case 10:case 11:let s=e.mapValue.fields||{},a=t.mapValue.fields||{};if(eI(s)!==eI(a))return!1;for(let e in s)if(s.hasOwnProperty(e)&&(void 0===a[e]||!e1(s[e],a[e])))return!1;return!0;default:return N(52216,{left:e})}}function e2(e,t){return void 0!==(e.values||[]).find(e=>e1(e,t))}function e3(e,t){var r,n,i,s,a,o;if(e===t)return 0;let l=e0(e),u=e0(t);if(l!==u)return Y(l,u);switch(l){case 0:case 0x1fffffffffffff:return 0;case 1:return Y(e.booleanValue,t.booleanValue);case 2:let c,h;return c=eL(e.integerValue||e.doubleValue),c<(h=eL(t.integerValue||t.doubleValue))?-1:c>h?1:c===h?0:isNaN(c)?isNaN(h)?0:-1:1;case 3:return e5(e.timestampValue,t.timestampValue);case 4:return e5(eq(e),eq(t));case 5:return J(e.stringValue,t.stringValue);case 6:let d,f;return r=e.bytesValue,n=t.bytesValue,d=eU(r),f=eU(n),d.compareTo(f);case 7:return function(e,t){let r=e.split("/"),n=t.split("/");for(let e=0;e<r.length&&e<n.length;e++){let t=Y(r[e],n[e]);if(0!==t)return t}return Y(r.length,n.length)}(e.referenceValue,t.referenceValue);case 8:let p;return i=e.geoPointValue,s=t.geoPointValue,0!==(p=Y(eL(i.latitude),eL(s.latitude)))?p:Y(eL(i.longitude),eL(s.longitude));case 9:return e6(e.arrayValue,t.arrayValue);case 10:let g,m,v,y,_;return a=e.mapValue,o=t.mapValue,g=a.fields||{},m=o.fields||{},v=g[eZ]?.arrayValue,y=m[eZ]?.arrayValue,0!==(_=Y(v?.values?.length||0,y?.values?.length||0))?_:e6(v,y);case 11:return function(e,t){if(e===eQ&&t===eQ)return 0;if(e===eQ)return 1;if(t===eQ)return -1;let r=e.fields||{},n=Object.keys(r),i=t.fields||{},s=Object.keys(i);n.sort(),s.sort();for(let e=0;e<n.length&&e<s.length;++e){let t=J(n[e],s[e]);if(0!==t)return t;let a=e3(r[n[e]],i[s[e]]);if(0!==a)return a}return Y(n.length,s.length)}(e.mapValue,t.mapValue);default:throw N(23264,{he:l})}}function e5(e,t){if("string"==typeof e&&"string"==typeof t&&e.length===t.length)return Y(e,t);let r=eF(e),n=eF(t),i=Y(r.seconds,n.seconds);return 0!==i?i:Y(r.nanos,n.nanos)}function e6(e,t){let r=e.values||[],n=t.values||[];for(let e=0;e<r.length&&e<n.length;++e){let t=e3(r[e],n[e]);if(t)return t}return Y(r.length,n.length)}function e4(e){var t,r;let n;return"nullValue"in e?"null":"booleanValue"in e?""+e.booleanValue:"integerValue"in e?""+e.integerValue:"doubleValue"in e?""+e.doubleValue:"timestampValue"in e?(n=eF(e.timestampValue),`time(${n.seconds},${n.nanos}
177)`):"stringValue"in e?e.stringValue:"bytesValue"in e?eU(e.bytesValue).toBase64():"referenceValue"in e?(t=e.referenceValue,ei.fromName(t).toString()):"geoPointValue"in e?(r=e.geoPointValue,`geo(${r.latitude},${r.longitude})`):"arrayValue"in e?function(e){let t="[",r=!0;for(let n of e.values||[])r?r=!1:t+=",",t+=e4(n);return t+"]"}(e.arrayValue):"mapValue"in e?function(e){let t=Object.keys(e.fields||{}).sort(),r="{",n=!0;for(let i of t)n?n=!1:r+=",",r+=`${i}:${e4(e.fields[i])}`;return r+"}"}(e.mapValue):N(61005,{value:e})}function e8(e,t){return{referenceValue:`projects/${e.projectId}/databases/${e.database}/documents/${t.path.canonicalString()}`}}function e9(e){return!!e&&"integerValue"in e}function e7(e){return e9(e)||!!e&&"doubleValue"in e}function te(e){return!!e&&"arrayValue"in e}function tt(e){return!!e&&"nullValue"in e}function tr(e){return!!e&&"doubleValue"in e&&isNaN(Number(e.doubleValue))}function tn(e){return!!e&&"mapValue"in e}function ti(e){return(e?.mapValue?.fields||{})[eY]?.stringValue===eX}function ts(e){if(e.geoPointValue)return{geoPointValue:{...e.geoPointValue}};if(e.timestampValue&&"object"==typeof e.timestampValue)return{timestampValue:{...e.timestampValue}};if(e.mapValue){let t={mapValue:{fields:{}}};return ek(e.mapValue.fields,(e,r)=>t.mapValue.fields[e]=ts(r)),t}if(e.arrayValue){let t={arrayValue:{values:[]}};for(let r=0;r<(e.arrayValue.values||[]).length;++r)t.arrayValue.values[r]=ts(e.arrayValue.values[r]);return t}return{...e}}function ta(e){return(((e.mapValue||{}).fields||{}).__type__||{}).stringValue===eJ}class to{constructor(e){this.value=e}static empty(){return new to({mapValue:{}})}field(e){if(e.isEmpty())return this.value;{let t=this.value;for(let r=0;r<e.length-1;++r)if(!tn(t=(t.mapValue.fields||{})[e.get(r)]))return null;return(t=(t.mapValue.fields||{})[e.lastSegment()])||null}}set(e,t){this.getFieldsMap(e.popLast())[e.lastSegment()]=ts(t)}setAll(e){let t=en.emptyPath(),r={},n=[];e.forEach((e,i)=>{if(!t.isImmediateParentOf(i)){let e=this.getFieldsMap(t);this.applyChanges(e,r,n),r={},n=[],t=i.popLast()}e?r[i.lastSegment()]=ts(e):n.push(i.lastSegment())});let i=this.getFieldsMap(t);this.applyChanges(i,r,n)}delete(e){let t=this.field(e.popLast());tn(t)&&t.mapValue.fields&&delete t.mapValue.fields[e.lastSegment()]}isEqual(e){return e1(this.value,e.value)}getFieldsMap(e){let t=this.value;t.mapValue.fields||(t.mapValue={fields:{}});for(let r=0;r<e.length;++r){let n=t.mapValue.fields[e.get(r)];tn(n)&&n.mapValue.fields||(n={mapValue:{fields:{}}},t.mapValue.fields[e.get(r)]=n),t=n}return t.mapValue.fields}applyChanges(e,t,r){for(let n of(ek(t,(t,r)=>e[t]=r),r))delete e[n]}clone(){return new to(ts(this.value))}}class tl{constructor(e,t,r,n,i,s,a){this.key=e,this.documentType=t,this.version=r,this.readTime=n,this.createTime=i,this.data=s,this.documentState=a}static newInvalidDocument(e){return new tl(e,0,ep.min(),ep.min(),ep.min(),to.empty(),0)}static newFoundDocument(e,t,r,n){return new tl(e,1,t,ep.min(),r,n,0)}static newNoDocument(e,t){return new tl(e,2,t,ep.min(),ep.min(),to.empty(),0)}static newUnknownDocument(e,t){return new tl(e,3,t,ep.min(),ep.min(),to.empty(),2)}convertToFoundDocument(e,t){return this.createTime.isEqual(ep.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=to.empty(),this.documentState=0,this}convertToUnknownDocument(e){return this.version=e,this.documentType=3,this.data=to.empty(),this.documentState=2,this}setHasCommittedMutations(){return this.documentState=2,this}setHasLocalMutations(){return this.documentState=1,this.version=ep.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 tl&&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 tl(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}})`}}
177class tu{constructor(e,t){this.position=e,this.inclusive=t}}function tc(e,t,r){let n=0;for(let i=0;i<e.position.length;i++){let s=t[i],a=e.position[i];if(n=s.field.isKeyField()?ei.comparator(ei.fromName(a.referenceValue),r.key):e3(a,r.data.field(s.field)),"desc"===s.dir&&(n*=-1),0!==n)break}return n}function th(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 r=0;r<e.position.length;r++)if(!e1(e.position[r],t.position[r]))return!1;return!0}class td{constructor(e,t="asc"){this.field=e,this.dir=t}}class tf{}class tp extends tf{constructor(e,t,r){super(),this.field=e,this.op=t,this.value=r}static create(e,t,r){return e.isKeyField()?"in"===t||"not-in"===t?this.createKeyFieldInFilter(e,t,r):new ty(e,t,r):"array-contains"===t?new tE(e,r):"in"===t?new tS(e,r):"not-in"===t?new tI(e,r):"array-contains-any"===t?new tk(e,r):new tp(e,t,r)}static createKeyFieldInFilter(e,t,r){return"in"===t?new t_(e,r):new tb(e,r)}matches(e){let t=e.data.field(this.field);return"!="===this.op?null!==t&&void 0===t.nullValue&&this.matchesComparison(e3(t,this.value)):null!==t&&e0(this.value)===e0(t)&&this.matchesComparison(e3(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 N(47266,{operator:this.op})}}isInequality(){return["<","<=",">",">=","!=","not-in"].indexOf(this.op)>=0}getFlattenedFilters(){return[this]}getFilters(){return[this]}}class tg extends tf{constructor(e,t){super(),this.filters=e,this.op=t,this.Pe=null}static create(e,t){return new tg(e,t)}matches(e){return tm(this)?void 0===this.filters.find(t=>!t.matches(e)):void 0!==this.filters.find(t=>t.matches(e))}getFlattenedFilters(){return null!==this.Pe||(this.Pe=this.filters.reduce((e,t)=>e.concat(t.getFlattenedFilters()),[])),this.Pe}getFilters(){return Object.assign([],this.filters)}}function tm(e){return"and"===e.op}function tv(e){for(let t of e.filters)if(t instanceof tg)return!1;return!0}class ty extends tp{constructor(e,t,r){super(e,t,r),this.key=ei.fromName(r.referenceValue)}matches(e){let t=ei.comparator(e.key,this.key);return this.matchesComparison(t)}}class t_ extends tp{constructor(e,t){super(e,"in",t),this.keys=tw("in",t)}matches(e){return this.keys.some(t=>t.isEqual(e.key))}}class tb extends tp{constructor(e,t){super(e,"not-in",t),this.keys=tw("not-in",t)}matches(e){return!this.keys.some(t=>t.isEqual(e.key))}}function tw(e,t){return(t.arrayValue?.values||[]).map(e=>ei.fromName(e.referenceValue))}class tE extends tp{constructor(e,t){super(e,"array-contains",t)}matches(e){let t=e.data.field(this.field);return te(t)&&e2(t.arrayValue,this.value)}}class tS extends tp{constructor(e,t){super(e,"in",t)}matches(e){let t=e.data.field(this.field);return null!==t&&e2(this.value.arrayValue,t)}}class tI extends tp{constructor(e,t){super(e,"not-in",t)}matches(e){if(e2(this.value.arrayValue,{nullValue:"NULL_VALUE"}))return!1;let t=e.data.field(this.field);return null!==t&&void 0===t.nullValue&&!e2(this.value.arrayValue,t)}}class tk extends tp{constructor(e,t){super(e,"array-contains-any",t)}matches(e){let t=e.data.field(this.field);return!(!te(t)||!t.arrayValue.values)&&t.arrayValue.values.some(e=>e2(this.value.arrayValue,e))}}class tT{constructor(e,t=null,r=[],n=[],i=null,s=null,a=null){this.path=e,this.collectionGroup=t,this.orderBy=r,this.filters=n,this.limit=i,this.startAt=s,this.endAt=a,this.Te=null}}function tA(e,t=null,r=[],n=[],i=null,s=null,a=null){return new tT(e,t,r,n,i,s,a)}function tC(e){if(null===e.Te){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 tp)return t.field.canonicalString()+t.op.toString()+e4(t.value);if(tv(t)&&tm(t))return t.filters.map(t=>e(t)).join(",");{let r=t.filters.map(t=>e(t)).join(",");return`${t.op}(${r})`}})(e)).join(","),t+="|ob:",t+=e.orderBy.map(e=>e.field.canonicalString()+e.dir).join(","),eE(e.limit)||(t+="|l:",t+=e.limit),e.startAt&&(t+="|lb:",t+=e.startAt.inclusive?"b:":"a:",t+=e.startAt.position.map(e=>e4(e)).join(",")),e.endAt&&(t+="|ub:",t+=e.endAt.inclusive?"a:":"b:",t+=e.endAt.position.map(e=>e4(e)).join(",")),e.Te=t}return e.Te}function tx(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 r,n;if(r=e.orderBy[i],n=t.orderBy[i],!(r.dir===n.dir&&r.field.isEqual(n.field)))return!1}if(e.filters.length!==t.filters.length)return!1;for(let r=0;r<e.filters.length;r++)if(!function e(t,r){return t instanceof tp?r instanceof tp&&t.op===r.op&&t.field.isEqual(r.field)&&e1(t.value,r.value):t instanceof tg?r instanceof tg&&t.op===r.op&&t.filters.length===r.filters.length&&t.filters.reduce((t,n,i)=>t&&e(n,r.filters[i]),!0):void N(19439)}(e.filters[r],t.filters[r]))return!1;return e.collectionGroup===t.collectionGroup&&!!e.path.isEqual(t.path)&&!!th(e.startAt,t.startAt)&&th(e.endAt,t.endAt)}function tR(e){return ei.isDocumentKey(e.path)&&null===e.collectionGroup&&0===e.filters.length}class tP{constructor(e,t=null,r=[],n=[],i=null,s="F",a=null,o=null){this.path=e,this.collectionGroup=t,this.explicitOrderBy=r,this.filters=n,this.limit=i,this.limitType=s,this.startAt=a,this.endAt=o,this.Ie=null,this.Ee=null,this.Re=null,this.startAt,this.endAt}}function tD(e){return new tP(e)}function tO(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 tN(e){return null!==e.collectionGroup}function tM(e){if(null===e.Ie){let t;e.Ie=[];let r=new Set;for(let t of e.explicitOrderBy)e.Ie.push(t),r.add(t.field.canonicalString());let n=e.explicitOrderBy.length>0?e.explicitOrderBy[e.explicitOrderBy.length-1].dir:"asc";
177(t=new eR(en.comparator),e.filters.forEach(e=>{e.getFlattenedFilters().forEach(e=>{e.isInequality()&&(t=t.add(e.field))})}),t).forEach(t=>{r.has(t.canonicalString())||t.isKeyField()||e.Ie.push(new td(t,n))}),r.has(en.keyField().canonicalString())||e.Ie.push(new td(en.keyField(),n))}return e.Ie}function tF(e){return e.Ee||(e.Ee=tL(e,tM(e))),e.Ee}function tL(e,t){if("F"===e.limitType)return tA(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 td(e.field,t)});let r=e.endAt?new tu(e.endAt.position,e.endAt.inclusive):null,n=e.startAt?new tu(e.startAt.position,e.startAt.inclusive):null;return tA(e.path,e.collectionGroup,t,e.filters,e.limit,r,n)}}function tU(e,t){let r=e.filters.concat([t]);return new tP(e.path,e.collectionGroup,e.explicitOrderBy.slice(),r,e.limit,e.limitType,e.startAt,e.endAt)}function tj(e,t,r){return new tP(e.path,e.collectionGroup,e.explicitOrderBy.slice(),e.filters.slice(),t,r,e.startAt,e.endAt)}function t$(e,t){return tx(tF(e),tF(t))&&e.limitType===t.limitType}function tV(e){return`${tC(tF(e))}|lt:${e.limitType}`}function tB(e){var t;let r;return`Query(target=${r=(t=tF(e)).path.canonicalString(),null!==t.collectionGroup&&(r+=" collectionGroup="+t.collectionGroup),t.filters.length>0&&(r+=`, filters: [${t.filters.map(e=>(function e(t){return t instanceof tp?`${t.field.canonicalString()} ${t.op} ${e4(t.value)}`:t instanceof tg?t.op.toString()+" {"+t.getFilters().map(e).join(" ,")+"}":"Filter"})(e)).join(", ")}]`),eE(t.limit)||(r+=", limit: "+t.limit),t.orderBy.length>0&&(r+=`, orderBy: [${t.orderBy.map(e=>`${e.field.canonicalString()} (${e.dir})`).join(", ")}]`),t.startAt&&(r+=", startAt: ",r+=t.startAt.inclusive?"b:":"a:",r+=t.startAt.position.map(e=>e4(e)).join(",")),t.endAt&&(r+=", endAt: ",r+=t.endAt.inclusive?"a:":"b:",r+=t.endAt.position.map(e=>e4(e)).join(",")),`Target(${r})`}; limitType=${e.limitType})`}function tW(e,t){var r,n,i,s;let a,o,l;return t.isFoundDocument()&&(a=t.key.path,null!==e.collectionGroup?t.key.hasCollectionId(e.collectionGroup)&&e.path.isPrefixOf(a):ei.isDocumentKey(e.path)?e.path.isEqual(a):e.path.isImmediateParentOf(a))&&function(e,t){for(let r of tM(e))if(!r.field.isKeyField()&&null===t.data.field(r.field))return!1;return!0}(e,t)&&function(e,t){for(let r of e.filters)if(!r.matches(t))return!1;return!0}(e,t)&&(r=e,n=t,(!r.startAt||(i=r.startAt,o=tc(i,tM(r),n),i.inclusive?!!(o<=0):!!(o<0)))&&(!r.endAt||(s=r.endAt,l=tc(s,tM(r),n),s.inclusive?!!(l>=0):!!(l>0))))}function tz(e){return(t,r)=>{let n=!1;for(let i of tM(e)){let e=function(e,t,r){var n;let i,s,a=e.field.isKeyField()?ei.comparator(t.key,r.key):(n=e.field,i=t.data.field(n),s=r.data.field(n),null!==i&&null!==s?e3(i,s):N(42886));switch(e.dir){case"asc":return a;case"desc":return -1*a;default:return N(19790,{direction:e.dir})}}(i,t,r);if(0!==e)return e;n=n||i.field.isKeyField()}return 0}}class tq{constructor(e,t){this.mapKeyFn=e,this.equalsFn=t,this.inner={},this.innerSize=0}get(e){let t=this.mapKeyFn(e),r=this.inner[t];if(void 0!==r){for(let[t,n]of r)if(this.equalsFn(t,e))return n}}has(e){return void 0!==this.get(e)}set(e,t){let r=this.mapKeyFn(e),n=this.inner[r];if(void 0===n)return this.inner[r]=[[e,t]],void this.innerSize++;for(let r=0;r<n.length;r++)if(this.equalsFn(n[r][0],e))return void(n[r]=[e,t]);n.push([e,t]),this.innerSize++}delete(e){let t=this.mapKeyFn(e),r=this.inner[t];if(void 0===r)return!1;for(let n=0;n<r.length;n++)if(this.equalsFn(r[n][0],e))return 1===r.length?delete this.inner[t]:r.splice(n,1),this.innerSize--,!0;return!1}forEach(e){ek(this.inner,(t,r)=>{for(let[t,n]of r)e(t,n)})}isEmpty(){return eT(this.inner)}size(){return this.innerSize}}let tH=new eA(ei.comparator),tG=new eA(ei.comparator);function tK(...e){let t=tG;for(let r of e)t=t.insert(r.key,r);return t}function tY(e){let t=tG;return e.forEach((e,r)=>t=t.insert(e,r.overlayedDocument)),t}function tJ(){return new tq(e=>e.toString(),(e,t)=>e.isEqual(t))}let tQ=new eA(ei.comparator),tX=new eR(ei.comparator);function tZ(...e){let t=tX;for(let r of e)t=t.add(r);return t}let t0=new eR(Y);function t1(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:eS(t)?"-0":t}}function t2(e){return{integerValue:""+e}}class t3{constructor(){this._=void 0}}function t5(e,t){return e instanceof rt?e7(t)?t:{integerValue:0}:null}class t6 extends t3{}class t4 extends t3{constructor(e){super(),this.elements=e}}function t8(e,t){let r=ra(t);for(let t of e.elements)r.some(e=>e1(e,t))||r.push(t);return{arrayValue:{values:r}}}class t9 extends t3{constructor(e){super(),this.elements=e}}function t7(e,t){let r=ra(t);for(let t of e.elements)r=r.filter(e=>!e1(e,t));return{arrayValue:{values:r}}}
177class re extends t3{constructor(e,t){super(),this.serializer=e,this.Ae=t}}class rt extends re{}class rr extends re{}class rn extends re{}function ri(e,t,r){if(!e7(t))return e.Ae;let n=r(rs(t),rs(e.Ae));return e9(t)&&e9(e.Ae)?t2(n):t1(e.serializer,n)}function rs(e){return eL(e.integerValue||e.doubleValue)}function ra(e){return te(e)&&e.arrayValue.values?e.arrayValue.values.slice():[]}class ro{constructor(e,t){this.field=e,this.transform=t}}class rl{constructor(e,t){this.version=e,this.transformResults=t}}class ru{constructor(e,t){this.updateTime=e,this.exists=t}static none(){return new ru}static exists(e){return new ru(void 0,e)}static updateTime(e){return new ru(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 rc(e,t){return void 0!==e.updateTime?t.isFoundDocument()&&t.version.isEqual(e.updateTime):void 0===e.exists||e.exists===t.isFoundDocument()}class rh{}function rd(e,t){if(!e.hasLocalMutations||t&&0===t.fields.length)return null;if(null===t)return e.isNoDocument()?new rb(e.key,ru.none()):new rg(e.key,e.data,ru.none());{let r=e.data,n=to.empty(),i=new eR(en.comparator);for(let e of t.fields)if(!i.has(e)){let t=r.field(e);null===t&&e.length>1&&(e=e.popLast(),t=r.field(e)),null===t?n.delete(e):n.set(e,t),i=i.add(e)}return new rm(e.key,n,new eD(i.toArray()),ru.none())}}function rf(e,t,r,n){return e instanceof rg?function(e,t,r,n){if(!rc(e.precondition,t))return r;let i=e.value.clone(),s=r_(e.fieldTransforms,n,t);return i.setAll(s),t.convertToFoundDocument(t.version,i).setHasLocalMutations(),null}(e,t,r,n):e instanceof rm?function(e,t,r,n){if(!rc(e.precondition,t))return r;let i=r_(e.fieldTransforms,n,t),s=t.data;return(s.setAll(rv(e)),s.setAll(i),t.convertToFoundDocument(t.version,s).setHasLocalMutations(),null===r)?null:r.unionWith(e.fieldMask.fields).unionWith(e.fieldTransforms.map(e=>e.field))}(e,t,r,n):rc(e.precondition,t)?(t.convertToNoDocument(t.version).setHasLocalMutations(),null):r}function rp(e,t){var r,n;return e.type===t.type&&!!e.key.isEqual(t.key)&&!!e.precondition.isEqual(t.precondition)&&(r=e.fieldTransforms,n=t.fieldTransforms,!!(void 0===r&&void 0===n||!(!r||!n)&&X(r,n,(e,t)=>{var r,n;return e.field.isEqual(t.field)&&(r=e.transform,n=t.transform,r instanceof t4&&n instanceof t4||r instanceof t9&&n instanceof t9?X(r.elements,n.elements,e1):r instanceof rt&&n instanceof rt||r instanceof rr&&n instanceof rr||r instanceof rn&&n instanceof rn?e1(r.Ae,n.Ae):r instanceof t6&&n instanceof t6)})))&&(0===e.type?e.value.isEqual(t.value):1!==e.type||e.data.isEqual(t.data)&&e.fieldMask.isEqual(t.fieldMask))}class rg extends rh{constructor(e,t,r,n=[]){super(),this.key=e,this.value=t,this.precondition=r,this.fieldTransforms=n,this.type=0}getFieldMask(){return null}}class rm extends rh{constructor(e,t,r,n,i=[]){super(),this.key=e,this.data=t,this.fieldMask=r,this.precondition=n,this.fieldTransforms=i,this.type=1}getFieldMask(){return this.fieldMask}}function rv(e){let t=new Map;return e.fieldMask.fields.forEach(r=>{if(!r.isEmpty()){let n=e.data.field(r);t.set(r,n)}}),t}function ry(e,t,r){let n=new Map;F(e.length===r.length,32656,{Ve:r.length,de:e.length});for(let s=0;s<r.length;s++){var i;let a=e[s],o=a.transform,l=t.data.field(a.field);n.set(a.field,(i=r[s],o instanceof t4?t8(o,l):o instanceof t9?t7(o,l):i))}return n}function r_(e,t,r){let n=new Map;for(let i of e){let e=i.transform,s=r.data.field(i.field);n.set(i.field,function(e,t,r){var n;let i,s,a;return e instanceof t6?(n=t,i={fields:{[e$]:{stringValue:ej},[eB]:{timestampValue:{seconds:r.seconds,nanos:r.nanoseconds}}}},n&&eW(n)&&(n=ez(n)),n&&(i.fields[eV]=n),{mapValue:i}):e instanceof t4?t8(e,t):e instanceof t9?t7(e,t):e instanceof rt?(a=rs(s=t5(e,t))+rs(e.Ae),e9(s)&&e9(e.Ae)?t2(a):t1(e.serializer,a)):e instanceof rr?ri(e,t,Math.min):e instanceof rn?ri(e,t,Math.max):void 0}(e,s,t))}return n}class rb extends rh{constructor(e,t){super(),this.key=e,this.precondition=t,this.type=2,this.fieldTransforms=[]}getFieldMask(){return null}}class rw extends rh{constructor(e,t){super(),this.key=e,this.prec
177ondition=t,this.type=3,this.fieldTransforms=[]}getFieldMask(){return null}}class rE{constructor(e,t,r,n){this.batchId=e,this.localWriteTime=t,this.baseMutations=r,this.mutations=n}applyToRemoteDocument(e,t){let r=t.mutationResults;for(let t=0;t<this.mutations.length;t++){let n=this.mutations[t];n.key.isEqual(e.key)&&function(e,t,r){let n,i;e instanceof rg?(n=e.value.clone(),i=ry(e.fieldTransforms,t,r.transformResults),n.setAll(i),t.convertToFoundDocument(r.version,n).setHasCommittedMutations()):e instanceof rm?function(e,t,r){if(!rc(e.precondition,t))return t.convertToUnknownDocument(r.version);let n=ry(e.fieldTransforms,t,r.transformResults),i=t.data;i.setAll(rv(e)),i.setAll(n),t.convertToFoundDocument(r.version,i).setHasCommittedMutations()}(e,t,r):t.convertToNoDocument(r.version).setHasCommittedMutations()}(n,e,r[t])}}applyToLocalView(e,t){for(let r of this.baseMutations)r.key.isEqual(e.key)&&(t=rf(r,e,t,this.localWriteTime));for(let r of this.mutations)r.key.isEqual(e.key)&&(t=rf(r,e,t,this.localWriteTime));return t}applyToLocalDocumentSet(e,t){let r=tJ();return this.mutations.forEach(n=>{let i=e.get(n.key),s=i.overlayedDocument,a=this.applyToLocalView(s,i.mutatedFields),o=rd(s,a=t.has(n.key)?null:a);null!==o&&r.set(n.key,o),s.isValidDocument()||s.convertToNoDocument(ep.min())}),r}keys(){return this.mutations.reduce((e,t)=>e.add(t.key),tZ())}isEqual(e){return this.batchId===e.batchId&&X(this.mutations,e.mutations,(e,t)=>rp(e,t))&&X(this.baseMutations,e.baseMutations,(e,t)=>rp(e,t))}}class rS{constructor(e,t,r,n){this.batch=e,this.commitVersion=t,this.mutationResults=r,this.docVersions=n}static from(e,t,r){F(e.mutations.length===r.length,58842,{me:e.mutations.length,fe:r.length});let n=tQ,i=e.mutations;for(let e=0;e<i.length;e++)n=n.insert(i[e].key,r[e].version);return new rS(e,t,r,n)}}class rI{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{ 178 largestBatchId: ${this.largestBatchId}, 179 mutation: ${this.mutation.toString()} 180 }`}}class rk{constructor(e,t,r){this.alias=e,this.aggregateType=t,this.fieldPath=r}}class rT{constructor(e,t){this.count=e,this.unchangedNames=t}}function rA(e){switch(e){case L.OK:return N(64938);case L.CANCELLED:case L.UNKNOWN:case L.DEADLINE_EXCEEDED:case L.RESOURCE_EXHAUSTED:case L.INTERNAL:case L.UNAVAILABLE:case L.UNAUTHENTICATED:return!1;case L.INVALID_ARGUMENT:case L.NOT_FOUND:case L.ALREADY_EXISTS:case L.PERMISSION_DENIED:case L.FAILED_PRECONDITION:case L.ABORTED:case L.OUT_OF_RANGE:case L.UNIMPLEMENTED:case L.DATA_LOSS:return!0;default:return N(15467,{code:e})}}function rC(e){if(void 0===e)return P("GRPC error has no .code"),L.UNKNOWN;switch(e){case f.OK:return L.OK;case f.CANCELLED:return L.CANCELLED;case f.UNKNOWN:return L.UNKNOWN;case f.DEADLINE_EXCEEDED:return L.DEADLINE_EXCEEDED;case f.RESOURCE_EXHAUSTED:return L.RESOURCE_EXHAUSTED;case f.INTERNAL:return L.INTERNAL;case f.UNAVAILABLE:return L.UNAVAILABLE;case f.UNAUTHENTICATED:return L.UNAUTHENTICATED;case f.INVALID_ARGUMENT:return L.INVALID_ARGUMENT;case f.NOT_FOUND:return L.NOT_FOUND;case f.ALREADY_EXISTS:return L.ALREADY_EXISTS;case f.PERMISSION_DENIED:return L.PERMISSION_DENIED;case f.FAILED_PRECONDITION:return L.FAILED_PRECONDITION;case f.ABORTED:return L.ABORTED;case f.OUT_OF_RANGE:return L.OUT_OF_RANGE;case f.UNIMPLEMENTED:return L.UNIMPLEMENTED;case f.DATA_LOSS:return L.DATA_LOSS;default:return N(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 rx=new n([0xffffffff,0xffffffff],0);function rR(e){let t=(new TextEncoder).encode(e),r=new i;return r.update(t),new Uint8Array(r.digest())}function rP(e){let t=new DataView(e.buffer),r=t.getUint32(0,!0),i=t.getUint32(4,!0),s=t.getUint32(8,!0),a=t.getUint32(12,!0);return[new n([r,i],0),new n([s,a],0)]}class rD{constructor(e,t,r){if(this.bitmap=e,this.padding=t,this.hashCount=r,t<0||t>=8)throw new rO(`Invalid padding: ${t}`);if(r<0||e.length>0&&0===this.hashCount)throw new rO(`Invalid hash count: ${r}`);if(0===e.length&&0!==t)throw new rO(`Invalid padding when bitmap length is 0: ${t}`);this.ge=8*e.length-t,this.pe=n.fromNumber(this.ge)}ye(e,t,r){let i=e.add(t.multiply(n.fromNumber(r)));return 1===i.compare(rx)&&(i=new n([i.getBits(0),i.getBits(1)],0)),i.modulo(this.pe).toNumber()}we(e){return!!(this.bitmap[Math.floor(e/8)]&1<<e%8)}mightContain(e){if(0===this.ge)return!1;let[t,r]=rP(rR(e));for(let e=0;e<this.hashCount;e++){let n=this.ye(t,r,e);if(!this.we(n))return!1}return!0}static create(e,t,r){let n=new rD(new Uint8Array(Math.ceil(e/8)),e%8==0?0:8-e%8,t);
180return r.forEach(e=>n.insert(e)),n}insert(e){if(0===this.ge)return;let[t,r]=rP(rR(e));for(let e=0;e<this.hashCount;e++){let n=this.ye(t,r,e);this.Se(n)}}Se(e){let t=Math.floor(e/8);this.bitmap[t]|=1<<e%8}}class rO extends Error{constructor(){super(...arguments),this.name="BloomFilterError"}}class rN{constructor(e,t,r,n,i){this.snapshotVersion=e,this.targetChanges=t,this.targetMismatches=r,this.documentUpdates=n,this.resolvedLimboDocuments=i}static createSynthesizedRemoteEventForCurrentChange(e,t,r){let n=new Map;return n.set(e,rM.createSynthesizedTargetChangeForCurrentChange(e,t,r)),new rN(ep.min(),n,new eA(Y),tH,tZ())}}class rM{constructor(e,t,r,n,i){this.resumeToken=e,this.current=t,this.addedDocuments=r,this.modifiedDocuments=n,this.removedDocuments=i}static createSynthesizedTargetChangeForCurrentChange(e,t,r){return new rM(r,t,tZ(),tZ(),tZ())}}class rF{constructor(e,t,r,n){this.be=e,this.removedTargetIds=t,this.key=r,this.De=n}}class rL{constructor(e,t){this.targetId=e,this.Ce=t}}class rU{constructor(e,t,r=eN.EMPTY_BYTE_STRING,n=null){this.state=e,this.targetIds=t,this.resumeToken=r,this.cause=n}}class rj{constructor(e){this.targetId=e,this.ve=0,this.Fe=rW(),this.Me=eN.EMPTY_BYTE_STRING,this.xe=!1,this.Oe=!0}get current(){return this.xe}get resumeToken(){return this.Me}get Ne(){return 0!==this.ve}get Be(){return this.Oe}Le(e){e.approximateByteSize()>0&&(this.Oe=!0,this.Me=e)}ke(){let e=tZ(),t=tZ(),r=tZ();return this.Fe.forEach((n,i)=>{switch(i){case 0:e=e.add(n);break;case 2:t=t.add(n);break;case 1:r=r.add(n);break;default:N(38017,{changeType:i})}}),new rM(this.Me,this.xe,e,t,r)}qe(){this.Oe=!1,this.Fe=rW()}Ke(e,t){this.Oe=!0,this.Fe=this.Fe.insert(e,t)}Ue(e){this.Oe=!0,this.Fe=this.Fe.remove(e)}$e(){this.ve+=1}We(){this.ve-=1,F(this.ve>=0,3241,{ve:this.ve,targetId:this.targetId})}Qe(){this.Oe=!0,this.xe=!0}}let r$="WatchChangeAggregator";class rV{constructor(e){this.Ge=e,this.ze=new Map,this.je=tH,this.Je=rB(),this.He=rB(),this.Ze=new eA(Y)}Xe(e){for(let t of e.be)e.De&&e.De.isFoundDocument()?this.Ye(t,e.De):this.et(t,e.key,e.De);for(let t of e.removedTargetIds)this.et(t,e.key,e.De)}tt(e){this.forEachTarget(e,t=>{let r=this.ze.get(t);if(r)switch(e.state){case 0:this.nt(t)&&r.Le(e.resumeToken);break;case 1:r.We(),r.Ne||r.qe(),r.Le(e.resumeToken);break;case 2:r.We(),r.Ne||this.removeTarget(t);break;case 3:this.nt(t)&&(r.Qe(),r.Le(e.resumeToken));break;case 4:this.nt(t)&&(this.rt(t),r.Le(e.resumeToken));break;default:N(56790,{state:e.state})}else R(r$,`handleTargetChange received targetChange for untracked target ID (${t}) with state (${e.state})`)})}forEachTarget(e,t){e.targetIds.length>0?e.targetIds.forEach(t):this.ze.forEach((e,r)=>{this.nt(r)&&t(r)})}it(e){let t=e.targetId,r=e.Ce.count,n=this.st(t);if(n){let i=n.target;if(tR(i))if(0===r){let e=new ei(i.path);this.et(t,e,tl.newNoDocument(e,ep.min()))}else F(1===r,20013,{expectedCount:r});else{let n=this.ot(t);if(n!==r){let r=this._t(e),i=r?this.ut(r,e,n):1;0!==i&&(this.rt(t),this.Ze=this.Ze.insert(t,2===i?"TargetPurposeExistenceFilterMismatchBloom":"TargetPurposeExistenceFilterMismatch"))}}}}_t(e){let t,r,n=e.Ce.unchangedNames;if(!n||!n.bits)return null;let{bits:{bitmap:i="",padding:s=0},hashCount:a=0}=n;try{t=eU(i).toUint8Array()}catch(e){if(e instanceof eO)return D("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{r=new rD(t,s,a)}catch(e){return D(e instanceof rO?"BloomFilter error: ":"Applying bloom filter failed: ",e),null}return 0===r.ge?null:r}ut(e,t,r){return 2*(t.Ce.count!==r-this.ht(e,t.targetId))}ht(e,t){let r=this.Ge.getRemoteKeysForTarget(t),n=0;return r.forEach(r=>{let i=this.Ge.lt(),s=`projects/${i.projectId}/databases/${i.database}/documents/${r.path.canonicalString()}`;e.mightContain(s)||(this.et(t,r,null),n++)}),n}Pt(e){let t=new Map;this.ze.forEach((r,n)=>{let i=this.st(n);if(i){if(r.current&&tR(i.target)){let t=new ei(i.target.path);this.Tt(t).has(n)||this.It(n,t)||this.et(n,t,tl.newNoDocument(t,e))}r.Be&&(t.set(n,r.ke()),r.qe())}});let r=tZ();this.He.forEach((e,t)=>{let n=!0;t.forEachWhile(e=>{let t=this.st(e);return!t||"TargetPurposeLimboResolution"===t.purpose||(n=!1,!1)}),n&&(r=r.add(e))}),this.je.forEach((t,r)=>r.setReadTime(e));let n=new rN(e,t,this.Ze,this.je,r);return this.je=tH,this.Je=rB(),this.He=rB(),this.Ze=new eA(Y),n}Ye(e,t){let r=this.ze.get(e);if(!r||!this.nt(e))return void R(r$,`addDocumentToTarget received document for unknown inactive target (${e})`);
180let n=2*!!this.It(e,t.key);r.Ke(t.key,n),this.je=this.je.insert(t.key,t),this.Je=this.Je.insert(t.key,this.Tt(t.key).add(e)),this.He=this.He.insert(t.key,this.Et(t.key).add(e))}et(e,t,r){let n=this.ze.get(e);n&&this.nt(e)?(this.It(e,t)?n.Ke(t,1):n.Ue(t),this.He=this.He.insert(t,this.Et(t).delete(e)),this.He=this.He.insert(t,this.Et(t).add(e)),r&&(this.je=this.je.insert(t,r))):R(r$,`removeDocumentFromTarget received document for unknown or inactive target (${e})`)}removeTarget(e){this.ze.delete(e)}ot(e){let t=this.ze.get(e);if(!t)return 0;let r=t.ke();return this.Ge.getRemoteKeysForTarget(e).size+r.addedDocuments.size-r.removedDocuments.size}$e(e){let t=this.ze.get(e);t||(R(r$,`recordPendingTargetRequest set up tracking for target ID ${e}`),t=new rj(e),this.ze.set(e,t)),t.$e()}Et(e){let t=this.He.get(e);return t||(t=new eR(Y),this.He=this.He.insert(e,t)),t}Tt(e){let t=this.Je.get(e);return t||(t=new eR(Y),this.Je=this.Je.insert(e,t)),t}nt(e){let t=null!==this.st(e);return t||R(r$,"Detected inactive target",e),t}st(e){let t=this.ze.get(e);return void 0===t||t.Ne?null:this.Ge.Rt(e)}rt(e){this.ze.set(e,new rj(e)),this.Ge.getRemoteKeysForTarget(e).forEach(t=>{this.et(e,t,null)})}It(e,t){return this.Ge.getRemoteKeysForTarget(e).has(t)}}function rB(){return new eA(ei.comparator)}function rW(){return new eA(ei.comparator)}let rz={asc:"ASCENDING",desc:"DESCENDING"},rq={"<":"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"},rH={and:"AND",or:"OR"};class rG{constructor(e,t){this.databaseId=e,this.useProto3Json=t}}function rK(e,t){return e.useProto3Json||eE(t)?t:{value:t}}function rY(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 rJ(e,t){return e.useProto3Json?t.toBase64():t.toUint8Array()}function rQ(e){let t;return F(!!e,49232),ep.fromTimestamp(new ef((t=eF(e)).seconds,t.nanos))}function rX(e,t){return rZ(e,t).canonicalString()}function rZ(e,t){let r=new et(["projects",e.projectId,"databases",e.database]).child("documents");return void 0===t?r:r.child(t)}function r0(e){let t=et.fromString(e);return F(nt(t),10190,{key:t.toString()}),t}function r1(e,t){return rX(e.databaseId,t.path)}function r2(e,t){let r=r0(t);if(r.get(1)!==e.databaseId.projectId)throw new U(L.INVALID_ARGUMENT,"Tried to deserialize key from different project: "+r.get(1)+" vs "+e.databaseId.projectId);if(r.get(3)!==e.databaseId.database)throw new U(L.INVALID_ARGUMENT,"Tried to deserialize key from different database: "+r.get(3)+" vs "+e.databaseId.database);return new ei(r6(r))}function r3(e,t){return rX(e.databaseId,t)}function r5(e){return new et(["projects",e.databaseId.projectId,"databases",e.databaseId.database]).canonicalString()}function r6(e){return F(e.length>4&&"documents"===e.get(4),29091,{key:e.toString()}),e.popFirst(5)}function r4(e,t,r){return{name:r1(e,t),fields:r.value.mapValue.fields}}function r8(e,t){var r,n;let i;if(t instanceof rg)i={update:r4(e,t.key,t.value)};else if(t instanceof rb)i={delete:r1(e,t.key)};else if(t instanceof rm){let r;i={update:r4(e,t.key,t.data),updateMask:(n=t.fieldMask,r=[],n.fields.forEach(e=>r.push(e.canonicalString())),{fieldPaths:r})}}else{if(!(t instanceof rw))return N(16599,{Vt:t.type});i={verify:r1(e,t.key)}}return t.fieldTransforms.length>0&&(i.updateTransforms=t.fieldTransforms.map(e=>(function(e){let t=e.transform;if(t instanceof t6)return{fieldPath:e.field.canonicalString(),setToServerValue:"REQUEST_TIME"};if(t instanceof t4)return{fieldPath:e.field.canonicalString(),appendMissingElements:{values:t.elements}};if(t instanceof t9)return{fieldPath:e.field.canonicalString(),removeAllFromArray:{values:t.elements}};if(t instanceof rt)return{fieldPath:e.field.canonicalString(),increment:t.Ae};if(t instanceof rr)return{fieldPath:e.field.canonicalString(),minimum:t.Ae};if(t instanceof rn)return{fieldPath:e.field.canonicalString(),maximum:t.Ae};throw N(20930,{transform:e.transform})})(e))),t.precondition.isNone||(i.currentDocument=void 0!==(r=t.precondition).updateTime?{updateTime:rY(e,r.updateTime.toTimestamp())}:void 0!==r.exists?{exists:r.exists}:N(27497)),i}function r9(e,t){var r,n;let i,s={structuredQuery:{}},a=t.path;null!==t.collectionGroup?(i=a,s.structuredQuery.from=[{collectionId:t.collectionGroup,allDescendants:!0}]):(i=a.popLast(),s.structuredQuery.from=[{collectionId:a.lastSegment()}]),s.parent=r3(e,i);let o=function(e){if(0!==e.length)return function e(t){var r;let n;return t instanceof tp?function(e){if("=="===e.op){if(tr(e.value))return{unaryFilter:{field:r7(e.field),op:"IS_NAN"}};if(tt(e.value))return{unaryFilter:{field:r7(e.field),op:"IS_NULL"}}}else if("!="===e.op){if(tr(e.value))return{unaryFilter:{field:r7(e.field),op:"IS_NOT_NA
180N"}};if(tt(e.value))return{unaryFilter:{field:r7(e.field),op:"IS_NOT_NULL"}}}return{fieldFilter:{field:r7(e.field),op:rq[e.op],value:e.value}}}(t):t instanceof tg?1===(n=(r=t).getFilters().map(t=>e(t))).length?n[0]:{compositeFilter:{op:rH[r.op],filters:n}}:N(54877,{filter:t})}(tg.create(e,"and"))}(t.filters);o&&(s.structuredQuery.where=o);let l=function(e){if(0!==e.length)return e.map(e=>({field:r7(e.field),direction:rz[e.dir]}))}(t.orderBy);l&&(s.structuredQuery.orderBy=l);let u=rK(e,t.limit);return null!==u&&(s.structuredQuery.limit=u),t.startAt&&(s.structuredQuery.startAt={before:(r=t.startAt).inclusive,values:r.position}),t.endAt&&(s.structuredQuery.endAt={before:!(n=t.endAt).inclusive,values:n.position}),{dt:s,parent:i}}function r7(e){return{fieldPath:e.canonicalString()}}function ne(e){return en.fromServerFormat(e.fieldPath)}function nt(e){return e.length>=4&&"projects"===e.get(0)&&"databases"===e.get(2)}function nr(e){return!!e&&"function"==typeof e._toProto&&"ProtoValue"===e._protoValueType}class nn{constructor(e,t,r,n,i=ep.min(),s=ep.min(),a=eN.EMPTY_BYTE_STRING,o=null){this.target=e,this.targetId=t,this.purpose=r,this.sequenceNumber=n,this.snapshotVersion=i,this.lastLimboFreeSnapshotVersion=s,this.resumeToken=a,this.expectedCount=o}withSequenceNumber(e){return new nn(this.target,this.targetId,this.purpose,e,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,this.expectedCount)}withResumeToken(e,t){return new nn(this.target,this.targetId,this.purpose,this.sequenceNumber,t,this.lastLimboFreeSnapshotVersion,e,null)}withExpectedCount(e){return new nn(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,this.lastLimboFreeSnapshotVersion,this.resumeToken,e)}withLastLimboFreeSnapshotVersion(e){return new nn(this.target,this.targetId,this.purpose,this.sequenceNumber,this.snapshotVersion,e,this.resumeToken,this.expectedCount)}}class ni{constructor(e){this.gt=e}}class ns{bt(e,t){this.Dt(e,t),t.Ct()}Dt(e,t){if("nullValue"in e)this.vt(t,5);else if("booleanValue"in e)this.vt(t,10),t.Ft(+!!e.booleanValue);else if("integerValue"in e)this.vt(t,15),t.Ft(eL(e.integerValue));else if("doubleValue"in e){let r=eL(e.doubleValue);isNaN(r)?this.vt(t,13):(this.vt(t,15),eS(r)?t.Ft(0):t.Ft(r))}else if("timestampValue"in e){let r=e.timestampValue;this.vt(t,20),"string"==typeof r&&(r=eF(r)),t.Mt(`${r.seconds||""}`),t.Ft(r.nanos||0)}else if("stringValue"in e)this.xt(e.stringValue,t),this.Ot(t);else if("bytesValue"in e)this.vt(t,30),t.Nt(eU(e.bytesValue)),this.Ot(t);else if("referenceValue"in e)this.Bt(e.referenceValue,t);else if("geoPointValue"in e){let r=e.geoPointValue;this.vt(t,45),t.Ft(r.latitude||0),t.Ft(r.longitude||0)}else"mapValue"in e?ta(e)?this.vt(t,Number.MAX_SAFE_INTEGER):ti(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)):N(19022,{Kt:e})}xt(e,t){this.vt(t,25),this.Ut(e,t)}Ut(e,t){t.Mt(e)}kt(e,t){let r=e.fields||{};for(let e of(this.vt(t,55),Object.keys(r)))this.xt(e,t),this.Dt(r[e],t)}Lt(e,t){let r=e.fields||{};this.vt(t,53);let n=r[eZ].arrayValue?.values?.length||0;this.vt(t,15),t.Ft(eL(n)),this.xt(eZ,t),this.Dt(r[eZ],t)}qt(e,t){let r=e.values||[];for(let e of(this.vt(t,50),r))this.Dt(e,t)}Bt(e,t){this.vt(t,37),ei.fromName(e).path.forEach(e=>{this.vt(t,60),this.Ut(e,t)})}vt(e,t){e.Ft(t)}Ot(e){e.Ft(2)}}ns.$t=new ns;class na{constructor(){this.Sn=new no}addToCollectionParentIndex(e,t){return this.Sn.add(t),e_.resolve()}getCollectionParents(e,t){return e_.resolve(this.Sn.getEntries(t))}addFieldIndex(e,t){return e_.resolve()}deleteFieldIndex(e,t){return e_.resolve()}deleteAllFieldIndexes(e){return e_.resolve()}createTargetIndexes(e,t){return e_.resolve()}getDocumentsMatchingTarget(e,t){return e_.resolve(null)}getIndexType(e,t){return e_.resolve(0)}getFieldIndexes(e,t){return e_.resolve([])}getNextCollectionGroupToUpdate(e){return e_.resolve(null)}getMinOffset(e,t){return e_.resolve(em.min())}getMinOffsetFromCollectionGroup(e,t){return e_.resolve(em.min())}updateCollectionGroup(e,t,r){return e_.resolve()}updateIndexEntries(e,t){return e_.resolve()}}class no{constructor(){this.index={}}add(e){let t=e.lastSegment(),r=e.popLast(),n=this.index[t]||new eR(et.comparator),i=!n.has(r);return this.index[t]=n.add(r),i}has(e){let t=e.lastSegment(),r=e.popLast(),n=this.index[t];return n&&n.has(r)}getEntries(e){return(this.index[e]||new eR(et.comparator)).toArray()}}new Uint8Array(0);let nl={didRun:!1,sequenceNumbersCollected:0,targetsRemoved:0,documentsRemoved:0};
180class nu{static withCacheSize(e){return new nu(e,nu.DEFAULT_COLLECTION_PERCENTILE,nu.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT)}constructor(e,t,r){this.cacheSizeCollectionThreshold=e,this.percentileToCollect=t,this.maximumSequenceNumbersToCollect=r}}nu.DEFAULT_COLLECTION_PERCENTILE=10,nu.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT=1e3,nu.DEFAULT=new nu(0x2800000,nu.DEFAULT_COLLECTION_PERCENTILE,nu.DEFAULT_MAX_SEQUENCE_NUMBERS_TO_COLLECT),nu.DISABLED=new nu(-1,0,0);class nc{constructor(e){this.ir=e}next(){return this.ir+=2,this.ir}static sr(){return new nc(0)}static _r(){return new nc(-1)}}let nh="LruGarbageCollector";function nd([e,t],[r,n]){let i=Y(e,r);return 0===i?Y(t,n):i}class nf{constructor(e){this.hr=e,this.buffer=new eR(nd),this.Pr=0}Tr(){return++this.Pr}Ir(e){let t=[e,this.Tr()];if(this.buffer.size<this.hr)this.buffer=this.buffer.add(t);else{let e=this.buffer.last();0>nd(t,e)&&(this.buffer=this.buffer.delete(e).add(t))}}get maxValue(){return this.buffer.last()[0]}}class np{constructor(e,t,r){this.garbageCollector=e,this.asyncQueue=t,this.localStore=r,this.Er=null}start(){-1!==this.garbageCollector.params.cacheSizeCollectionThreshold&&this.Rr(6e4)}stop(){this.Er&&(this.Er.cancel(),this.Er=null)}get started(){return null!==this.Er}Rr(e){R(nh,`Garbage collection scheduled in ${e}ms`),this.Er=this.asyncQueue.enqueueAfterDelay("lru_garbage_collection",e,async()=>{this.Er=null;try{await this.localStore.collectGarbage(this.garbageCollector)}catch(e){eb(e)?R(nh,"Ignoring IndexedDB error during garbage collection: ",e):await ey(e)}await this.Rr(3e5)})}}class ng{constructor(e,t){this.Ar=e,this.params=t}calculateTargetCount(e,t){return this.Ar.Vr(e).next(e=>Math.floor(t/100*e))}nthSequenceNumber(e,t){if(0===t)return e_.resolve(ew.ce);let r=new nf(t);return this.Ar.forEachTarget(e,e=>r.Ir(e.sequenceNumber)).next(()=>this.Ar.dr(e,e=>r.Ir(e))).next(()=>r.maxValue)}removeTargets(e,t,r){return this.Ar.removeTargets(e,t,r)}removeOrphanedDocuments(e,t){return this.Ar.removeOrphanedDocuments(e,t)}collect(e,t){return -1===this.params.cacheSizeCollectionThreshold?(R("LruGarbageCollector","Garbage collection skipped; disabled"),e_.resolve(nl)):this.getCacheSize(e).next(r=>r<this.params.cacheSizeCollectionThreshold?(R("LruGarbageCollector",`Garbage collection skipped; Cache size ${r} is lower than threshold ${this.params.cacheSizeCollectionThreshold}`),nl):this.mr(e,t))}getCacheSize(e){return this.Ar.getCacheSize(e)}mr(e,t){let r,n,i,s,a,o,l,u=Date.now();return this.calculateTargetCount(e,this.params.percentileToCollect).next(t=>(t>this.params.maximumSequenceNumbersToCollect?(R("LruGarbageCollector",`Capping sequence numbers to collect down to the maximum of ${this.params.maximumSequenceNumbersToCollect} from ${t}`),n=this.params.maximumSequenceNumbersToCollect):n=t,s=Date.now(),this.nthSequenceNumber(e,n))).next(n=>(r=n,a=Date.now(),this.removeTargets(e,r,t))).next(t=>(i=t,o=Date.now(),this.removeOrphanedDocuments(e,r))).next(e=>(l=Date.now(),x()<=E.$b.DEBUG&&R("LruGarbageCollector",`LRU Garbage Collection 181 Counted targets in ${s-u}ms 182 Determined least recently used ${n} in `+(a-s)+"ms\n"+` Removed ${i} targets in `+(o-a)+"ms\n"+` Removed ${e} documents in `+(l-o)+"ms\n"+`Total Duration: ${l-u}ms`),e_.resolve({didRun:!0,sequenceNumbersCollected:n,targetsRemoved:i,documentsRemoved:e})))}}class nm{constructor(){this.changes=new tq(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,tl.newInvalidDocument(e).setReadTime(t))}getEntry(e,t){this.assertNotApplied();let r=this.changes.get(t);return void 0!==r?e_.resolve(r):this.getFromCache(e,t)}getEntries(e,t){return this.getAllFromCache(e,t)}apply(e){return this.assertNotApplied(),this.changesApplied=!0,this.applyChanges(e)}assertNotApplied(){}}class nv{constructor(e,t){this.overlayedDocument=e,this.mutatedFields=t}}class ny{constructor(e,t,r,n){this.remoteDocumentCache=e,this.mutationQueue=t,this.documentOverlayCache=r,this.indexManager=n}getDocument(e,t){let r=null;return this.documentOverlayCache.getOverlay(e,t).next(n=>(r=n,this.remoteDocumentCache.getEntry(e,t))).next(e=>(null!==r&&rf(r.mutation,e,eD.empty(),ef.now()),e))}getDocuments(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.getLocalViewOfDocuments(e,t,tZ()).next(()=>t))}getLocalViewOfDocuments(e,t,r=tZ()){let n=tJ();return this.populateOverlays(e,n,t).next(()=>this.computeViews(e,t,n,r).next(e=>{let t=tK();return e.forEach((e,r)=>{t=t.insert(e,r.overlayedDocument)}),t}))}getOverlayedDocuments(e,t){let r=tJ();return this.populateOverlays(e,r,t).next(()=>this.computeViews(e,t,r,tZ()))}populateOverlays(e,t,r){let n=[];
182return r.forEach(e=>{t.has(e)||n.push(e)}),this.documentOverlayCache.getOverlays(e,n).next(e=>{e.forEach((e,r)=>{t.set(e,r)})})}computeViews(e,t,r,n){let i=tH,s=tJ(),a=tJ();return t.forEach((e,t)=>{let a=r.get(t.key);n.has(t.key)&&(void 0===a||a.mutation instanceof rm)?i=i.insert(t.key,t):void 0!==a?(s.set(t.key,a.mutation.getFieldMask()),rf(a.mutation,t,a.mutation.getFieldMask(),ef.now())):s.set(t.key,eD.empty())}),this.recalculateAndSaveOverlays(e,i).next(e=>(e.forEach((e,t)=>s.set(e,t)),t.forEach((e,t)=>a.set(e,new nv(t,s.get(e)??null))),a))}recalculateAndSaveOverlays(e,t){let r=tJ(),n=new eA((e,t)=>e-t),i=tZ();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 a=r.get(e)||eD.empty();a=i.applyToLocalView(s,a),r.set(e,a);let o=(n.get(i.batchId)||tZ()).add(e);n=n.insert(i.batchId,o)})}).next(()=>{let s=[],a=n.getReverseIterator();for(;a.hasNext();){let n=a.getNext(),o=n.key,l=n.value,u=tJ();l.forEach(e=>{if(!i.has(e)){let n=rd(t.get(e),r.get(e));null!==n&&u.set(e,n),i=i.add(e)}}),s.push(this.documentOverlayCache.saveOverlays(e,o,u))}return e_.waitFor(s)}).next(()=>r)}recalculateAndSaveOverlaysForDocumentKeys(e,t){return this.remoteDocumentCache.getEntries(e,t).next(t=>this.recalculateAndSaveOverlays(e,t))}getDocumentsMatchingQuery(e,t,r,n){return ei.isDocumentKey(t.path)&&null===t.collectionGroup&&0===t.filters.length?this.getDocumentsMatchingDocumentQuery(e,t.path):tN(t)?this.getDocumentsMatchingCollectionGroupQuery(e,t,r,n):this.getDocumentsMatchingCollectionQuery(e,t,r,n)}getNextDocuments(e,t,r,n){return this.remoteDocumentCache.getAllFromCollectionGroup(e,t,r,n).next(i=>{let s=n-i.size>0?this.documentOverlayCache.getOverlaysForCollectionGroup(e,t,r.largestBatchId,n-i.size):e_.resolve(tJ()),a=-1,o=i;return s.next(t=>e_.forEach(t,(t,r)=>(a<r.largestBatchId&&(a=r.largestBatchId),i.get(t)?e_.resolve():this.remoteDocumentCache.getEntry(e,t).next(e=>{o=o.insert(t,e)}))).next(()=>this.populateOverlays(e,t,i)).next(()=>this.computeViews(e,o,t,tZ())).next(e=>({batchId:a,changes:tY(e)})))})}getDocumentsMatchingDocumentQuery(e,t){return this.getDocument(e,new ei(t)).next(e=>{let t=tK();return e.isFoundDocument()&&(t=t.insert(e.key,e)),t})}getDocumentsMatchingCollectionGroupQuery(e,t,r,n){let i=t.collectionGroup,s=tK();return this.indexManager.getCollectionParents(e,i).next(a=>e_.forEach(a,a=>{let o=new tP(a.child(i),null,t.explicitOrderBy.slice(),t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt);return this.getDocumentsMatchingCollectionQuery(e,o,r,n).next(e=>{e.forEach((e,t)=>{s=s.insert(e,t)})})}).next(()=>s))}getDocumentsMatchingCollectionQuery(e,t,r,n){let i;return this.documentOverlayCache.getOverlaysForCollection(e,t.path,r.largestBatchId).next(s=>(i=s,this.remoteDocumentCache.getDocumentsMatchingQuery(e,t,r,i,n))).next(e=>{i.forEach((t,r)=>{let n=r.getKey();null===e.get(n)&&(e=e.insert(n,tl.newInvalidDocument(n)))});let r=tK();return e.forEach((e,n)=>{let s=i.get(e);void 0!==s&&rf(s.mutation,n,eD.empty(),ef.now()),tW(t,n)&&(r=r.insert(e,n))}),r})}}class n_{constructor(e){this.serializer=e,this.Or=new Map,this.Nr=new Map}getBundleMetadata(e,t){return e_.resolve(this.Or.get(t))}saveBundleMetadata(e,t){return this.Or.set(t.id,{id:t.id,version:t.version,createTime:rQ(t.createTime)}),e_.resolve()}getNamedQuery(e,t){return e_.resolve(this.Nr.get(t))}saveNamedQuery(e,t){var r;let n;return this.Nr.set(t.name,{name:t.name,query:(n=function(e){var t,r,n,i;let s,a,o,l,u,c=4===(s=r0(e.parent)).length?et.emptyPath():r6(s),h=e.structuredQuery,d=h.from?h.from.length:0,f=null;if(d>0){F(1===d,65062);let e=h.from[0];e.allDescendants?f=e.collectionId:c=c.child(e.collectionId)}let p=[];h.where&&(p=(a=function e(t){return void 0!==t.unaryFilter?function(e){switch(e.unaryFilter.op){case"IS_NAN":let t=ne(e.unaryFilter.field);return tp.create(t,"==",{doubleValue:NaN});case"IS_NULL":let r=ne(e.unaryFilter.field);return tp.create(r,"==",{nullValue:"NULL_VALUE"});case"IS_NOT_NAN":let n=ne(e.unaryFilter.field);return tp.create(n,"!=",{doubleValue:NaN});case"IS_NOT_NULL":let i=ne(e.unaryFilter.field);return tp.create(i,"!=",{nullValue:"NULL_VALUE"});case"OPERATOR_UNSPECIFIED":return N(61313);default:return N(60726)}}(t):void 0!==t.fieldFilter?tp.create(ne(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 N(58110);default:return N(50506)}}(t.fieldFilter.op),t.fieldFilter.value):void 0!==t.compositeFilter?tg.create(t.compositeFilter.filters.map(t=>e(t)),function(e){switch(e){case"AND":return"and";case"OR":return"or";default:return N(1026)}}(t.compositeFilter.op)):N(30097,{filter:t})}(h.where))instanceof tg&&tv(t=a)&&tm(t)?a.getFilters():[a]);let g=[];h.orderBy&&(g=h.orderBy.map(e=>new td(ne(e.field),function(e){switch(e){case"ASCENDING":return"asc";case"DESCENDING":return"desc";default:return}}(e.direction))));let m=null;h.limit&&(m=eE(o="object"==typeof(r=h.limit)?r.value:r)?null:o);let v=null;h.startAt&&(l=!!(n=h.startAt).before,v=new tu(n.values||[],l));let y=null;return h.endAt&&(u=!(i=h.endAt).before,y=new tu(i.values||[],u)),new tP(c,f,g,p,m,"F",v,y)}({parent:(r=t.bundledQuery).parent,structuredQuery:r.structuredQuery}
182),"LAST"===r.limitType?tj(n,n.limit,"L"):n),readTime:rQ(t.readTime)}),e_.resolve()}}class nb{constructor(){this.overlays=new eA(ei.comparator),this.Br=new Map}getOverlay(e,t){return e_.resolve(this.overlays.get(t))}getOverlays(e,t){let r=tJ();return e_.forEach(t,t=>this.getOverlay(e,t).next(e=>{null!==e&&r.set(t,e)})).next(()=>r)}saveOverlays(e,t,r){return r.forEach((r,n)=>{this.wt(e,t,n)}),e_.resolve()}removeOverlaysForBatchId(e,t,r){let n=this.Br.get(r);return void 0!==n&&(n.forEach(e=>this.overlays=this.overlays.remove(e)),this.Br.delete(r)),e_.resolve()}getOverlaysForCollection(e,t,r){let n=tJ(),i=t.length+1,s=new ei(t.child("")),a=this.overlays.getIteratorFrom(s);for(;a.hasNext();){let e=a.getNext().value,s=e.getKey();if(!t.isPrefixOf(s.path))break;s.path.length===i&&e.largestBatchId>r&&n.set(e.getKey(),e)}return e_.resolve(n)}getOverlaysForCollectionGroup(e,t,r,n){let i=new eA((e,t)=>e-t),s=this.overlays.getIterator();for(;s.hasNext();){let e=s.getNext().value;if(e.getKey().getCollectionGroup()===t&&e.largestBatchId>r){let t=i.get(e.largestBatchId);null===t&&(t=tJ(),i=i.insert(e.largestBatchId,t)),t.set(e.getKey(),e)}}let a=tJ(),o=i.getIterator();for(;o.hasNext()&&(o.getNext().value.forEach((e,t)=>a.set(e,t)),!(a.size()>=n)););return e_.resolve(a)}wt(e,t,r){let n=this.overlays.get(r.key);if(null!==n){let e=this.Br.get(n.largestBatchId).delete(r.key);this.Br.set(n.largestBatchId,e)}this.overlays=this.overlays.insert(r.key,new rI(t,r));let i=this.Br.get(t);void 0===i&&(i=tZ(),this.Br.set(t,i)),this.Br.set(t,i.add(r.key))}}class nw{constructor(){this.sessionToken=eN.EMPTY_BYTE_STRING}getSessionToken(e){return e_.resolve(this.sessionToken)}setSessionToken(e,t){return this.sessionToken=t,e_.resolve()}}class nE{constructor(){this.Lr=new eR(nS.kr),this.qr=new eR(nS.Kr)}isEmpty(){return this.Lr.isEmpty()}addReference(e,t){let r=new nS(e,t);this.Lr=this.Lr.add(r),this.qr=this.qr.add(r)}Ur(e,t){e.forEach(e=>this.addReference(e,t))}removeReference(e,t){this.$r(new nS(e,t))}Wr(e,t){e.forEach(e=>this.removeReference(e,t))}Qr(e){let t=new ei(new et([])),r=new nS(t,e),n=new nS(t,e+1),i=[];return this.qr.forEachInRange([r,n],e=>{this.$r(e),i.push(e.key)}),i}Gr(){this.Lr.forEach(e=>this.$r(e))}$r(e){this.Lr=this.Lr.delete(e),this.qr=this.qr.delete(e)}zr(e){let t=new ei(new et([])),r=new nS(t,e),n=new nS(t,e+1),i=tZ();return this.qr.forEachInRange([r,n],e=>{i=i.add(e.key)}),i}containsKey(e){let t=new nS(e,0),r=this.Lr.firstAfterOrEqual(t);return null!==r&&e.isEqual(r.key)}}class nS{constructor(e,t){this.key=e,this.jr=t}static kr(e,t){return ei.comparator(e.key,t.key)||Y(e.jr,t.jr)}static Kr(e,t){return Y(e.jr,t.jr)||ei.comparator(e.key,t.key)}}class nI{constructor(e,t){this.indexManager=e,this.referenceDelegate=t,this.mutationQueue=[],this.Xn=1,this.Jr=new eR(nS.kr)}checkEmpty(e){return e_.resolve(0===this.mutationQueue.length)}addMutationBatch(e,t,r,n){let i=this.Xn;this.Xn++,this.mutationQueue.length>0&&this.mutationQueue[this.mutationQueue.length-1];let s=new rE(i,t,r,n);for(let t of(this.mutationQueue.push(s),n))this.Jr=this.Jr.add(new nS(t.key,i)),this.indexManager.addToCollectionParentIndex(e,t.key.path.popLast());return e_.resolve(s)}lookupMutationBatch(e,t){return e_.resolve(this.Hr(t))}getNextMutationBatchAfterBatchId(e,t){let r=this.Zr(t+1),n=r<0?0:r;return e_.resolve(this.mutationQueue.length>n?this.mutationQueue[n]:null)}getHighestUnacknowledgedBatchId(){return e_.resolve(0===this.mutationQueue.length?-1:this.Xn-1)}getAllMutationBatches(e){return e_.resolve(this.mutationQueue.slice())}getAllMutationBatchesAffectingDocumentKey(e,t){let r=new nS(t,0),n=new nS(t,1/0),i=[];return this.Jr.forEachInRange([r,n],e=>{let t=this.Hr(e.jr);i.push(t)}),e_.resolve(i)}getAllMutationBatchesAffectingDocumentKeys(e,t){let r=new eR(Y);return t.forEach(e=>{let t=new nS(e,0),n=new nS(e,1/0);this.Jr.forEachInRange([t,n],e=>{r=r.add(e.jr)})}),e_.resolve(this.Xr(r))}getAllMutationBatchesAffectingQuery(e,t){let r=t.path,n=r.length+1,i=r;ei.isDocumentKey(i)||(i=i.child(""));let s=new nS(new ei(i),0),a=new eR(Y);return this.Jr.forEachWhile(e=>{let t=e.key.path;return!!r.isPrefixOf(t)&&(t.length===n&&(a=a.add(e.jr)),!0)},s),e_.resolve(this.Xr(a))}Xr(e){let t=[];
182return e.forEach(e=>{let r=this.Hr(e);null!==r&&t.push(r)}),t}removeMutationBatch(e,t){F(0===this.Yr(t.batchId,"removed"),55003),this.mutationQueue.shift();let r=this.Jr;return e_.forEach(t.mutations,n=>{let i=new nS(n.key,t.batchId);return r=r.delete(i),this.referenceDelegate.markPotentiallyOrphaned(e,n.key)}).next(()=>{this.Jr=r})}tr(e){}containsKey(e,t){let r=new nS(t,0),n=this.Jr.firstAfterOrEqual(r);return e_.resolve(t.isEqual(n&&n.key))}performConsistencyCheck(e){return this.mutationQueue.length,e_.resolve()}Yr(e,t){return this.Zr(e)}Zr(e){return 0===this.mutationQueue.length?0:e-this.mutationQueue[0].batchId}Hr(e){let t=this.Zr(e);return t<0||t>=this.mutationQueue.length?null:this.mutationQueue[t]}}class nk{constructor(e){this.ei=e,this.docs=new eA(ei.comparator),this.size=0}setIndexManager(e){this.indexManager=e}addEntry(e,t){let r=t.key,n=this.docs.get(r),i=n?n.size:0,s=this.ei(t);return this.docs=this.docs.insert(r,{document:t.mutableCopy(),size:s}),this.size+=s-i,this.indexManager.addToCollectionParentIndex(e,r.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 r=this.docs.get(t);return e_.resolve(r?r.document.mutableCopy():tl.newInvalidDocument(t))}getEntries(e,t){let r=tH;return t.forEach(e=>{let t=this.docs.get(e);r=r.insert(e,t?t.document.mutableCopy():tl.newInvalidDocument(e))}),e_.resolve(r)}getDocumentsMatchingQuery(e,t,r,n){let i=tH,s=t.path,a=new ei(s.child("__id-9223372036854775808__")),o=this.docs.getIteratorFrom(a);for(;o.hasNext();){let{key:e,value:{document:a}}=o.getNext();if(!s.isPrefixOf(e.path))break;e.path.length>s.length+1||0>=function(e,t){let r=e.readTime.compareTo(t.readTime);return 0!==r||0!==(r=ei.comparator(e.documentKey,t.documentKey))?r:Y(e.largestBatchId,t.largestBatchId)}(new em(a.readTime,a.key,-1),r)||(n.has(a.key)||tW(t,a))&&(i=i.insert(a.key,a.mutableCopy()))}return e_.resolve(i)}getAllFromCollectionGroup(e,t,r,n){N(9500)}ti(e,t){return e_.forEach(this.docs,e=>t(e))}newChangeBuffer(e){return new nT(this)}getSize(e){return e_.resolve(this.size)}}class nT extends nm{constructor(e){super(),this.Fr=e}applyChanges(e){let t=[];
182return this.changes.forEach((r,n)=>{n.isValidDocument()?t.push(this.Fr.addEntry(e,n)):this.Fr.removeEntry(r)}),e_.waitFor(t)}getFromCache(e,t){return this.Fr.getEntry(e,t)}getAllFromCache(e,t){return this.Fr.getEntries(e,t)}}class nA{constructor(e){this.persistence=e,this.ni=new tq(e=>tC(e),tx),this.lastRemoteSnapshotVersion=ep.min(),this.highestTargetId=0,this.ri=0,this.ii=new nE,this.targetCount=0,this.si=nc.sr()}forEachTarget(e,t){return this.ni.forEach((e,r)=>t(r)),e_.resolve()}getLastRemoteSnapshotVersion(e){return e_.resolve(this.lastRemoteSnapshotVersion)}getHighestSequenceNumber(e){return e_.resolve(this.ri)}allocateTargetId(e){return this.highestTargetId=this.si.next(),e_.resolve(this.highestTargetId)}setTargetsMetadata(e,t,r){return r&&(this.lastRemoteSnapshotVersion=r),t>this.ri&&(this.ri=t),e_.resolve()}cr(e){this.ni.set(e.target,e);let t=e.targetId;t>this.highestTargetId&&(this.si=new nc(t),this.highestTargetId=t),e.sequenceNumber>this.ri&&(this.ri=e.sequenceNumber)}addTargetData(e,t){return this.cr(t),this.targetCount+=1,e_.resolve()}updateTargetData(e,t){return this.cr(t),e_.resolve()}removeTargetData(e,t){return this.ni.delete(t.target),this.ii.Qr(t.targetId),this.targetCount-=1,e_.resolve()}removeTargets(e,t,r){let n=0,i=[];return this.ni.forEach((s,a)=>{a.sequenceNumber<=t&&null===r.get(a.targetId)&&(this.ni.delete(s),i.push(this.removeMatchingKeysForTargetId(e,a.targetId)),n++)}),e_.waitFor(i).next(()=>n)}getTargetCount(e){return e_.resolve(this.targetCount)}getTargetData(e,t){let r=this.ni.get(t)||null;return e_.resolve(r)}addMatchingKeys(e,t,r){return this.ii.Ur(t,r),e_.resolve()}removeMatchingKeys(e,t,r){this.ii.Wr(t,r);let n=this.persistence.referenceDelegate,i=[];return n&&t.forEach(t=>{i.push(n.markPotentiallyOrphaned(e,t))}),e_.waitFor(i)}removeMatchingKeysForTargetId(e,t){return this.ii.Qr(t),e_.resolve()}getMatchingKeysForTargetId(e,t){let r=this.ii.zr(t);return e_.resolve(r)}containsKey(e,t){return e_.resolve(this.ii.containsKey(t))}}class nC{constructor(e,t){this.oi={},this.overlays={},this._i=new ew(0),this.ai=!1,this.ai=!0,this.ui=new nw,this.referenceDelegate=e(this),this.ci=new nA(this),this.indexManager=new na,this.remoteDocumentCache=function(e){return new nk(e)}(e=>this.referenceDelegate.li(e)),this.serializer=new ni(t),this.hi=new n_(this.serializer)}start(){return Promise.resolve()}shutdown(){return this.ai=!1,Promise.resolve()}get started(){return this.ai}setDatabaseDeletedListener(){}setNetworkEnabled(){}getIndexManager(e){return this.indexManager}getDocumentOverlayCache(e){let t=this.overlays[e.toKey()];return t||(t=new nb,this.overlays[e.toKey()]=t),t}getMutationQueue(e,t){let r=this.oi[e.toKey()];return r||(r=new nI(t,this.referenceDelegate),this.oi[e.toKey()]=r),r}getGlobalsCache(){return this.ui}getTargetCache(){return this.ci}getRemoteDocumentCache(){return this.remoteDocumentCache}getBundleCache(){return this.hi}runTransaction(e,t,r){R("MemoryPersistence","Starting transaction:",e);let n=new nx(this._i.next());return this.referenceDelegate.Pi(),r(n).next(e=>this.referenceDelegate.Ti(n).next(()=>e)).toPromise().then(e=>(n.raiseOnCommittedEvent(),e))}Ii(e,t){return e_.or(Object.values(this.oi).map(r=>()=>r.containsKey(e,t)))}}class nx extends ev{constructor(e){super(),this.currentSequenceNumber=e}}class nR{constructor(e){this.persistence=e,this.Ei=new nE,this.Ri=null}static Ai(e){return new nR(e)}get Vi(){if(this.Ri)return this.Ri;throw N(60996)}addReference(e,t,r){return this.Ei.addReference(r,t),this.Vi.delete(r.toString()),e_.resolve()}removeReference(e,t,r){return this.Ei.removeReference(r,t),this.Vi.add(r.toString()),e_.resolve()}markPotentiallyOrphaned(e,t){return this.Vi.add(t.toString()),e_.resolve()}removeTarget(e,t){this.Ei.Qr(t.targetId).forEach(e=>this.Vi.add(e.toString()));let r=this.persistence.getTargetCache();return r.getMatchingKeysForTargetId(e,t.targetId).next(e=>{e.forEach(e=>this.Vi.add(e.toString()))}).next(()=>r.removeTargetData(e,t))}Pi(){this.Ri=new Set}Ti(e){let t=this.persistence.getRemoteDocumentCache().newChangeBuffer();return e_.forEach(this.Vi,r=>{let n=ei.fromPath(r);return this.di(e,n).next(e=>{e||t.removeEntry(n,ep.min())})}).next(()=>(this.Ri=null,t.apply(e)))}updateLimboDocument(e,t){return this.di(e,t).next(e=>{e?this.Vi.delete(t.toString()):this.Vi.add(t.toString())})}li(e){return 0}di(e,t){return e_.or([()=>e_.resolve(this.Ei.containsKey(t)),()=>this.persistence.getTargetCache().containsKey(e,t),()=>this.persistence.Ii(e,t)])}}class nP{constructor(e,t){this.persistence=e,this.mi=new tq(e=>(function(e){let t="";for(let r=0;r<e.length;r++)t.length>0&&(t+="\x01\x01"),t=function(e,t){let r=t,n=e.length;for(let t=0;t<n;t++){let n=e.charAt(t);switch(n){case"\0":r+="\x01\x10";break;case"\x01":r+="\x01\x11";break;default:r+=n}}return r}(e.get(r),t);return t+"\x01\x01"})(e.path),(e,t)=>e.isEqual(t)),this.garbageCollector=function(e,t){return new ng(e,t)}(this,t)}static Ai(e,t){return new nP(e,t)}Pi(){}Ti(e){return e_.resolve()}forEachTarget(e,t){return this.persistence.getTargetCache().forEac
182hTarget(e,t)}Vr(e){let t=this.gr(e);return this.persistence.getTargetCache().getTargetCount(e).next(e=>t.next(t=>e+t))}gr(e){let t=0;return this.dr(e,e=>{t++}).next(()=>t)}dr(e,t){return e_.forEach(this.mi,(r,n)=>this.yr(e,r,n).next(e=>e?e_.resolve():t(n)))}removeTargets(e,t,r){return this.persistence.getTargetCache().removeTargets(e,t,r)}removeOrphanedDocuments(e,t){let r=0,n=this.persistence.getRemoteDocumentCache(),i=n.newChangeBuffer();return n.ti(e,n=>this.yr(e,n,t).next(e=>{e||(r++,i.removeEntry(n,ep.min()))})).next(()=>i.apply(e)).next(()=>r)}markPotentiallyOrphaned(e,t){return this.mi.set(t,e.currentSequenceNumber),e_.resolve()}removeTarget(e,t){let r=t.withSequenceNumber(e.currentSequenceNumber);return this.persistence.getTargetCache().updateTargetData(e,r)}addReference(e,t,r){return this.mi.set(r,e.currentSequenceNumber),e_.resolve()}removeReference(e,t,r){return this.mi.set(r,e.currentSequenceNumber),e_.resolve()}updateLimboDocument(e,t){return this.mi.set(t,e.currentSequenceNumber),e_.resolve()}li(e){let t=e.key.toString().length;return e.isFoundDocument()&&(t+=function e(t){switch(e0(t)){case 0:case 1:return 4;case 2:return 8;case 3:case 8:return 16;case 4:let r=ez(t);return r?16+e(r):16;case 5:return 2*t.stringValue.length;case 6:return eU(t.bytesValue).approximateByteSize();case 7:return t.referenceValue.length;case 9:return(t.arrayValue.values||[]).reduce((t,r)=>t+e(r),0);case 10:case 11:var n;let i;return n=t.mapValue,i=0,ek(n.fields,(t,r)=>{i+=t.length+e(r)}),i;default:throw N(13486,{value:t})}}(e.data.value)),t}yr(e,t,r){return e_.or([()=>this.persistence.Ii(e,t),()=>this.persistence.getTargetCache().containsKey(e,t),()=>{let e=this.mi.get(t);return e_.resolve(void 0!==e&&e>r)}])}getCacheSize(e){return this.persistence.getRemoteDocumentCache().getSize(e)}}class nD{constructor(e,t,r,n){this.targetId=e,this.fromCache=t,this.Ps=r,this.Ts=n}static Is(e,t){let r=tZ(),n=tZ();for(let e of t.docChanges)switch(e.type){case 0:r=r.add(e.doc.key);break;case 1:n=n.add(e.doc.key)}return new nD(e,t.fromCache,r,n)}}class nO{constructor(){this._documentReadCount=0}get documentReadCount(){return this._documentReadCount}incrementDocumentReadCount(e){this._documentReadCount+=e}}class nN{constructor(){this.Es=!1,this.Rs=!1,this.As=100,this.Vs=function(){let e;return(0,_.nr)()?8:Number((e=(0,_.ZQ)().match(/Android ([\d.]+)/i))?e[1].split(".").slice(0,2).join("."):"-1")>0?6:4}()}initialize(e,t){this.ds=e,this.indexManager=t,this.Es=!0}getDocumentsMatchingQuery(e,t,r,n){let i={result:null};return this.fs(e,t).next(e=>{i.result=e}).next(()=>{if(!i.result)return this.gs(e,t,n,r).next(e=>{i.result=e})}).next(()=>{if(i.result)return;let r=new nO;return this.ps(e,t,r).next(n=>{if(i.result=n,this.Rs)return this.ys(e,t,r,n.size)})}).next(()=>i.result)}ys(e,t,r,n){return r.documentReadCount<this.As?(x()<=E.$b.DEBUG&&R("QueryEngine","SDK will not create cache indexes for query:",tB(t),"since it only creates cache indexes for collection contains","more than or equal to",this.As,"documents"),e_.resolve()):(x()<=E.$b.DEBUG&&R("QueryEngine","Query:",tB(t),"scans",r.documentReadCount,"local documents and returns",n,"documents as results."),r.documentReadCount>this.Vs*n?(x()<=E.$b.DEBUG&&R("QueryEngine","The SDK decides to create cache indexes for query:",tB(t),"as using cache indexes may help improve performance."),this.indexManager.createTargetIndexes(e,tF(t))):e_.resolve())}fs(e,t){if(tO(t))return e_.resolve(null);let r=tF(t);return this.indexManager.getIndexType(e,r).next(n=>0===n?null:(null!==t.limit&&1===n&&(r=tF(t=tj(t,null,"F"))),this.indexManager.getDocumentsMatchingTarget(e,r).next(n=>{let i=tZ(...n);return this.ds.getDocuments(e,i).next(n=>this.indexManager.getMinOffset(e,r).next(r=>{let s=this.ws(t,n);return this.Ss(t,s,i,r.readTime)?this.fs(e,tj(t,null,"F")):this.bs(e,s,t,r)}))})))}gs(e,t,r,n){return tO(t)||n.isEqual(ep.min())?e_.resolve(null):this.ds.getDocuments(e,r).next(i=>{let s,a,o=this.ws(t,i);return this.Ss(t,o,r,n)?e_.resolve(null):(x()<=E.$b.DEBUG&&R("QueryEngine","Re-using previous result from %s to execute query: %s",n.toString(),tB(t)),this.bs(e,o,t,(s=n.toTimestamp().seconds,a=n.toTimestamp().nanoseconds+1,new em(ep.fromTimestamp(1e9===a?new ef(s+1,0):new ef(s,a)),ei.empty(),-1))
182).next(e=>e))})}ws(e,t){let r=new eR(tz(e));return t.forEach((t,n)=>{tW(e,n)&&(r=r.add(n))}),r}Ss(e,t,r,n){if(null===e.limit)return!1;if(r.size!==t.size)return!0;let i="F"===e.limitType?t.last():t.first();return!!i&&(i.hasPendingWrites||i.version.compareTo(n)>0)}ps(e,t,r){return x()<=E.$b.DEBUG&&R("QueryEngine","Using full collection scan to execute query:",tB(t)),this.ds.getDocumentsMatchingQuery(e,t,em.min(),r)}bs(e,t,r,n){return this.ds.getDocumentsMatchingQuery(e,r,n).next(e=>(t.forEach(t=>{e=e.insert(t.key,t)}),e))}}let nM="LocalStore";class nF{constructor(e,t,r,n){this.persistence=e,this.Ds=t,this.serializer=n,this.Cs=new eA(Y),this.vs=new tq(e=>tC(e),tx),this.Fs=new Map,this.Ms=e.getRemoteDocumentCache(),this.ci=e.getTargetCache(),this.hi=e.getBundleCache(),this.xs(r)}xs(e){this.documentOverlayCache=this.persistence.getDocumentOverlayCache(e),this.indexManager=this.persistence.getIndexManager(e),this.mutationQueue=this.persistence.getMutationQueue(e,this.indexManager),this.localDocuments=new ny(this.Ms,this.mutationQueue,this.documentOverlayCache,this.indexManager),this.Ms.setIndexManager(this.indexManager),this.Ds.initialize(this.localDocuments,this.indexManager)}collectGarbage(e){return this.persistence.runTransaction("Collect garbage","readwrite-primary",t=>e.collect(t,this.Cs))}}async function nL(e,t){return await e.persistence.runTransaction("Handle user change","readonly",r=>{let n;return e.mutationQueue.getAllMutationBatches(r).next(i=>(n=i,e.xs(t),e.mutationQueue.getAllMutationBatches(r))).next(t=>{let i=[],s=[],a=tZ();for(let e of n)for(let t of(i.push(e.batchId),e.mutations))a=a.add(t.key);for(let e of t)for(let t of(s.push(e.batchId),e.mutations))a=a.add(t.key);return e.localDocuments.getDocuments(r,a).next(e=>({Os:e,removedBatchIds:i,addedBatchIds:s}))})})}function nU(e){return e.persistence.runTransaction("Get last remote snapshot version","readonly",t=>e.ci.getLastRemoteSnapshotVersion(t))}async function nj(e,t,r){let n=e.Cs.get(t);try{r||await e.persistence.runTransaction("Release target",r?"readwrite":"readwrite-primary",t=>e.persistence.referenceDelegate.removeTarget(t,n))}catch(e){if(!eb(e))throw e;R(nM,`Failed to update sequence numbers for target ${t}: ${e}`)}e.Cs=e.Cs.remove(t),e.vs.delete(n.target)}function n$(e,t,r){let n=ep.min(),i=tZ();return e.persistence.runTransaction("Execute query","readwrite",s=>{var a;let o;return(a=tF(t),void 0!==(o=e.vs.get(a))?e_.resolve(e.Cs.get(o)):e.ci.getTargetData(s,a)).next(t=>{if(t)return n=t.lastLimboFreeSnapshotVersion,e.ci.getMatchingKeysForTargetId(s,t.targetId).next(e=>{i=e})}).next(()=>e.Ds.getDocumentsMatchingQuery(s,t,r?n:ep.min(),r?i:tZ())).next(r=>{var n,s,a;let o;return n=e,s=t.collectionGroup||(t.path.length%2==1?t.path.lastSegment():t.path.get(t.path.length-2)),a=r,o=n.Fs.get(s)||ep.min(),a.forEach((e,t)=>{t.readTime.compareTo(o)>0&&(o=t.readTime)}),n.Fs.set(s,o),{documents:r,Ls:i}})})}class nV{constructor(){this.activeTargetIds=t0}Ws(e){this.activeTargetIds=this.activeTargetIds.add(e)}Qs(e){this.activeTargetIds=this.activeTargetIds.delete(e)}$s(){return JSON.stringify({activeTargetIds:this.activeTargetIds.toArray(),updateTimeMs:Date.now()})}}class nB{constructor(){this.Co=new nV,this.vo={},this.onlineStateHandler=null,this.sequenceNumberHandler=null}addPendingMutation(e){}updateMutationState(e,t,r){}addLocalQueryTarget(e,t=!0){return t&&this.Co.Ws(e),this.vo[e]||"not-current"}updateQueryState(e,t,r){this.vo[e]=t}removeLocalQueryTarget(e){this.Co.Qs(e)}isLocalQueryTarget(e){return this.Co.activeTargetIds.has(e)}clearQueryState(e){delete this.vo[e]}getAllActiveQueryTargets(){return this.Co.activeTargetIds}isActiveQueryTarget(e){return this.Co.activeTargetIds.has(e)}start(){return this.Co=new nV,Promise.resolve()}handleUserChange(e,t,r){}setOnlineState(e){}shutdown(){}writeSequenceNumber(e){}notifyBundleLoaded(e){}}class nW{Fo(e){}shutdown(){}}let nz="ConnectivityMonitor";class nq{constructor(){this.Mo=()=>this.xo(),this.Oo=()=>this.No(),this.Bo=[],this.Lo()}Fo(e){this.Bo.push(e)}shutdown(){window.removeEventListener("online",this.Mo),window.removeEventListener("offline",this.Oo)}Lo(){window.addEventListener("online",this.Mo),window.addEventListener("offline",this.Oo)}xo(){for(let e of(R(nz,"Network connectivity changed: AVAILABLE"),this.Bo))e(0)}No(){for(let e of(R(nz,"Network connectivity changed: UNAVAILABLE"),this.Bo))e(1)}static v(){return"u">typeof window&&void 0!==window.addEventListener&&void 0!==window.removeEventListener}}let nH=null;function nG(){return null===nH?nH=0x10000000+Math.round(0x80000000*Math.random()):nH++,"0x"+nH.toString(16)}let nK="RestConnection",nY={BatchGetDocuments:"batchGet",Commit:"commit",RunQuery:"runQuery",RunAggregation
182Query:"runAggregationQuery",ExecutePipeline:"executePipeline"};class nJ{get ko(){return!1}constructor(e){this.databaseInfo=e,this.databaseId=e.databaseId;const t=e.ssl?"https":"http",r=encodeURIComponent(this.databaseId.projectId),n=encodeURIComponent(this.databaseId.database);this.qo=t+"://"+e.host,this.Ko=`projects/${r}/databases/${n}`,this.Uo=this.databaseId.database===eG?`project_id=${r}`:`project_id=${r}&database_id=${n}`}$o(e,t,r,n,i){let s=nG(),a=this.Wo(e,t.toUriEncodedString());R(nK,`Sending RPC '${e}' ${s}:`,a,r);let o={"google-cloud-resource-prefix":this.Ko,"x-goog-request-params":this.Uo};this.Qo(o,n,i);let{host:l}=new URL(a),u=(0,_.zJ)(l);return this.Go(e,a,o,r,u).then(t=>(R(nK,`Received RPC '${e}' ${s}: `,t),t),t=>{throw D(nK,`RPC '${e}' ${s} failed with error: `,t,"url: ",a,"request:",r),t})}zo(e,t,r,n,i,s){return this.$o(e,t,r,n,i)}Qo(e,t,r){e["X-Goog-Api-Client"]="gl-js/ fire/"+A,e["Content-Type"]="text/plain",this.databaseInfo.appId&&(e["X-Firebase-GMPID"]=this.databaseInfo.appId),t&&t.headers.forEach((t,r)=>e[r]=t),r&&r.headers.forEach((t,r)=>e[r]=t)}Wo(e,t){let r=nY[e],n=`${this.qo}/v1/${t}:${r}`;return this.databaseInfo.apiKey&&(n=`${n}?key=${encodeURIComponent(this.databaseInfo.apiKey)}`),n}terminate(){}}class nQ{constructor(e){this.jo=e.jo,this.Jo=e.Jo}Ho(e){this.Zo=e}Xo(e){this.Yo=e}e_(e){this.t_=e}onMessage(e){this.n_=e}close(){this.Jo()}send(e){this.jo(e)}r_(){this.Zo()}i_(){this.Yo()}s_(e){this.t_(e)}o_(e){this.n_(e)}}let nX="WebChannelConnection",nZ=(e,t,r)=>{e.listen(t,e=>{try{r(e)}catch(e){setTimeout(()=>{throw e},0)}})};class n0 extends nJ{constructor(e){super(e),this.__=[],this.forceLongPolling=e.forceLongPolling,this.autoDetectLongPolling=e.autoDetectLongPolling,this.useFetchStreams=e.useFetchStreams,this.longPollingOptions=e.longPollingOptions}static a_(){n0.u_||(nZ(h(),c.STAT_EVENT,e=>{e.stat===u.PROXY?R(nX,"STAT_EVENT: detected buffering proxy"):e.stat===u.NOPROXY&&R(nX,"STAT_EVENT: detected no buffering proxy")}),n0.u_=!0)}Go(e,t,r,n,i){let a=nG();return new Promise((i,u)=>{let c=new s;c.setWithCredentials(!0),c.listenOnce(o.COMPLETE,()=>{try{switch(c.getLastErrorCode()){case l.NO_ERROR:let t=c.getResponseJson();R(nX,`XHR for RPC '${e}' ${a} received:`,JSON.stringify(t)),i(t);break;case l.TIMEOUT:R(nX,`RPC '${e}' ${a} timed out`),u(new U(L.DEADLINE_EXCEEDED,"Request time out"));break;case l.HTTP_ERROR:let r=c.getStatus();if(R(nX,`RPC '${e}' ${a} failed with status:`,r,"response text:",c.getResponseText()),r>0){let e=c.getResponseJson();Array.isArray(e)&&(e=e[0]);let t=e?.error;if(t&&t.status&&t.message){let e,r=(e=t.status.toLowerCase().replace(/_/g,"-"),Object.values(L).indexOf(e)>=0?e:L.UNKNOWN);u(new U(r,t.message))}else u(new U(L.UNKNOWN,"Server responded with status "+c.getStatus()))}else u(new U(L.UNAVAILABLE,"Connection failed."));break;default:N(9055,{c_:e,streamId:a,l_:c.getLastErrorCode(),h_:c.getLastError()})}}finally{R(nX,`RPC '${e}' ${a} completed.`)}});let h=JSON.stringify(n);R(nX,`RPC '${e}' ${a} sending request:`,n),c.send(t,"POST",h,r,15)})}P_(e,t,r){let n=nG(),i=[this.qo,"/","google.firestore.v1.Firestore","/",e,"/channel"],s=this.createWebChannelTransport(),o={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},l=this.longPollingOptions.timeoutSeconds;void 0!==l&&(o.longPollingTimeout=Math.round(1e3*l)),this.useFetchStreams&&(o.useFetchStreams=!0),this.Qo(o.initMessageHeaders,t,r),o.encodeInitMessageHeaders=!0;let u=i.join("");R(nX,`Creating RPC '${e}' stream ${n}: ${u}`,o);let c=s.createWebChannel(u,o);this.T_(c);let h=!1,d=!1,p=new nQ({jo:t=>{d?R(nX,`Not sending because RPC '${e}' stream ${n} is closed:`,t):(h||(R(nX,`Opening RPC '${e}' stream ${n} transport.`),c.open(),h=!0),R(nX,`RPC '${e}' stream ${n} sending:`,t),c.send(t))},Jo:()=>c.close()});return nZ(c,a.EventType.OPEN,()=>{d||(R(nX,`RPC '${e}' stream ${n} transport opened.`),p.r_())}),nZ(c,a.EventType.CLOSE,()=>{d||(d=!0,R(nX,`RPC '${e}' stream ${n} transport closed`),p.s_(),this.I_(c))}
182),nZ(c,a.EventType.ERROR,t=>{d||(d=!0,D(nX,`RPC '${e}' stream ${n} transport errored. Name:`,t.name,"Message:",t.message),p.s_(new U(L.UNAVAILABLE,"The operation could not be completed")))}),nZ(c,a.EventType.MESSAGE,t=>{if(!d){let r=t.data[0];F(!!r,16349);let i=r?.error||r[0]?.error;if(i){R(nX,`RPC '${e}' stream ${n} received error:`,i);let t=i.status,r=function(e){let t=f[e];if(void 0!==t)return rC(t)}(t),s=i.message;"NOT_FOUND"===t&&s.includes("database")&&s.includes("does not exist")&&s.includes(this.databaseId.database)&&D(`Database '${this.databaseId.database}' not found. Please check your project configuration.`),void 0===r&&(r=L.INTERNAL,s="Unknown error status: "+t+" with message "+i.message),d=!0,p.s_(new U(r,s)),c.close()}else R(nX,`RPC '${e}' stream ${n} received:`,r),p.o_(r)}}),n0.a_(),setTimeout(()=>{p.i_()},0),p}terminate(){this.__.forEach(e=>e.close()),this.__=[]}T_(e){this.__.push(e)}I_(e){this.__=this.__.filter(t=>t===e)}Qo(e,t,r){super.Qo(e,t,r),this.databaseInfo.apiKey&&(e["x-goog-api-key"]=this.databaseInfo.apiKey)}createWebChannelTransport(){return d()}}function n1(){return"u">typeof document?document:null}function n2(e){return new rG(e,!0)}n0.u_=!1;class n3{constructor(e,t,r=1e3,n=1.5,i=6e4){this.Di=e,this.timerId=t,this.E_=r,this.R_=n,this.A_=i,this.V_=0,this.d_=null,this.m_=Date.now(),this.reset()}reset(){this.V_=0}f_(){this.V_=this.A_}g_(e){this.cancel();let t=Math.floor(this.V_+this.p_()),r=Math.max(0,Date.now()-this.m_),n=Math.max(0,t-r);n>0&&R("ExponentialBackoff",`Backing off for ${n} ms (base delay: ${this.V_} ms, delay with jitter: ${t} ms, last attempt: ${r} ms ago)`),this.d_=this.Di.enqueueAfterDelay(this.timerId,n,()=>(this.m_=Date.now(),e())),this.V_*=this.R_,this.V_<this.E_&&(this.V_=this.E_),this.V_>this.A_&&(this.V_=this.A_)}y_(){null!==this.d_&&(this.d_.skipDelay(),this.d_=null)}cancel(){null!==this.d_&&(this.d_.cancel(),this.d_=null)}p_(){return(Math.random()-.5)*this.V_}}let n5="PersistentStream";class n6{constructor(e,t,r,n,i,s,a,o){this.Di=e,this.w_=r,this.S_=n,this.connection=i,this.authCredentialsProvider=s,this.appCheckCredentialsProvider=a,this.listener=o,this.state=0,this.b_=0,this.D_=null,this.C_=null,this.stream=null,this.v_=0,this.F_=new n3(e,t)}M_(){return 1===this.state||5===this.state||this.x_()}x_(){return 2===this.state||3===this.state}start(){this.v_=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.Di.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)}K_(){this.C_&&(this.C_.cancel(),this.C_=null)}async close(e,t){this.q_(),this.K_(),this.F_.cancel(),this.b_++,4!==e?this.F_.reset():t&&t.code===L.RESOURCE_EXHAUSTED?(P(t.toString()),P("Using maximum backoff delay to prevent overloading the backend."),this.F_.f_()):t&&t.code===L.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.e_(t)}U_(){}auth(){this.state=1;let e=this.W_(this.b_),t=this.b_;Promise.all([this.authCredentialsProvider.getToken(),this.appCheckCredentialsProvider.getToken()]).then(([e,r])=>{this.b_===t&&this.Q_(e,r)},t=>{e(()=>{let e=new U(L.UNKNOWN,"Fetching auth token failed: "+t.message);return this.G_(e)})})}Q_(e,t){let r=this.W_(this.b_);this.stream=this.z_(e,t),this.stream.Ho(()=>{r(()=>this.listener.Ho())}),this.stream.Xo(()=>{r(()=>(this.state=2,this.C_=this.Di.enqueueAfterDelay(this.S_,1e4,()=>(this.x_()&&(this.state=3),Promise.resolve())),this.listener.Xo()))}),this.stream.e_(e=>{r(()=>this.G_(e))}),this.stream.onMessage(e=>{r(()=>1==++this.v_?this.j_(e):this.onNext(e))})}O_(){this.state=5,this.F_.g_(async()=>{this.state=0,this.start()})}G_(e){return R(n5,`close with error: ${e}`),this.stream=null,this.close(4,e)}W_(e){return t=>{this.Di.enqueueAndForget(()=>this.b_===e?t():(R(n5,"stream callback skipped by getCloseGuardedDispatcher."),Promise.resolve()))}}}class n4 extends n6{constructor(e,t,r,n,i,s){super(e,"listen_stream_connection_backoff","listen_stream_idle","health_check_timeout",t,r,n,s),this.serializer
182=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 r;if("targetChange"in t){var n,i;t.targetChange;let s="NO_CHANGE"===(n=t.targetChange.targetChangeType||"NO_CHANGE")?0:"ADD"===n?1:"REMOVE"===n?2:"CURRENT"===n?3:"RESET"===n?4:N(39313,{state:n}),a=t.targetChange.targetIds||[],o=(i=t.targetChange.resumeToken,e.useProto3Json?(F(void 0===i||"string"==typeof i,58123),eN.fromBase64String(i||"")):(F(void 0===i||i instanceof k||i instanceof Uint8Array,16193),eN.fromUint8Array(i||new Uint8Array))),l=t.targetChange.cause;r=new rU(s,a,o,l&&new U(void 0===l.code?L.UNKNOWN:rC(l.code),l.message||"")||null)}else if("documentChange"in t){t.documentChange;let n=t.documentChange;n.document,n.document.name,n.document.updateTime;let i=r2(e,n.document.name),s=rQ(n.document.updateTime),a=n.document.createTime?rQ(n.document.createTime):ep.min(),o=new to({mapValue:{fields:n.document.fields}}),l=tl.newFoundDocument(i,s,a,o);r=new rF(n.targetIds||[],n.removedTargetIds||[],l.key,l)}else if("documentDelete"in t){t.documentDelete;let n=t.documentDelete;n.document;let i=r2(e,n.document),s=n.readTime?rQ(n.readTime):ep.min(),a=tl.newNoDocument(i,s);r=new rF([],n.removedTargetIds||[],a.key,a)}else if("documentRemove"in t){t.documentRemove;let n=t.documentRemove;n.document;let i=r2(e,n.document);r=new rF([],n.removedTargetIds||[],i,null)}else{if(!("filter"in t))return N(11601,{At:t});{t.filter;let e=t.filter;e.targetId;let{count:n=0,unchangedNames:i}=e,s=new rT(n,i);r=new rL(e.targetId,s)}}return r}(this.serializer,e),r=function(e){if(!("targetChange"in e))return ep.min();let t=e.targetChange;return t.targetIds&&t.targetIds.length?ep.min():t.readTime?rQ(t.readTime):ep.min()}(e);return this.listener.J_(t,r)}H_(e){let t,r={};r.database=r5(this.serializer),r.addTarget=function(e,t){let r,n=t.target;if((r=tR(n)?{documents:{documents:[r3(e,n.path)]}}:{query:r9(e,n).dt}).targetId=t.targetId,t.resumeToken.approximateByteSize()>0){r.resumeToken=rJ(e,t.resumeToken);let n=rK(e,t.expectedCount);null!==n&&(r.expectedCount=n)}else if(t.snapshotVersion.compareTo(ep.min())>0){r.readTime=rY(e,t.snapshotVersion.toTimestamp());let n=rK(e,t.expectedCount);null!==n&&(r.expectedCount=n)}return r}(this.serializer,e);let n=(this.serializer,null==(t=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 N(28987,{purpose:e})}}(e.purpose))?null:{"goog-listen-tags":t});n&&(r.labels=n),this.k_(r)}Z_(e){let t={};t.database=r5(this.serializer),t.removeTarget=e,this.k_(t)}}class n8 extends n6{constructor(e,t,r,n,i,s){super(e,"write_stream_connection_backoff","write_stream_idle","health_check_timeout",t,r,n,s),this.serializer=i}get X_(){return this.v_>0}start(){this.lastStreamToken=void 0,super.start()}U_(){this.X_&&this.Y_([])}z_(e,t){return this.connection.P_("Write",e,t)}j_(e){return F(!!e.streamToken,31322),this.lastStreamToken=e.streamToken,F(!e.writeResults||0===e.writeResults.length,55816),this.listener.ea()}onNext(e){var t,r;F(!!e.streamToken,12678),this.lastStreamToken=e.streamToken,this.F_.reset();let n=(t=e.writeResults,r=e.commitTime,t&&t.length>0?(F(void 0!==r,14353),t.map(e=>{let t;return(t=e.updateTime?rQ(e.updateTime):rQ(r)).isEqual(ep.min())&&(t=rQ(r)),new rl(t,e.transformResults||[])})):[]),i=rQ(e.commitTime);return this.listener.ta(i,n)}na(){let e={};e.database=r5(this.serializer),this.k_(e)}Y_(e){let t={streamToken:this.lastStreamToken,writes:e.map(e=>r8(this.serializer,e))};this.k_(t)}}class n9{}class n7 extends n9{constructor(e,t,r,n){super(),this.authCredentials=e,this.appCheckCredentials=t,this.connection=r,this.serializer=n,this.ra=!1}ia(){if(this.ra)throw new U(L.FAILED_PRECONDITION,"The client has already been terminated.")}$o(e,t,r,n){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([i,s])=>this.connection.$o(e,rZ(t,r),n,i,s)).catch(e=>{throw"FirebaseError"===e.name?(e.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new U(L.UNKNOWN,e.toString())})}zo(e,t,r,n,i){return this.ia(),Promise.all([this.authCredentials.getToken(),this.appCheckCredentials.getToken()]).then(([s,a])=>this.connection.zo(e,rZ(t,r),n,s,a,i)).catch(e=>{throw"FirebaseError"===e.name?(e.code===L.UNAUTHENTICATED&&(this.authCredentials.invalidateToken(),this.appCheckCredentials.invalidateToken()),e):new U(L.UNKNOWN,e.toString())})}terminate(){this.ra=!0,this.connection.terminate()}}class ie{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} 183This 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?(P(t),this._a=!1):R("OnlineStateTracker",t)}ha(){null!==this.oa&&(this.oa.cancel(),this.oa=null)}}let it="RemoteStore";class ir{constructor(e,t,r,n,i){this.localStore=e,this.datastore=t,this.asyncQueue=r,this.remoteSyncer={},this.Pa=[],this.Ta=new Map,this.Ia=new Map,this.Ea=new Map,this.Ra=new nc(1e3),this.Aa=new nc(1001),this.Va=new Set,this.da=[],this.ma=i,this.ma.Fo(e=>{r.enqueueAndForget(async()=>
183{ip(this)&&(R(it,"Restarting streams for network reachability change."),await async function(e){e.Va.add(4),await is(e),e.fa.set("Unknown"),e.Va.delete(4),await ii(e)}(this))})}),this.fa=new ie(r,n)}}async function ii(e){if(ip(e))for(let t of e.da)await t(!0)}async function is(e){for(let t of e.da)await t(!1)}function ia(e,t){return e.Ia.get(t)||void 0}function io(e,t){var r;let n,i,s=ia(e,t.targetId);if(void 0!==s&&e.Ta.has(s))return;let a=(void 0!==(n=ia(e,r=t.targetId))&&e.Ea.delete(n),i=r%2!=0?e.Aa.next():e.Ra.next(),e.Ia.set(r,i),e.Ea.set(i,r),i);R(it,"remoteStoreListen mapping SDK target ID to remote",t.targetId,a);let o=new nn(t.target,a,t.purpose,t.sequenceNumber,t.snapshotVersion,t.lastLimboFreeSnapshotVersion,t.resumeToken);e.Ta.set(a,o),id(e)?ih(e):iR(e).x_()&&iu(e,o)}function il(e,t){let r=iR(e),n=ia(e,t);R(it,"remoteStoreUnlisten removing mapping of SDK target ID to remote",t,n),e.Ta.delete(n),e.Ia.delete(t),e.Ea.delete(n),r.x_()&&ic(e,n),0===e.Ta.size&&(r.x_()?r.B_():ip(e)&&e.fa.set("Unknown"))}function iu(e,t){if(e.ga.$e(t.targetId),t.resumeToken.approximateByteSize()>0||t.snapshotVersion.compareTo(ep.min())>0){let r=e.Ea.get(t.targetId);if(void 0===r)return void R(it,"SDK target ID not found for remote ID: "+t.targetId);let n=e.remoteSyncer.getRemoteKeysForTarget(r).size;t=t.withExpectedCount(n)}iR(e).H_(t)}function ic(e,t){e.ga.$e(t),iR(e).Z_(t)}function ih(e){e.ga=new rV({getRemoteKeysForTarget:t=>{let r=e.Ea.get(t);return void 0!==r?e.remoteSyncer.getRemoteKeysForTarget(r):tZ()},Rt:t=>e.Ta.get(t)||null,lt:()=>e.datastore.serializer.databaseId}),iR(e).start(),e.fa.aa()}function id(e){return ip(e)&&!iR(e).M_()&&e.Ta.size>0}function ip(e){return 0===e.Va.size}async function ig(e){e.fa.set("Online")}async function im(e){e.Ta.forEach((t,r)=>{iu(e,t)})}async function iv(e,t){e.ga=void 0,id(e)?(e.fa.la(t),ih(e)):e.fa.set("Unknown")}async function iy(e,t,r){if(e.fa.set("Online"),t instanceof rU&&2===t.state&&t.cause)try{await async function(e,t){let r=t.cause;for(let n of t.targetIds){if(e.Ta.has(n)){let t=e.Ea.get(n);void 0!==t&&(await e.remoteSyncer.rejectListen(t,r),e.Ia.delete(t),e.Ea.delete(n)),e.Ta.delete(n)}e.ga.removeTarget(n)}}(e,t)}catch(r){R(it,"Failed to remove targets %s: %s ",t.targetIds.join(","),r),await i_(e,r)}else if(t instanceof rF?e.ga.Xe(t):t instanceof rL?e.ga.it(t):e.ga.tt(t),!r.isEqual(ep.min()))try{let t,n,i,s,a=await nU(e.localStore);r.compareTo(a)>
183=0&&await ((t=e.ga.Pt(r)).targetChanges.forEach((t,n)=>{if(t.resumeToken.approximateByteSize()>0){let i=e.Ta.get(n);i&&e.Ta.set(n,i.withResumeToken(t.resumeToken,r))}}),t.targetMismatches.forEach((t,r)=>{let n=e.Ta.get(t);if(!n)return;e.Ta.set(t,n.withResumeToken(eN.EMPTY_BYTE_STRING,n.snapshotVersion)),ic(e,t);let i=new nn(n.target,t,r,n.sequenceNumber);iu(e,i)}),n=new Map,t.targetChanges.forEach((t,r)=>{let i=e.Ea.get(r);void 0!==i&&n.set(i,t)}),i=new eA(Y),t.targetMismatches.forEach((t,r)=>{let n=e.Ea.get(t);void 0!==n&&(i=i.insert(n,r))}),s=new rN(t.snapshotVersion,n,i,t.documentUpdates,t.resolvedLimboDocuments),e.remoteSyncer.applyRemoteEvent(s))}catch(t){R(it,"Failed to raise snapshot:",t),await i_(e,t)}}async function i_(e,t,r){if(!eb(t))throw t;e.Va.add(1),await is(e),e.fa.set("Offline"),r||(r=()=>nU(e.localStore)),e.asyncQueue.enqueueRetryable(async()=>{R(it,"Retrying IndexedDB access"),await r(),e.Va.delete(1),await ii(e)})}function ib(e,t){return t().catch(r=>i_(e,r,t))}async function iw(e){var t;let r=iP(e),n=e.Pa.length>0?e.Pa[e.Pa.length-1].batchId:-1;for(;ip(t=e)&&t.Pa.length<10;)try{let t=await function(e,t){return e.persistence.runTransaction("Get next mutation batch","readonly",r=>(void 0===t&&(t=-1),e.mutationQueue.getNextMutationBatchAfterBatchId(r,t)))}(e.localStore,n);if(null===t){0===e.Pa.length&&r.B_();break}n=t.batchId,function(e,t){e.Pa.push(t);let r=iP(e);r.x_()&&r.X_&&r.Y_(t.mutations)}(e,t)}catch(t){await i_(e,t)}iE(e)&&iS(e)}function iE(e){return ip(e)&&!iP(e).M_()&&e.Pa.length>0}function iS(e){iP(e).start()}async function iI(e){iP(e).na()}async function ik(e){let t=iP(e);for(let r of e.Pa)t.Y_(r.mutations)}async function iT(e,t,r){let n=e.Pa.shift(),i=rS.from(n,t,r);await ib(e,()=>e.remoteSyncer.applySuccessfulWrite(i)),await iw(e)}async function iA(e,t){t&&iP(e).X_&&await async function(e,t){var r;if(rA(r=t.code)&&r!==L.ABORTED){let r=e.Pa.shift();iP(e).N_(),await ib(e,()=>e.remoteSyncer.rejectFailedWrite(r.batchId,t)),await iw(e)}}(e,t),iE(e)&&iS(e)}async function iC(e,t){e.asyncQueue.verifyOperationInProgress(),R(it,"RemoteStore received new credentials");let r=ip(e);e.Va.add(3),await is(e),r&&e.fa.set("Unknown"),await e.remoteSyncer.handleCredentialChange(t),e.Va.delete(3),await ii(e)}async function ix(e,t){t?(e.Va.delete(2),await ii(e)):t||(e.Va.add(2),await is(e),e.fa.set("Unknown"))}function iR(e){var t,r,n;return e.pa||(t=e.datastore,r=e.asyncQueue,n={Ho:ig.bind(null,e),Xo:im.bind(null,e),e_:iv.bind(null,e),J_:iy.bind(null,e)},t.ia(),e.pa=new n4(r,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,n),e.da.push(async t=>{t?(e.pa.N_(),id(e)?ih(e):e.fa.set("Unknown")):(await e.pa.stop(),e.ga=void 0)})),e.pa}function iP(e){var t,r,n;return e.ya||(t=e.datastore,r=e.asyncQueue,n={Ho:()=>Promise.resolve(),Xo:iI.bind(null,e),e_:iA.bind(null,e),ea:ik.bind(null,e),ta:iT.bind(null,e)},t.ia(),e.ya=new n8(r,t.connection,t.authCredentials,t.appCheckCredentials,t.serializer,n),e.da.push(async t=>{t?(e.ya.N_(),await iw(e)):(await e.ya.stop(),e.Pa.length>0&&(R(it,`Stopping write stream with ${e.Pa.length} pending writes`),e.Pa=[]))})),e.ya}class iD{constructor(e,t,r,n,i){this.asyncQueue=e,this.timerId=t,this.targetTimeMs=r,this.op=n,this.removalCallback=i,this.deferred=new j,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,r,n,i){let s=new iD(e,t,Date.now()+r,n,i);return s.start(r),s}start(e){this.timerHandle=setTimeout(()=>this.handleDelayElapsed(),e)}skipDelay(){return this.handleDelayElapsed()}cancel(e){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new U(L.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 iO(e,t){if(P("AsyncQueue",`${t}: ${e}`),eb(e))return new U(L.UNAVAILABLE,`${t}: ${e}`);throw e}class iN{static emptySet(e){return new iN(e.comparator)}constructor(e){this.comparator=e?(t,r)=>e(t,r)||ei.comparator(t.key,r.key):(e,t)=>ei.comparator(e.key,t.key),this.keyedMap=tK(),this.sortedSet=new eA(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,r)=>(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 iN)||this.size!==e.size)return!1;let t=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();for(;t.hasNext();){let e=t.getNext().key,n=r.getNext().key;if(!e.isEqual(n))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 r=new iN;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=t,r}}class iM{constructor(){this.wa=new eA(ei.comparator)}track(e){let t=e.doc.key,r=this.wa.get(t);r?0!==e.type&&3===r.type?this.wa=this.wa.insert(t,e):3===e.type&&1!==r.type?this.wa=this.wa.insert(t,{type:r.type,doc:e.doc}):2===e.type&&2===r.type?this.wa=this.wa.insert(t,{type:2,doc:e.doc}):2===e.type&&0===r.type?this.wa=this.wa.insert(t,{type:0,doc:e.doc}):1===e.type&&0===r.type?this.wa=this.wa.remove(t):1===e.type&&2===r.type?this.wa=this.wa.insert(t,{type:1,doc:r.doc}):0===e.type&&1===r.type?this.wa=this.wa.insert(t,{type:2,doc:e.doc}):N(63341,{At:e,Sa:r}):this.wa=this.wa.insert(t,e)}ba(){let e=[];return this.wa.inorderTraversal((t,r)=>{e.push(r)}),e}}class iF{constructor(e,t,r,n,i,s,a,o,l){this.query=e,this.docs=t,this.oldDocs=r,this.docChanges=n,this.mutatedKeys=i,this.fromCache=s,this.syncStateChanged=a,this.excludesMetadataChanges=o,this.hasCachedResults=l}static fromInitialDocuments(e,t,r,n,i){let s=[];
183return t.forEach(e=>{s.push({type:0,doc:e})}),new iF(e,t,iN.emptySet(t),s,r,n,!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)&&t$(this.query,e.query)&&this.docs.isEqual(e.docs)&&this.oldDocs.isEqual(e.oldDocs)))return!1;let t=this.docChanges,r=e.docChanges;if(t.length!==r.length)return!1;for(let e=0;e<t.length;e++)if(t[e].type!==r[e].type||!t[e].doc.isEqual(r[e].doc))return!1;return!0}}class iL{constructor(){this.Da=void 0,this.Ca=[]}va(){return this.Ca.some(e=>e.Fa())}}class iU{constructor(){this.queries=ij(),this.onlineState="Unknown",this.Ma=new Set}terminate(){var e;let t;e=new U(L.ABORTED,"Firestore shutting down"),t=this.queries,this.queries=ij(),t.forEach((t,r)=>{for(let t of r.Ca)t.onError(e)})}}function ij(){return new tq(e=>tV(e),t$)}async function i$(e,t){let r=3,n=t.query,i=e.queries.get(n);i?!i.va()&&t.Fa()&&(r=2):(i=new iL,r=+!t.Fa());try{switch(r){case 0:i.Da=await e.onListen(n,!0);break;case 1:i.Da=await e.onListen(n,!1);break;case 2:await e.onFirstRemoteStoreListen(n)}}catch(r){let e=iO(r,`Initialization of query '${tB(t.query)}' failed`);return void t.onError(e)}e.queries.set(n,i),i.Ca.push(t),t.xa(e.onlineState),i.Da&&t.Oa(i.Da)&&iz(e)}async function iV(e,t){let r=t.query,n=3,i=e.queries.get(r);if(i){let e=i.Ca.indexOf(t);e>=0&&(i.Ca.splice(e,1),0===i.Ca.length?n=+!t.Fa():!i.va()&&t.Fa()&&(n=2))}switch(n){case 0:return e.queries.delete(r),e.onUnlisten(r,!0);case 1:return e.queries.delete(r),e.onUnlisten(r,!1);case 2:return e.onLastRemoteStoreUnlisten(r);default:return}}function iB(e,t){let r=!1;for(let n of t){let t=n.query,i=e.queries.get(t);if(i){for(let e of i.Ca)e.Oa(n)&&(r=!0);i.Da=n}}r&&iz(e)}function iW(e,t,r){let n=e.queries.get(t);if(n)for(let e of n.Ca)e.onError(r);e.queries.delete(t)}function iz(e){e.Ma.forEach(e=>{e.next()})}(m=g||(g={})).Na="default",m.Cache="cache";class iq{constructor(e,t,r){this.query=e,this.Ba=t,this.La=!1,this.ka=null,this.onlineState="Unknown",this.options=r||{}}Oa(e){if(!this.options.includeMetadataChanges){let t=[];for(let r of e.docChanges)3!==r.type&&t.push(r);e=new iF(e.query,e.docs,e.oldDocs,t,e.mutatedKeys,e.fromCache,e.syncStateChanged,!0,e.hasCachedResults)}let t=!1;return this.La?this.qa(e)&&(this.Ba.next(e),t=!0):this.Ka(e,this.onlineState)&&(this.Ua(e),t=!0),this.ka=e,t}onError(e){this.Ba.error(e)}xa(e){this.onlineState=e;let t=!1;return this.ka&&!this.La&&this.Ka(this.ka,e)&&(this.Ua(this.ka),t=!0),t}Ka(e,t){return!(e.fromCache&&this.Fa())||(!this.options.$a||"Offline"===t)&&(!e.docs.isEmpty()||e.hasCachedResults||"Offline"===t)}qa(e){if(e.docChanges.length>0)return!0;let t=this.ka&&this.ka.hasPendingWrites!==e.hasPendingWrites;return!(!e.syncStateChanged&&!t)&&!0===this.options.includeMetadataChanges}Ua(e){e=iF.fromInitialDocuments(e.query,e.docs,e.mutatedKeys,e.fromCache,e.hasCachedResults),this.La=!0,this.Ba.next(e)}Fa(){return this.options.source!==g.Cache}}class iH{constructor(e){this.key=e}}class iG{constructor(e){this.key=e}}class iK{constructor(e,t){this.query=e,this.eu=t,this.tu=null,this.hasCachedResults=!1,this.current=!1,this.nu=tZ(),this.mutatedKeys=tZ(),this.ru=tz(e),this.iu=new iN(this.ru)}get su(){return this.eu}ou(e,t){let r=t?t._u:new iM,n=t?t.iu:this.iu,i=t?t.mutatedKeys:this.mutatedKeys,s=n,a=!1,o="F"===this.query.limitType&&n.size===this.query.limit?n.last():null,l="L"===this.query.limitType&&n.size===this.query.limit?n.first():null;if(e.inorderTraversal((e,t)=>{let u=n.get(e),c=tW(this.query,t)?t:null,h=!!u&&this.mutatedKeys.has(u.key),d=!!c&&(c.hasLocalMutations||this.mutatedKeys.has(c.key)&&c.hasCommittedMutations),f=!1;u&&c?u.data.isEqual(c.data)?h!==d&&(r.track({type:3,doc:c}),f=!0):this.au(u,c)||(r.track({type:2,doc:c}),f=!0,(o&&this.ru(c,o)>0||l&&0>this.ru(c,l))&&(a=!0)):!u&&c?(r.track({type:0,doc:c}),f=!0):u&&!c&&(r.track({type:1,doc:u}),f=!0,(o||l)&&(a=!0)),f&&(c?(s=s.add(c),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;
183){let e="F"===this.query.limitType?s.last():s.first();s=s.delete(e.key),i=i.delete(e.key),r.track({type:1,doc:e})}return{iu:s,_u:r,Ss:a,mutatedKeys:i}}au(e,t){return e.hasLocalMutations&&t.hasCommittedMutations&&!t.hasLocalMutations}applyChanges(e,t,r,n){let i=this.iu;this.iu=e.iu,this.mutatedKeys=e.mutatedKeys;let s=e._u.ba();s.sort((e,t)=>{var r,n;let i;return r=e.type,n=t.type,(i=e=>{switch(e){case 0:return 1;case 2:case 3:return 2;case 1:return 0;default:return N(20277,{At:e})}})(r)-i(n)||this.ru(e.doc,t.doc)}),this.uu(r),n=n??!1;let a=t&&!n?this.cu():[],o=0===this.nu.size&&this.current&&!n?1:0,l=o!==this.tu;return(this.tu=o,0!==s.length||l)?{snapshot:new iF(this.query,e.iu,i,s,e.mutatedKeys,0===o,l,!1,!!r&&r.resumeToken.approximateByteSize()>0),lu:a}:{lu:a}}xa(e){return this.current&&"Offline"===e?(this.current=!1,this.applyChanges({iu:this.iu,_u:new iM,mutatedKeys:this.mutatedKeys,Ss:!1},!1)):{lu:[]}}hu(e){return!this.eu.has(e)&&!!this.iu.has(e)&&!this.iu.get(e).hasLocalMutations}uu(e){e&&(e.addedDocuments.forEac
183h(e=>this.eu=this.eu.add(e)),e.modifiedDocuments.forEach(e=>{}),e.removedDocuments.forEach(e=>this.eu=this.eu.delete(e)),this.current=e.current)}cu(){if(!this.current)return[];let e=this.nu;this.nu=tZ(),this.iu.forEach(e=>{this.hu(e.key)&&(this.nu=this.nu.add(e.key))});let t=[];return e.forEach(e=>{this.nu.has(e)||t.push(new iG(e))}),this.nu.forEach(r=>{e.has(r)||t.push(new iH(r))}),t}Pu(e){this.eu=e.Ls,this.nu=tZ();let t=this.ou(e.documents);return this.applyChanges(t,!0)}Tu(){return iF.fromInitialDocuments(this.query,this.iu,this.mutatedKeys,0===this.tu,this.hasCachedResults)}}let iY="SyncEngine";class iJ{constructor(e,t,r){this.query=e,this.targetId=t,this.view=r}}class iQ{constructor(e){this.key=e,this.Iu=!1}}class iX{constructor(e,t,r,n,i,s){this.localStore=e,this.remoteStore=t,this.eventManager=r,this.sharedClientState=n,this.currentUser=i,this.maxConcurrentLimboResolutions=s,this.Eu={},this.Ru=new tq(e=>tV(e),t$),this.Au=new Map,this.Vu=new Set,this.du=new eA(ei.comparator),this.mu=new Map,this.fu=new nE,this.gu={},this.pu=new Map,this.yu=nc._r(),this.onlineState="Unknown",this.wu=void 0}get isPrimaryClient(){return!0===this.wu}}async function iZ(e,t,r=!0){let n,i=sc(e),s=i.Ru.get(t);return s?(i.sharedClientState.addLocalQueryTarget(s.targetId),n=s.view.Tu()):n=await i1(i,t,r,!0),n}async function i0(e,t){let r=sc(e);await i1(r,t,!0,!1)}async function i1(e,t,r,n){var i,s;let a,o=await (i=e.localStore,s=tF(t),i.persistence.runTransaction("Allocate target","readwrite",e=>{let t;return i.ci.getTargetData(e,s).next(r=>r?(t=r,e_.resolve(t)):i.ci.allocateTargetId(e).next(r=>(t=new nn(s,r,"TargetPurposeListen",e.currentSequenceNumber),i.ci.addTargetData(e,t).next(()=>t))))}).then(e=>{let t=i.Cs.get(e.targetId);return(null===t||e.snapshotVersion.compareTo(t.snapshotVersion)>0)&&(i.Cs=i.Cs.insert(e.targetId,e),i.vs.set(s,e.targetId)),e})),l=o.targetId,u=e.sharedClientState.addLocalQueryTarget(l,r);return n&&(a=await i2(e,t,l,"current"===u,o.resumeToken)),e.isPrimaryClient&&r&&io(e.remoteStore,o),a}async function i2(e,t,r,n,i){e.Su=(t,r,n)=>(async function(e,t,r,n){let i=t.view.ou(r);i.Ss&&(i=await n$(e.localStore,t.query,!1).then(({documents:e})=>t.view.ou(e,i)));let s=n&&n.targetChanges.get(t.targetId),a=n&&null!=n.targetMismatches.get(t.targetId),o=t.view.applyChanges(i,e.isPrimaryClient,s,a);return ss(e,t.targetId,o.lu),o.snapshot})(e,t,r,n);let s=await n$(e.localStore,t,!0),a=new iK(t,s.Ls),o=a.ou(s.documents),l=rM.createSynthesizedTargetChangeForCurrentChange(r,n&&"Offline"!==e.onlineState,i),u=a.applyChanges(o,e.isPrimaryClient,l);ss(e,r,u.lu);let c=new iJ(t,r,a);return e.Ru.set(t,c),e.Au.has(r)?e.Au.get(r).push(t):e.Au.set(r,[t]),u.snapshot}async function i3(e,t,r){let n=e.Ru.get(t),i=e.Au.get(n.targetId);i.length>1?(e.Au.set(n.targetId,i.filter(e=>!t$(e,t))),e.Ru.delete(t)):e.isPrimaryClient?(e.sharedClientState.removeLocalQueryTarget(n.targetId),e.sharedClientState.isActiveQueryTarget(n.targetId)||await nj(e.localStore,n.targetId,!1).then(()=>{e.sharedClientState.clearQueryState(n.targetId),r&&il(e.remoteStore,n.targetId),sn(e,n.targetId)}).catch(ey)):(sn(e,n.targetId),await nj(e.localStore,n.targetId,!0))}async function i5(e,t){let r=e.Ru.get(t),n=e.Au.get(r.targetId);e.isPrimaryClient&&1===n.length&&(e.sharedClientState.removeLocalQueryTarget(r.targetId),il(e.remoteStore,r.targetId))}async function i6(e,t,r){var n,i,s;let a=((n=e).remoteStore.remoteSyncer.applySuccessfulWrite=i7.bind(null,n),n.remoteStore.remoteSyncer.rejectFailedWrite=se.bind(null,n),n);try{let e,n,o,l,u,c=await (i=a.localStore,o=ef.now(),l=t.reduce((e,t)=>e.add(t.key),tZ()),i.persistence.runTransaction("Locally write mutations","readwrite",r=>{let s=tH,a=tZ();return i.Ms.getEntries(r,l).next(e=>{(s=e).forEach((e,t)=>{t.isValidDocument()||(a=a.add(e))})}).next(()=>i.localDocuments.getOverlayedDocuments(r,s)).next(n=>{e=n;let s=[];for(let r of t){let t=function(e,t){let r=null;for(let n of e.fieldTransforms){let e=t.data.field(n.field),i=t5(n.transform,e||null);null!=i&&(null===r&&(r=to.empty()),r.set(n.field,i))}return r||null}(r,e.get(r.key).overlayedDocument);null!=t&&s.push(new rm(r.key,t,function e(t){let r=[];return ek(t.fields,(t,n)=>{let i=new en([t]);if(tn(n)){let t=e(n.mapValue).fields;if(0===t.length)r.push(i);else for(let e of t)r.push(i.child(e))}else r.push(i)}),new eD(r)}(t.value.mapValue),ru.exists(!0)))}
183return i.mutationQueue.addMutationBatch(r,o,s,t)}).next(t=>{n=t;let s=t.applyToLocalDocumentSet(e,a);return i.documentOverlayCache.saveOverlays(r,t.batchId,s)})}).then(()=>({batchId:n.batchId,changes:tY(e)})));a.sharedClientState.addPendingMutation(c.batchId),s=c.batchId,(u=a.gu[a.currentUser.toKey()])||(u=new eA(Y)),u=u.insert(s,r),a.gu[a.currentUser.toKey()]=u,await so(a,c.changes),await iw(a.remoteStore)}catch(t){let e=iO(t,"Failed to persist write");r.reject(e)}}async function i4(e,t){try{var r,n;let i,s,a=await (r=e.localStore,i=(n=t).snapshotVersion,s=r.Cs,r.persistence.runTransaction("Apply remote event","readwrite-primary",e=>{var t,a,o;let l,u,c=r.Ms.newChangeBuffer({trackRemovals:!0});s=r.Cs;let h=[];n.targetChanges.forEach((t,a)=>{var o;let l=s.get(a);if(!l)return;h.push(r.ci.removeMatchingKeys(e,t.removedDocuments,a).next(()=>r.ci.addMatchingKeys(e,t.addedDocuments,a)));let u=l.withSequenceNumber(e.currentSequenceNumber);null!==n.targetMismatches.get(a)?u=u.withResumeToken(eN.EMPTY_BYTE_STRING,ep.min()).withLastLimboFreeSnapshotVersion(ep.min()):t.resumeToken.approximateByteSize()>0&&(u=u.withResumeToken(t.resumeToken,i)),s=s.insert(a,u),o=u,(0===l.resumeToken.approximateByteSize()||o.snapshotVersion.toMicroseconds()-l.snapshotVersion.toMicroseconds()>=3e8||t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size>0)&&h.push(r.ci.updateTargetData(e,u))});let d=tH,f=tZ();if(n.documentUpdates.forEach(t=>{n.resolvedLimboDocuments.has(t)&&h.push(r.persistence.referenceDelegate.updateLimboDocument(e,t))}),h.push((t=e,a=c,o=n.documentUpdates,l=tZ(),u=tZ(),o.forEach(e=>l=l.add(e)),a.getEntries(t,l).next(e=>{let t=tH;return o.forEach((r,n)=>{let i=e.get(r);n.isFoundDocument()!==i.isFoundDocument()&&(u=u.add(r)),n.isNoDocument()&&n.version.isEqual(ep.min())?(a.removeEntry(r,n.readTime),t=t.insert(r,n)):!i.isValidDocument()||n.version.compareTo(i.version)>0||0===n.version.compareTo(i.version)&&i.hasPendingWrites?(a.addEntry(n),t=t.insert(r,n)):R(nM,"Ignoring outdated watch update for ",r,". Current version:",i.version," Watch version:",n.version)}),{Ns:t,Bs:u}})).next(e=>{d=e.Ns,f=e.Bs})),!i.isEqual(ep.min())){let t=r.ci.getLastRemoteSnapshotVersion(e).next(t=>r.ci.setTargetsMetadata(e,e.currentSequenceNumber,i));h.push(t)}return e_.waitFor(h).next(()=>c.apply(e)).next(()=>r.localDocuments.getLocalViewOfDocuments(e,d,f)).next(()=>d)}).then(e=>(r.Cs=s,e)));
183t.targetChanges.forEach((t,r)=>{let n=e.mu.get(r);n&&(F(t.addedDocuments.size+t.modifiedDocuments.size+t.removedDocuments.size<=1,22616),t.addedDocuments.size>0?n.Iu=!0:t.modifiedDocuments.size>0?F(n.Iu,14607):t.removedDocuments.size>0&&(F(n.Iu,42227),n.Iu=!1))}),await so(e,a,t)}catch(e){await ey(e)}}function i8(e,t,r){if(e.isPrimaryClient&&0===r||!e.isPrimaryClient&&1===r){var n;let r,i=[];e.Ru.forEach((e,r)=>{let n=r.view.xa(t);n.snapshot&&i.push(n.snapshot)}),(n=e.eventManager).onlineState=t,r=!1,n.queries.forEach((e,n)=>{for(let e of n.Ca)e.xa(t)&&(r=!0)}),r&&iz(n),i.length&&e.Eu.J_(i),e.onlineState=t,e.isPrimaryClient&&e.sharedClientState.setOnlineState(t)}}async function i9(e,t,r){e.sharedClientState.updateQueryState(t,"rejected",r);let n=e.mu.get(t),i=n&&n.key;if(i){let r=new eA(ei.comparator);r=r.insert(i,tl.newNoDocument(i,ep.min()));let n=tZ().add(i),s=new rN(ep.min(),new Map,new eA(Y),r,n);await i4(e,s),e.du=e.du.remove(i),e.mu.delete(t),sa(e)}else await nj(e.localStore,t,!1).then(()=>sn(e,t,r)).catch(ey)}async function i7(e,t){let r=t.batch.batchId;try{var n,i;let s=await (n=e.localStore,i=t,n.persistence.runTransaction("Acknowledge batch","readwrite-primary",e=>{let t,r,s,a=i.batch.keys(),o=n.Ms.newChangeBuffer({trackRemovals:!0});return(r=(t=i.batch).keys(),s=e_.resolve(),r.forEach(r=>{s=s.next(()=>o.getEntry(e,r)).next(e=>{let n=i.docVersions.get(r);F(null!==n,48541),0>e.version.compareTo(n)&&(t.applyToRemoteDocument(e,i),e.isValidDocument()&&(e.setReadTime(i.commitVersion),o.addEntry(e)))})}),s.next(()=>n.mutationQueue.removeMutationBatch(e,t))).next(()=>o.apply(e)).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,a,i.batch.batchId)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,function(e){let t=tZ();for(let r=0;r<e.mutationResults.length;++r)e.mutationResults[r].transformResults.length>0&&(t=t.add(e.batch.mutations[r].key));return t}(i))).next(()=>n.localDocuments.getDocuments(e,a))}));sr(e,r,null),st(e,r),e.sharedClientState.updateMutationState(r,"acknowledged"),await so(e,s)}catch(e){await ey(e)}}async function se(e,t,r){try{var n;let i=await (n=e.localStore,n.persistence.runTransaction("Reject batch","readwrite-primary",e=>{let r;
183return n.mutationQueue.lookupMutationBatch(e,t).next(t=>(F(null!==t,37113),r=t.keys(),n.mutationQueue.removeMutationBatch(e,t))).next(()=>n.mutationQueue.performConsistencyCheck(e)).next(()=>n.documentOverlayCache.removeOverlaysForBatchId(e,r,t)).next(()=>n.localDocuments.recalculateAndSaveOverlaysForDocumentKeys(e,r)).next(()=>n.localDocuments.getDocuments(e,r))}));sr(e,t,r),st(e,t),e.sharedClientState.updateMutationState(t,"rejected",r),await so(e,i)}catch(e){await ey(e)}}function st(e,t){(e.pu.get(t)||[]).forEach(e=>{e.resolve()}),e.pu.delete(t)}function sr(e,t,r){let n=e.gu[e.currentUser.toKey()];if(n){let i=n.get(t);i&&(r?i.reject(r):i.resolve(),n=n.remove(t)),e.gu[e.currentUser.toKey()]=n}}function sn(e,t,r=null){for(let n of(e.sharedClientState.removeLocalQueryTarget(t),e.Au.get(t)))e.Ru.delete(n),r&&e.Eu.bu(n,r);e.Au.delete(t),e.isPrimaryClient&&e.fu.Qr(t).forEach(t=>{e.fu.containsKey(t)||si(e,t)})}function si(e,t){e.Vu.delete(t.path.canonicalString());let r=e.du.get(t);null!==r&&(il(e.remoteStore,r),e.du=e.du.remove(t),e.mu.delete(r),sa(e))}function ss(e,t,r){for(let n of r)n instanceof iH?(e.fu.addReference(n.key,t),function(e,t){let r=t.key,n=r.path.canonicalString();e.du.get(r)||e.Vu.has(n)||(R(iY,"New document in limbo: "+r),e.Vu.add(n),sa(e))}(e,n)):n instanceof iG?(R(iY,"Document no longer in limbo: "+n.key),e.fu.removeReference(n.key,t),e.fu.containsKey(n.key)||si(e,n.key)):N(19791,{Du:n})}function sa(e){for(;e.Vu.size>0&&e.du.size<e.maxConcurrentLimboResolutions;){let t=e.Vu.values().next().value;e.Vu.delete(t);let r=new ei(et.fromString(t)),n=e.yu.next();e.mu.set(n,new iQ(r)),e.du=e.du.insert(r,n),io(e.remoteStore,new nn(tF(tD(r.path)),n,"TargetPurposeLimboResolution",ew.ce))}}async function so(e,t,r){let n=[],i=[],s=[];e.Ru.isEmpty()||(e.Ru.forEach((a,o)=>{s.push(e.Su(o,t,r).then(t=>{if((t||r)&&e.isPrimaryClient){let n=t?!t.fromCache:r?.targetChanges.get(o.targetId)?.current;e.sharedClientState.updateQueryState(o.targetId,n?"current":"not-current")}if(t){n.push(t);let e=nD.Is(o.targetId,t);i.push(e)}}))}),await Promise.all(s),e.Eu.J_(n),await async function(e,t){try{await e.persistence.runTransaction("notifyLocalViewChanges","readwrite",r=>e_.forEach(t,t=>e_.forEach(t.Ps,n=>e.persistence.referenceDelegate.addReference(r,t.targetId,n)).next(()=>e_.forEach(t.Ts,n=>e.persistence.referenceDelegate.removeReference(r,t.targetId,n)))))}catch(e){if(!eb(e))throw e;R(nM,"Failed to update sequence numbers: "+e)}for(let r of t){let t=r.targetId;if(!r.fromCache){let r=e.Cs.get(t),n=r.snapshotVersion,i=r.withLastLimboFreeSnapshotVersion(n);e.Cs=e.Cs.insert(t,i)}}}(e.localStore,i))}async function sl(e,t){if(!e.currentUser.isEqual(t)){R(iY,"User change. New user:",t.toKey());let r=await nL(e.localStore,t);e.currentUser=t,e.pu.forEach(e=>{e.forEach(e=>{e.reject(new U(L.CANCELLED,"'waitForPendingWrites' promise is rejected due to a user change."))})}),e.pu.clear(),e.sharedClientState.handleUserChange(t,r.removedBatchIds,r.addedBatchIds),await so(e,r.Os)}}function su(e,t){let r=e.mu.get(t);if(r&&r.Iu)return tZ().add(r.key);{let r=tZ(),n=e.Au.get(t);if(!n)return r;for(let t of n){let n=e.Ru.get(t);r=r.unionWith(n.view.su)}return r}}function sc(e){return e.remoteStore.remoteSyncer.applyRemoteEvent=i4.bind(null,e),e.remoteStore.remoteSyncer.getRemoteKeysForTarget=su.bind(null,e),e.remoteStore.remoteSyncer.rejectListen=i9.bind(null,e),e.Eu.J_=iB.bind(null,e.eventManager),e.Eu.bu=iW.bind(null,e.eventManager),e}class sh{constructor(){this.kind="memory",this.synchronizeTabs=!1}async initialize(e){this.serializer=n2(e.databaseInfo.databaseId),this.sharedClientState=this.Fu(e),this.persistence=this.Mu(e),await this.persistence.start(),this.localStore=this.xu(e),this.gcScheduler=this.Ou(e,this.localStore),this.indexBackfillerScheduler=this.Nu(e,this.localStore)}Ou(e,t){return null}Nu(e,t){return null}xu(e){var t,r;return t=this.persistence,r=new nN,new nF(t,r,e.initialUser,this.serializer)}Mu(e){return new nC(nR.Ai,this.serializer)}Fu(e){return new nB}async terminate(){this.gcScheduler?.stop(),this.indexBackfillerScheduler?.stop(),this.sharedCl
183ientState.shutdown(),await this.persistence.shutdown()}}sh.provider={build:()=>new sh};class sd extends sh{constructor(e){super(),this.cacheSizeBytes=e}Ou(e,t){return F(this.persistence.referenceDelegate instanceof nP,46915),new np(this.persistence.referenceDelegate.garbageCollector,e.asyncQueue,t)}Mu(e){let t=void 0!==this.cacheSizeBytes?nu.withCacheSize(this.cacheSizeBytes):nu.DEFAULT;return new nC(e=>nP.Ai(e,t),this.serializer)}}class sf{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=>i8(this.syncEngine,e,1),this.remoteStore.remoteSyncer.handleCredentialChange=sl.bind(null,this.syncEngine),await ix(this.remoteStore,this.syncEngine.isPrimaryClient))}createEventManager(e){return new iU}createDatastore(e){var t;let r=n2(e.databaseInfo.databaseId),n=new n0(e.databaseInfo);return t=e.authCredentials,new n7(t,e.appCheckCredentials,n,r)}createRemoteStore(e){var t,r;return t=this.localStore,r=this.datastore,new ir(t,r,e.asyncQueue,e=>i8(this.syncEngine,e,0),nq.v()?new nq:new nW)}createSyncEngine(e,t){var r,n,i,s,a,o;let l;return r=this.localStore,n=this.remoteStore,i=this.eventManager,s=this.sharedClientState,a=e.initialUser,o=e.maxConcurrentLimboResolutions,l=new iX(r,n,i,s,a,o),t&&(l.wu=!0),l}async terminate(){await async function(e){R(it,"RemoteStore shutting down."),e.Va.add(5),await is(e),e.ma.shutdown(),e.fa.set("Unknown")}(this.remoteStore),this.datastore?.terminate(),this.eventManager?.terminate()}}sf.provider={build:()=>new sf};class sp{constructor(e){this.observer=e,this.muted=!1}next(e){this.muted||this.observer.next&&this.Lu(this.observer.next,e)}error(e){this.muted||(this.observer.error?this.Lu(this.observer.error,e):P("Uncaught Error in snapshot listener:",e.toString()))}ku(){this.muted=!0}Lu(e,t){setTimeout(()=>{this.muted||e(t)},0)}}class sg{constructor(e){this.datastore=e,this.readVersions=new Map,this.mutations=[],this.committed=!1,this.lastTransactionError=null,this.writtenDocs=new Set}async lookup(e){if(this.ensureCommitNotCalled(),this.mutations.length>0)throw this.lastTransactionError=new U(L.INVALID_ARGUMENT,"Firestore transactions require all reads to be executed before all writes."),this.lastTransactionError;let t=await async function(e,t){let r={documents:t.map(t=>r1(e.serializer,t))},n=await e.zo("BatchGetDocuments",e.serializer.databaseId,et.emptyPath(),r,t.length),i=new Map;n.forEach(t=>{var r;let n,s,a,o,l,u,c=(r=e.serializer,"found"in t?(F(!!t.found,43571),t.found.name,t.found.updateTime,n=r2(r,t.found.name),s=rQ(t.found.updateTime),a=t.found.createTime?rQ(t.found.createTime):ep.min(),o=new to({mapValue:{fields:t.found.fields}}),tl.newFoundDocument(n,s,a,o)):"missing"in t?(F(!!t.missing,3894),F(!!t.readTime,22933),l=r2(r,t.missing),u=rQ(t.readTime),tl.newNoDocument(l,u)):N(7234,{result:t}));i.set(c.key.toString(),c)});let s=[];return t.forEach(e=>{let t=i.get(e.toString());F(!!t,55234,{key:e}),s.push(t)}),s}(this.datastore,e);return t.forEach(e=>this.recordVersion(e)),t}set(e,t){this.write(t.toMutation(e,this.precondition(e))),this.writtenDocs.add(e.toString())}update(e,t){try{this.write(t.toMutation(e,this.preconditionForUpdate(e)))}catch(e){this.lastTransactionError=e}this.writtenDocs.add(e.toString())}delete(e){this.write(new rb(e,this.precondition(e))),this.writtenDocs.add(e.toString())}async commit(){if(this.ensureCommitNotCalled(),this.lastTransactionError)throw this.lastTransactionError;let e=this.readVersions;this.mutations.forEach(t=>{e.delete(t.key.toString())}),e.forEach((e,t)=>{let r=ei.fromPath(t);this.mutations.push(new rw(r,this.precondition(r)))}),await async function(e,t){let r={writes:t.map(t=>r8(e.serializer,t))};await e.$o("Commit",e.serializer.databaseId,et.emptyPath(),r)}(this.datastore,this.mutations),this.committed=!0}recordVersion(e){let t;if(e.isFoundDocument())t=e.version;else{if(!e.isNoDocument())throw N(50498,{Ju:e.constructor.name});t=ep.min()}let r=this.readVersions.get(e.key.toString());if(r){if(!t.isEqual(r))throw new U(L.ABORTED,"Document version changed between two reads.")}else this.readVersions.set(e.key.toString(),t)}precondition(e){let t=this.readVersions.get(e.toString());return!this.writtenDocs.has(e.toString())&&t?t.isEqual(ep.min())?ru.exists(!1):ru.updateTime(t):ru.none()}preconditionForUpdate(e){let t=this.readVersions.get(e.toString());if(!this.writtenDocs.has(e.toString())&&t){if(t.isEqual(ep.min()))throw new U(L.INVALID_ARGUMENT,"Can't update a document that doesn't exist.");return ru.updateTime(t)}return ru.exists(!0)}write(e){this.ensureCommitNotCalled(),this.mutations.push(e)}ensureCommitNotCalled(){}}class sm{constructor(e,t,r,n,i){this.asyncQueue=e,this.datastore=t,this.options=r,this.updateFunction=n,this.deferred=i,this.Hu=r.maxAttempts,this.F_=new n3(this.asyncQueue,"transaction_retry")}Zu(){this.Hu-=1,this.Xu()}Xu(){this.F_.g_(async()=>{let e=new sg(this.datastore),t=this.Yu(e);t&&t.then(t=>{this.asyncQueue.enqueueAndForget(()=>e.commit().then(()=>{this.deferred.resolve(t)}).catch(e=>{this.ec(e)}))}).catch(e=>{this.ec(e)})})}Yu(e){try{let t=this.updateFunction(e);return!eE(t)&&t.catch&&t.then?t:(this.deferred.reject(Error("Transaction callback must return a Promise")),null)}catch(e){return this.deferred.reject(e),null}}ec(e){this.Hu>0&&this.tc(e)?(this.Hu-=1,this.asyncQueue.enqueueAndForget(()=>(this.Xu(),Promise.resolve()))):this.deferred.reject(e)}tc(e){if("FirebaseError"===e?.name){let t=e.code;return"aborted"===t||"failed-precondition"===t||"already-exists"===t||!rA(t)}return!1}}let sv="FirestoreClient";class sy{constructor(e,t,r,n,i){this.authCredentials=e,this.appCheckCredentials=t,this.asyncQueue=r,this._databaseInfo=n,this.user=T.UNAUTHENTICATED,this.clientId=K.newId(),this.authCredentialListener=()=>Promise.resolve(),this.appCheckCredentialListener=()=>Promise.resolve(),this._uninitializedComponentsProvider=i,this.authCredentials.start(r,async e=>{R(sv,"Received user=",e.uid),await this.authCredentialListener(e),this.user=e}),this.appCheckCredentials.start(r,e=>(R(sv,"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 j;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(r){let t=iO(r,"Failed to shutdown persistence");e.reject(t)}}),e.promise}}async function s_(e,t){e.asyncQueue.verifyOperationInProgress(),R(sv,"Initializing OfflineComponentProvider");let r=e.configuration;await t.initialize(r);let n=r.initialUser;e.setCredentialChangeListener(async e=>{n.isEqual(e)||(await nL(t.localStore,e),n=e)}),t.persistence.setDatabaseDeletedListener(()=>e.terminate()),e._offlineComponents=t}
183async function sb(e,t){e.asyncQueue.verifyOperationInProgress();let r=await sw(e);R(sv,"Initializing OnlineComponentProvider"),await t.initialize(r,e.configuration),e.setCredentialChangeListener(e=>iC(t.remoteStore,e)),e.setAppCheckTokenChangeListener((e,r)=>iC(t.remoteStore,r)),e._onlineComponents=t}async function sw(e){if(!e._offlineComponents)if(e._uninitializedComponentsProvider){R(sv,"Using user provided OfflineComponentProvider");try{await s_(e,e._uninitializedComponentsProvider._offline)}catch(t){if(!("FirebaseError"===t.name?t.code===L.FAILED_PRECONDITION||t.code===L.UNIMPLEMENTED:!("u">typeof DOMException&&t instanceof DOMException)||22===t.code||20===t.code||11===t.code))throw t;D("Error using user provided cache. Falling back to memory cache: "+t),await s_(e,new sh)}}else R(sv,"Using default OfflineComponentProvider"),await s_(e,new sd(void 0));return e._offlineComponents}async function sE(e){return e._onlineComponents||(e._uninitializedComponentsProvider?(R(sv,"Using user provided OnlineComponentProvider"),await sb(e,e._uninitializedComponentsProvider._online)):(R(sv,"Using default OnlineComponentProvider"),await sb(e,new sf))),e._onlineComponents}function sS(e){return sE(e).then(e=>e.datastore)}async function sI(e){let t=await sE(e),r=t.eventManager;return r.onListen=iZ.bind(null,t.syncEngine),r.onUnlisten=i3.bind(null,t.syncEngine),r.onFirstRemoteStoreListen=i0.bind(null,t.syncEngine),r.onLastRemoteStoreUnlisten=i5.bind(null,t.syncEngine),r}function sk(e){let t={};return void 0!==e.timeoutSeconds&&(t.timeoutSeconds=e.timeoutSeconds),t}let sT=new Map,sA="firestore.googleapis.com";class sC{constructor(e){if(void 0===e.host){if(void 0!==e.ssl)throw new U(L.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=sA,this.ssl=!0}else this.host=e.host,this.ssl=e.ssl??!0;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 U(L.INVALID_ARGUMENT,"cacheSizeBytes must be at least 1048576");this.cacheSizeBytes=e.cacheSizeBytes}(function(e,t,r,n){if(!0===t&&!0===n)throw new U(L.INVALID_ARGUMENT,`${e} and ${r} 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=sk(e.experimentalLongPollingOptions??{}),function(e){if(void 0!==e.timeoutSeconds){if(isNaN(e.timeoutSeconds))throw new U(L.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (must not be NaN)`);if(e.timeoutSeconds<5)throw new U(L.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (minimum allowed value is 5)`);if(e.timeoutSeconds>30)throw new U(L.INVALID_ARGUMENT,`invalid long polling timeout: ${e.timeoutSeconds} (maximum allowed value is 30)`)}}(this.experimentalLongPollingOptions),this.useFetchStreams=!!e.useFetchStreams}isEqual(e){var t,r;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,r=e.experimentalLongPollingOptions,t.timeoutSeconds===r.timeoutSeconds)&&this.ignoreUndefinedProperties===e.ignoreUndefinedProperties&&this.useFetchStreams===e.useFetchStreams}}class sx{constructor(e,t,r,n){this._authCredentials=e,this._appCheckCredentials=t,this._databaseId=r,this._app=n,this.type="firestore-lite",this._persistenceKey="(lite)",this._settings=new sC({}),this._settingsFrozen=!1,this._emulatorOptions={},this._terminateTask="notTerminated"}get app(){if(!this._app)throw new U(L.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 U(L.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 sC(e),this._emulatorOptions=e.emulatorOptions||{},void 0!==e.credentials&&(this._authCredentials=function(e){if(!e)return new V;switch(e.type){case"firstParty":return new q(e.sessionIndex||"0",e.iamToken||null,e.authTokenFactory||null);case"provider":return e.client;default:throw new U(L.INVALID_ARGUMENT,"makeAuthCredentialsProvider failed due to invali
183d 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(){let e;return(e=sT.get(this))&&(R("ComponentProvider","Removing Datastore"),sT.delete(this),e.terminate()),Promise.resolve()}}function sR(e,t,r,n={}){e=ec(e,sx);let i=(0,_.zJ)(t),s=e._getSettings(),a={...s,emulatorOptions:e._getEmulatorOptions()},o=`${t}:${r}`;i&&(0,_.gE)(`https://${o}`),s.host!==sA&&s.host!==o&&D("Host has been set in both settings() and connectFirestoreEmulator(), emulator host will be used.");let l={...s,host:o,ssl:i,emulatorOptions:n};if(!(0,_.bD)(l,a)&&(e._setSettings(l),n.mockUserToken)){let t,r;if("string"==typeof n.mockUserToken)t=n.mockUserToken,r=T.MOCK_USER;else{t=(0,_.Fy)(n.mockUserToken,e._app?.options.projectId);let i=n.mockUserToken.sub||n.mockUserToken.user_id;if(!i)throw new U(L.INVALID_ARGUMENT,"mockUserToken must contain 'sub' or 'user_id' field!");r=new T(i)}e._authCredentials=new B(new $(t,r))}}class sP{constructor(e,t,r){this.converter=t,this._query=r,this.type="query",this.firestore=e}withConverter(e){return new sP(this.firestore,e,this._query)}}class sD{constructor(e,t,r){this.converter=t,this._key=r,this.type="document",this.firestore=e}get _path(){return this._key.path}get id(){return this._key.path.lastSegment()}get path(){return this._key.path.canonicalString()}get parent(){return new sO(this.firestore,this.converter,this._key.path.popLast())}withConverter(e){return new sD(this.firestore,e,this._key)}toJSON(){return{type:sD._jsonSchemaVersion,referencePath:this._key.toString()}}static fromJSON(e,t,r){if(ed(t,sD._jsonSchema))return new sD(e,r||null,new ei(et.fromString(t.referencePath)))}}sD._jsonSchemaVersion="firestore/documentReference/1.0",sD._jsonSchema={type:eh("string",sD._jsonSchemaVersion),referencePath:eh("string")};class sO extends sP{constructor(e,t,r){super(e,t,tD(r)),this._path=r,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 sD(this.firestore,null,new ei(e))}withConverter(e){return new sO(this.firestore,e,this._path)}}function sN(e,t,...r){if(e=(0,_.Ku)(e),es("collection","path",t),e instanceof sx){let n=et.fromString(t,...r);return eo(n),new sO(e,null,n)}{if(!(e instanceof sD||e instanceof sO))throw new U(L.INVALID_ARGUMENT,"Expected first argument to collection() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=e._path.child(et.fromString(t,...r));return eo(n),new sO(e.firestore,null,n)}}function sM(e,t,...r){if(e=(0,_.Ku)(e),1==arguments.length&&(t=K.newId()),es("doc","path",t),e instanceof sx){let n=et.fromString(t,...r);return ea(n),new sD(e,null,new ei(n))}{if(!(e instanceof sD||e instanceof sO))throw new U(L.INVALID_ARGUMENT,"Expected first argument to doc() to be a CollectionReference, a DocumentReference or FirebaseFirestore");let n=e._path.child(et.fromString(t,...r));return ea(n),new sD(e.firestore,e instanceof sO?e.converter:null,new ei(n))}}let sF="AsyncQueue";class sL{constructor(e=Promise.resolve()){this.nc=[],this.rc=!1,this.sc=[],this.oc=null,this._c=!1,this.ac=!1,this.uc=[],this.F_=new n3(this,"async_queue_retry"),this.cc=()=>{let e=n1();e&&R(sF,"Visibility state changed to "+e.visibilityState),this.F_.y_()},this.lc=e;const t=n1();t&&"function"==typeof t.addEventListener&&t.addEventListener("visibilitychange",this.cc)}get isShuttingDown(){return this.rc}enqueueAndForget(e){this.enqueue(e)}enqueueAndForgetEvenWhileRestricted(e){this.hc(),this.Pc(e)}enterRestrictedMode(e){if(!this.rc){this.rc=!0,this.ac=e||!1;let t=n1();t&&"function"==typeof t.removeEventListener&&t.removeEventListener("visibilitychange",this.cc)}}enqueue(e){if(this.hc(),this.rc)return new Promise(()=>{});let t=new j;return this.Pc(()=>this.rc&&this.ac?Promise.resolve():(e().then(t.resolve,t.reject),t.promise)).then(()=>t.promise)}enqueueRetryable(e){this.enqueueAndForget(()=>(this.nc.push(e),this.Tc()))}async Tc(){if(0!==this.nc.length){try{await this.nc[0](),this.nc.shift(),this.F_.reset()}catch(e){if(!eb(e))throw e;R(sF,"Operation failed with retryable error: "+e)}this.nc.length>0&&this.F_.g_(()=>this.Tc())}}Pc(e){let t=this.lc.then(()=>
183(this._c=!0,e().catch(e=>{throw this.oc=e,this._c=!1,P("INTERNAL UNHANDLED ERROR: ",sU(e)),e}).then(e=>(this._c=!1,e))));return this.lc=t,t}enqueueAfterDelay(e,t,r){this.hc(),this.uc.indexOf(e)>-1&&(t=0);let n=iD.createAndSchedule(this,e,t,r,e=>this.Ic(e));return this.sc.push(n),n}hc(){this.oc&&N(47125,{Ec:sU(this.oc)})}verifyOperationInProgress(){}async Rc(){let e;do e=this.lc,await e;while(e!==this.lc)}Ac(e){for(let t of this.sc)if(t.timerId===e)return!0;return!1}Vc(e){return this.Rc().then(()=>{for(let t of(this.sc.sort((e,t)=>e.targetTimeMs-t.targetTimeMs),this.sc))if(t.skipDelay(),"all"!==e&&t.timerId===e)break;return this.Rc()})}dc(e){this.uc.push(e)}Ic(e){let t=this.sc.indexOf(e);this.sc.splice(t,1)}}function sU(e){let t=e.message||"";return e.stack&&(t=e.stack.includes(e.message)?e.stack:e.message+"\n"+e.stack),t}class sj extends sx{constructor(e,t,r,n){super(e,t,r,n),this.type="firestore",this._queue=new sL,this._persistenceKey=n?.name||"[DEFAULT]"}async _terminate(){if(this._firestoreClient){let e=this._firestoreClient.terminate();this._queue=new sL(e),this._firestoreClient=void 0,await e}}}function s$(e,t){let r="object"==typeof e?e:(0,v.Sx)(),n=(0,v.j6)(r,"firestore").getImmediate({identifier:"string"==typeof e?e:t||eG});if(!n._initialized){let e=(0,_.yU)("firestore");e&&sR(n,...e)}return n}function sV(e){if(e._terminated)throw new U(L.FAILED_PRECONDITION,"The client has already been terminated.");return e._firestoreClient||function(e){var t,r,n,i,s;let a,o=e._freezeSettings(),l=(t=e._databaseId,r=e._app?.options.appId||"",n=e._persistenceKey,i=e._app?.options.apiKey,new eH(t,r,n,o.host,o.ssl,o.experimentalForceLongPolling,o.experimentalAutoDetectLongPolling,sk(o.experimentalLongPollingOptions),o.useFetchStreams,o.isUsingEmulator,i));e._componentsProvider||o.localCache?._offlineComponentProvider&&o.localCache?._onlineComponentProvider&&(e._componentsProvider={_offline:o.localCache._offlineComponentProvider,_online:o.localCache._onlineComponentProvider}),e._firestoreClient=new sy(e._authCredentials,e._appCheckCredentials,e._queue,l,e._componentsProvider&&(s=e._componentsProvider,a=s?._online.build(),{_offline:s?._offline.build(a),_online:a}))}(e),e._firestoreClient}class sB{constructor(e){this._byteString=e}static fromBase64String(e){try{return new sB(eN.fromBase64String(e))}catch(e){throw new U(L.INVALID_ARGUMENT,"Failed to construct data from Base64 string: "+e)}}static fromUint8Array(e){return new sB(eN.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:sB._jsonSchemaVersion,bytes:this.toBase64()}}static fromJSON(e){if(ed(e,sB._jsonSchema))return sB.fromBase64String(e.bytes)}}sB._jsonSchemaVersion="firestore/bytes/1.0",sB._jsonSchema={type:eh("string",sB._jsonSchemaVersion),bytes:eh("string")};class sW{constructor(...e){for(let t=0;t<e.length;++t)if(0===e[t].length)throw new U(L.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new en(e)}isEqual(e){return this._internalPath.isEqual(e._internalPath)}}class sz{constructor(e){this._methodName=e}}class sq{constructor(e,t){if(!isFinite(e)||e<-90||e>90)throw new U(L.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+e);if(!isFinite(t)||t<-180||t>180)throw new U(L.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 Y(this._lat,e._lat)||Y(this._long,e._long)}toJSON(){return{latitude:this._lat,longitude:this._long,type:sq._jsonSchemaVersion}}static fromJSON(e){if(ed(e,sq._jsonSchema))return new sq(e.latitude,e.longitude)}}sq._jsonSchemaVersion="firestore/geoPoint/1.0",sq._jsonSchema={type:eh("string",sq._jsonSchemaVersion),latitude:eh("number"),longitude:eh("number")};class sH{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 r=0;r<e.length;++r)if(e[r]!==t[r])return!1;return!0}(this._values,e._values)}toJSON(){return{type:sH._jsonSchemaVersion,vectorValues:this._values}}
183static fromJSON(e){if(ed(e,sH._jsonSchema)){if(Array.isArray(e.vectorValues)&&e.vectorValues.every(e=>"number"==typeof e))return new sH(e.vectorValues);throw new U(L.INVALID_ARGUMENT,"Expected 'vectorValues' field to be a number array")}}}sH._jsonSchemaVersion="firestore/vectorValue/1.0",sH._jsonSchema={type:eh("string",sH._jsonSchemaVersion),vectorValues:eh("object")};let sG=/^__.*__$/;class sK{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return null!==this.fieldMask?new rm(e,this.data,this.fieldMask,t,this.fieldTransforms):new rg(e,this.data,t,this.fieldTransforms)}}class sY{constructor(e,t,r){this.data=e,this.fieldMask=t,this.fieldTransforms=r}toMutation(e,t){return new rm(e,this.data,this.fieldMask,t,this.fieldTransforms)}}function sJ(e){switch(e){case 0:case 2:case 1:return!0;case 3:case 4:return!1;default:throw N(40011,{dataSource:e})}}class sQ{constructor(e,t,r,n,i,s){this.settings=e,this.databaseId=t,this.serializer=r,this.ignoreUndefinedProperties=n,void 0===i&&this.mc(),this.fieldTransforms=i||[],this.fieldMask=s||[]}get path(){return this.settings.path}get dataSource(){return this.settings.dataSource}i(e){return new sQ({...this.settings,...e},this.databaseId,this.serializer,this.ignoreUndefinedProperties,this.fieldTransforms,this.fieldMask)}gc(e){let t=this.path?.child(e),r=this.i({path:t,arrayElement:!1});return r.yc(e),r}wc(e){let t=this.path?.child(e),r=this.i({path:t,arrayElement:!1});return r.mc(),r}Sc(e){return this.i({path:void 0,arrayElement:!0})}bc(e){return ai(e,this.settings.methodName,this.settings.hasConverter||!1,this.path,this.settings.targetDoc)}contains(e){return void 0!==this.fieldMask.find(t=>e.isPrefixOf(t))||void 0!==this.fieldTransforms.find(t=>e.isPrefixOf(t.field))}mc(){if(this.path)for(let e=0;e<this.path.length;e++)this.yc(this.path.get(e))}yc(e){if(0===e.length)throw this.bc("Document fields must not be empty");if(sJ(this.dataSource)&&sG.test(e))throw this.bc('Document fields cannot begin and end with "__"')}}class sX{constructor(e,t,r){this.databaseId=e,this.ignoreUndefinedProperties=t,this.serializer=r||n2(e)}V(e,t,r,n=!1){return new sQ({dataSource:e,methodName:t,targetDoc:r,path:en.emptyPath(),arrayElement:!1,hasConverter:n},this.databaseId,this.serializer,this.ignoreUndefinedProperties)}}function sZ(e){let t=e._freezeSettings(),r=n2(e._databaseId);return new sX(e._databaseId,!!t.ignoreUndefinedProperties,r)}function s0(e,t,r,n,i,s={}){let a,o,l=e.V(s.merge||s.mergeFields?2:0,t,r,i);ae("Data must be an object, but it was:",l,n);let u=s9(n,l);if(s.merge)a=new eD(l.fieldMask),o=l.fieldTransforms;else if(s.mergeFields){let e=[];for(let n of s.mergeFields){let i=at(t,n,r);if(!l.contains(i))throw new U(L.INVALID_ARGUMENT,`Field '${i}' is specified in your field mask but missing from your input data.`);as(e,i)||e.push(i)}a=new eD(e),o=l.fieldTransforms.filter(e=>a.covers(e.field))}else a=null,o=l.fieldTransforms;return new sK(new to(u),a,o)}class s1 extends sz{_toFieldTransform(e){if(2!==e.dataSource)throw 1===e.dataSource?e.bc(`${this._methodName}() can only appear at the top level of your update data`):e.bc(`${this._methodName}() cannot be used with set() unless you pass {merge:true}`);return e.fieldMask.push(e.path),null}isEqual(e){return e instanceof s1}}function s2(e,t,r){return new sQ({dataSource:3,targetDoc:t.settings.targetDoc,methodName:e._methodName,arrayElement:r},t.databaseId,t.serializer,t.ignoreUndefinedProperties)}class s3 extends sz{constructor(e,t){super(e),this.Cc=t}_toFieldTransform(e){let t=s2(this,e,!0),r=new t4(this.Cc.map(e=>s8(e,t)));return new ro(e.path,r)}isEqual(e){return e instanceof s3&&(0,_.bD)(this.Cc,e.Cc)}}class s5 extends sz{constructor(e,t){super(e),this.Cc=t}_toFieldTransform(e){let t=s2(this,e,!0),r=new t9(this.Cc.map(e=>s8(e,t)));return new ro(e.path,r)}isEqual(e){return e instanceof s5&&(0,_.bD)(this.Cc,e.Cc)}}function s6(e,t,r,n){let i=e.V(1,t,r);ae("Data must be an object, but it was:",i,n);let s=[],a=to.empty();return ek(n,(e,n)=>{let o=an(t,e,r);n=(0,_.Ku)(n);let l=i.wc(o);if(n instanceof s1)s.push(o);else{let e=s8(n,l);null!=e&&(s.push(o),a.set(o,e))}}),new sY(a,new eD(s),i.fieldTransforms)}function s4(e,t,r,n,i,s){let a=e.V(1,t,r),o=[at(t,n,r)],l=[i];if(s.length%2!=0)throw new U(L.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)o.push(at(t,s[e])),l.push(s[e+1]);let u=[],c=to.empty();for(let e=o.length-1;e>=0;
183--e)if(!as(u,o[e])){let t=o[e],r=l[e];r=(0,_.Ku)(r);let n=a.wc(t);if(r instanceof s1)u.push(t);else{let e=s8(r,n);null!=e&&(u.push(t),c.set(t,e))}}return new sY(c,new eD(u),a.fieldTransforms)}function s8(e,t){if(s7(e=(0,_.Ku)(e)))return ae("Unsupported field value:",t,e),s9(e,t);if(e instanceof sz)return function(e,t){if(!sJ(t.dataSource))throw t.bc(`${e._methodName}() can only be used with update() and set()`);if(!t.path)throw t.bc(`${e._methodName}() is not currently supported inside arrays`);let r=e._toFieldTransform(t);r&&t.fieldTransforms.push(r)}(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.arrayElement&&4!==t.dataSource)throw t.bc("Nested arrays are not supported");let r=[],n=0;for(let i of e){let e=s8(i,t.Sc(n));null==e&&(e={nullValue:"NULL_VALUE"}),r.push(e),n++}return{arrayValue:{values:r}}}return function(e,t){var r,n,i,s;if(null===(e=(0,_.Ku)(e)))return{nullValue:"NULL_VALUE"};if("number"==typeof e)return r=t.serializer,"number"==typeof(i=n=e)&&Number.isInteger(i)&&!eS(i)&&i<=Number.MAX_SAFE_INTEGER&&i>=Number.MIN_SAFE_INTEGER?t2(n):t1(r,n);if("boolean"==typeof e)return{booleanValue:e};if("string"==typeof e)return{stringValue:e};if(e instanceof Date){let r=ef.fromDate(e);return{timestampValue:rY(t.serializer,r)}}if(e instanceof ef){let r=new ef(e.seconds,1e3*Math.floor(e.nanoseconds/1e3));return{timestampValue:rY(t.serializer,r)}}if(e instanceof sq)return{geoPointValue:{latitude:e.latitude,longitude:e.longitude}};if(e instanceof sB)return{bytesValue:rJ(t.serializer,e._byteString)};if(e instanceof sD){let r=t.databaseId,n=e.firestore._databaseId;if(!n.isEqual(r))throw t.bc(`Document reference is for database ${n.projectId}/${n.database} but should be for database ${r.projectId}/${r.database}`);return{referenceValue:rX(e.firestore._databaseId||t.databaseId,e._key.path)}}if(e instanceof sH)return{mapValue:{fields:{[eY]:{stringValue:eX},[eZ]:{arrayValue:{values:((s=e)instanceof sH?s.toArray():s).map(e=>{if("number"!=typeof e)throw t.bc("VectorValues must only contain numeric values.");return t1(t.serializer,e)})}}}}};if(nr(e))return e._toProto(t.serializer);throw t.bc(`Unsupported field value: ${eu(e)}`)}(e,t)}function s9(e,t){let r={};return eT(e)?t.path&&t.path.length>0&&t.fieldMask.push(t.path):ek(e,(e,n)=>{let i=s8(n,t.gc(e));null!=i&&(r[e]=i)}),{mapValue:{fields:r}}}function s7(e){return!("object"!=typeof e||null===e||e instanceof Array||e instanceof Date||e instanceof ef||e instanceof sq||e instanceof sB||e instanceof sD||e instanceof sz||e instanceof sH||nr(e))}function ae(e,t,r){if(!s7(r)||!el(r)){let n=eu(r);throw"an object"===n?t.bc(e+" a custom object"):t.bc(e+" "+n)}}function at(e,t,r){if((t=(0,_.Ku)(t))instanceof sW)return t._internalPath;if("string"==typeof t)return an(e,t);throw ai("Field path arguments must be of type string or ",e,!1,void 0,r)}let ar=RegExp("[~\\*/\\[\\]]");function an(e,t,r){if(t.search(ar)>=0)throw ai(`Invalid field path (${t}). Paths must not contain '~', '*', '/', '[', or ']'`,e,!1,void 0,r);try{return new sW(...t.split("."))._internalPath}catch(n){throw ai(`Invalid field path (${t}). Paths must not be empty, begin with '.', end with '.', or contain '..'`,e,!1,void 0,r)}}function ai(e,t,r,n,i){let s=n&&!n.isEmpty(),a=void 0!==i,o=`Function ${t}() called with invalid data`;r&&(o+=" (via `toFirestore()`)"),o+=". ";let l="";return(s||a)&&(l+=" (found",s&&(l+=` in field ${n}`),a&&(l+=` in document ${i}`),l+=")"),new U(L.INVALID_ARGUMENT,o+e+l)}function as(e,t){return e.some(e=>e.isEqual(t))}class aa{convertValue(e,t="none"){switch(e0(e)){case 0:return null;case 1:return e.booleanValue;case 2:return eL(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(eU(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 N(62114,{value:e})}}convertObject(e,t){return this.convertObjectMap(e.fields,t)}convertObjectMap(e,t="none"){let r={};return ek(e,(e,n)=>{r[e]=this.convertValue(n,t)}),r}convertVectorValue(e){return new sH(e.fields?.[eZ].arrayValue?.values?.map(e=>eL(e.doubleValue)))}convertGeoPoint(e){return new sq(eL(e.latitude),eL(e.longitude))}convertArray(e,t){return(e.values||[]).map(e=>this.convertValue(e,t))}convertServerTimestamp(e,t){switch(t){case"previous":let r=ez(e);return null==r?null:this.convertValue(r,t);case"estimate":return this.convertTimestamp(eq(e));default:return null}}convertTimestamp(e){let t=eF(e);return new ef(t.seconds,t.nanos)}convertDocumentKey(e,t){let r=et.fromString(e);F(nt(r),9688,{name:e});let n=new eK(r.get(1),r.get(3)),i=new ei(r.popFirst(5));return n.isEqual(t)||P(`Document ${i} contains a document reference within a different database (${n.projectId}/${n.database}) which is not supported. It will be treated as a reference in the current database (${t.projectId}/${t.database}) instead.`),i}}class ao extends aa{constructor(e){super(),this.firestore=e}convertBytes(e){return new sB(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);
183return new sD(this.firestore,null,t)}}function al(){return new s1("deleteField")}function au(...e){return new s3("arrayUnion",e)}function ac(...e){return new s5("arrayRemove",e)}let ah="@firebase/firestore",ad="4.15.0";function af(e){if("object"!=typeof e||null===e)return!1;for(let t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}class ap{constructor(e="count",t){this._internalFieldPath=t,this.type="AggregateField",this.aggregateType=e}}class ag{constructor(e,t,r){this._userDataWriter=t,this._data=r,this.type="AggregateQuerySnapshot",this.query=e}data(){return this._userDataWriter.convertObjectMap(this._data)}_fieldsProto(){return new to({mapValue:{fields:this._data}}).clone().value.mapValue.fields}}class am{constructor(e,t,r,n,i){this._firestore=e,this._userDataWriter=t,this._key=r,this._document=n,this._converter=i}get id(){return this._key.path.lastSegment()}get ref(){return new sD(this._firestore,this._converter,this._key)}exists(){return null!==this._document}data(){if(this._document){if(this._converter){let e=new av(this._firestore,this._userDataWriter,this._key,this._document,null);return this._converter.fromFirestore(e)}return this._userDataWriter.convertValue(this._document.data.value)}}_fieldsProto(){return this._document?.data.clone().value.mapValue.fields??void 0}get(e){if(this._document){let t=this._document.data.field(at("DocumentSnapshot.get",e));if(null!==t)return this._userDataWriter.convertValue(t)}}}class av extends am{data(){return super.data()}}function ay(e){if("L"===e.limitType&&0===e.explicitOrderBy.length)throw new U(L.UNIMPLEMENTED,"limitToLast() queries require specifying at least one orderBy() clause")}class a_{}class ab extends a_{}function aw(e,t,...r){let n=[];for(let i of(t instanceof a_&&n.push(t),function(e){let t=e.filter(e=>e instanceof aI).length,r=e.filter(e=>e instanceof aE).length;if(t>1||t>0&&r>0)throw new U(L.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(...)))`.")}(n=n.concat(r)),n))e=i._apply(e);return e}class aE extends ab{constructor(e,t,r){super(),this._field=e,this._op=t,this._value=r,this.type="where"}static _create(e,t,r){return new aE(e,t,r)}_apply(e){let t=this._parse(e);return aP(e._query,t),new sP(e.firestore,e.converter,tU(e._query,t))}_parse(e){let t=sZ(e.firestore);return function(e,t,r,n,i,s,a){let o;if(i.isKeyField()){if("array-contains"===s||"array-contains-any"===s)throw new U(L.INVALID_ARGUMENT,`Invalid Query. You can't perform '${s}' queries on documentId().`);if("in"===s||"not-in"===s){aR(a,s);let t=[];for(let r of a)t.push(ax(n,e,r));o={arrayValue:{values:t}}}else o=ax(n,e,a)}else"in"!==s&&"not-in"!==s&&"array-contains-any"!==s||aR(a,s),o=function(e,t,r,n=!1){return s8(r,e.V(n?4:3,t))}(r,t,a,"in"===s||"not-in"===s);return tp.create(i,s,o)}(e._query,"where",t,e.firestore._databaseId,this._field,this._op,this._value)}}function aS(e,t,r){let n=at("where",e);return aE._create(n,t,r)}class aI extends a_{constructor(e,t){super(),this.type=e,this._queryConstraints=t}static _create(e,t){return new aI(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]:tg.create(t,this._getOperator())}_apply(e){let t=this._parse(e);return 0===t.getFilters().length?e:(function(e,t){let r=e;for(let e of t.getFlattenedFilters())aP(r,e),r=tU(r,e)}(e._query,t),new sP(e.firestore,e.converter,tU(e._query,t)))}_getQueryConstraints(){return this._queryConstraints}_getOperator(){return"and"===this.type?"and":"or"}}class ak extends ab{constructor(e,t){super(),this._field=e,this._direction=t,this.type="orderBy"}static _create(e,t){return new ak(e,t)}_apply(e){var t;let r,n=function(e,t,r){if(null!==e.startAt)throw new U(L.INVALID_ARGUMENT,"Invalid query. You must not call startAt() or startAfter() before calling orderBy().");if(null!==e.endAt)throw new U(L.INVALID_ARGUMENT,"Invalid query. You must not call endAt() or endBefore() before calling orderBy().");return new td(t,r)}(e._query,this._field,this._direction);return new sP(e.firestore,e.converter,(t=e._query,r=t.explicitOrderBy.concat([n]),new tP(t.path,t.collectionGroup,r,t.filters.slice(),t.limit,t.limitType,t.startAt,t.endAt)))}}function aT(e,t="asc"){let r=at("orderBy",e);return ak._create(r,t)}class aA extends ab{constructor(e,t,r){super(),this.type=e,this._limit=t,this._limitType=r}static _create(e,t,r){return new aA(e,t,r)}_apply(e){return new sP(e.firestore,e.converter,tj(e._query,this._limit,this._limitType))}}function aC(e){return function(e,t){if(t<=0)throw new U(L.INVALID_ARGUMENT,`Function ${e}() requires a positive number, but it was: ${t}.`)}("limit",e),aA._create("limit",e,"F")}
183function ax(e,t,r){if("string"==typeof(r=(0,_.Ku)(r))){if(""===r)throw new U(L.INVALID_ARGUMENT,"Invalid query. When querying with documentId(), you must provide a valid document ID, but it was an empty string.");if(!tN(t)&&-1!==r.indexOf("/"))throw new U(L.INVALID_ARGUMENT,`Invalid query. When querying a collection by documentId(), you must provide a plain document ID, but '${r}' contains a '/' character.`);let n=t.path.child(et.fromString(r));if(!ei.isDocumentKey(n))throw new U(L.INVALID_ARGUMENT,`Invalid query. When querying a collection group by documentId(), the value provided must result in a valid document path, but '${n}' is not because it has an odd number of segments (${n.length}).`);return e8(e,new ei(n))}if(r instanceof sD)return e8(e,r._key);throw new U(L.INVALID_ARGUMENT,`Invalid query. When querying with documentId(), you must provide a valid string or a DocumentReference, but it was: ${eu(r)}.`)}function aR(e,t){if(!Array.isArray(e)||0===e.length)throw new U(L.INVALID_ARGUMENT,`Invalid Query. A non-empty array is required for '${t.toString()}' filters.`)}function aP(e,t){let r=function(e,t){for(let r of e)for(let e of r.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!==r)throw r===t.op?new U(L.INVALID_ARGUMENT,`Invalid query. You cannot use more than one '${t.op.toString()}' filter.`):new U(L.INVALID_ARGUMENT,`Invalid query. You cannot use '${t.op.toString()}' filters with '${r.toString()}' filters.`)}function aD(e,t,r){return e?r&&(r.merge||r.mergeFields)?e.toFirestore(t,r):e.toFirestore(t):t}class aO extends aa{constructor(e){super(),this.firestore=e}convertBytes(e){return new sB(e)}convertReference(e){let t=this.convertDocumentKey(e,this.firestore._databaseId);return new sD(this.firestore,null,t)}}function aN(e){return function(e,t){var r;let n,i=ec(e.firestore,sj),s=sV(i),a=function(e,t){let r=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&r.push(t(e[n],n,e));return r}(t,(e,t)=>new rk(t,e.aggregateType,e._internalFieldPath));return(r=e._query,n=new j,s.asyncQueue.enqueueAndForget(async()=>{try{let e=await sS(s);n.resolve(async function(e,t,r){var n;let{request:i,ft:s,parent:a}=function(e,t,r){let{dt:n,parent:i}=r9(e,t),s={},a=[],o=0;return r.forEach(e=>{let t="aggregate_"+o++;s[t]=e.alias,"count"===e.aggregateType?a.push({alias:t,count:{}}):"avg"===e.aggregateType?a.push({alias:t,avg:{field:r7(e.fieldPath)}}):"sum"===e.aggregateType&&a.push({alias:t,sum:{field:r7(e.fieldPath)}})}),{request:{structuredAggregationQuery:{aggregations:a,structuredQuery:n.structuredQuery},parent:n.parent},ft:s,parent:i}}(e.serializer,((n=t).Re||(n.Re=tL(n,n.explicitOrderBy)),n.Re),r);e.connection.ko||delete i.parent;let o=(await e.zo("RunAggregationQuery",e.serializer.databaseId,a,i,1)).filter(e=>!!e.result);F(1===o.length,64727);let l=o[0].result?.aggregateFields;return Object.keys(l).reduce((e,t)=>(e[s[t]]=l[t],e),{})}(e,r,a))}catch(e){n.reject(e)}}),n.promise).then(t=>new ag(e,new ao(i),t))}(e,{count:new ap("count")})}class aM{constructor(e,t){this.hasPendingWrites=e,this.fromCache=t}isEqual(e){return this.hasPendingWrites===e.hasPendingWrites&&this.fromCache===e.fromCache}}class aF extends am{constructor(e,t,r,n,i,s){super(e,t,r,n,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 aL(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 r=this._document.data.field(at("DocumentSnapshot.get",e));if(null!==r)return this._userDataWriter.convertValue(r,t.serverTimestamps)}}toJSON(){if(this.metadata.hasPendingWrites)throw new U(L.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=aF._jsonSchemaVersion,t.bundle="",t.bundleSource="DocumentSnapshot",t.bundleName=this._key.toString(),e&&e.isValidDocument()&&e.isFoundDocument()&&
183(this._userDataWriter.convertObjectMap(e.data.value.mapValue.fields,"previous"),this._firestore,this.ref.path,t.bundle="NOT SUPPORTED"),t}}aF._jsonSchemaVersion="firestore/documentSnapshot/1.0",aF._jsonSchema={type:eh("string",aF._jsonSchemaVersion),bundleSource:eh("string","DocumentSnapshot"),bundleName:eh("string"),bundle:eh("string")};class aL extends aF{data(e={}){return super.data(e)}}class aU{constructor(e,t,r,n){this._firestore=e,this._userDataWriter=t,this._snapshot=n,this.metadata=new aM(n.hasPendingWrites,n.fromCache),this.query=r}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(r=>{e.call(t,new aL(this._firestore,this._userDataWriter,r.key,r,new aM(this._snapshot.mutatedKeys.has(r.key),this._snapshot.fromCache),this.query.converter))})}docChanges(e={}){let t=!!e.includeMetadataChanges;if(t&&this._snapshot.excludesMetadataChanges)throw new U(L.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(r=>{let n=new aL(e._firestore,e._userDataWriter,r.doc.key,r.doc,new aM(e._snapshot.mutatedKeys.has(r.doc.key),e._snapshot.fromCache),e.query.converter);return r.doc,{type:"added",doc:n,oldIndex:-1,newIndex:t++}})}{let r=e._snapshot.oldDocs;return e._snapshot.docChanges.filter(e=>t||3!==e.type).map(t=>{let n=new aL(e._firestore,e._userDataWriter,t.doc.key,t.doc,new aM(e._snapshot.mutatedKeys.has(t.doc.key),e._snapshot.fromCache),e.query.converter),i=-1,s=-1;return 0!==t.type&&(i=r.indexOf(t.doc.key),r=r.delete(t.doc.key)),1!==t.type&&(s=(r=r.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 N(61501,{type:e})}}(t.type),doc:n,oldIndex:i,newIndex:s}})}}(this,t),this._cachedChangesIncludeMetadataChanges=t),this._cachedChanges}toJSON(){if(this.metadata.hasPendingWrites)throw new U(L.FAILED_PRECONDITION,"QuerySnapshot.toJSON() attempted to serialize a document with pending writes. Await waitForPendingWrites() before invoking toJSON().");let e={};e.type=aU._jsonSchemaVersion,e.bundleSource="QuerySnapshot",e.bundleName=K.newId(),this._firestore._databaseId.database,this._firestore._databaseId.projectId;let t=[],r=[],n=[];return this.docs.forEach(e=>{null!==e._document&&(t.push(e._document),r.push(this._userDataWriter.convertObjectMap(e._document.data.value.mapValue.fields,"previous")),n.push(e.ref.path))}),this._firestore,this.query._query,e.bundleName,e.bundle="NOT SUPPORTED",e}}aU._jsonSchemaVersion="firestore/querySnapshot/1.0",aU._jsonSchema={type:eh("string",aU._jsonSchemaVersion),bundleSource:eh("string","QuerySnapshot"),bundleName:eh("string"),bundle:eh("string")};let aj={maxAttempts:5};class a${constructor(e,t){this._firestore=e,this._commitHandler=t,this._mutations=[],this._committed=!1,this._dataReader=sZ(e)}set(e,t,r){this._verifyNotCommitted();let n=aV(e,this._firestore),i=aD(n.converter,t,r),s=s0(this._dataReader,"WriteBatch.set",n._key,i,null!==n.converter,r);return this._mutations.push(s.toMutation(n._key,ru.none())),this}update(e,t,r,...n){let i;this._verifyNotCommitted();let s=aV(e,this._firestore);return i="string"==typeof(t=(0,_.Ku)(t))||t instanceof sW?s4(this._dataReader,"WriteBatch.update",s._key,t,r,n):s6(this._dataReader,"WriteBatch.update",s._key,t),this._mutations.push(i.toMutation(s._key,ru.exists(!0))),this}delete(e){this._verifyNotCommitted();let t=aV(e,this._firestore);return this._mutations=this._mutations.concat(new rb(t._key,ru.none())),this}commit(){return this._verifyNotCommitted(),this._committed=!0,this._mutations.length>0?this._commitHandler(this._mutations):Promise.resolve()}_verifyNotCommitted(){if(this._committed)throw new U(L.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")}}function aV(e,t){if((e=(0,_.Ku)(e)).firestore!==t)throw new U(L.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}class aB{constructor(e,t){this._firestore=e,this._transaction=t,this._dataReader=sZ(e)}get(e){let t=aV(e,this._firestore),r=new aO(this._firestore);return this._transaction.lookup([t._key]).then(e=>{if(!e||1!==e.length)return N(24041);let n=e[0];if(n.isFoundDocument())return new am(this._firestore,r,n.key,n,t.converter);if(n.isNoDocument())return new am(this._firestore,r,t._key,null,t.converter);throw N(18433,{doc:n})})}set(e,t,r){let n=aV(e,this._firestore),i=aD(n.converter,t,r),s=s0(this._dataReader,"Transaction.set",n._key,i,null!==n.converter,r);return this._transaction.set(n._key,s),this}update(e,t,r,...n){let i,s=aV(e,this._firestore);return i="string"==typeof(t=(0,_.Ku)(t))||t instanceof sW?s4(this._dataReader,"Transaction.update",s._key,t,r,n):s6(this._dataReader,"Transaction.update",s._key,t),this._transaction.update(s._key,i),this}delete(e){let t=aV(e,this._firestore);return this._transaction.delete(t._key),this}}class aW extends aB{constructor(e,t){super(e,t),this._firestore=e}get(e){let t=aV(e,this._firestore),r=new ao(this._firestore);return super.get(e).then(e=>new aF(this._firestore,r,t._key,e._document,new aM(!1,!1),t.converter))}}function az(e,t,r){var n,i;let s;e=ec(e,sj);let a={...aj,...r};if(a.maxAttempts<1)throw new U(L.INVALID_ARGUMENT,"Max attempts must be at least 1");return n=sV(e),i=r=>t(new aW(e,r)),s=new j,n.asyncQueue.enqueueAndForget(async()=>{let e=await sS(n);new sm(n.asyncQueue,e,a,i,s).Zu()}),s.promise}function aq(e){e=ec(e,sD);let t=ec(e.firestore,sj);return(function(e,t,r={}){let n=new j;return e.asyncQueue.enqueueAndForget(async()=>{var i,s;let a,o;return i=await sI(e),s=e.asyncQueue,a=new sp({next:e=>{a.ku(),s.enqueueAndForget(()=>iV(i,o));let l=e.docs.has(t);
183!l&&e.fromCache?n.reject(new U(L.UNAVAILABLE,"Failed to get document because the client is offline.")):l&&e.fromCache&&r&&"server"===r.source?n.reject(new U(L.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.)')):n.resolve(e)},error:e=>n.reject(e)}),i$(i,o=new iq(tD(t.path),a,{includeMetadataChanges:!0,$a:!0}))}),n.promise})(sV(t),e._key).then(r=>aX(t,e,r))}function aH(e){e=ec(e,sP);let t=ec(e.firestore,sj),r=sV(t),n=new ao(t);return ay(e._query),(function(e,t,r={}){let n=new j;return e.asyncQueue.enqueueAndForget(async()=>{var i,s;let a,o;return i=await sI(e),s=e.asyncQueue,o=new iq(t,a=new sp({next:e=>{a.ku(),s.enqueueAndForget(()=>iV(i,o)),e.fromCache&&"server"===r.source?n.reject(new U(L.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.)')):n.resolve(e)},error:e=>n.reject(e)}),{includeMetadataChanges:!0,$a:!0}),i$(i,o)}),n.promise})(r,e._query).then(r=>new aU(t,n,e,r))}function aG(e,t,r){e=ec(e,sD);let n=ec(e.firestore,sj),i=aD(e.converter,t,r),s=sZ(n);return aQ(n,[s0(s,"setDoc",e._key,i,null!==e.converter,r).toMutation(e._key,ru.none())])}function aK(e,t,r,...n){e=ec(e,sD);let i=ec(e.firestore,sj),s=sZ(i);return aQ(i,[("string"==typeof(t=(0,_.Ku)(t))||t instanceof sW?s4(s,"updateDoc",e._key,t,r,n):s6(s,"updateDoc",e._key,t)).toMutation(e._key,ru.exists(!0))])}function aY(e){return aQ(ec(e.firestore,sj),[new rb(e._key,ru.none())])}function aJ(e,...t){var r;let n,i,s,a,o;e=(0,_.Ku)(e);let l={includeMetadataChanges:!1,source:"default"},u=0;"object"!=typeof t[0]||af(t[u])||(l=t[u++]);let c={includeMetadataChanges:l.includeMetadataChanges,source:l.source};if(af(t[u])){let e=t[u];t[u]=e.next?.bind(e),t[u+1]=e.error?.bind(e),t[u+2]=e.complete?.bind(e)}if(e instanceof sD)i=ec(e.firestore,sj),s=tD(e._key.path),n={next:r=>{t[u]&&t[u](aX(i,e,r))},error:t[u+1],complete:t[u+2]};else{let r=ec(e,sP);i=ec(r.firestore,sj),s=r._query;let a=new ao(i);n={next:e=>{t[u]&&t[u](new aU(i,a,r,e))},error:t[u+1],complete:t[u+2]},ay(e._query)}return r=sV(i),o=new iq(s,a=new sp(n),c),r.asyncQueue.enqueueAndForget(async()=>i$(await sI(r),o)),()=>{a.ku(),r.asyncQueue.enqueueAndForget(async()=>iV(await sI(r),o))}}function aQ(e,t){var r;let n;return r=sV(e),n=new j,r.asyncQueue.enqueueAndForget(async()=>i6(await sE(r).then(e=>e.syncEngine),t,n)),n.promise}function aX(e,t,r){let n=r.docs.get(t._key),i=new ao(e);return new aF(e,i,t._key,n,new aM(r.hasPendingWrites,r.fromCache),t.converter)}function aZ(e){return sV(e=ec(e,sj)),new a$(e,t=>aQ(e,t))}new WeakMap,function(e=!0){A=v.MF,(0,v.om)(new y.uA("firestore",(t,{instanceIdentifier:r,options:n})=>{let i=t.getProvider("app").getImmediate(),s=new sj(new W(t.getProvider("auth-internal")),new G(i,t.getProvider("app-check-internal")),function(e,t){if(!Object.prototype.hasOwnProperty.apply(e.options,["projectId"]))throw new U(L.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.');return new eK(e.options.projectId,t)}(i,r),i);return n={useFetchStreams:e,...n},s._setSettings(n),s},"PUBLIC").setMultipleInstances(!0)),(0,v.KO)(ah,ad,void 0),(0,v.KO)(ah,ad,"esm2020")}()},27456:(e,t,r)=>{"use strict";r.d(t,{h1:()=>o,uA:()=>i});var n=r(19519);class i{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let s="[DEFAULT]";class a{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 n.cY;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}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 r=this.normalizeInstanceIdentifier(e);try{let e=this.getOrInitializeService({instanceIdentifier:r});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,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(`${this.name}(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(let[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(n);return n}onInit(e,t){let r=this.normalizeInstanceIdentifier(t),n=this.onInitCallbacks.get(r)??new Set;n.add(e),this.onInitCallbacks.set(r,n);let i=this.instances.get(r);return i&&e(i,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){let r=this.onInitCallbacks.get(t);if(r)for(let n of r)try{n(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){var r;let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e)===s?void 0:r,options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch{}return n||null}normalizeInstanceIdentifier(e=s){return this.component?this.component.multipleInstances?e:s:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o{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 a(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},27554:(e,t,r)=>{"use strict";r.d(t,{Ek:()=>o,aq:()=>h,fJ:()=>d,iJ:()=>l,s2:()=>a});var n=r(62221);let i=["steuernummer","taxAffiliation","isTaxExempt","isSME","isConductedByCorporateBodyUnderPublicLaw","legalForm","streetAddress","legalRepresentative","economicSectorWZ2008","hasA
183ssociatedCompanies","haveAssociatedCompaniesRequestedFZulGFunding","fundingAssessmentBasis","associatedCompanies","hasEmployeesAbroad","salaryExpenses"],s=["bsfzId","bsfzDecisionDate","internalOrExternal","isNotContractWork","isNotCooperativeProject","hasProjectChangedSinceBSFZApplication","ftesDomestic","ftesAbroad","contributors","salariesDomestic","salariesAbroad","socialSecurityContributions","contractors","hasConsentedToSharingExternalContractorsWithTaxOffice","hasOtherFunding","additionalFunding"],a="projects_";function o(e){return"string"==typeof e&&e.startsWith(a)}function l(e){return i.includes(e)||o(e)}let u={bsfzId:n.N0.ProjectData,bsfzDecisionDate:n.N0.ProjectData,internalOrExternal:n.N0.ProjectData,isNotContractWork:n.N0.ProjectData,isNotCooperativeProject:n.N0.ProjectData,hasProjectChangedSinceBSFZApplication:n.N0.ProjectData,ftesDomestic:n.N0.RnDCosts,ftesAbroad:n.N0.RnDCosts,contributors:n.N0.RnDCosts,salariesDomestic:n.N0.RnDCosts,salariesAbroad:n.N0.RnDCosts,socialSecurityContributions:n.N0.RnDCosts,contractors:n.N0.ExternalContractors,hasConsentedToSharingExternalContractorsWithTaxOffice:n.N0.ExternalContractors,hasOtherFunding:n.N0.AdditionalFunding,additionalFunding:n.N0.AdditionalFunding},c={steuernummer:n.TI.TaxData,taxAffiliation:n.TI.TaxData,isTaxExempt:n.TI.TaxData,isSME:n.TI.TaxData,isConductedByCorporateBodyUnderPublicLaw:n.TI.TaxData,legalForm:n.TI.GeneralCompanyData,streetAddress:n.TI.GeneralCompanyData,legalRepresentative:n.TI.GeneralCompanyData,economicSectorWZ2008:n.TI.GeneralCompanyData,hasAssociatedCompanies:n.TI.AssociatedCompanies,haveAssociatedCompaniesRequestedFZulGFunding:n.TI.AssociatedCompanies,fundingAssessmentBasis:n.TI.AssociatedCompanies,associatedCompanies:n.TI.AssociatedCompanies,hasEmployeesAbroad:n.TI.SalaryExpenses,salaryExpenses:n.TI.SalaryExpenses};function h(e){if(!l(e))return n.jB.Overview;if(o(e)){let t=e.split("_").pop()||"",r=e.substring(9,21);if(s.includes(t)){let e=u[t];return`${e}_${r}`}return}return c[e]}function d(e){if(!l(e))return"\xdcberblick";if("steuernummer"===e)return"Steuernummer";if("taxAffiliation"===e)return"Organschaft";if("isTaxExempt"===e)return"Ist euer Unternehmen von der Steuer befreit?";if("isSME"===e)return"Ist euer Unternehmen ein KMU?";if("isConductedByCorporateBodyUnderPublicLaw"===e)return"Wurde euer R&D Projekt von juristischen Personen des \xf6ffentlichen Rechts durchgef\xfchrt, entweder im Rahmen eines wirtschaftlichen Gesch\xe4ftsbetriebs oder eines nicht steuerbefreiten Betriebs?";else if("legalForm"===e)return"Unternehmen, Sitz und Rechtsform";else if("streetAddress"===e)return"Gesch\xe4ftsanschrift";else if("legalRepresentative"===e)return"Gesetzlicher Vertreter";else if("economicSectorWZ2008"===e)return"Wirtschaftszweig";else if("hasAssociatedCompanies"===e)return"War euer Unternehmen im Wirtschaftsjahr mit einem anderen in Deutschland ans\xe4ssigen Unternehmen verbunden?";else if("haveAssociatedCompaniesRequestedFZulGFunding"===e)return"Hat eines der verbundenen Unternehmen f\xfcr das Wirtschaftsjahr ebenfalls die Forschungszulage beantragt oder plant dies zu tun?";else if("fundingAssessmentBasis"===e)return"Wie viel der maximalen Bemessungsgrundlage soll ACME AG in Anspruch nehmen?";else if("associatedCompanies"===e)return"Unternehmen, die im Wirtschaftsjahr mit euch verbunden waren";else if("hasEmployeesAbroad"===e)return"Habt ihr Arbeitnehmende, die ihre Steuern in einem anderen EU/EWR-Land oder der Schweiz zahlen?";else if("salaryExpenses"===e)return"Lohnaufwendungen im gesamten Unternehmen";else if(o(e)){if(e.endsWith("bsfzId"))return"Vorhabens-ID der BSFZ";else if(e.endsWith("bsfzDecisionDate"))return"Datum der Bescheinigung";else if(e.endsWith("internalOrExternal"))return"Sind f\xfcr das R&D Projekt im Wirtschaftsjahr interne und / oder externe Kosten angefallen?";else if(e.endsWith("isNotContractWork"))return"Wird das Projekt aus eigener Initiative ausgef\xfchrt?";else if(e.endsWith("isNotCooperativeProject"))return"Wird euer Projekt ohne Kooperationspartner ausgef\xfchrt?";else if(e.endsWith("hasProjectChangedSinceBSFZApplication"))return"Entspricht das Projekt noch den Angaben, die im F\xf6rderantrag gemacht wurden?";else if(e.endsWith("ftesDomestic"))return"Anzahl der FTEs aller Arbeitnehmenden, die in Deutschland Steuern zahlen";else if(e.endsWith("ftesAbroad"))return"Anzahl der FTEs aller Arbeitnehmenden, die ihre Steuern in EU/EWR oder der Schweiz zahlen";else if(e.endsWith("contributors"))return"Anzahl K\xf6pfe, die am Projekt gearbeitet haben";else if(e.endsWith("salariesDomestic"))return"Bruttoarbeitsl\xf6hne aller Arbeitnehmenden, die in Deutschland ihre Steuern zahlen";else if(e.endsWith("salariesAbroad"))return"Bruttoarbeitsl\xf6hne aller Arbeitnehmenden, die ihre Steuern in EU/EWR oder der Schweiz zahlen";else if(e.endsWith("socialSecurityContributions"))return"Ausgaben f\xfcr die Zukunftssicherung aller Arbeitnehmenden, die in Deutschland ihre Steuern zahlen";else if(e.endsWith("contractors"))return"Auftragnehmer, die im Wirtschaftsjahr am Projekt mitgewirkt haben";
183else if(e.endsWith("hasConsentedToSharingExternalContractorsWithTaxOffice"))return"D\xfcrfen die Angaben, die zu externen Auftragnehmern gegen\xfcber der BSFZ gemacht wurden, vom Finanzamt \xfcbernommen werden?";else if(e.endsWith("hasOtherFunding"))return"Wurden im Wirtschaftsjahr andere F\xf6rdermittel oder staatliche Beihilfen gew\xe4hrt oder habt ihr solche beantragt?";else if(e.endsWith("additionalFunding"))return"Liste alle F\xf6rderungen und staatliche Beihilfen, die im Wirtschaftsjahr genutzt wurden."}return""}},28323:(e,t)=>{"use strict";function r(e,t,n=!1){return t?Object.keys(e).filter(e=>n?!t.includes(e):t.includes(e)).reduce((t,r)=>(t[r]=e[r],t),{}):{}}function n(e,t,r,n){let i=n&&Object.keys(n).length>0?new URL(Object.values(n)[0],e):new URL(e);return t&&r&&t.forEach(e=>{r[e]&&i.searchParams.set(e,r[e])}),i.toString()}function i(e,t,r,i,s){var a;if(!t)return`<${e}></${e}>`;let o=(null==(a=t.src)?void 0:a.url)?Object.assign(Object.assign({},t),{src:n(t.src.url,t.src.params,i,s)}):t,l=Object.keys(Object.assign(Object.assign({},o),r)).reduce((e,t)=>{let n=null==r?void 0:r[t],i=o[t],s=null!=n?n:i,a=!0===s?t:`${t}="${s}"`;return s?e+` ${a}`:e},"");return`<${e}${l}></${e}>`}Object.defineProperty(t,"__esModule",{value:!0}),t.formatData=t.createHtml=t.formatUrl=void 0,t.formatUrl=n,t.createHtml=i,t.formatData=function(e,t){var s,a,o,l,u;let c=r(t,null==(s=e.scripts)?void 0:s.reduce((e,t)=>[...e,...Array.isArray(t.params)?t.params:[]],[])),h=r(t,null==(o=null==(a=e.html)?void 0:a.attributes.src)?void 0:o.params),d=r(t,[null==(u=null==(l=e.html)?void 0:l.attributes.src)?void 0:u.slugParam]),f=r(t,[...Object.keys(c),...Object.keys(h),...Object.keys(d)],!0);return Object.assign(Object.assign({},e),{html:e.html?i(e.html.element,e.html.attributes,f,h,d):null,scripts:e.scripts?e.scripts.map(e=>Object.assign(Object.assign({},e),{url:n(e.url,e.params,c)})):null})}},30675:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{apiKey:t,...r}=e,n={...r,key:t},{html:o}=(0,s.GoogleMapsEmbed)(n);return(0,i.jsx)(a.default,{height:n.height||null,width:n.width||null,html:o,dataNtpc:"GoogleMapsEmbed"})};let i=r(26514),s=r(46485),a=n(r(923))},31055:(e,t,r)=>{"use strict";r.d(t,{k:()=>i});var n=r(65756);let i={ordinalNumber:(e,t)=>{let r=Number(e),n=r%100;if(n>20||n<10)switch(n%10){case 1:return r+"st";case 2:return r+"nd";case 3:return r+"rd"}return r+"th"},era:(0,n.o)({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:(0,n.o)({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:e=>e-1}),month:(0,n.o)({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},defaultWidth:"wide"}),day:(0,n.o)({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},defaultWidth:"wide"}),dayPeriod:(0,n.o)({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})}},31972:(e,t,r)=>{"use strict";r.d(t,{VS:()=>n,Vu:()=>i,iq:()=>s});let n=[{name:"Deutschland",alpha2:"de",inEWR:!0},{name:"Afghanistan",alpha2:"af",inEWR:!1},{name:"\xc4gypten",alpha2:"eg",inEWR:!1},{name:"Albanien",alpha2:"al",inEWR:!1},{name:"Algerien",alpha2:"dz",inEWR:!1},{name:"Andorra",alpha2:"ad",inEWR:!1},{name:"Angola",alpha2:"ao",inEWR:!1},{name:"Antigua und Barbuda",alpha2:"ag",inEWR:!1},{name:"\xc4quatorialguinea",alpha2:"gq",inEWR:!1},{name:"Argentinien",alpha2:"ar",inEWR:!1},{name:"Armenien",alpha2:"am",inEWR:!1},{name:"Aserbaidschan",alpha2:"az",inEWR:!1},{name:"\xc4thiopien",alpha2:"et",inEWR:!1},{name:"Australien",alpha2:"au",inEWR:!1},{name:"Bahamas",alpha2:"bs",inEWR:!1},{name:"Bahrain",alpha2:"bh",inEWR:!1},{name:"Bangladesch",alpha2:"bd",inEWR:!1},{name:"Barbados",alpha2:"bb",inEWR:!1},{name:"Belarus",alpha2:"by",inEWR:!1},{name:"Belgien",alpha2:"be",inEWR:!0},{name:"Belize",alpha2:"bz",inEWR:!1},{name:"Benin",alpha2:"bj",inEWR:!1},{name:"Bhutan",alpha2:"bt",inEWR:!1},{name:"Bolivien",alpha2:"bo",inEWR:!1},{name:"Bosnien und Herzegowina",alpha2:"ba",inEWR:!1},{name:"Botswana",alpha2:"bw",inEWR:!1},{name:"Brasilien",alpha2:"br",inEWR:!1},{name:"Brunei",alpha2:"bn",inEWR:!1},{name:"Bulgarien",alpha2:"bg",inEWR:!0},{name:"Burkina Faso",alpha2:"bf",inEWR:!1},{name:"Burundi",alpha2:"bi",inEWR:!1},{name:"Cayman Islands",alpha2:"ky",inEWR:!1},{name:"Chile",alpha2:"cl",inEWR:!1},{name:"Volksrepublik China",alpha2:"cn",inEWR:!1},{name:"Costa Rica",alpha2:"cr",inEWR:!1},{name:"D\xe4nemark",alpha2:"dk",inEWR:!0},{name:"Dominica",alpha2:"dm",inEWR:!1},{name:"Dominikanische Republik",alpha2:"do",inEWR:!1},{name:"Dschibuti",alpha2:"dj",inEWR:!1},{name:"Ecuador",alpha2:"ec",inEWR:!1},{name:"Elfenbeink\xfcste",alpha2:"ci",inEWR:!1},{name:"El Salvador",alpha2:"sv",inEWR:!1},{name:"Eritrea",alpha2:"er",inEWR:!1},{name:"Estland",alpha2:"ee",inEWR:!0},{name:"Eswatini",alpha2:"sz",inEWR:!1},{name:"Fidschi",alpha2:"fj",inEWR:!1},{name:"Finnland",alpha2:"fi",inEWR:!0},{name:"Frankreich",alpha2:"fr",inEWR:!0},{name:"Gabun",alpha2:"ga",inEWR:!1},{name:"Gambia",alpha2:"gm",inEWR:!1},{name:"Georgien",alpha2:"ge",inEWR:!1},{name:"Ghana",alpha2:"gh",inEWR:!1},{name:"Grenada",alpha2:"gd",inEWR:!1},{name:"Griechenland",alpha2:"gr",inEWR:!0},{name:"Guatemala",alpha2:"gt",inEWR:!1},{name:"Guinea",alpha2:"gn",inEWR:!1},{name:"Guinea-Bissau",alpha2:"gw",inEWR:!1},{name:"Guyana",alpha2:"gy",inEWR:!1},{name:"Haiti",alpha2:"ht",inEWR:!1},{name:"Honduras",alpha2:"hn",inEWR:!1},{name:"Indien",alpha2:"in",inEWR:!1},{name:"Indonesien",alpha2:"id",inEWR:!1},{name:"Irak",alpha2:"iq",inEWR:!1},{name:"Iran",alpha2:"ir",inEWR:!1},{name:"Irland",alpha2:"ie",inEWR:!0},{name:"Island",alpha2:"is",inEWR:!0},{name:"Israel",alpha2:"il",inEWR:!1},{name:"Italien",alpha2:"it",inEWR:!0},{name:"Jamaika",alpha2:"jm",inEWR:!1},{name:"Japan",alpha2:"jp",inEWR:!1},{name:"Jemen",alpha2:"ye",inEWR:!1},{name:"Jordanien",alpha2:"jo",inEWR:!1},{name:"Kambodscha",alpha2:"kh",inEWR:!1},{name:"Kamerun",alpha2:"cm",inEWR:!1},{name:"Kanada",alpha2:"ca",inEWR:!1},{name:"Kap Verde",alpha2:"cv",inEWR:!1},{name:"Kasachstan",alpha2:"kz",inEWR:!1},{name:"Katar",alpha2:"qa",inEWR:!1},{name:"Kenia",alpha2:"ke",inEWR:!1},{name:"Kirgisistan",alpha2:"kg",inEWR:!1},{name:"Kiribati",alpha2:"ki",inEWR:!1}
183,{name:"Kolumbien",alpha2:"co",inEWR:!1},{name:"Komoren",alpha2:"km",inEWR:!1},{name:"Kongo, Demokratische Republik",alpha2:"cd",inEWR:!1},{name:"Kongo, Republik",alpha2:"cg",inEWR:!1},{name:"Korea, Nord",alpha2:"kp",inEWR:!1},{name:"Korea, S\xfcd",alpha2:"kr",inEWR:!1},{name:"Kroatien",alpha2:"hr",inEWR:!0},{name:"Kuba",alpha2:"cu",inEWR:!1},{name:"Kuwait",alpha2:"kw",inEWR:!1},{name:"Laos",alpha2:"la",inEWR:!1},{name:"Lesotho",alpha2:"ls",inEWR:!1},{name:"Lettland",alpha2:"lv",inEWR:!0},{name:"Libanon",alpha2:"lb",inEWR:!1},{name:"Liberia",alpha2:"lr",inEWR:!1},{name:"Libyen",alpha2:"ly",inEWR:!1},{name:"Liechtenstein",alpha2:"li",inEWR:!0},{name:"Litauen",alpha2:"lt",inEWR:!0},{name:"Luxemburg",alpha2:"lu",inEWR:!0},{name:"Madagaskar",alpha2:"mg",inEWR:!1},{name:"Malawi",alpha2:"mw",inEWR:!1},{name:"Malaysia",alpha2:"my",inEWR:!1},{name:"Malediven",alpha2:"mv",inEWR:!1},{name:"Mali",alpha2:"ml",inEWR:!1},{name:"Malta",alpha2:"mt",inEWR:!0},{name:"Marokko",alpha2:"ma",inEWR:!1},{name:"Marshallinseln",alpha2:"mh",inEWR:!1},{name:"Mauretanien",alpha2:"mr",inEWR:!1},{name:"Mauritius",alpha2:"mu",inEWR:!1},{name:"Mexiko",alpha2:"mx",inEWR:!1},{name:"Mikronesien",alpha2:"fm",inEWR:!1},{name:"Moldau",alpha2:"md",inEWR:!1},{name:"Monaco",alpha2:"mc",inEWR:!1},{name:"Mongolei",alpha2:"mn",inEWR:!1},{name:"Montenegro",alpha2:"me",inEWR:!1},{name:"Mosambik",alpha2:"mz",inEWR:!1},{name:"Myanmar",alpha2:"mm",inEWR:!1},{name:"Namibia",alpha2:"na",inEWR:!1},{name:"Nauru",alpha2:"nr",inEWR:!1},{name:"Nepal",alpha2:"np",inEWR:!1},{name:"Neuseeland",alpha2:"nz",inEWR:!1},{name:"Nicaragua",alpha2:"ni",inEWR:!1},{name:"Niederlande",alpha2:"nl",inEWR:!0},{name:"Niger",alpha2:"ne",inEWR:!1},{name:"Nigeria",alpha2:"ng",inEWR:!1},{name:"Nordmazedonien",alpha2:"mk",inEWR:!1},{name:"Norwegen",alpha2:"no",inEWR:!0},{name:"Oman",alpha2:"om",inEWR:!1},{name:"\xd6sterreich",alpha2:"at",inEWR:!0},{name:"Osttimor",alpha2:"tl",inEWR:!1},{name:"Pakistan",alpha2:"pk",inEWR:!1},{name:"Palau",alpha2:"pw",inEWR:!1},{name:"Panama",alpha2:"pa",inEWR:!1},{name:"Papua-Neuguinea",alpha2:"pg",inEWR:!1},{name:"Paraguay",alpha2:"py",inEWR:!1},{name:"Peru",alpha2:"pe",inEWR:!1},{name:"Philippinen",alpha2:"ph",inEWR:!1},{name:"Polen",alpha2:"pl",inEWR:!0},{name:"Portugal",alpha2:"pt",inEWR:!0},{name:"Ruanda",alpha2:"rw",inEWR:!1},{name:"Rum\xe4nien",alpha2:"ro",inEWR:!0},{name:"Russland",alpha2:"ru",inEWR:!1},{name:"Salomonen",alpha2:"sb",inEWR:!1},{name:"Sambia",alpha2:"zm",inEWR:!1},{name:"Samoa",alpha2:"ws",inEWR:!1},{name:"San Marino",alpha2:"sm",inEWR:!1},{name:"S\xe3o Tom\xe9 und Pr\xedncipe",alpha2:"st",inEWR:!1},{name:"Saudi-Arabien",alpha2:"sa",inEWR:!1},{name:"Schweden",alpha2:"se",inEWR:!0},{name:"Schweiz",alpha2:"ch",inEWR:!1},{name:"Senegal",alpha2:"sn",inEWR:!1},{name:"Serbien",alpha2:"rs",inEWR:!1},{name:"Seychellen",alpha2:"sc",inEWR:!1},{name:"Sierra Leone",alpha2:"sl",inEWR:!1},{name:"Simbabwe",alpha2:"zw",inEWR:!1},{name:"Singapur",alpha2:"sg",inEWR:!1},{name:"Slowakei",alpha2:"sk",inEWR:!0},{name:"Slowenien",alpha2:"si",inEWR:!0},{name:"Somalia",alpha2:"so",inEWR:!1},{name:"Spanien",alpha2:"es",inEWR:!0},{name:"Sri Lanka",alpha2:"lk",inEWR:!1},{name:"St. Kitts und Nevis",alpha2:"kn",inEWR:!1},{name:"St. Lucia",alpha2:"lc",inEWR:!1},{name:"St. Vincent und die Grenadinen",alpha2:"vc",inEWR:!1},{name:"S\xfcdafrika",alpha2:"za",inEWR:!1},{name:"Sudan",alpha2:"sd",inEWR:!1},{name:"S\xfcdsudan",alpha2:"ss",inEWR:!1},{name:"Suriname",alpha2:"sr",inEWR:!1},{name:"Syrien",alpha2:"sy",inEWR:!1},{name:"Tadschikistan",alpha2:"tj",inEWR:!1},{name:"Tansania",alpha2:"tz",inEWR:!1},{name:"Thailand",alpha2:"th",inEWR:!1},{name:"Togo",alpha2:"tg",inEWR:!1},{name:"Tonga",alpha2:"to",inEWR:!1},{name:"Trinidad und Tobago",alpha2:"tt",inEWR:!1},{name:"Tschad",alpha2:"td",inEWR:!1},{name:"Tschechien",alpha2:"cz",inEWR:!0},{name:"Tunesien",alpha2:"tn",inEWR:!1},{name:"T\xfcrkei",alpha2:"tr",inEWR:!1},{name:"Turkmenistan",alpha2:"tm",inEWR:!1},{name:"Tuvalu",alpha2:"tv",inEWR:!1},{name:"Uganda",alpha2:"ug",inEWR:!1},{name:"Ukraine",alpha2:"ua",inEWR:!1},{name:"Ungarn",alpha2:"hu",inEWR:!0},{name:"Uruguay",alpha2:"uy",inEWR:!1},{name:"Usbekistan",alpha2:"uz",inEWR:!1},{name:"Vanuatu",alpha2:"vu",inEWR:!1},{name:"Venezuela",alpha2:"ve",inEWR:!1},{name:"Vereinigte Arabische Emirate",alpha2:"ae",inEWR:!1},{name:"Vereinigte Staaten",alpha2:"us",inEWR:!1},{name:"Vereinigtes K\xf6nigreich",alpha2:"gb",inEWR:!1},{name:"Vietnam",alpha2:"vn",inEWR:!1},{name:"Zentralafrikanische Republik",alpha2:"cf",inEWR:!1},{name:"Zypern",alpha2:"cy",inEWR:!0}],i={de:"Deutschland",af:"Afghanistan",eg:"\xc4gypten",al:"Albanien",dz:"Algerien",ad:"And
183orra",ao:"Angola",ag:"Antigua und Barbuda",gq:"\xc4quatorialguinea",ar:"Argentinien",am:"Armenien",az:"Aserbaidschan",et:"\xc4thiopien",au:"Australien",bs:"Bahamas",bh:"Bahrain",bd:"Bangladesch",bb:"Barbados",by:"Belarus",be:"Belgien",bz:"Belize",bj:"Benin",bt:"Bhutan",bo:"Bolivien",ba:"Bosnien und Herzegowina",bw:"Botswana",br:"Brasilien",bn:"Brunei",bg:"Bulgarien",bf:"Burkina Faso",bi:"Burundi",ky:"Cayman Islands",cl:"Chile",cn:"Volksrepublik China",cr:"Costa Rica",dk:"D\xe4nemark",dm:"Dominica",do:"Dominikanische Republik",dj:"Dschibuti",ec:"Ecuador",ci:"Elfenbeink\xfcste",sv:"El Salvador",er:"Eritrea",ee:"Estland",sz:"Eswatini",fj:"Fidschi",fi:"Finnland",fr:"Frankreich",ga:"Gabun",gm:"Gambia",ge:"Georgien",gh:"Ghana",gd:"Grenada",gr:"Griechenland",gt:"Guatemala",gn:"Guinea",gw:"Guinea-Bissau",gy:"Guyana",ht:"Haiti",hn:"Honduras",in:"Indien",id:"Indonesien",iq:"Irak",ir:"Iran",ie:"Irland",is:"Island",il:"Israel",it:"Italien",jm:"Jamaika",jp:"Japan",ye:"Jemen",jo:"Jordanien",kh:"Kambodscha",cm:"Kamerun",ca:"Kanada",cv:"Kap Verde",kz:"Kasachstan",qa:"Katar",ke:"Kenia",kg:"Kirgisistan",ki:"Kiribati",co:"Kolumbien",km:"Komoren",cd:"Kongo, Demokratische Republik",cg:"Kongo, Republik",kp:"Korea, Nord",kr:"Korea, S\xfcd",hr:"Kroatien",cu:"Kuba",kw:"Kuwait",la:"Laos",ls:"Lesotho",lv:"Lettland",lb:"Libanon",lr:"Liberia",ly:"Libyen",li:"Liechtenstein",lt:"Litauen",lu:"Luxemburg",mg:"Madagaskar",mw:"Malawi",my:"Malaysia",mv:"Malediven",ml:"Mali",mt:"Malta",ma:"Marokko",mh:"Marshallinseln",mr:"Mauretanien",mu:"Mauritius",mx:"Mexiko",fm:"Mikronesien",md:"Moldau",mc:"Monaco",mn:"Mongolei",me:"Montenegro",mz:"Mosambik",mm:"Myanmar",na:"Namibia",nr:"Nauru",np:"Nepal",nz:"Neuseeland",ni:"Nicaragua",nl:"Niederlande",ne:"Niger",ng:"Nigeria",mk:"Nordmazedonien",no:"Norwegen",om:"Oman",at:"\xd6sterreich",tl:"Osttimor",pk:"Pakistan",pw:"Palau",pa:"Panama",pg:"Papua-Neuguinea",py:"Paraguay",pe:"Peru",ph:"Philippinen",pl:"Polen",pt:"Portugal",rw:"Ruanda",ro:"Rum\xe4nien",ru:"Russland",sb:"Salomonen",zm:"Sambia",ws:"Samoa",sm:"San Marino",st:"S\xe3o Tom\xe9 und Pr\xedncipe",sa:"Saudi-Arabien",se:"Schweden",ch:"Schweiz",sn:"Senegal",rs:"Serbien",sc:"Seychellen",sl:"Sierra Leone",zw:"Simbabwe",sg:"Singapur",sk:"Slowakei",si:"Slowenien",so:"Somalia",es:"Spanien",lk:"Sri Lanka",kn:"St. Kitts und Nevis",lc:"St. Lucia",vc:"St. Vincent und die Grenadinen",za:"S\xfcdafrika",sd:"Sudan",ss:"S\xfcdsudan",sr:"Suriname",sy:"Syrien",tj:"Tadschikistan",tz:"Tansania",th:"Thailand",tg:"Togo",to:"Tonga",tt:"Trinidad und Tobago",td:"Tschad",cz:"Tschechien",tn:"Tunesien",tr:"T\xfcrkei",tm:"Turkmenistan",tv:"Tuvalu",ug:"Uganda",ua:"Ukraine",hu:"Ungarn",uy:"Uruguay",uz:"Usbekistan",vu:"Vanuatu",ve:"Venezuela",ae:"Vereinigte Arabische Emirate",us:"Vereinigte Staaten",gb
183:"Vereinigtes K\xf6nigreich",vn:"Vietnam",cf:"Zentralafrikanische Republik",cy:"Zypern"},s={de:!0,be:!0,bg:!0,dk:!0,ee:!0,fi:!0,fr:!0,gr:!0,ie:!0,is:!0,it:!0,hr:!0,lv:!0,li:!0,lt:!0,lu:!0,mt:!0,nl:!0,no:!0,at:!0,pl:!0,pt:!0,ro:!0,se:!0,sk:!0,si:!0,es:!0,cz:!0,hu:!0,cy:!0}},32797:(e,t,r)=>{"use strict";r.d(t,{Ex:()=>p,H2:()=>c,X2:()=>l,Z9:()=>v,e8:()=>f,eT:()=>h,jq:()=>o,oU:()=>a,sT:()=>d,uq:()=>u});var n=r(18389),i=r(76055),s=r(43247);let a="abroad";function o(e){return void 0!==e&&null!==e.email&&(e.role===i.gG.Admin||e.role===i.gG.Super)}function l(e){return e.role===i.gG.Admin}function u(e,t){let r=`${e.firstName} ${e.lastName}`,n=`${t.firstName} ${t.lastName}`;return r.localeCompare(n)}function c(e,t){let r=`${e.lastName} ${e.firstName}`,n=`${t.lastName} ${t.firstName}`;return r.localeCompare(n)}function h(e,t){let r=t.find(t=>t.id===e);return r?`${r.firstName} ${r.lastName}`:""}function d(e,t){let r=(0,s.Yh)(e.employmentStartDate),n=(0,s.Yh)(e.employmentEndDate);return null!==r&&r.getFullYear()<=parseInt(t)&&(!n||n.getFullYear()>=parseInt(t))}function f(e){return"de"===e.taxResidence}function p(){return(0,n.d_)("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",28)()}function g(e,t){return"asc"===t?e:-e}function m(e,t,r){return"number"==typeof e&&"number"==typeof t?g(e-t,r):g(String(e).localeCompare(String(t)),r)}function v(e,t,r,n){let i=r?.direction??"asc";switch(r?.sortingKey){case"email":return m(e.email||"-",t.email||"-",i);case"createdAt":return m(e.createdAt.seconds,t.createdAt.seconds,i)}let s=r&&n?.[r.sortingKey];return s?m(s(e),s(t),i):g(u(e,t),i)}},33208:(e,t,r)=>{"use strict";r.d(t,{j:()=>u,r:()=>l});var n=r(26514),i=r(25203),s=r(63052),a=r(75834);let o=(0,a.createContext)({});function l({children:e}){let{authUser:t,loading:r}=(0,i.ZY)(),u=(0,a.useRef)(t);(0,a.useEffect)(()=>{u.current=t},[t]);let c=(0,a.useRef)(r);return(0,a.useEffect)(()=>{c.current=r},[r]),(0,n.jsx)(o.Provider,{value:{trackError:function e(t,r,n,i=1){if("localhost"!==location.hostname){let a=c.current,o=u.current;if((!s.Ay.__loaded||!o&&a)&&i<6)return void setTimeout(()=>e(t,r,n,i+1),100*i);let l={message:t,userId:o?.uid,role:o?.actingRole,customerId:o?.claims.customerId,...n};s.Ay.captureException(r,l)}else console.error(t,r)},trackWarning:function e(t,r,n=1){if("localhost"!==location.hostname){let i=c.current,a=u.current;if((!s.Ay.__loaded||!a&&i)&&n<6)return void setTimeout(()=>e(t,r,n+1),100*n);let o={eventKind:"warning",userId:a?.uid,role:a?.actingRole,customerId:a?.claims.customerId,...r};s.Ay.capture("â ï¸ "+t,o)}else console.warn("â ï¸ "+t,r)}},children:e})}let u=()=>{let e=(0,a.useContext)(o);if("function"!=typeof e.trackError)throw Error("useErrorTracking requires <ErrorTrackingProvider> higher in the component tree");return e}},34001:(e,t,r)=>{"use strict";function n(e){return e instanceof Date||"object"==typeof e&&"[object Date]"===Object.prototype.toString.call(e)}r.d(t,{$:()=>n})},34029:(e,t,r)=>{"use strict";r.d(t,{cQ:()=>o,nA:()=>u,ts:()=>c,wL:()=>a});var n=r(83246),i=r(55158);let s=[{validFrom:new Date("2021-11-01"),validUntil:new Date("2022-02-08"),fileName:"Coup AGBs.pdf",filePath:"shared_docs/terms/2021-11-01/Coup AGBs.pdf",isLatest:!1},{validFrom:new Date("2022-02-09"),validUntil:new Date("2022-03-28"),fileName:"Coup AGBs.pdf",filePath:"shared_docs/terms/2022-02-09/Coup AGBs.pdf",isLatest:!1},{validFrom:new Date("2022-03-29"),validUntil:new Date("2022-08-08"),fileName:"Coup AGBs.pdf",filePath:"shared_docs/terms/2022-03-29/Coup AGBs.pdf",isLatest:!1},{validFrom:new Date("2022-08-09"),validUntil:new Date("2025-05-25"),fileName:"Coup AGBs.pdf",filePath:"shared_docs/terms/2022-08-09/Coup AGBs.pdf",isLatest:!1},{validFrom:new Date("2025-05-26"),validUntil:(0,n.e)(new Date,10),fileName:"Coup Vertrag ueber die Zusammenarbeit.pdf",filePath:"shared_docs/terms/2025-05-26/Coup Vertrag ueber die Zusammenarbeit.pdf",isLatest:!0}];function a(e){if(!e)return null;let t=e.toDate();for(let e of s)if((0,i.Y)(t,e.validUntil))return e;return null}function o(){return s.at(-1)}let l=[{validFrom:new Date("2023-09-28"),validUntil:new Date("2025-05-25"),fileName:"",filePath:"",isLatest:!1},{validFrom:new Date("2025-05-26"),validUntil:(0,n.e)(new Date,10),fileName:"Coup AVV.pdf",filePath:"shared_docs/terms/2025-05-26/Coup AVV.pdf",isLatest:!0}];function u(){return l.at(-1)}function c(e,t,r){if(!e||!t)return null;let n=t.toDate(),s=!0;for(let t of l){if((0,i.Y)(n,t.validUntil)){if(s&&r)return{...t,fileName:r,filePath:`customers/${e}/${r}`};return t}s=!1}return null}},35292:(e,t,r)=>{"use strict";r.d(t,{o:()=>i});var n=r(6792);function i(e,t){let r=(0,n.a)(e,t?.in);return r.setHours(0,0,0,0),r}},35681:(e,t,r)=>{"use strict";r.d(t,{Y:()=>i});var n=r(6344);let i={ordinalNumber:(0,r(14910).K)({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:e=>parseInt(e,10)}),era:(0,n.A)({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:(0,n.A)({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:e=>e+1}),month:(0,n.A)({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},defaultParseWidth:"any"}),day:(0,n.A)({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:(0,n.A)({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})}},36100:(e,t,r)=>{"use strict";r.d(t,{DI:()=>u,Pj:()=>s,cP:()=>o,d4:()=>l,oe:()=>a,zp:()=>i});var n=r(41040);function i(){return"function"==typeof window.gtag}function s(e){i()&>ag("set","user_properties",{coup_user_id:e})}function a(e){i()&>ag("config",n.T.firebaseConfig.measurementId,{page_path:e})}function o(e){i()&>ag("event","search",{search_term:e})}function l(e,t){i()&>ag("event","select_content",{content_type:e,item_id:t})}function u(e){if(i())switch(e.kind){case"leads_form_submission":return"function"==typeof window.lintrk&&window.lintrk("track",{conversion_id:"6105274"}),gtag("event","leads_form_submission",{event_category:"engagement"});case"leads_guide_submission":return gtag("event","leads_guide_submission",{event_category:"engagement"});case"book_a_call":return gtag("event","book_a_call",{event_category:"engagement",event_label:e.data.userId,customer_id:e.data.customerId})}}},36908:(e,t,r)=>{"use strict";r.d(t,{s:()=>l});var n=r(74226),i=r(49943),s=r(95498),a=r(83813),o=r(6792);function l(e,t){let r,l,u=(0,o.a)(e,t?.in);return Math.round(((0,i.b)(u)-(r=(0,a.p)(u,void 0),(l=(0,s.w)(u,0)).setFullYear(r,0,4),l.setHours(0,0,0,0),(0,i.b)(l)))/n.my)+1}},38420:function(e,t,r){"use strict";var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}
183,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleMapsEmbed=void 0;let s=i(r(95926)),a=r(28323);t.GoogleMapsEmbed=e=>{var t=n(e,[]);return(0,a.formatData)(s.default,t)}},39655:(e,t,r)=>{"use strict";r.d(t,{Oh:()=>g,YJ:()=>h,gf:()=>d,hI:()=>v,j5:()=>m,rj:()=>p,rq:()=>f});var n,i,s=r(25229),a=r(18389),o=r(86281),l=r(89797),u=r(27554),c=r(7459),h=((n=h||{}).NoTaxAffiliation="no_tax_affiliation",n.ParentCompany="parent_company",n.SubsidiaryCompany="subsidiary_company",n.ParentSubsidiaryUnion="parent_subsidiary_union",n),d=((i=d||{}).Applied="applied",i.Approved="approved",i.Unselected="unselected",i);function f(e){let t=s.Dc.now(),r={ftesAbroad:e.salaryExpenses?.ftesAbroad||"",ftesDomestic:e.salaryExpenses?.ftesDomestic||"",hasEmployeesAbroad:"boolean"==typeof e.salaryExpenses?.hasEmployeesAbroad?e.salaryExpenses.hasEmployeesAbroad:null,salariesAbroad:e.salaryExpenses?.salariesAbroad||"",salariesDomestic:e.salariesDomestic||"",socialSecurityContributions:e.socialSecurityContributions||""};return{id:(0,a.Ak)(12),customerId:e.customerId,status:c.Z.InCreation,statusHistory:[],kind:l.Q.PayoutApplication,revisionId:(0,a.Ak)(12),revisionCreatedAt:t,createdAt:t,createdBy:e.createdBy,createdByEmail:e.createdByEmail,createdByDisplayName:e.createdByDisplayName,lastUpdatedAt:t,lastUpdatedBy:e.createdBy,lastUpdatedByEmail:e.createdByEmail,lastUpdatedByDisplayName:e.createdByDisplayName,data:{...e.customerInfo,startFiscalYear:e.startFiscalYear,endFiscalYear:e.endFiscalYear,economicSectorWZ2008:e.economicSectorWZ2008||"",taxAffiliation:"no_tax_affiliation",isTaxExempt:!1,isConductedByCorporateBodyUnderPublicLaw:!1,hasAssociatedCompanies:null,hasConsentedToSharingAssociatedCompaniesWithTaxOffice:null,haveAssociatedCompaniesRequestedFZulGFunding:null,fundingAssessmentBasis:"",associatedCompanies:[],salaryExpenses:r,projects:e.projects,...(0,o.M)("isSME",e.isSME)}}}function p(e){return{id:(0,a.Ak)(12),name:"",fundingBody:"",fundingStatus:"unselected",...e}}function g(e){return{id:(0,a.Ak)(12),name:"",hasRequestedFZulGFunding:!0,federalState:null,steuernummer:"",...e}}function m(e){return{id:(0,a.Ak)(12),name:"",country:"",zipCode:"",city:"",streetAddress:"",vatId:"",federalState:null,isSubContract:!1,paidInvoices:"",...e}}function v(e,t){if("steuernummer"===e)return{federalState:t.data.federalState,steuernummer:t.data.steuernummer};if("taxAffiliation"===e)return{taxAffiliation:t.data.taxAffiliation};if("isTaxExempt"===e)return{isTaxExempt:t.data.isTaxExempt};if("isSME"===e)return{isSME:t.data.isSME};if("isConductedByCorporateBodyUnderPublicLaw"===e)return{isConductedByCorporateBodyUnderPublicLaw:t.data.isConductedByCorporateBodyUnderPublicLaw};else if("legalForm"===e)return{customerName:t.data.customerName,legalForm:t.data.legalForm,municipality:t.data.municipality};else if("streetAddress"===e)return{streetAddress:t.data.streetAddress,addressLine2:t.data.addressLine2,zipCode:t.data.zipCode,city:t.data.city,...t.data.country?{country:t.data.country}:{}};else if("legalRepresentative"===e)return{legalRepresentative:t.data.legalRepresentative};else if("economicSectorWZ2008"===e)return{economicSectorWZ2008:t.data.economicSectorWZ2008};else if("hasAssociatedCompanies"===e)return{hasAssociatedCompanies:t.data.hasAssociatedCompanies};else if("haveAssociatedCompaniesRequestedFZulGFunding"===e)return{haveAssociatedCompaniesRequestedFZulGFunding:t.data.haveAssociatedCompaniesRequestedFZulGFunding};else if("fundingAssessmentBasis"===e)return{fundingAssessmentBasis:t.data.fundingAssessmentBasis};else if("associatedCompanies"===e)return{associatedCompanies:t.data.associatedCompanies};else if("hasEmployeesAbroad"===e)return{salaryExpenses:t.data.salaryExpenses};else if("salaryExpenses"===e)return{salaryExpenses:t.data.salaryExpenses};else if((0,u.Ek)(e)){let r=e.replace("projects_","").substring(0,12),n=t.data.projects.find(e=>e.id===r);if(!n)throw Error(`Cannot find project with id ${r}`);return{projects:[n]}}return{}}},40528:(e,t,r)=>{"use strict";function n(e){return e.replaceAll(/<[^>]*>/g,"")}r.d(t,{$:()=>n})},41040:(e,t,r)=>{"use strict";r.d(t,{T:()=>n});let n={env:"production",appName:"Coup",protocol:"localhost"===location.hostname?"http://":"https://",baseUrl:"localhost"===location.hostname?"localhost:3000":"www.getcouped.com",emailDomain:"@getcouped.com",firebaseConfig:{apiKey:"AIzaSyCdPm9BeYJ3DMNU0hsIdfNm-4_nCJXDjU0",authDomain:"get-couped.firebaseapp.com",projectId:"get-couped",storageBucket:"get-couped.appspot.com",messagingSenderId:"147997862542",appId:"1:147997862542:web:f72607c77eb926c52677df",measurementId:"G-94B57G672X"},EMULATOR_AUTH_PORT:9099,EMULATOR_FIRESTORE_PORT:8080,EMULATOR_FUNCTIONS_PORT:5001,EMULATOR_HOSTING_PORT:5e3,EMULATOR_STORAGE_PORT:9199,algoliaConfig:{appId:"BYA0CI2E46",apiKey:"4e5369125ddce2ab05bf0bb6854c20fb",fundingDatabaseIndex:"foerderdatenbank"},stripeConfig:{publishableKey:"pk_live_51MU8pUAL3G2Hpjvuaoe52YNU2r2vLSBeKQz5qSsMHkOD5f6tcnurW4GtwTgY38W5G8mCrnRiP9EtaNdqlrWSSTu900qrrxtZUG",priceIdS:"price_1MlCU1AL3G2Hpjvuv5pLq6M2",priceIdM:"price_1MlCUZAL3G2HpjvuOFVaGsZ5",priceIdL:"price_1MlCUvAL3G2HpjvuAsJZGcLO"}}},41669:(e,t,r)=>{"use strict";let n;r.d(t,{AH:()=>w,Mg:()=>v,Sl:()=>m,Wz:()=>p,_H:()=>S,ap:()=>h,b6:()=>c,dE:()=>y,dj:()=>E,ec:()=>_,iD:()=>d,in:()=>f,pu:()=>b,ri:()=>g});var i=r(76055),s=r(64233),a=r(90035),o=r(41040),l=r(60858),u=r(20514);function c(e){let{role:t}=e.claims;return t===i.gG.Admin&&"custom"===e.signInProvider?"super_admin":t}function h(){return n}async function d(e,t){try{let{user:r}=await (0,a.x9)(n,e,t);return r}catch(e){if("auth/multi-factor-auth-required"===e.code)return{resolver:(0,a.vZ)(n,e)};throw e}}async function f(e,t){let r=e.hints.find(e=>"totp"===e.factorId)?.uid;if(!r)throw Error("Cannot complete MFA sign-in - invalid resolver");let n=a.p7.assertionForSignIn(r,t);return e.resolveSignIn(n)}async function p(e){let{user:t}=await (0,a.p)(n,e);return t}async function g(){return(0,u.eD)(),(0,a.CI)(n)}async function m(e){return(0,a.RE)(n,e)}async function v(e,t,r){if(await (0,a.R4)(n,e,t),r)try{return await (0,a.x9)(n,r,t),!0}catch(e){if("auth/multi-factor-auth-required"===e.code)return{resolver:(0,a.vZ)(n,e)};throw e}return!1}async function y(e){let t=n.currentUser;if(null===t)throw new s.q("Error re-authenticating user","user-not-found");let r=t.email;if(!r)throw new s.q("Error re-authenticating user","email-not-found");try{let n=a.IX.credential(r,e);await (0,a.kZ)(t,n)}catch(e){if("auth/multi-factor-auth-required"===e.code)return{resolver:(0,a.vZ)(n,e)};throw e}}async function _(e){let t=n.currentUser;if(!t)throw new s.q("Error updating user password","user-not-found");return(0,a.f3)(t,e)}async function b(){let e=n.currentUser;if(!e)throw new s.q("No logged-in user","user-not-found");return(0,a.VO)(e).getSession()}async function w(e,t,r="TOTP"){let i=n.currentUser;if(!i)throw new s.q("No logged-in user","user-not-found");let o=a.p7.assertionForEnrollment(e,t);return(0,a.VO)(i).enroll(o,r)}async function E(){let e=n.currentUser;if(!e)throw new s.q("No logged-in user","user-not-found");let t=(0,a.VO)(e);for(let e of t.enrolledFactors)await t.unenroll(e)}function S(e){return"object"==typeof e&&null!==e&&"resolver"in e}n=(0,a.xI)(l.x),"localhost"===location.hostname&&(0,a.Wq)(n,"http://localhost:"+
183o.T.EMULATOR_AUTH_PORT,{disableWarnings:!0})},43247:(e,t,r)=>{"use strict";r.d(t,{Cq:()=>o,H:()=>h,Pn:()=>a,Rd:()=>p,SK:()=>m,Yh:()=>f,_T:()=>c,iV:()=>u,pm:()=>g,pp:()=>d,sq:()=>l});var n=r(57677),i=r(55158),s=r(98381);function a(e){return"string"==typeof e&&/^20[0-9]{2}$/gm.test(e)}function o(e){return"string"==typeof e&&/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/.test(e)}function l(e){return(0,n.GP)(e,"yyyy-MM-dd")}function u(e){return e.split("-")[2]}function c(e){return e.split("-")[1]}function h(e){return e.split("-")[0]}function d(e){if(null!==e&&"object"==typeof e&&"function"==typeof e.toDate)return e.toDate();let[t,r,n]=e.split("-"),i=parseInt(t),s=parseInt(r)-1,a=parseInt(n);if(isNaN(i))throw Error(`Cannot parse date string ${e}`);return isNaN(s)||isNaN(a)?isNaN(s)?new Date(i,0):new Date(i,s):new Date(i,s,a)}function f(e){return e?d(e):null}let p=["01","02","03","04","05","06","07","08","09","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"];function g(e,t,r,n){return!!e&&!!t&&!!r&&!!n&&(0,i.Y)(d(e),d(n))&&(0,s.d)(d(t),d(r))}function m(){return new Date().getFullYear().toString()}},44786:(e,t,r)=>{"use strict";r.d(t,{h:()=>o});var n=r(59231),i=r(95498),s=r(82430),a=r(6792);function o(e,t){let r=(0,a.a)(e,t?.in),o=r.getFullYear(),l=(0,n.q)(),u=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??l.firstWeekContainsDate??l.locale?.options?.firstWeekContainsDate??1,c=(0,i.w)(t?.in||e,0);c.setFullYear(o+1,0,u),c.setHours(0,0,0,0);let h=(0,s.k)(c,t),d=(0,i.w)(t?.in||e,0);d.setFullYear(o,0,u),d.setHours(0,0,0,0);let f=(0,s.k)(d,t);return+r>=+h?o+1:+r>=+f?o:o-1}},45964:(e,t,r)=>{"use strict";r.d(t,{B$:()=>S,Dp:()=>y,Gw:()=>m,KB:()=>_,Ue:()=>p,YD:()=>g,aH:()=>f,ae:()=>w,gD:()=>E,m2:()=>v,rk:()=>I,ru:()=>k,vk:()=>b});var n=r(85203),i=r(56705),s=r(18389),a=r(99582),o=r(80036),l=r(31972),u=r(43247),c=r(92674),h=r(13002),d=r(7459);function f(e,t){let{displayYear:r}=p(e);return t?`Antrag auf FZul ${r}`:`Antrag auf Forschungszulage ${r}`}function p(e){let t=e.startFiscalYear.substring(0,4),r=e.endFiscalYear.substring(0,4),n=t!==r;return{year:t,fiscalYearCoversTwoYears:n,displayYear:n?`${t}/${r}`:t}}let g=(e,t)=>{if(e&&t){let r=(0,u.pp)(e),n=(0,u.pp)(t),i=r.getFullYear(),s=n.getFullYear();return(2020===i||2020===s)&&r<(0,u.pp)("2020-07-01")&&n>(0,u.pp)("2020-06-30")}return!1},m=(e,t)=>{if(e&&t){let r=(0,u.pp)(e),n=(0,u.pp)(t),i=r.getFullYear(),s=n.getFullYear();return(2024===i||2024===s)&&r<(0,u.pp)("2024-03-28")&&n>(0,u.pp)("2024-03-27")}return!1};function v(e){return parseInt(e.substring(0,4))>=2024}function y(e){return{question:e.split("_")[0],projectId:e.split("_").slice(1).join("_")}}function _(e,t,r,n){let i=t.substring(0,4),o=i===r.substring(0,4),u="unselected",d=e.data.hasOtherFunding;if(o){let t=(0,h._)(e.data.companies,i,"EU"),r="number"==typeof t&&t>0,n=e.data.internalStaffCostRnD[`year_${i}`],s=e.data.internalInvestmentsRnD[`year_${i}`],a="number"==typeof n&&n>0||"number"==typeof s&&s>0;u=a&&r?"both":r?"external":a?"internal":"unselected";let o=e.data.fundingAssessmentBasisInternal[`year_${i}`]||0,l=e.data.fundingAssessmentBasisExternal[`year_${i}`]||0;d=e.data.hasOtherFunding&&(o>0||l>0)}let f=[];if(o)for(let t of(e.data.companies.filter(e=>e.isContractor&&!0===l.iq[e.country]&&(e.yearlyCost[`year_${i}`]||0)>0).map(c.Re).forEach(e=>f.push(e)),n.filter(t=>t.data.paymentYear===i&&t.projectId===e.id).forEach(e=>{let t=f.find(t=>t.name===e.data.issuerName);t?(t.paidInvoices=t.paidInvoices||0,t.paidInvoices+=e.data.netAmount||0,"2020"===i&&(t.paidInvoicesBeforeJuly2020=t.paidInvoicesBeforeJuly2020||0,!0===e.data.paidBeforeJuly2020&&(t.paidInvoicesBeforeJuly2020+=e.data.netAmount||0),t.paidInvoicesAfterJune2020=t.paidInvoicesAfterJune2020||0,!1===e.data.paidBeforeJuly2020&&(t.paidInvoicesAfterJune2020+=e.data.netAmount||0)),"2024"===i&&(t.paidInvoicesBeforeMarch28th2024=t.paidInvoicesBeforeMarch28th2024||0,!0===e.data.paidBeforeMarch28th2024&&(t.paidInvoicesBeforeMarch28th2024+=e.data.netAmount||0),t.paidInvoicesAfterMarch27th2024=t.paidInvoicesAfterMarch27th2024||0,!1===e.data.paidBeforeMarch28th2024&&(t.paidInvoicesAfterMarch27th2024+=e.data.netAmount||0))):f.push({id:(0,s.Ak)(12),name:e.data.issuerName,country:"",zipCode:"",city:"",streetAddress:"",vatId:"",federalState:null,isSubContract:!1,paidInvoices:e.data.netAmount||0,..."2020"===i?{paidInvoicesBeforeJuly2020:!0===e.data.paidBeforeJuly2020&&e.data.netAmount||0,paidInvoicesAfterJune2020:!1===e.data.paidBeforeJuly2020&&e.data.netAmount||0}:{},..."2024"===i?{paidInvoicesBeforeMarch28th2024:!0===e.data.paidBeforeMarch28th2024&&e.data.netAmount||0,paidInvoicesAfterMarch27th2024:!1===e.data.paidBeforeMarch28th2024&&e.data.netAmount||0}:{}})}),f))"2020"===i?("number"==typeof t.paidInvoicesBeforeJuly2020&&(t.paidInvoicesBeforeJuly2020=Math.round(t.paidInvoicesBeforeJuly2020)),"number"==typeof t.paidInvoicesAfterJune2020&&
183(t.paidInvoicesAfterJune2020=Math.round(t.paidInvoicesAfterJune2020)),t.paidInvoices=(0,a._t)(t.paidInvoicesBeforeJuly2020,t.paidInvoicesAfterJune2020)):"2024"===i?("number"==typeof t.paidInvoicesBeforeMarch28th2024&&(t.paidInvoicesBeforeMarch28th2024=Math.round(t.paidInvoicesBeforeMarch28th2024)),"number"==typeof t.paidInvoicesAfterMarch27th2024&&(t.paidInvoicesAfterMarch27th2024=Math.round(t.paidInvoicesAfterMarch27th2024)),t.paidInvoices=(0,a._t)(t.paidInvoicesBeforeMarch28th2024,t.paidInvoicesAfterMarch27th2024)):"number"==typeof t.paidInvoices&&(t.paidInvoices=Math.round(t.paidInvoices));return{id:e.id,name:e.data.name,startDate:e.data.startDate,endDate:e.data.endDate,bsfzId:e.bsfzProjectId||"",bsfzDecisionDate:e.bsfzDecisionDate||null,internalOrExternal:u,isNotCooperativeProject:null,hasSubmittedBSFZNotice:!0,hasProjectChangedSinceBSFZApplication:null,hasOtherFunding:d,isNotContractWork:!0,ftesDomestic:"",ftesAbroad:"",employees:"",salariesDomestic:"",shareholderSalaries:"",salariesDomesticBeforeJuly2020:"",salariesDomesticAfterJune2020:"",salariesAbroad:"",salariesAbroadBeforeJuly2020:"",salariesAbroadAfterJune2020:"",socialSecurityContributions:"",socialSecurityContributionsBeforeJuly2020:"",socialSecurityContributionsAfterJune2020:"",externalContractors:f,hasConsentedToSharingExternalContractorsWithTaxOffice:!0,additionalFunding:[]}}function b(e,t){return e||t===d.Z.Created||t===d.Z.RevisionRequested||t===d.Z.ApprovedTaxOffice||t===d.Z.PayoutReceived}function w(e,t){return e||t===d.Z.InCreation||t===d.Z.InReview||t===d.Z.ReadyForFiling||t===d.Z.Filed||t===d.Z.ApprovedTaxOffice||t===d.Z.PayoutReceived}function E(e){let t=new Set,r=!1;return e.forEach(e=>{if(e.data.startDate&&e.data.endDate){let s=(0,u.pp)(e.data.startDate),a=(0,u.pp)(e.data.endDate);if(e.data.endPastFiscalYear){let t=(0,u._T)(e.data.endPastFiscalYear),o=(0,u.iV)(e.data.endPastFiscalYear);if("12"!==t||"31"!==o){r=!0;let e=s.getFullYear().toString(),l=a.getFullYear().toString(),c=(0,u.pp)(`${e}-${t}-${o}`),h=(0,u.pp)(`${l}-${t}-${o}`);s<=c&&(s=(0,n.f)((0,i.d)(c,1),1)),a<=h&&(a=(0,i.d)(h,1))}}(0,o.R)(s,a).forEach(e=>t.add(e))}}),Array.from(t).sort((e,t)=>e.localeCompare(t)).map(e=>({label:r?`${e}/${parseInt(e)+1}`:e,id:e}))}function S(e){return e.status===d.Z.ReadyForFiling||e.status===d.Z.Filed||e.status===d.Z.ApprovedTaxOffice||e.status===d.Z.PayoutReceived}function I(e,t,r,n){if(S(r)||t!==(0,u.H)(r.data.startFiscalYear))return null;let i=r.data.projects.find(e=>e.id===n);if(!i)return null;let s=i.externalContractors.find(t=>t.name===e);return s?{contractorId:s.id,payoutApplicationId:r.id}:null}function k(e,t,r){return e?e.data.projects.map(({id:e,name:t})=>({id:e,name:t})):t.filter(e=>(0,h.Um)(e,r)).map(e=>({id:e.id,name:e.data.name}))}},46225:(e,t,r)=>{e.exports=r(77269)},46485:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeEmbed=t.GoogleMapsEmbed=t.GoogleAnalytics=void 0;var n=r(83151);Object.defineProperty(t,"GoogleAnalytics",{enumerable:!0,get:function(){return n.GoogleAnalytics}});var i=r(38420);Object.defineProperty(t,"GoogleMapsEmbed",{enumerable:!0,get:function(){return i.GoogleMapsEmbed}});var s=r(60140);Object.defineProperty(t,"YouTubeEmbed",{enumerable:!0,get:function(){return s.YouTubeEmbed}})},47578:(e,t,r)=>{"use strict";r.d(t,{O:()=>s,n:()=>i});var n,i=((n={}).Idle="idle",n.Loading="loading",n.LoggedOut="logged-out",n.Error="error",n.Success="success",n);function s(...e){return 0===e.length||e.every(e=>"idle"===e)?"idle":e.every(e=>"success"===e)?"success":e.includes("error")?"error":"loading"}},47596:(e,t,r)=>{"use strict";r.d(t,{p:()=>l});var n=r(47578),i=r(33208),s=r(4992),a=r(25203),o=r(75834);function l(e,...t){let{trackError:r}=(0,i.j)(),{authUser:u,loading:c}=(0,a.ZY)(),h=Array.isArray(e)?e.join("/"):e,[d,f]=(0,o.useState)({status:e?n.n.Loading:n.n.Idle,data:[]});return(0,o.useEffect)(()=>{if(null===h)return f({status:n.n.Idle,data:[]});if(!u&&!c)return f({status:n.n.LoggedOut,data:[]});if(d.status!==n.n.Loading&&f({status:n.n.Loading,data:[]}),c)return;let e=(0,s.Q5)(h,e=>{f({status:n.n.Success,data:e})},e=>{r("Error subscribing to Firestore collection",e),f({status:n.n.Error,data:[]})},...t);return()=>{e&&e()}},[h,c,u,JSON.stringify(t)]),d}},48449:(e,t,r)=>{"use strict";r.d(t,{Ak:()=>n});let n=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[63&r[e]];return t}},49943:(e,t,r)=>{"use strict";r.d(t,{b:()=>i});var n=r(82430);function i(e,t){return(0,n.k)(e,{...t,weekStartsOn:1}
183)}},55e3:()=>{},55158:(e,t,r)=>{"use strict";r.d(t,{Y:()=>i});var n=r(6792);function i(e,t){return+(0,n.a)(e)<+(0,n.a)(t)}},56705:(e,t,r)=>{"use strict";r.d(t,{d:()=>i});var n=r(83246);function i(e,t,r){return(0,n.e)(e,-t,r)}},57677:(e,t,r)=>{"use strict";r.d(t,{GP:()=>T});var n=r(15042),i=r(59231),s=r(76012),a=r(19107),o=r(6792),l=r(36908),u=r(83813),c=r(17428),h=r(44786);function d(e,t){let r=Math.abs(e).toString().padStart(t,"0");return(e<0?"-":"")+r}let f={y(e,t){let r=e.getFullYear(),n=r>0?r:1-r;return d("yy"===t?n%100:n,t.length)},M(e,t){let r=e.getMonth();return"M"===t?String(r+1):d(r+1,2)},d:(e,t)=>d(e.getDate(),t.length),a(e,t){let r=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.toUpperCase();case"aaa":return r;case"aaaaa":return r[0];default:return"am"===r?"a.m.":"p.m."}},h:(e,t)=>d(e.getHours()%12||12,t.length),H:(e,t)=>d(e.getHours(),t.length),m:(e,t)=>d(e.getMinutes(),t.length),s:(e,t)=>d(e.getSeconds(),t.length),S(e,t){let r=t.length;return d(Math.trunc(e.getMilliseconds()*Math.pow(10,r-3)),t.length)}},p={G:function(e,t,r){let n=+(e.getFullYear()>0);switch(t){case"G":case"GG":case"GGG":return r.era(n,{width:"abbreviated"});case"GGGGG":return r.era(n,{width:"narrow"});default:return r.era(n,{width:"wide"})}},y:function(e,t,r){if("yo"===t){let t=e.getFullYear();return r.ordinalNumber(t>0?t:1-t,{unit:"year"})}return f.y(e,t)},Y:function(e,t,r,n){let i=(0,h.h)(e,n),s=i>0?i:1-i;return"YY"===t?d(s%100,2):"Yo"===t?r.ordinalNumber(s,{unit:"year"}):d(s,t.length)},R:function(e,t){return d((0,u.p)(e),t.length)},u:function(e,t){return d(e.getFullYear(),t.length)},Q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(n);case"QQ":return d(n,2);case"Qo":return r.ordinalNumber(n,{unit:"quarter"});case"QQQ":return r.quarter(n,{width:"abbreviated",context:"formatting"});case"QQQQQ":return r.quarter(n,{width:"narrow",context:"formatting"});default:return r.quarter(n,{width:"wide",context:"formatting"})}},q:function(e,t,r){let n=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(n);case"qq":return d(n,2);case"qo":return r.ordinalNumber(n,{unit:"quarter"});case"qqq":return r.quarter(n,{width:"abbreviated",context:"standalone"});case"qqqqq":return r.quarter(n,{width:"narrow",context:"standalone"});default:return r.quarter(n,{width:"wide",context:"standalone"})}},M:function(e,t,r){let n=e.getMonth();switch(t){case"M":case"MM":return f.M(e,t);case"Mo":return r.ordinalNumber(n+1,{unit:"month"});case"MMM":return r.month(n,{width:"abbreviated",context:"formatting"});case"MMMMM":return r.month(n,{width:"narrow",context:"formatting"});default:return r.month(n,{width:"wide",context:"formatting"})}},L:function(e,t,r){let n=e.getMonth();switch(t){case"L":return String(n+1);case"LL":return d(n+1,2);case"Lo":return r.ordinalNumber(n+1,{unit:"month"});case"LLL":return r.month(n,{width:"abbreviated",context:"standalone"});case"LLLLL":return r.month(n,{width:"narrow",context:"standalone"});default:return r.month(n,{width:"wide",context:"standalone"})}},w:function(e,t,r,n){let i=(0,c.N)(e,n);return"wo"===t?r.ordinalNumber(i,{unit:"week"}):d(i,t.length)},I:function(e,t,r){let n=(0,l.s)(e);return"Io"===t?r.ordinalNumber(n,{unit:"week"}):d(n,t.length)},d:function(e,t,r){return"do"===t?r.ordinalNumber(e.getDate(),{unit:"date"}):f.d(e,t)},D:function(e,t,r){let n,i=(n=(0,o.a)(e,void 0),(0,s.m)(n,(0,a.D)(n))+1);return"Do"===t?r.ordinalNumber(i,{unit:"dayOfYear"}):d(i,t.length)},E:function(e,t,r){let n=e.getDay();switch(t){case"E":case"EE":case"EEE":return r.day(n,{width:"abbreviated",context:"formatting"});case"EEEEE":return r.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},e:function(e,t,r,n){let i=e.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return d(s,2);case"eo":return r.ordinalNumber(s,{unit:"day"});case"eee":return r.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return r.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return r.day(i,{width:"short",context:"formatting"});default:return r.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,r,n){let i=e.getDay(),s=(i-n.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return d(s,t.length);case"co":return r.ordinalNumber(s,{unit:"day"});case"ccc":return r.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return r.day(i,{width:"narrow",context:"standalone"});case"cccccc":return r.day(i,{width:"short",context:"standalone"});default:return r.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,r){let n=e.getDay(),i=0===n?7:n;switch(t){case"i":return String(i);case"ii":return d(i,t.length);case"io":return r.ordinalNumber(i,{unit:"day"});case"iii":return r.day(n,{width:"abbreviated",context:"formatting"});case"iiiii":return r.day(n,{width:"narrow",context:"formatting"});case"iiiiii":return r.day(n,{width:"short",context:"formatting"});default:return r.day(n,{width:"wide",context:"formatting"})}},a:function(e,t,r){let n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"aaa":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},b:function(e,t,r){let n,i=e.getHours();switch(n=12===i?"noon":0===i?"midnight":i/12>
183=1?"pm":"am",t){case"b":case"bb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"bbb":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},B:function(e,t,r){let n,i=e.getHours();switch(n=i>=17?"evening":i>=12?"afternoon":i>=4?"morning":"night",t){case"B":case"BB":case"BBB":return r.dayPeriod(n,{width:"abbreviated",context:"formatting"});case"BBBBB":return r.dayPeriod(n,{width:"narrow",context:"formatting"});default:return r.dayPeriod(n,{width:"wide",context:"formatting"})}},h:function(e,t,r){if("ho"===t){let t=e.getHours()%12;return 0===t&&(t=12),r.ordinalNumber(t,{unit:"hour"})}return f.h(e,t)},H:function(e,t,r){return"Ho"===t?r.ordinalNumber(e.getHours(),{unit:"hour"}):f.H(e,t)},K:function(e,t,r){let n=e.getHours()%12;return"Ko"===t?r.ordinalNumber(n,{unit:"hour"}):d(n,t.length)},k:function(e,t,r){let n=e.getHours();return(0===n&&(n=24),"ko"===t)?r.ordinalNumber(n,{unit:"hour"}):d(n,t.length)},m:function(e,t,r){return"mo"===t?r.ordinalNumber(e.getMinutes(),{unit:"minute"}):f.m(e,t)},s:function(e,t,r){return"so"===t?r.ordinalNumber(e.getSeconds(),{unit:"second"}):f.s(e,t)},S:function(e,t){return f.S(e,t)},X:function(e,t,r){let n=e.getTimezoneOffset();if(0===n)return"Z";switch(t){case"X":return m(n);case"XXXX":case"XX":return v(n);default:return v(n,":")}},x:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"x":return m(n);case"xxxx":case"xx":return v(n);default:return v(n,":")}},O:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+g(n,":");default:return"GMT"+v(n,":")}},z:function(e,t,r){let n=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+g(n,":");default:return"GMT"+v(n,":")}},t:function(e,t,r){return d(Math.trunc(e/1e3),t.length)},T:function(e,t,r){return d(+e,t.length)}};function g(e,t=""){let r=e>0?"-":"+",n=Math.abs(e),i=Math.trunc(n/60),s=n%60;return 0===s?r+String(i):r+String(i)+t+d(s,2)}function m(e,t){return e%60==0?(e>0?"-":"+")+d(Math.abs(e)/60,2):v(e,t)}function v(e,t=""){let r=Math.abs(e);return(e>0?"-":"+")+d(Math.trunc(r/60),2)+t+d(r%60,2)}var y=r(919),_=r(96986),b=r(98273);let w=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,S=/^'([^]*?)'?$/,I=/''/g,k=/[a-zA-Z]/;function T(e,t,r){let s=(0,i.q)(),a=r?.locale??s.locale??n.c,l=r?.firstWeekContainsDate??r?.locale?.options?.firstWeekContainsDate??s.firstWeekContainsDate??s.locale?.options?.firstWeekContainsDate??1,u=r?.weekStartsOn??r?.locale?.options?.weekStartsOn??s.weekStartsOn??s.locale?.options?.weekStartsOn??0,c=(0,o.a)(e,r?.in);if(!(0,b.f)(c))throw RangeError("Invalid time value");let h=t.match(E).map(e=>{let t=e[0];return"p"===t||"P"===t?(0,y.m[t])(e,a.formatLong):e}).join("").match(w).map(e=>{if("''"===e)return{isToken:!1,value:"'"};let t=e[0];if("'"===t){var r;let t;return{isToken:!1,value:(t=(r=e).match(S))?t[1].replace(I,"'"):r}}if(p[t])return{isToken:!0,value:e};if(t.match(k))throw RangeError("Format string contains an unescaped latin alphabet character `"+t+"`");return{isToken:!1,value:e}});a.localize.preprocessor&&(h=a.localize.preprocessor(c,h));let d={firstWeekContainsDate:l,weekStartsOn:u,locale:a};return h.map(n=>{if(!n.isToken)return n.value;let i=n.value;return(!r?.useAdditionalWeekYearTokens&&(0,_.xM)(i)||!r?.useAdditionalDayOfYearTokens&&(0,_.ef)(i))&&(0,_.Ss)(i,t,String(e)),(0,p[i[0]])(c,i,a.localize,d)}).join("")}},59231:(e,t,r)=>{"use strict";r.d(t,{q:()=>i});let n={};function i(){return n}},59334:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendGAEvent=t.GoogleAnalytics=t.sendGTMEvent=t.GoogleTagManager=t.YouTubeEmbed=t.GoogleMapsEmbed=void 0;var i=r(30675);Object.defineProperty(t,"GoogleMapsEmbed",{enumerable:!0,get:function(){return n(i).default}});var s=r(88115);Object.defineProperty(t,"YouTubeEmbed",{enumerable:!0,get:function(){return n(s).default}});var a=r(99132);Object.defineProperty(t,"GoogleTagManager",{enumerable:!0,get:function(){return a.GoogleTagManager}}),Object.defineProperty(t,"sendGTMEvent",{enumerable:!0,get:function(){return a.sendGTMEvent}});var o=r(79390);Object.defineProperty(t,"GoogleAnalytics",{enumerable:!0,get:function(){return o.GoogleAnalytics}}),Object.defineProperty(t,"sendGAEvent",{enumerable:!0,get:function(){return o.sendGAEvent}})},60140:function(e,t,r){"use strict";var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}
183,i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.YouTubeEmbed=void 0;let s=i(r(9658)),a=r(28323);t.YouTubeEmbed=e=>{var t=n(e,[]);return(0,a.formatData)(s.default,t)}},60858:(e,t,r)=>{"use strict";r.d(t,{x:()=>K});var n=r(91790);(0,n.KO)("firebase","12.14.0","app");var i=r(27456),s=r(19519),a=r(72457);let o=new Map,l={activated:!1,tokenObservers:[]},u={initialized:!1,enabled:!1};function c(e){return o.get(e)||{...l}}let h="https://content-firebaseappcheck.googleapis.com/v1";class d{constructor(e,t,r,n,i){if(this.operation=e,this.retryPolicy=t,this.getWaitDuration=r,this.lowerBound=n,this.upperBound=i,this.pending=null,this.nextErrorWaitInterval=n,n>i)throw Error("Proactive refresh lower bound greater than upper bound!")}start(){this.nextErrorWaitInterval=this.lowerBound,this.process(!0).catch(()=>{})}stop(){this.pending&&(this.pending.reject("cancelled"),this.pending=null)}isRunning(){return!!this.pending}async process(e){this.stop();try{var t;this.pending=new s.cY,this.pending.promise.catch(e=>{}),await (t=this.getNextRun(e),new Promise(e=>{setTimeout(e,t)})),this.pending.resolve(),await this.pending.promise,this.pending=new s.cY,this.pending.promise.catch(e=>{}),await this.operation(),this.pending.resolve(),await this.pending.promise,this.process(!0).catch(()=>{})}catch(e){this.retryPolicy(e)?this.process(!1).catch(()=>{}):this.stop()}}getNextRun(e){if(e)return this.nextErrorWaitInterval=this.lowerBound,this.getWaitDuration();{let e=this.nextErrorWaitInterval;return this.nextErrorWaitInterval*=2,this.nextErrorWaitInterval>this.upperBound&&(this.nextErrorWaitInterval=this.upperBound),e}}}let f=new s.FA("appCheck","AppCheck",{"already-initialized":"You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.","use-before-activation":"App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.","fetch-network-error":"Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.","fetch-parse-error":"Fetch client could not parse response. Original error: {$originalErrorMessage}.","fetch-status-error":"Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","recaptcha-error":"ReCAPTCHA error.","initial-throttle":"{$httpStatus} error. Attempts allowed again after {$time}",throttled:"Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"});function p(e=!1){return e?self.grecaptcha?.enterprise:self.grecaptcha}function g(e){if(!c(e).activated)throw f.create("use-before-activation",{appName:e.name})}function m(e){let t=Math.round(e/1e3),r=Math.floor(t/86400),n=Math.floor((t-3600*r*24)/3600),i=Math.floor((t-3600*r*24-3600*n)/60),s="";return r&&(s+=v(r)+"d:"),n&&(s+=v(n)+"h:"),s+=v(i)+"m:"+v(t-3600*r*24-3600*n-60*i)+"s"}function v(e){return 0===e?"00":e>=10?e.toString():"0"+e}async function y({url:e,body:t},r){let n,i,s={"Content-Type":"application/json"},a=r.getImmediate({optional:!0});if(a){let e=await a.getHeartbeatsHeader();e&&(s["X-Firebase-Client"]=e)}let o={method:"POST",body:JSON.stringify(t),headers:s};try{n=await fetch(e,o)}catch(e){throw f.create("fetch-network-error",{originalErrorMessage:e?.message})}if(200!==n.status)throw f.create("fetch-status-error",{httpStatus:n.status});try{i=await n.json()}catch(e){throw f.create("fetch-parse-error",{originalErrorMessage:e?.message})}let l=i.ttl.match(/^([\d.]+)(s)$/);if(!l||!l[2]||isNaN(Number(l[1])))throw f.create("fetch-parse-error",{originalErrorMessage:`ttl field (timeToLive) is not in standard Protobuf Duration format: ${i.ttl}`});let u=1e3*Number(l[1]),c=Date.now();return{token:i.token,expireTimeMillis:c+u,issuedAtTimeMillis:c}}
183function _(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${h}/projects/${r}/apps/${n}:exchangeDebugToken?key=${i}`,body:{debug_token:t}}}let b="firebase-app-check-store",w="debug-token",E=null;function S(){return E||(E=new Promise((e,t)=>{try{let r=indexedDB.open("firebase-app-check-database",1);r.onsuccess=t=>{e(t.target.result)},r.onerror=e=>{t(f.create("storage-open",{originalErrorMessage:e.target.error?.message}))},r.onupgradeneeded=e=>{let t=e.target.result;0===e.oldVersion&&t.createObjectStore(b,{keyPath:"compositeKey"})}}catch(e){t(f.create("storage-open",{originalErrorMessage:e?.message}))}}))}async function I(e,t){let r=(await S()).transaction(b,"readwrite"),n=r.objectStore(b).put({compositeKey:e,value:t});return new Promise((e,t)=>{n.onsuccess=t=>{e()},r.onerror=e=>{t(f.create("storage-set",{originalErrorMessage:e.target.error?.message}))}})}async function k(e){let t=(await S()).transaction(b,"readonly"),r=t.objectStore(b).get(e);return new Promise((e,n)=>{r.onsuccess=t=>{let r=t.target.result;r?e(r.value):e(void 0)},t.onerror=e=>{n(f.create("storage-get",{originalErrorMessage:e.target.error?.message}))}})}function T(e){return`${e.options.appId}-${e.name}`}let A=new a.Vy("@firebase/app-check");async function C(e){if((0,s.zW)()){let t;try{t=await k(T(e))}catch(e){A.warn(`Failed to read token from IndexedDB. Error: ${e}`)}return t}}function x(e,t){if((0,s.zW)())return I(T(e),t).catch(e=>{A.warn(`Failed to write token to IndexedDB. Error: ${e}`)});return Promise.resolve()}async function R(){let e;try{e=await k(w)}catch(e){}if(e)return e;{let e=crypto.randomUUID();return I(w,e).catch(e=>A.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)),e}}function P(){return u.enabled}async function D(){if(u.enabled&&u.token)return u.token.promise;throw Error(` 184 Can't get debug token in production mode. 185 `)}let O={error:"UNKNOWN_ERROR"};async function N(e,t=!1,r=!1){let n,i,s=e.app;g(s);let a=c(s),o=a.token;if(o&&!$(o)&&(a.token=void 0,o=void 0),!o){let e=await a.cachedTokenPromise;e&&($(e)?o=e:await x(s,void 0))}if(!t&&o&&$(o))return{token:o.token};let l=!1;if(P())try{let t=await D();a.exchangeTokenPromise||(a.exchangeTokenPromise=y(_(s,t),e.heartbeatServiceProvider).finally(()=>{a.exchangeTokenPromise=void 0}),l=!0);let r=await a.exchangeTokenPromise;return await x(s,r),a.token=r,{token:r.token}}catch(e){return"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?A.warn(e.message):r&&A.error(e),V(e)}try{a.exchangeTokenPromise||(a.exchangeTokenPromise=a.provider.getToken().finally(()=>{a.exchangeTokenPromise=void 0}),l=!0),o=await c(s).exchangeTokenPromise}catch(e){"appCheck/throttled"===e.code||"appCheck/initial-throttle"===e.code?A.warn(e.message):r&&A.error(e),i=e}return o?i?n=$(o)?{token:o.token,internalError:i}:V(i):(n={token:o.token},a.token=o,await x(s,o)):n=V(i),l&&j(s,n),n}async function M(e){let t=e.app;g(t);let{provider:r}=c(t);if(P()){let r=_(t,await D());r.body.limited_use=!0;let{token:n}=await y(r,e.heartbeatServiceProvider);return{token:n}}{let{token:e}=await r.getToken(!0);return{token:e}}}function F(e,t,r,n){let{app:i}=e,s=c(i);if(s.tokenObservers=[...s.tokenObservers,{next:r,error:n,type:t}],s.token&&$(s.token)){let t=s.token;Promise.resolve().then(()=>{r({token:t.token}),U(e)}).catch(()=>{})}s.cachedTokenPromise.then(()=>U(e))}function L(e,t){let r=c(e),n=r.tokenObservers.filter(e=>e.next!==t);0===n.length&&r.tokenRefresher&&r.tokenRefresher.isRunning()&&r.tokenRefresher.stop(),r.tokenObservers=n}function U(e){let{app:t}=e,r=c(t),n=r.tokenRefresher;n||(r.tokenRefresher=n=function(e){let{app:t}=e;return new d(async()=>{let r;if((r=c(t).token?await N(e,!0):await N(e)).error)throw r.error;if(r.internalError)throw r.internalError},()=>!0,()=>{let e=c(t);if(!e.token)return 0;{let t=e.token.issuedAtTimeMillis+(e.token.expireTimeMillis-e.token.issuedAtTimeMillis)*.5+3e5;return Math.max(0,(t=Math.min(t,e.token.expireTimeMillis-3e5))-Date.now())}},3e4,96e4)}(e)),!n.isRunning()&&r.isTokenAutoRefreshEnabled&&n.start()}
185function j(e,t){for(let r of c(e).tokenObservers)try{"EXTERNAL"===r.type&&null!=t.error?r.error(t.error):r.next(t)}catch(e){}}function $(e){return e.expireTimeMillis-Date.now()>0}function V(e){return{token:s.K3.encodeString(JSON.stringify(O),!1),error:e}}class B{constructor(e,t){this.app=e,this.heartbeatServiceProvider=t}_delete(){let{tokenObservers:e}=c(this.app);for(let t of e)L(this.app,t.next);return Promise.resolve()}}function W(e,t,r,n,i){r.ready(()=>{var s,a,o,l;let u,h;s=e,a=t,o=r,l=n,u=o.render(l,{sitekey:a,size:"invisible",callback:()=>{c(s).reCAPTCHAState.succeeded=!0},"error-callback":()=>{c(s).reCAPTCHAState.succeeded=!1}}),(h=c(s)).reCAPTCHAState={...h.reCAPTCHAState,widgetId:u},i.resolve(r)})}async function z(e){g(e);let t=c(e).reCAPTCHAState,r=await t.initialized.promise;return new Promise((t,n)=>{let i=c(e).reCAPTCHAState;r.ready(()=>{t(r.execute(i.widgetId,{action:"fire_app_check"}))})})}class q{constructor(e){this._siteKey=e,this._throttleData=null}async getToken(e=!1){let t;var r=this._throttleData;if(r&&Date.now()-r.allowRequestsAfter<=0)throw f.create("throttled",{time:m(r.allowRequestsAfter-Date.now()),httpStatus:r.httpStatus});let n=await z(this._app).catch(e=>{throw f.create("recaptcha-error")});if(!c(this._app).reCAPTCHAState?.succeeded)throw f.create("recaptcha-error");try{let r=function(e,t){let{projectId:r,appId:n,apiKey:i}=e.options;return{url:`${h}/projects/${r}/apps/${n}:exchangeRecaptchaEnterpriseToken?key=${i}`,body:{recaptcha_enterprise_token:t}}}(this._app,n);e&&(r.body.limited_use=!0),t=await y(r,this._heartbeatServiceProvider)}catch(e){if(e.code?.includes("fetch-status-error"))throw this._throttleData=function(e,t){if(404===e||403===e)return{backoffCount:1,allowRequestsAfter:Date.now()+864e5,httpStatus:e};{let r=t?t.backoffCount:0,n=(0,s.p9)(r,1e3,2);return{backoffCount:r+1,allowRequestsAfter:Date.now()+n,httpStatus:e}}}(Number(e.customData?.httpStatus),this._throttleData),f.create("initial-throttle",{time:m(this._throttleData.allowRequestsAfter-Date.now()),httpStatus:this._throttleData.httpStatus});throw e}return this._throttleData=null,t}initialize(e){var t,r,i;let a,o,l,u,h,d;this._app=e,this._heartbeatServiceProvider=(0,n.j6)(e,"heartbeat");(t=this._siteKey,a=new s.cY,c(e).reCAPTCHAState={initialized:a},r=e,u=`fire_app_check_${r.name}`,(h=document.createElement("div")).id=u,h.style.display="none",document.body.appendChild(h),o=u,(l=p(!0))?W(e,t,l,o,a):(i=()=>{let r=p(!0);if(!r)throw Error("no recaptcha");W(e,t,r,o,a)},(d=document.createElement("script")).src="https://www.google.com/recaptcha/enterprise.js",d.onload=i,document.head.appendChild(d)),a.promise).catch(()=>{})}isEqual(e){return e instanceof q&&this._siteKey===e._siteKey}}let H="app-check-internal";(0,n.om)(new i.uA("app-check",e=>new B(e.getProvider("app").getImmediate(),e.getProvider("heartbeat")),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider(H).initialize()})),(0,n.om)(new i.uA(H,e=>{var t;return t=e.getProvider("app-check").getImmediate(),{getToken:e=>N(t,e),getLimitedUseToken:()=>M(t),addTokenListener:e=>F(t,"INTERNAL",e),removeTokenListener:e=>L(t.app,e)}},"PUBLIC").setInstantiationMode("EXPLICIT")),(0,n.KO)("@firebase/app-check","0.11.4");var G=r(41040);let K=function(){try{return(0,n.Sx)(G.T.appName)}catch{let e=(0,n.Wp)(G.T.firebaseConfig,G.T.appName);return!function(e=(0,n.Sx)(),t){e=(0,s.Ku)(e);let r=(0,n.j6)(e,"app-check");if(u.initialized||function(){let e=(0,s.mS)();if(u.initialized=!0,"string"!=typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN&&!0!==e.FIREBASE_APPCHECK_DEBUG_TOKEN)return;u.enabled=!0;let t=new s.cY;u.token=t,"string"==typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN?t.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN):t.resolve(R())}(),P()&&D().then(e=>console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)),r.isInitialized()){r.getImmediate();let n=r.getOptions();if(n.isTokenAutoRefreshEnabled===t.isTokenAutoRefreshEnabled&&n.provider.isEqual(t.provider))return;
185throw f.create("already-initialized",{appName:e.name})}let i=r.initialize({options:t});(function(e,t,r=!1){var n;let i=(n={...l},o.set(e,n),o.get(e));i.activated=!0,i.provider=t,i.cachedTokenPromise=C(e).then(t=>(t&&$(t)&&(i.token=t,j(e,{token:t.token})),t)),i.isTokenAutoRefreshEnabled=r&&e.automaticDataCollectionEnabled,!e.automaticDataCollectionEnabled&&r&&A.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."),i.provider.initialize(e)})(e,t.provider,t.isTokenAutoRefreshEnabled),c(e).isTokenAutoRefreshEnabled&&F(i,"INTERNAL",()=>{})}(e,{provider:new q("6LcGY1YrAAAAADXwo8e-n8fcDG7H9-LScOkMyiyQ"),isTokenAutoRefreshEnabled:!0}),e}}()},62221:(e,t,r)=>{"use strict";r.d(t,{$r:()=>c,N0:()=>l,TI:()=>o,dU:()=>h,jB:()=>u,k8:()=>d});var n,i,s,a,o=((n=o||{}).TaxData="tax",n.GeneralCompanyData="company",n.AssociatedCompanies="associated-companies",n.SalaryExpenses="salary-expenses",n),l=((i=l||{}).ProjectData="project",i.RnDCosts="rnd-costs",i.ExternalContractors="external-contractors",i.AdditionalFunding="additional-funding",i),u=((s=u||{}).Overview="overview",s),c=((a=c||{}).Congratulations="congratulations",a);function h(e,t){let r;switch(e){case"tax":return"Steuerdaten";case"company":return"Stammdaten";case"associated-companies":return"Verbundene Unternehmen";case"salary-expenses":return"Lohnaufwendungen"}let n=e.substring(e.length-12,e.length);switch(e.split("_").shift()){case"project":r="Allgemeine Angaben";break;case"rnd-costs":r="R&D Personalkosten";break;case"external-contractors":r="Externe Aufw\xe4nde";break;case"additional-funding":r="Andere F\xf6rderungen"}let i=t.find(e=>e.id===n)?.name||n;return`Projekt ${i} - ${r}`}function d(e,t){if("tax"===e)return 0;{if("company"===e)return 1;if("associated-companies"===e)return 2;if("salary-expenses"===e)return 3;let r=e.substring(e.length-12,e.length),n=(t.findIndex(e=>e.id===r)+1)*10,i=e.split("_").shift();if("project"===i)return n+4;if("rnd-costs"===i)return n+5;if("external-contractors"===i)return n+6;else if("additional-funding"===i)return n+7}return 8}},63052:(e,t,r)=>{"use strict";r.d(t,{Ay:()=>aO});var n,i="u">typeof window?window:void 0,s="u">typeof globalThis?globalThis:i;"u"<typeof self&&(s.self=s),"u"<typeof File&&(s.File=function(){});var a=null==s?void 0:s.navigator,o=null==s?void 0:s.document,l=null==s?void 0:s.location,u=null==s?void 0:s.fetch,c=null!=s&&s.XMLHttpRequest&&"withCredentials"in new s.XMLHttpRequest?s.XMLHttpRequest:void 0,h=null==s?void 0:s.AbortController,d=null==s?void 0:s.CompressionStream,f=null==a?void 0:a.userAgent,p=null!=i?i:{},g="1.393.5",m={DEBUG:!1,LIB_VERSION:g,LIB_NAME:"web",JS_SDK_VERSION:g};function v(e,t,r,n,i,s,a){try{var o=e[s](a),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(n,i)}function y(e){return function(){var t=this,r=arguments;return new Promise(function(n,i){var s=e.apply(t,r);function a(e){v(s,n,i,a,o,"next",e)}function o(e){v(s,n,i,a,o,"throw",e)}a(void 0)})}}function _(){return(_=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var n in r)({}).hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(null,arguments)}function b(e,t){if(null==e)return{};var r={};for(var n in e)if(({}).hasOwnProperty.call(e,n)){if(-1!==t.indexOf(n))continue;r[n]=e[n]}return r}var w,E,S,I,k=((w={}).AnonymousId="anonymous_id",w.DistinctId="distinct_id",w.Props="props",w.EnablePersonProcessing="enable_person_processing",w.PersonMode="person_mode",w.FeatureFlagDetails="feature_flag_details",w.FeatureFlags="feature_flags",w.FeatureFlagPayloads="feature_flag_payloads",w.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",w.BootstrapFeatureFlags="bootstrap_feature_flags",w.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",w.OverrideFeatureFlags="override_feature_flags",w.Queue="queue",w.LogsQueue="logs_queue",w.OptedOut="opted_out",w.SessionId="session_id",w.SessionStartTimestamp="session_start_timestamp",w.SessionLastTimestamp="session_timestamp",w.PersonProperties="person_properties",w.GroupProperties="group_properties",w.InstalledAppBuild="installed_app_build",w.InstalledAppVersion="installed_app_version",w.SessionReplay="session_replay",w.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",w.SurveyLastSeenDate="survey_last_seen_date",w.SurveysSeen="surveys_seen",w.Surveys="surveys",w.RemoteConfig="remote_config",w.FlagsEndpointWasHit="flags_endpoint_was_hit",w.DeviceId="device_id",w),T=((E={}).GZipJS="gzip-js",E.Base64="base64",E),A=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"],C=["token"],x="NativeGzipValidationError",R=e=>e.length>=2&&31===e[0]&&139===e[1],P=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),D=e=>
185{var t=Error("Native gzip produced invalid output: "+e);throw t.name=x,t},O=(S=y(function*(e,t){18>e.size&&D("too-short");var r=new Uint8Array((yield e.slice(0,10).arrayBuffer()));R(r)&&8===r[2]||D("invalid-header");var n=new DataView((yield e.slice(e.size-8).arrayBuffer()));n.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(I)return I;I=[];for(var e=0;256>e;e++){for(var t=e,r=0;8>r;r++)t=1&t?0xedb88320^t>>>1:t>>>1;I[e]=t>>>0}return I})(),r=0xffffffff,n=0;e.length>n;n++)r=t[255&(r^e[n])]^r>>>8;return(0xffffffff^r)>>>0})(t)&&D("invalid-crc");var i=t.length>>>0;n.getUint32(4,!0)!==i&&D("invalid-size")}),function(e,t){return S.apply(this,arguments)});function N(){return(N=y(function*(e,t,r){void 0===t&&(t=!0);try{var n,i=(new TextEncoder).encode(e),s=new CompressionStream("gzip"),a=s.writable.getWriter(),o=a.write(i).then(()=>a.close()).catch((n=y(function*(e){try{yield a.abort(e)}catch(e){}throw e}),function(e){return n.apply(this,arguments)})),l=new Response(s.readable).blob(),[u]=yield Promise.all([l,o]);return yield O(u,i),u}catch(e){if(null!=r&&r.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var M=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],F=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var r=e.toLowerCase();return M.concat(t).some(e=>{var t=e.toLowerCase();return -1!==r.indexOf(t)})};function L(e,t){return -1!==e.indexOf(t)}var U=function(e){return e.trim()},j=function(e){return e.replace(/^\$/,"")},$=Object.prototype,V=$.hasOwnProperty,B=$.toString,W=Array.isArray||function(e){return"[object Array]"===B.call(e)},z=e=>"function"==typeof e,q=e=>e===Object(e)&&!W(e),H=e=>{if(q(e)){for(var t in e)if(V.call(e,t))return!1;return!0}return!1},G=e=>void 0===e,K=e=>"[object String]"==B.call(e),Y=e=>K(e)&&0===e.trim().length,J=e=>null===e,Q=e=>G(e)||J(e),X=e=>"[object Number]"==B.call(e)&&e==e,Z=e=>X(e)&&e>0,ee=e=>"[object Boolean]"===B.call(e),et=e=>L(A,e),er=e=>L(C,e);function en(e){return null===e||"object"!=typeof e}function ei(e,t){return({}).toString.call(e)==="[object "+t+"]"}function es(e){return"u">typeof Event&&function(e,t){try{return e instanceof t}catch(e){return!1}}(e,Event)}var ea=[!0,"true",1,"1","yes"],eo=[!1,"false",0,"0","no"];function el(e,t,r,n,i){return t>r&&(n.warn("min cannot be greater than max."),t=r),X(e)?e>r?(n.warn(" cannot be greater than max: "+r+". Using max value instead."),r):t>e?(n.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(n.warn(" must be a number. using max or fallback. max: "+r+", fallback: "+i),el(i||r,t,r,n))}class eu{constructor(e){this.Ee={},this.Pe=e.Pe,this.Fe=el(e.bucketSize,0,100,e.Ae),this.$e=el(e.refillRate,0,this.Fe,e.Ae),this.De=el(e.refillInterval,0,864e5,e.Ae)}Ne(e,t){var r=Math.floor((t-e.lastAccess)/this.De);r>0&&(e.tokens=Math.min(e.tokens+r*this.$e,this.Fe),e.lastAccess=e.lastAccess+r*this.De)}consumeRateLimit(e){var t,r=Date.now(),n=String(e),i=this.Ee[n];return i?this.Ne(i,r):this.Ee[n]=i={tokens:this.Fe,lastAccess:r},0===i.tokens||(i.tokens--,0===i.tokens&&(null==(t=this.Pe)||t.call(this,e)),0===i.tokens)}stop(){this.Ee={}}}var ec="Mobile",eh="Android",ed="Tablet",ef=eh+" "+ed,ep="iPad",eg="Apple",em=eg+" Watch",ev="Safari",ey="BlackBerry",e_="Samsung",eb=e_+"Browser",ew=e_+" Internet",eE="Chrome",eS=eE+" OS",eI=eE+" iOS",ek="Internet Explorer",eT=ek+" "+ec,eA="Opera",eC=eA+" Mini",ex="Edge",eR="Microsoft "+ex,eP="Firefox",eD=eP+" iOS",eO="Nintendo",eN="PlayStation",eM="Xbox",eF=eh+" "+ec,eL=ec+" "+ev,eU="Windows",ej=eU+" Phone",e$="Nokia",eV="Ouya",eB="Generic",eW=eB+" "+ec.toLowerCase(),ez=eB+" "+ed.toLowerCase(),eq="Konqueror",eH="Oculus Browser",eG="Vivaldi",eK="Yandex",eY="Whale",eJ="DuckDuckGo",eQ="Pale Moon",eX="Waterfox",eZ="Brave",e0="Google Search App",e1="(\\d+(\\.\\d+)?)",e2=Reg
185Exp("Version/"+e1),e3=RegExp(eM,"i"),e5=RegExp(eN+" \\w+","i"),e6=RegExp(eO+" \\w+","i"),e4=RegExp(ey+"|PlayBook|BB10","i"),e8={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},e9=function(e,t,r,n){var i;return t=t||"",(null!=r&&r.brave?eZ:null)||(null!=n&&n.detectGoogleSearchApp&&L(e,"GSA/")?e0:L(e," OPR/")&&L(e,"Mini")?eC:L(e," OPR/")?eA:e4.test(e)?ey:L(e,"IE"+ec)||L(e,"WPDesktop")?eT:L(e,"OculusBrowser")?eH:L(e,eb)?ew:L(e,ex)||L(e,"Edg/")?eR:L(e,eG+"/")?eG:L(e,"YaBrowser/")?eK:L(e,eY+"/")?eY:L(e,eJ+"/")||L(e,"Ddg/")?eJ:L(e,"FBIOS")?"Facebook "+ec:L(e,"UCWEB")||L(e,"UCBrowser")?"UC Browser":L(e,"CriOS")?eI:L(e,"CrMo")||L(e,eE)?eE:L(e,eh)&&L(e,ev)?eF:L(e,"FxiOS")?eD:L(e.toLowerCase(),eq.toLowerCase())?eq:L(e,eZ+"/")?eZ:(i=t)&&L(i,eg)||L(e,ev)&&!L(e,eE)&&!L(e,eh)?L(e,ec)?eL:ev:L(e,"PaleMoon/")?eQ:L(e,eX+"/")?eX:L(e,eP)?eP:L(e,"MSIE")||L(e,"Trident/")?ek:L(e,"Gecko")?eP:"")},e7={[eT]:[RegExp("rv:"+e1)],[eR]:[RegExp(ex+"?\\/"+e1)],[eE]:[RegExp("("+eE+"|CrMo)\\/"+e1)],[eI]:[RegExp("CriOS\\/"+e1)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+e1)],[ev]:[e2],[eL]:[e2],[eA]:[RegExp("(Opera|OPR)\\/"+e1)],[eP]:[RegExp(eP+"\\/"+e1)],[eD]:[RegExp("FxiOS\\/"+e1)],[eq]:[RegExp("Konqueror[:/]?"+e1,"i")],[ey]:[RegExp(ey+" "+e1),e2],[eF]:[RegExp("android\\s"+e1,"i")],[ew]:[RegExp(eb+"\\/"+e1)],[eH]:[RegExp("OculusBrowser\\/"+e1)],[eG]:[RegExp(eG+"\\/"+e1)],[eK]:[RegExp("YaBrowser\\/"+e1)],[eY]:[RegExp(eY+"\\/"+e1)],[eZ]:[RegExp(eZ+"\\/"+e1)],[eJ]:[RegExp("(DuckDuckGo|Ddg)\\/"+e1)],[eQ]:[RegExp("PaleMoon\\/"+e1)],[eX]:[RegExp(eX+"\\/"+e1)],[e0]:[RegExp("GSA\\/"+e1)],[ek]:[RegExp("(rv:|MSIE )"+e1)],Mozilla:[RegExp("rv:"+e1)]},te=function(e,t,r,n){var i=e7[e9(e,t,r,n)];if(G(i))return null;for(var s=0;i.length>s;s++){var a=e.match(i[s]);if(a)return parseFloat(a[a.length-2])}return null},tt=[[RegExp(eM+"; "+eM+" (.*?)[);]","i"),e=>[eM,e&&e[1]||""]],[RegExp(eO,"i"),[eO,""]],[RegExp(eN,"i"),[eN,""]],[e4,[ey,""]],[RegExp(eU,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[ej,""];if(new RegExp(ec).test(t)&&!/IEMobile\b/.test(t))return[eU+" "+ec,""];var r=/Windows NT ([0-9.]+)/i.exec(t);if(r&&r[1]){var n=e8[r[1]]||"";return/arm/i.test(t)&&(n="RT"),[eU,n]}return[eU,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=G(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+eh+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+eh+")","i"),e=>e&&e[2]?[eh,[e[2],e[3],e[4]||"0"].join(".")]:[eh,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[eS,""]],[/Linux|debian/i,["Linux",""]]],tr=function(e){return e6.test(e)?eO:e5.test(e)?eN:e3.test(e)?eM:RegExp(eV,"i").test(e)?eV:RegExp("("+ej+"|WPDesktop)","i").test(e)?ej:/iPad/.test(e)?ep:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?em:e4.test(e)?ey:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(e$,"i").test(e)?e$:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?new RegExp(ec).test(e)&&!/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)||/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?eh:ef:RegExp("(pda|"+ec+")","i").test(e)?eW:RegExp(ed,"i").test(e)&&!RegExp(ed+" pc","i").test(e)?ez:""},tn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function ti(e,t){return"string"==typeof e&&tn.test(e)?e:t()}function ts(e){return e?e.split("#")[0]:e}function ta(e,t){var r=setTimeout(e,t);return(null==r?void 0:r.unref)&&(null==r||r.unref()),r}var to=e=>e instanceof Error,tl={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},tu=tl.info;function tc(e){var t=[];for(var r in e){var n=e[r];J(n)||G(n)||t.push({key:r,value:function e(t){if(ee(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(W(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(n)})}return t}function th(e,t,r){return _({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":r})}function td(e,t,r,n){return{resourceLogs:[{resource:{attributes:tc(t)},scopeLogs:[{scope:{name:r,version:n},logRecords:e}]}]}}let tf=class{constructor(e,t,r,n,i,s,a){var o;void 0===s&&(s=()=>Promise.resolve()),this._instance=e,this.Se=t,this.Ae=r,this.qe=n,this.Be=i,this.je=s,this.He=a,this.Ue=null,this.ze=0,this.Ve=0,this.We=0,this.Ge=0,this.Ze=!1,this.Qe=t.maxBufferSize,this.Je=Math.max(null!=(o=t.maxQueueSize)?o:t.maxBufferSize,t.maxBufferSize),this.Ye=t.flushIntervalMs,this.Ke=t.maxBatchRecordsPerPost,this.Xe=t.rateCapWindowMs,this.et=t.maxLogsPerInterval}reset(){this.tt(),this.Ue=null,this.We=0,this.Ge=0,this.Ze=!1,this.ze=0,this.Ve=0,this.Ke=this.Se.maxBatchRecordsPerPost}onReconnect(){this.Ve=0,this.rt()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this.it(e);
185if(null!==t)if(t.body){if(this.nt()){var r={record:function(e,t){var{text:r,number:n}=tl[e.level||"info"]||tu,i=String(Date.now())+"000000",s={};t.distinctId&&(s.posthogDistinctId=t.distinctId),t.sessionId&&(s.sessionId=t.sessionId),t.windowId&&(s["window.id"]=t.windowId),Q(t.sessionStartTimestamp)||(s.sessionStartTimestamp=String(t.sessionStartTimestamp)),Q(t.lastActivityTimestamp)||(s.lastActivityTimestamp=String(t.lastActivityTimestamp)),t.currentUrl&&(s["url.full"]=t.currentUrl),t.screenName&&(s["screen.name"]=t.screenName),t.appState&&(s["app.state"]=t.appState),t.activeFeatureFlags&&t.activeFeatureFlags.length>0&&(s.feature_flags=t.activeFeatureFlags);var a=_({},s,e.attributes||{}),o={timeUnixNano:i,observedTimeUnixNano:i,severityNumber:n,severityText:r,body:{stringValue:e.body},attributes:tc(a)};return e.trace_id&&(o.traceId=e.trace_id),e.span_id&&(o.spanId=e.span_id),G(e.trace_flags)||(o.flags=e.trace_flags),o}(t,this.qe())};this.Be(()=>this.st(r))}}else this.Ae.info("Log was rejected in beforeSend function")}}it(e){var t=this.Se.beforeSend;if(!t)return e;var r=W(t)?t:[t],n=e;for(var i of r)try{var s=i(n);if(!s)return this.Ae.info("Log was rejected in beforeSend function"),null;n=s}catch(e){return this.Ae.error("Error in beforeSend function for log:",e),null}return n}nt(){if(void 0===this.et)return!0;var e=Date.now(),t=e-this.We;return this.Xe>t&&t>=0||(this.We=e,this.Ge=0,this.Ze=!1),this.et>this.Ge?(this.Ge++,!0):(this.Ze||(this.Ae.warn("captureLog dropping logs: exceeded "+this.et+" logs per "+this.Xe+"ms"),this.Ze=!0),!1)}flush(){var e=this;return y(function*(){if(!e._instance.isDisabled)return e.Ue||(e.Ue=e.ot().finally(()=>{e.Ue=null})),e.Ue})()}ot(){var e=this;return y(function*(){e.tt();var t=null!=(i=e._instance.getPersistedProperty(k.LogsQueue))?i:[];if(0!==t.length)for(var r=t.length,n=0;t.length>0&&r>n;){e.ze=0;var i,s,a,o=Math.min(t.length,e.Ke),l=t.slice(0,o),u=td(l.map(e=>e.record),e.ut(),null!=(s=e.He)?s:e._instance.getLibraryId(),e._instance.getLibraryVersion()),c=yield e._instance.ht(u);if("too-large"===c.kind&&l.length>1)e.Ke=Math.max(1,Math.floor(l.length/2)),e.Ae.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.Ke);else if("retry-later"===c.kind||("too-large"===c.kind?e.Ae.warn("Dropping a single log record after 413 with batch size 1 â the record is larger than the server cap and cannot be split further."):"ok"===c.kind&&e.Se.maxBatchRecordsPerPost>e.Ke&&(e.Ke=Math.min(e.Se.maxBatchRecordsPerPost,e.Ke+1)),yield e.dt(l.length),t=null!=(a=e._instance.getPersistedProperty(k.LogsQueue))?a:[],n+=l.length,"fatal"===c.kind))throw c.error}})()}dt(e){var t=this;return y(function*(){var r,n=Math.max(0,e-t.ze),i=null!=(r=t._instance.getPersistedProperty(k.LogsQueue))?r:[];t._instance.setPersistedProperty(k.LogsQueue,i.slice(n)),yield t.je()})()}ut(){return th(this.Se,this._instance.getLibraryId(),this._instance.getLibraryVersion())}st(e){var t;if(!this._instance.optedOut){var r=null!=(t=this._instance.getPersistedProperty(k.LogsQueue))?t:[];this.Je>r.length||(r.shift(),this.ze++,this.Ae.info("Logs queue is full, dropping oldest record.")),r.push(e),this._instance.setPersistedProperty(k.LogsQueue,r),this.Qe>r.length?this.ct():this.rt()}}ct(e){void 0===e&&(e=this.Ye),this.vt||(this.vt=ta(()=>{this.vt=void 0,this.rt()},e))}ft(){var e=Math.min(Math.max(0,this.Ve-1),6);return this.Ye*Math.pow(2,e)}yt(){var e=this._instance.getPersistedProperty(k.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return y(function*(){t.tt();var r=t.flush().catch(()=>{});void 0!==e?yield Promise.race([r,new Promise(t=>ta(t,e))]):yield r})()}flushWithTimeout(e){var t=this;return y(function*(){var r=!1,n=t.flush(),i=new Promise(t=>ta(()=>{r=!0,t()},e));try{yield Promise.race([n,i])}finally{r&&n.catch(()=>{})}})()}rt(){this.flush().then(()=>{this.Ve=0},e=>{this.Ve++,this.Ae.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.yt()&&this.ct(this.ft())})}tt(){this.vt&&(clearTimeout(this.vt),this.vt=void 0)}};class tp{constructor(e,t,r){void 0===r&&(r=[]),this.coercers=e,this.stackParser=t,this.modifiers=r}buildFromUnknown(e,t){void 0===t&&(t={});var r=t&&t.mechanism||{handled:!0,type:"generic"},n=this.buildCoercingContext(r,t,0).apply(e),i=this.buildParsingContext(t),s=this.parseStacktrace(n,i);return{$exception_list:this.convertToExceptionList(s,r),$exception_level:"error"}}modifyFrames(e){var t=this;return y(function*(){for(var r of e)r.stacktrace&&r.stacktrace.frames&&W(r.stacktrace.frames)&&(r.stacktrace.frames=yield t.applyModifiers(r.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var r,n;return null!=e.cause&&(r=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(n=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.ski
185pFirstLines:0),t.chunkIdMap)),_({},e,{cause:r,stack:n})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var r of this.coercers)if(r.match(e))return r.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return y(function*(){var r=e;for(var n of t.modifiers)r=yield n(r);return r})()}convertToExceptionList(e,t){var r,n,i,s={type:e.type,value:e.value,mechanism:{type:null!=(r=t.type)?r:"generic",handled:null==(n=t.handled)||n,synthetic:null!=(i=e.synthetic)&&i}};e.stack&&(s.stacktrace={type:"raw",frames:e.stack});var a=[s];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,_({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var r=Object.keys(t);return r4&&r.length===r6||(r6=r.length,r4=r.reduce((r,n)=>{r5||(r5={});var i=r5[n];if(i)r[i[0]]=i[1];else for(var s=e(n),a=s.length-1;a>=0;a--){var o=s[a],l=null==o?void 0:o.filename,u=t[n];if(l&&u){r[l]=u,r5[n]=[l,u];break}}return r},{})),r4}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,r){void 0===r&&(r=0);var n=(r,n)=>{if(4>=n){var i=this.buildCoercingContext(e,t,n);return this.applyCoercers(r,i)}};return _({},t,{syntheticException:0==r?t.syntheticException:void 0,mechanism:e,apply:e=>n(e,r),next:e=>n(e,r+1)})}}function tg(e,t,r,n,i){var s={platform:e,filename:t,function:"<anonymous>"===r?"?":r,in_app:!0};return G(n)||(s.lineno=n),G(i)||(s.colno=i),s}var tm=(e,t)=>{var r=-1!==e.indexOf("safari-extension"),n=-1!==e.indexOf("safari-web-extension");return r||n?[-1!==e.indexOf("@")?e.split("@")[0]:"?",r?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tv=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ty=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,t_=/\((\S*)(?::(\d+))(?::(\d+))\)/,tb=(e,t)=>{var r=tv.exec(e);if(r){var[,n,i,s]=r;return tg(t,n,"?",+i,+s)}var a=ty.exec(e);if(a){if(a[2]&&0===a[2].indexOf("eval")){var o=t_.exec(a[2]);o&&(a[2]=o[1],a[3]=o[2],a[4]=o[3])}var[l,u]=tm(a[1]||"?",a[2]);return tg(t,u,l,a[3]?+a[3]:void 0,a[4]?+a[4]:void 0)}},tw=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tE=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tS=(e,t)=>{var r=tw.exec(e);if(r){if(r[3]&&r[3].indexOf(" > eval")>-1){var n=tE.exec(r[3]);n&&(r[1]=r[1]||"eval",r[3]=n[1],r[4]=n[2],r[5]="")}var i=r[3],s=r[1]||"?";return[s,i]=tm(s,i),tg(t,i,s,r[4]?+r[4]:void 0,r[5]?+r[5]:void 0)}},tI=/\(error: (.*)\)/;class tk{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var r=K(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:r?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return ei(e,"DOMException")}isDOMError(e){return ei(e,"DOMError")}}class tT{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var r=e.message;return String(r.error&&"string"==typeof r.error.message?r.error.message:r)}getStack(e){return e.stacktrace||e.stack||void 0}}class tA{match(e){return ei(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var r;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}var tC=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tx{match(e){return"string"==typeof e}coerce(e,t){var r,[n,i]=this.getInfos(e);return{type:null!=n?n:"Error",value:null!=i?i:e,stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}getInfos(e){var t="Error",r=e,n=e.match(tC);return n&&(t=n[1],r=n[2]),[t,r]}}var tR=["fatal","error","warning","log","info","debug"];function tP(e,t){void 0===t&&(t=40);var r=Object.keys(e);if(r.sort(),!r.length)return"[object has no keys]";for(var n=r.length;n>0;n--){var i=r.slice(0,n).join(", ");
185if(t>=i.length)return n===r.length?i:i.length>t?i.slice(0,t)+"...":i}return""}class tD{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var r,n=this.getErrorPropertyFromObject(e);return n?t.apply(n):{type:this.getType(e),value:this.getValue(e),stack:null==(r=t.syntheticException)?void 0:r.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return es(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var r=this.getObjectClassName(e);return(r&&"Object"!==r?"'"+r+"'":"Object")+" captured as exception with keys: "+tP(e)}isSeverityLevel(e){return K(e)&&!Y(e)&&tR.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var r=e[t];if(to(r))return r}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tO{match(e){return es(e)}coerce(e,t){var r,n=e.constructor.name;return{type:n,value:n+" captured as exception with keys: "+tP(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class tN{match(e){return en(e)}coerce(e,t){var r;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}}}class tM{match(e){return ei(e,"PromiseRejectionEvent")||this.isCustomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!es(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var r,n=this.getUnhandledRejectionReason(e);return en(n)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(n),stack:null==(r=t.syntheticException)?void 0:r.stack,synthetic:!0}:t.apply(n)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tF="$message",tL="$timestamp",tU=new Set([tF,tL]),tj={enabled:!0,max_bytes:32768};function t$(e){var t;return e?{enabled:null!=(t=e.enabled)?t:tj.enabled,max_bytes:function(e,t){if(!X(e)||e===1/0||e===-1/0)return t;var r=Math.floor(e);return 0>r?t:r}(e.max_bytes,tj.max_bytes)}:_({},tj)}class tV{constructor(e){this.bt=[],this._t=0,this.Se=t$(e)}setConfig(e){this.Se=t$(e),this.wt()}add(e){var t=function(e){var t=function(e){var t=new WeakSet;try{return JSON.stringify(e,(e,r)=>{if("bigint"==typeof r)return r.toString();if("function"!=typeof r&&"symbol"!=typeof r){if(r instanceof Date)return r.toISOString();if(r instanceof Error)return{name:r.name,message:r.message,stack:r.stack};if(r&&"object"==typeof r){if(t.has(r))return"[Circular]";t.add(r)}return r}})}catch(e){return}}(e);if(t)try{var r=JSON.parse(t);if(!q(r))return;var n=r[tF],i=r[tL];if(!K(n)||0===n.trim().length||!K(i)&&!X(i))return;return{step:r,json:t}}catch(e){return}}(e);if(t){var r=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),r=0,n=0;t.length>n;n++)"%"===t[n]?(r+=1,n+=2):r+=1;return r}(t.json);r>this.Se.max_bytes||(this.bt.push({step:t.step,bytes:r}),this._t+=r,this.wt())}}getAttachable(){return this.bt.map(e=>e.step)}clear(){this.bt=[],this._t=0}size(){return this.bt.length}wt(){for(;this._t>this.Se.max_bytes&&this.bt.length>0;){var e=this.bt.shift();e&&(this._t-=e.bytes)}}}var tB=function(e,t){var{debugEnabled:r}=void 0===t?{}:t,n={k(t){if(i&&(m.DEBUG||p.POSTHOG_DEBUG||r)&&!G(i.console)&&i.console){for(var n=("__rrweb_original__"in i.console[t])?i.console[t].__rrweb_original__:i.console[t],s=arguments.length,a=Array(s>1?s-1:0),o=1;s>o;o++)a[o-1]=arguments[o];n(e,...a)}},debug(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];n.k("debug",...t)},info(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];n.k("log",...t)},warn(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];n.k("warn",...t)},error(){for(var e=arguments.length,t=Array(e),r=0;e>r;r++)t[r]=arguments[r];n.k("error",...t)},critical(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];console.error(e,...r)},uninitializedWarning(e){n.error("You must initialize PostHog before calling "+e)},createLogger:(t,r)=>tB(e+" "+t,r)};return n},tW=tB("[PostHog.js]"),tz=tW.createLogger,tq=tz("[ExternalScriptsLoader]"),tH=(e,t,r)=>{if(e.config.disable_external_dependency_loading)return tq.warn(t+" was requested but loading of external scripts is disabled."),r("Loading of external scripts is disabled");var n=null==o?void 0:o.querySelectorAll("script");
185if(n){for(var i,s=0;n.length>s;s++)if(i=function(){if(n[s].src===t){var e=n[s];return e.__posthog_loading_callback_fired?{v:r()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,r(void 0,t)}),e.onerror=e=>r(e),{v:void 0})}}())return i.v}var a=()=>{if(!o)return r("document not found");var n=o.createElement("script");if(n.type="text/javascript",n.crossOrigin="anonymous",n.src=t,n.onload=e=>{n.__posthog_loading_callback_fired=!0,r(void 0,e)},n.onerror=e=>r(e),e.config.prepare_external_dependency_script&&(n=e.config.prepare_external_dependency_script(n)),!n)return r("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)o.head.appendChild(n);else{var i,s=o.querySelectorAll("body > script");s.length>0?null==(i=s[0].parentNode)||i.insertBefore(n,s[0]):o.body.appendChild(n)}};null!=o&&o.body?a():null==o||o.addEventListener("DOMContentLoaded",a)};p.__PosthogExtensions__=p.__PosthogExtensions__||{},p.__PosthogExtensions__.loadExternalDependency=(e,t,r)=>{if("remote-config"!==t){var n;if(e.config.strict_script_versioning)n=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var i="/static/"+t+".js?v="+e.version;"toolbar"===t&&(i=i+"&t="+3e5*Math.floor(Date.now()/3e5)),n=e.requestRouter.endpointFor("assets",i)}tH(e,n,r)}else{var s=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");tH(e,s,r)}},p.__PosthogExtensions__.loadSiteApp=(e,t,r)=>{var n=e.requestRouter.endpointFor("api",t);tH(e,n,r)};var tG="$people_distinct_id",tK="$device_id",tY="__alias",tJ="__timers",tQ="$autocapture_disabled_server_side",tX="$heatmaps_enabled_server_side",tZ="$exception_capture_enabled_server_side",t0="$error_tracking_suppression_rules",t1="$error_tracking_capture_extension_exceptions",t2="$web_vitals_enabled_server_side",t3="$dead_clicks_enabled_server_side",t5="$product_tours_enabled_server_side",t6="$web_vitals_allowed_metrics",t4="$session_recording_remote_config",t8="$replay_sample_rate",t9="$replay_override_sampling",t7="$replay_override_linked_flag",re="$replay_override_url_trigger",rt="$replay_override_event_trigger",rr="$sesid",rn="$session_is_sampled",ri="$enabled_feature_flags",rs="$active_feature_flags",ra="$early_access_features",ro="$feature_flag_details",rl="$feature_flag_payloads",ru="$feature_flag_request_id",rc="$override_feature_flags",rh="$override_feature_flag_payloads",rd="$stored_person_properties",rf="$stored_group_properties",rp="$surveys",rg="$surveys_loaded_at",rm="$surveys_activated",rv="ph_product_tours",ry="$flag_call_reported",r_="$flag_call_reported_session_id",rb="$feature_flag_errors",rw="$feature_flag_evaluated_at",rE="$user_state",rS="$client_session_props",rI="$capture_rate_limit",rk="$initial_campaign_params",rT="$initial_referrer_info",rA="$initial_person_info",rC="$epp",rx="__POSTHOG_TOOLBAR__",rR="$posthog_cookieless",rP="$sdk_debug_extensions_init_method",rD="$sdk_debug_extensions_init_time_ms",rO="$sdk_debug_recording_script_not_loaded",rN="PostHog loadExternalDependency extension not found.",rM="on_reject",rF="always",rL="anonymous",rU="identified",rj="identified_only",r$="visibilitychange",rV="beforeunload",rB="$pageview",rW="$pageleave",rz="$identify",rq="$groupidentify";function rH(e,t){W(e)&&e.forEach(t)}function rG(e,t){if(!Q(e))if(W(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,r)=>t(e,r));else for(var r in e)V.call(e,r)&&t(e[r],r)}var rK=function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];for(var i of r)for(var s in i)void 0!==i[s]&&(e[s]=i[s]);return e};function rY(e){for(var t=Object.keys(e),r=t.length,n=Array(r);r--;)n[r]=[t[r],e[t[r]]];return n}var rJ=function(e){try{return e()}catch(e){return}},rQ=function(e){return function(){try{for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];return e.apply(this,r)}catch(e){tW.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),tW.critical(e)}}},rX=function(e){var t={};return rG(e,function(e,r){(K(e)&&e.length>0||X(e))&&(t[r]=e)}),t},rZ=["herokuapp.com","vercel.app","netlify.app"];function r0(e,t,r,n){var{capture:i=!1,passive:s=!0}=null!=n?n:{};null==e||e.addEventListener(t,r,{capture:i,passive:s})}function r1(e){return"ph_toolbar_internal"===e.name}Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return X(e)&&isFinite(e)&&Math.floor(e)===e});class r2{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,r,n){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(r)||!Number.isInteger(n)||0>e||0>t||0>r||0>n||e>0xffffffffffff||t>4095||r>0x3fffffff||n>0xffffffff)throw RangeError("invalid field value");var i=new Uint8Array(16);return i[0]=e/0x10000000000,i[1]=e/0x100000000,i[2]=e/0x1000000,i[3]=e/65536,i[4]=e/256,i[5]=e,i[6]=112|t>>>8,i[7]=t,i[8]=128|r>>>24,i[9]=r>>>16,i[10]=r>>>8,i[11]=r,i[12]=n>>>24,i[13]=n>>>16,i[14]=n>>>8,i[15]=n,new r2(i)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new r2(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var r=this.bytes[t]-e.bytes[t];if(0!==r)return Math.sign(r)}return 0}}class r3{constructor(){this.S=0,this.C=0,this.I=new r7}generate(){var e=this.generateOrAbort();if(G(e)){this.S=0;var t=this.generateOrAbort();if(G(t))throw Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.M();else{if(this.S>=e+1e4)return;this.C++,this.C>0x3ffffffffff&&(this.S++,this.M())}return r2.fromFieldsV7(this.S,Math.trunc(this.C/0x40000000),0x3fffffff&this.C,this.I.nextUint32())}M(){this.C=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}}var r5,r6,r4,r8,r9=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};i&&!G(i.crypto)&&crypto.getRandomValues&&(r9=e=>crypto.getRandomValues(e));class r7{constructor(){this.R=new Uint32Array(8),this.O=1/0}nextUint32(){return this.R.length>this.O||(r9(this.R),this.O=0),this.R[this.O++]}}var ne=()=>nt().toString(),nt=()=>(r8||(r8=new r3)).generate(),nr="",nn=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,ni={N:()=>!!o,D(e){tW.error("cookieStore error: "+e)},P(e){if(o){try{for(var t=e+"=",r=o.cookie.split(";").filter(e=>e.length),n=0;r.length>n;n++){for(var i=r[n];" "==i.charAt(0);)i=i.substring(1,i.length);if(0===i.indexOf(t))return decodeURIComponent(i.substring(t.length,i.length))}}catch(e){}return null}},F(e){var t;try{t=JSON.parse(ni.P(e))||{}}catch(e){}return t},q(e,t,r,n,i){if(!o)return!1;try{var s="",a="",l=function(e,t){if(t){var r=function(e,t){if(void 0===t&&(t=o),nr)return nr;if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var r=e.split("."),n=Math.min(r.length,8),i="dmn_chk_"+ne();!nr&&n--;){var s=r.slice(n).join("."),a=i+"=1;domain=."+s+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(i)&&(t.cookie=a+";max-age=0",nr=s)}return nr}(e);if(!r){var n,i=(n=e.match(nn))?n[0]:"";i!==r&&tW.info("Warning: cookie subdomain discovery mismatch",i,r),r=i}return r?"; domain=."+r:""}return""}(o.location.hostname,n);if(r){var u=new Date;u.setTime(u.getTime()+864e5*r),s="; expires="+u.toUTCString()}i&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+l+a;return c.length>3686.4&&tW.warn("cookieStore warning: large cookie, len="+c.length),o.cookie=c,!0}catch(e){return!1}},A(e,t){if(null!=o&&o.cookie)try{ni.q(e,"",-1,t)}catch(e){return}}},ns=null,na={N(){if(!J(ns))return ns;var e=!0;if(G(i))e=!1;
185else try{var t="__mplssupport__";na.q(t,"xyz"),'"xyz"'!==na.P(t)&&(e=!1),na.A(t)}catch(t){e=!1}return e||tW.error("localStorage unsupported; falling back to cookie store"),ns=e,e},D(e){tW.error("localStorage error: "+e)},P(e){try{return null==i?void 0:i.localStorage.getItem(e)}catch(e){na.D(e)}return null},F(e){try{return JSON.parse(na.P(e))||{}}catch(e){}return null},q(e,t){try{return null==i||i.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){na.D(e)}return!1},A(e){try{null==i||i.localStorage.removeItem(e)}catch(e){na.D(e)}}},no=[tK,"distinct_id",rr,rn,rC,rA,rE],nl={},nu={N:()=>!0,D(e){tW.error("memoryStorage error: "+e)},P:e=>nl[e]||null,F:e=>nl[e]||null,q:(e,t)=>(nl[e]=t,!0),A(e){delete nl[e]}},nc=null,nh={N(){if(!J(nc))return nc;if(nc=!0,G(i))nc=!1;else try{var e="__support__";nh.q(e,"xyz"),'"xyz"'!==nh.P(e)&&(nc=!1),nh.A(e)}catch(e){nc=!1}return nc},D(e){tW.error("sessionStorage error: ",e)},P(e){try{return null==i?void 0:i.sessionStorage.getItem(e)}catch(e){nh.D(e)}return null},F(e){try{return JSON.parse(nh.P(e))||null}catch(e){}return null},q(e,t){try{return null==i||i.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){nh.D(e)}return!1},A(e){try{null==i||i.sessionStorage.removeItem(e)}catch(e){nh.D(e)}}};class nd{constructor(e){this._instance=e}get Se(){return this._instance.config}get consent(){return this.kt()?0:this.St}
185isOptedOut(){return this.Se.cookieless_mode===rF||this.isRejected()||-1===this.consent&&this.Se.cookieless_mode===rM}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Se.opt_out_capturing_by_default}optInOut(e){this.Ct.q(this.It,+!!e,this.Se.cookie_expiration,this.Se.cross_subdomain_cookie,this.Se.secure_cookie)}reset(){this.Ct.A(this.It,this.Se.cross_subdomain_cookie)}get It(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:r}=this._instance.config;return r||(t?t+e:"__ph_opt_in_out_"+e)}get St(){var e=this.Ct.P(this.It);return L(ea,e)?1:L(eo,e)?0:-1}get Ct(){var e=this.Se.opt_out_capturing_persistence_type,t="localStorage"===e?na:ni;if(!this.Tt||this.Tt!==t){this.Tt=t;var r="localStorage"===e?ni:na;r.P(this.It)&&(this.Tt.P(this.It)||this.optInOut(L(ea,r.P(this.It))),r.A(this.It,this.Se.cross_subdomain_cookie))}return this.Tt}kt(){return!!this.Se.respect_dnt&&[null==a?void 0:a.doNotTrack,null==a?void 0:a.msDoNotTrack,p.doNotTrack].some(e=>L(ea,e))}}function nf(e){return e instanceof Element&&(e.id===rx||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function np(e){return!!e&&1===e.nodeType}function ng(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function nm(e){return!!e&&3===e.nodeType}function nv(e){return!!e&&11===e.nodeType&&np(e.host)}function ny(e){return e?U(e).split(/\s+/):[]}function n_(e){var t=null==i?void 0:i.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function nb(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return ny(t)}function nw(e){return Q(e)?null:U(e).split(/(\s+)/).filter(e=>nz(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function nE(e){var t="";return nF(e)&&!nL(e)&&e.childNodes&&e.childNodes.length&&rG(e.childNodes,function(e){var r;nm(e)&&e.textContent&&(t+=null!=(r=nw(e.textContent))?r:"")}),U(t)}function nS(e){var t;return G(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var nI=["a","button","form","input","select","textarea","label"];function nk(e,t){if(G(t))return!0;var r,n=function(e){if(t.some(t=>(function(e,t){var r=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!r&&r.call(e,t)}catch(e){return!1}})(e,t)))return{v:!0}};for(var i of e)if(r=n(i))return r.v;return!1}function nT(e){var t=e.parentNode;return!(!t||!np(t))&&t}var nA=[".ph-no-autocapture","[data-ph-no-autocapture]"],nC=["next","previous","prev",">","<"],nx=[...nC,"+","-","â","â"],nR=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,nP=[".ph-no-rageclick",".ph-no-capture"],nD=["","text","search","email","password","url","tel","number"];function nO(e,t){if(!i||nN(e)||(ee(t)?(n=!!t&&nP,s=void 0,a=!1):(n=null!=(o=null==t?void 0:t.css_selector_ignorelist)?o:nP,s=null==t?void 0:t.content_ignorelist,a=null!=(l=null==t?void 0:t.ignore_text_selection)&&l),!1===n)||a&&!(!(r=e)||!np(r))&&(ng(r,"textarea")||(ng(r,"input")?L(nD,(r.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(r))))return!1;var r,n,s,a,o,l,{targetElementList:u}=nM(e,!1);return!function(e,t){var r;if(!1===e||G(e))return!1;if(!0===e)r=nC;else{if(!W(e))return!1;if(e.length>10)return tW.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;r=e.map(e=>e.toLowerCase())}return t.some(e=>{var{safeText:t,ariaLabel:n}=e;return r.some(e=>nR(t,e)||nR(n,e))})}(s,u.map(e=>{var t;return{safeText:nE(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!nk(u,n)}var nN=e=>!e||ng(e,"html")||!np(e),nM=(e,t)=>{if(!i||nN(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var r=!1,n=[e],s=e;s.parentNode&&!ng(s,"body");)if(nv(s.parentNode))n.push(s.parentNode.host),s=s.parentNode.host;else{var a=nT(s);if(!a)break;if(t||nI.indexOf(a.tagName.toLowerCase())>-1)r=!0;else{var o=i.getComputedStyle(a);o&&"pointer"===o.getPropertyValue("cursor")&&(r=!0)}n.push(a),s=a}return{parentIsUsefulElement:r,targetElementList:n}};function nF(e){for(var t=e;t.parentNode&&!ng(t,"body");t=t.parentNode){var r=nb(t);if(L(r,"ph-sensitive")||L(r,"ph-no-capture"))return!1}if(L(nb(e),"ph-include"))return!0;var n=e.type||"";if(K(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}
185var i=e.name||e.id||"";return!K(i)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,""))}function nL(e){return!!(ng(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||ng(e,"select")||ng(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var nU="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",nj=RegExp("^(?:"+nU+")$"),n$=new RegExp(nU),nV="\\d{3}-?\\d{2}-?\\d{4}",nB=RegExp("^("+nV+")$"),nW=RegExp("("+nV+")");function nz(e,t){return void 0===t&&(t=!0),!(Q(e)||K(e)&&(e=U(e),(t?nj:n$).test((e||"").replace(/[- ]/g,""))||(t?nB:nW).test(e)))&&!0}function nq(e){var t=nE(e);return nz(t=(t+" "+function e(t){var r="";return t&&t.childNodes&&t.childNodes.length&&rG(t.childNodes,function(t){var n;if(t&&"span"===(null==(n=t.tagName)?void 0:n.toLowerCase()))try{var i=nE(t);r=(r+" "+i).trim(),t.childNodes&&t.childNodes.length&&(r=(r+" "+e(t)).trim())}catch(e){tW.error("[AutoCapture]",e)}}),r}(e)).trim())?t:""}function nH(e){return e.replace(/"|\\"/g,'\\"')}var nG=tz("[Dead Clicks]"),nK=()=>!0,nY=e=>{var t,r=!(null==(t=e.instance.persistence)||!t.get_property(t3)),n=e.instance.config.capture_dead_clicks;return ee(n)?n:!!q(n)||r};class nJ{get lazyLoadedDeadClicksAutocapture(){return this.Et}constructor(e,t,r){this.instance=e,this.isEnabled=t,this.onCapture=r,this.startIfEnabledOrStop()}onRemoteConfig(e){"captureDeadClicks"in e&&(this.instance.persistence&&this.instance.persistence.register({[t3]:e.captureDeadClicks}),this.startIfEnabledOrStop())}startIfEnabledOrStop(){this.isEnabled(this)?this.Mt(()=>{this.Pt()}):this.stop()}Mt(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.initDeadClicksAutocapture?e():null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?nG.error("failed to load script",t):e()})}Pt(){var e;if(o){if(!this.Et&&null!=(e=p.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=q(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.Et=p.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.Et.start(o),nG.info("starting...")}}else nG.error("`document` not found. Cannot start.")}stop(){this.Et&&(this.Et.stop(),this.Et=void 0,nG.info("stopping..."))}}var nQ=tz("[SegmentIntegration]"),nX="posthog-js";function nZ(e,t){var{organization:r,projectId:n,prefix:i,severityAllowList:s=["error"],sendExceptionsToPostHog:a=!0}=void 0===t?{}:t;return t=>{if("*"!==s&&!s.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var o=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=o,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var l,u,c,h,d,f,p=(null==(l=t.exception)?void 0:l.values)||[],g=p.map(e=>_({},e,{stacktrace:e.stacktrace?_({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>_({},e,{platform:"web:javascript"}))}):void 0})),m={$exception_message:(null==(u=p[0])?void 0:u.value)||t.message,$exception_type:null==(c=p[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(h=p[0])?void 0:h.value)||t.message,$sentry_exception_type:null==(d=p[0])?void 0:d.type,$sentry_tags:t.tags};return r&&n&&(m.$sentry_url=(i||"https://sentry.io/organizations/")+r+"/issues/?project="+n+"&query="+t.event_id),a&&(null==(f=e.exceptions)||f.sendExceptionEvent(m)),t}}class n0{constructor(e,t,r,n,i,s){this.name=nX,this.setupOnce=function(a){a(nZ(e,{organization:t,projectId:r,prefix:n,severityAllowList:i,sendExceptionsToPostHog:null==s||s}))}}}class n1{constructor(e){this.Rt=(e,t,r)=>{r&&(r.noSessionId||r.activityTimeout||r.sessionPastMaximumLength||r.crossTabAdoption)&&(tW.info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:r}),this.Ot=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.Lt()}Lt(){var e;this.Ft=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.Rt)}destroy(){var e;null==(e=this.Ft)||e.call(this),this.Ft=void 0}doPageView(e,t){var r,n=this.At(e,t);return this.Ot={pathname:null!=(r=null==i?void 0:i.location.pathname)?r:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),n}doPageLeave(e){var t;return this.At(e,null==(t=this.Ot)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Ot)?void 0:e.pageViewId}}At(e,t){var r=this.Ot;if(!r)return{$pageview_id:t};var n={$pageview_id:t,$prev_pageview_id:r.pageViewId},i=this._instance.scrollManager.getContext();if(i&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:s,lastScrollY:a,maxScrollY:o,maxContentHeight:l,lastContentY:u,maxContentY:c}=i;
185if(!(G(s)||G(a)||G(o)||G(l)||G(u)||G(c))){s=Math.ceil(s),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),c=Math.ceil(c);var h=s>1?el(a/s,0,1,tW):1,d=s>1?el(o/s,0,1,tW):1,f=l>1?el(u/l,0,1,tW):1,p=l>1?el(c/l,0,1,tW):1;n=rK(n,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:f,$prev_pageview_max_content:c,$prev_pageview_max_content_percentage:p})}}return r.pathname&&(n.$prev_pageview_pathname=r.pathname),r.timestamp&&(n.$prev_pageview_duration=(e.getTime()-r.timestamp.getTime())/1e3),n}}var n2=["flags","surveys"],n3={[tG]:{exposure:"hidden"},[tY]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[tJ]:{exposure:"hidden"},[tQ]:{exposure:"event"},[tX]:{exposure:"hidden"},[tZ]:{exposure:"event"},[t0]:{exposure:"hidden"},[t1]:{exposure:"event"},[t2]:{exposure:"event"},[t3]:{exposure:"event"},[t5]:{exposure:"hidden"},[t6]:{exposure:"event"},[t4]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[rr]:{exposure:"hidden"},[rn]:{exposure:"event"},[t8]:{exposure:"event",shouldSkipFromEventProperties:e=>J(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[ri]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!q(e))return{};for(var t={},r=Object.keys(e),n=0;r.length>n;n++)t["$feature/"+r[n]]=e[r[n]];return t}},[rs]:{exposure:"event",storageGroup:"flags"},[ra]:{exposure:"hidden"},[ro]:{exposure:"hidden",storageGroup:"flags"},[rl]:{exposure:"event",storageGroup:"flags"},[ru]:{exposure:"event",storageGroup:"flags",volatile:!0},[rc]:{exposure:"event"},[rh]:{exposure:"hidden"},[rd]:{exposure:"hidden"},[rf]:{exposure:"hidden"},[rp]:{exposure:"hidden",storageGroup:"surveys"},[rg]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[rm]:{exposure:"event"},[rv]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[ry]:{exposure:"hidden"},[r_]:{exposure:"hidden"},[rb]:{exposure:"hidden"},[rw]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[rE]:{exposure:"hidden"},[rS]:{exposure:"hidden"},[rI]:{exposure:"hidden"},[rk]:{exposure:"hidden"},[rT]:{exposure:"hidden"},[rA]:{exposure:"hidden"},[rC]:{exposure:"hidden"},[t9]:{exposure:"event"},[t7]:{exposure:"event"},[re]:{exposure:"event"},[rt]:{exposure:"event"},[rP]:{exposure:"event"},[rD]:{exposure:"event"},[rO]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},n5=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],n6=e=>{var t=n3[e];
185if(t)return t;for(var[r,n]of n5)if(0===e.indexOf(r))return n},n4=e=>{var t=null==o?void 0:o.createElement("a");return G(t)?null:(t.href=e,t)},n8=function(e,t){for(var r,n=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;n.length>i;i++){var s=n[i].split("=");if(s[0]===t){r=s;break}}if(!W(r)||2>r.length)return"";var a=r[1];try{a=decodeURIComponent(a)}catch(e){tW.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},n9=function(e,t,r){if(!e||!t||!t.length)return e;for(var n=e.split("#"),i=n[1],s=(n[0]||"").split("?"),a=s[1],o=s[0],l=(a||"").split("&"),u=[],c=0;l.length>c;c++){var h=l[c].split("=");W(h)&&(t.includes(h[0])?u.push(h[0]+"="+r):u.push(l[c]))}var d=o;return null!=a&&(d+="?"+u.join("&")),null!=i&&(d+="#"+i),d},n7=function(e,t){var r=e.match(RegExp(t+"=([^&]*)"));return r?r[1]:null},ie="https?://(.*)",it=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],ir=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...it],ii="<masked>",is=["li_fat_id"];function ia(e,t,r){if(!o)return{};var n,i=t?[...it,...r||[]]:[],s=io(n9(o.URL,i,ii),e);return rK((n={},rG(is,function(e){var t=ni.P(e);n[e]=t||null}),n),s)}function io(e,t){var r=ir.concat(t||[]),n={};return rG(r,function(t){var r=n8(e,t);n[t]=r||null}),n}function il(e){var t=e?0===e.search(ie+"google.([^/?]*)")?"google":0===e.search(ie+"bing.com")?"bing":0===e.search(ie+"yahoo.com")?"yahoo":0===e.search(ie+"duckduckgo.com")?"duckduckgo":null:null,r={};if(!J(t)){r.$search_engine=t;var n=o?n8(o.referrer,"yahoo"!=t?"q":"p"):"";n.length&&(r.ph_keyword=n)}return r}function iu(){return navigator.language||navigator.userLanguage}var ic="$direct";function ih(){return(null==o?void 0:o.referrer)||ic}function id(e,t,r){void 0===r&&(r=!1);var n=e?[...it,...t||[]]:[],i=r?ts(null==l?void 0:l.href):null==l?void 0:l.href,s=null==i?void 0:i.substring(0,1e3);return{r:ih().substring(0,1e3),u:s?n9(s,n,ii):void 0}}function ip(e,t){void 0===t&&(t=!1);var r,{r:n,u:i}=e,s=t?ts(i):i,a={$referrer:n,$referring_domain:null==n?void 0:n==ic?ic:null==(r=n4(n))?void 0:r.host};if(s){a.$current_url=s;var o=n4(s);a.$host=null==o?void 0:o.host,a.$pathname=null==o?void 0:o.pathname,rK(a,io(s))}return n&&rK(a,il(n)),a}function ig(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var im={flags:rw,surveys:rg},iv=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],iy="main";class i_{constructor(e,t,r){if(void 0===r&&(r=!0),this.$t={},this.Dt=!1,this.Nt=!1,this.Se=e,this.qt=r,this.props={},this.Bt=!1,this.jt=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Ct=this.Ht(e),this.Nt=this.Ut(e),this.load(),e.debug&&tW.info("Persistence loaded",e.persistence,_({},this.props)),this.update_config(e,e,t),this.save(),i){var n=()=>this.flush();r0(i,"beforeunload",n,{capture:!1}),r0(i,"pagehide",n,{capture:!1})}}zt(){var e,t=null==(e=this.Se)?void 0:e.persistence_save_debounce_ms;return X(t)&&t>0?t:0}isDisabled(){return!!this.Vt}Ht(e){-1===iv.indexOf(e.persistence.toLowerCase())&&(tW.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,r,n,s,a=(t=e.cookie_persisted_properties||[],r=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===r&&(r=!1),n=[...no,...t],_({},na,{F(e){try{var t={};try{t=ni.F(e)||{}}catch(e){}var n,i=JSON.parse(na.P(e)||"{}");if(r){var s={};for(var a in t){var o=t[a];J(o)||""===o||(s[a]=o)}n=rK(i,s)}else n=rK(t,i);return na.q(e,n),n}catch(e){}return null},q(e,t,r,i,s,a){var o=na.q(e,t,void 0,void 0,a);try{var l={};n.forEach(e=>{t[e]&&(l[e]=t[e])}),Object.keys(l).length&&ni.q(e,l,r,i,s,a)}catch(e){na.D(e)}return o},A(e,t){try{null==i||i.localStorage.removeItem(e),ni.A(e,t)}catch(e){na.D(e)}}})),o=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&na.N()?(s=na,o=!0):"localstorage+cookie"===l&&a.N()?(s=a,o=!0):"sessionstorage"===l&&nh.N()?s=nh:"memory"===l?s=nu:"cookie"===l?s=ni:a.N()?(s=a,o=!0):s=ni,this.Dt=o,s}Wt(e){return this.jt+"__"+e}Ut(e){return this.Dt&&!!e.split_storage}Gt(e){var t=null!=e?e:this.Se.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var r=this.props[rw];return!r||"number"!=typeof r||Date.now()-r>t}properties(){var e={};return rG(this.props,(t,r)=>{var n=n6(r);if("derived"===(null==n?void 0:n.exposure)){if(null!=n.shouldSkipFromEventProperties&&n.shouldSkipFromEventProperties(t,r===ri?()=>this.Gt():()=>!1))return;n.transformToEventProperties&&rK(e,n.transformToEventProperties(t))}else if(!n||"event"===n.exposure){if(null!=n&&null!=n.shouldSkipFromEventProperties&&n.shouldSkipFromEventProperties(t,()=>!1))return;e[r]=t}}),e}load(){if(!this.Vt){var e=this.Ct.F(this.jt);e&&(this.props=rK({},e)),this.Nt&&this.Zt()}}Zt(){for(var e of n2){var t=na.F(this.Wt(e));if(t&&!H(t)){var r=this.Qt(e);r.persisted=!0,this.Jt(e)||(r.fingerprint=this.Yt(t,e)),this.Kt(e,t)||rK(this.props,t)}}}Jt(e){return Object.keys(this.props).some(t=>{var r;return(null==(r=n6(t))?void 0:r.storageGroup)===e})}Kt(e,t){var r=im[e];
185if(!r)return!1;var n=t[r],i=this.props[r];return X(n)&&X(i)&&i>n}refreshKey(e){var t;if(!this.Vt){var r=this.Nt?null==(t=n6(e))?void 0:t.storageGroup:void 0,n=r?na.F(this.Wt(r)):this.Ct.F(this.jt);if(n&&e in n)this.Xt(e,n[e]);else{if(r){var i=this.Ct.F(this.jt);if(i&&e in i)return void this.Xt(e,i[e])}this.er(e)}}}save(){if(!this.Vt){var e=this.zt();e>0?G(this.tr)&&(this.tr=setTimeout(()=>{this.tr=void 0,this.rr()},e)):this.rr()}}flush(){G(this.tr)||(clearTimeout(this.tr),this.tr=void 0,this.rr())}rr(){this.Vt||(this.Nt?this.ir():this.nr(this.Ct,this.jt,this.props,iy))}ir(){var{main:e,groups:t}=this.sr();for(var r of(this.nr(this.Ct,this.jt,e,iy),n2)){var n,i=t[r];(!H(i)||null!=(n=this.$t[r])&&n.persisted)&&this.nr(na,this.Wt(r),i,r)}}sr(){var e={},t={};for(var r of n2)t[r]={};return rG(this.props,(r,n)=>{var i,s=null==(i=n6(n))?void 0:i.storageGroup;s?t[s][n]=r:e[n]=r}),{main:e,groups:t}}Yt(e,t){if(t===iy)return JSON.stringify(e)+"|"+this.ar+"|"+this.lr+"|"+this.ur;var r={};return rG(e,(e,t)=>{var n;r[t]=null!=(n=n6(t))&&n.volatile?"__volatile__":e}),JSON.stringify(r)}nr(e,t,r,n){var i,s=this.Qt(n);if(n===iy||s.dirty||G(s.fingerprint)){try{if((i=this.Yt(r,n))===s.fingerprint)return void(s.dirty=!1)}catch(e){i=void 0}e.q(t,r,this.ar,this.lr,this.ur,this.Se.debug)?(s.dirty=!1,n!==iy&&(s.persisted=!0),G(i)||(s.fingerprint=i)):this.Se.debug&&tW.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var{keepGroupEntries:t=!1}=void 0===e?{}:e;if(G(this.tr)||(clearTimeout(this.tr),this.tr=void 0),this.Ct.A(this.jt,!1),this.Ct.A(this.jt,!0),!t&&this.qt)for(var r of n2)na.A(this.Wt(r));
185t?delete this.$t[iy]:this.$t={}}clear(){this.remove(),this.props={}}register_once(e,t,r){if(q(e)){G(t)&&(t="None"),this.ar=G(r)?this.hr:r;var n=!1;if(rG(e,(e,r)=>{this.props.hasOwnProperty(r)&&this.props[r]!==t||(this.Xt(r,e),n=!0)}),n)return this.save(),!0}return!1}register(e,t){if(q(e)){this.ar=G(t)?this.hr:t;var r=!1;if(rG(e,(t,n)=>{e.hasOwnProperty(n)&&this.props[n]!==t&&(this.Xt(n,t),r=!0)}),r)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.er(e),this.save())}update_campaign_params(){if(!this.Bt){var e=ia(this.Se.custom_campaign_params,this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties);H(rX(e))||this.register(e),this.Bt=!0}}update_search_keyword(){var e;this.register((e=null==o?void 0:o.referrer)?il(e):{})}update_referrer_info(){var e;this.register_once({$referrer:ih(),$referring_domain:null!=o&&o.referrer&&(null==(e=n4(o.referrer))?void 0:e.host)||ic},void 0)}set_initial_person_info(){this.props[rk]||this.props[rT]||this.register_once({[rA]:id(this.Se.mask_personal_data_properties,this.Se.custom_personal_data_properties,this.Se.disable_capture_url_hashes)},void 0)}get_initial_props(){var e,t,r,n={};rG([rT,rk],e=>{var t=this.props[e];t&&rG(t,function(e,t){n["$initial_"+j(t)]=e})});var i=this.props[rA];return i&&rK(n,(void 0===(e=this.Se.disable_capture_url_hashes)&&(e=!1),t=ip(i,e),r={},rG(t,function(e,t){r["$initial_"+j(t)]=e}),r)),n}safe_merge(e){return rG(this.props,function(t,r){r in e||(e[r]=t)}),e}update_config(e,t,r){this.hr=this.ar=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!r),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var n=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var r=[...e].sort(),n=[...t].sort();return r.every((e,t)=>e===n[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),i=n?this.Ht(e):this.Ct,s=this.Ut(e);if(n||s!==this.Nt){var a=this.props;this.clear(),this.Ct=i,this.Nt=s,this.props=a,this.save()}}set_disabled(e){this.Vt=e,this.Vt?this.remove():this.save()}set_cross_subdomain(e){e!==this.lr&&(this.lr=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.ur&&(this.ur=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var r=this.props[tJ]||{};r[e]=t,this.Xt(tJ,r),this.save()}remove_event_timer(e){var t=this.props[tJ]||{},r=t[e];return G(r)||(delete t[e],this.Xt(tJ,t),this.save()),r}get_property(e){return this.props[e]}set_property(e,t){this.Xt(e,t),this.save()}Xt(e,t){var r;this.props[e]=t,null!=(r=n6(e))&&r.volatile||this.dr(e)}er(e){delete this.props[e],this.dr(e)}dr(e){var t,r=null==(t=n6(e))?void 0:t.storageGroup;r&&(this.Qt(r).dirty=!0)}Qt(e){return this.$t[e]||(this.$t[e]={})}}var ib="events",iw="cancelEvents",iE="survey shown",iS="survey dismissed",iI="survey sent",ik="popover",iT=tz("[RateLimiter]");class iA{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{iT.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void iT.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,r,n,{captureEventsBurstLimit:i,captureEventsPerSecond:s}=this,a=(new Date).getTime(),o=null!=(t=null==(r=this.instance.persistence)?void 0:r.get_property(rI))?t:{tokens:i,last:a};o.tokens+=(a-o.last)/1e3*s,o.last=a,o.tokens>i&&(o.tokens=i);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+s+" events per second and "+i+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(n=this.instance.persistence)||n.set_property(rI,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var iC=tz("[RemoteConfig]");class ix{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}cr(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.loadExternalDependency?null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):e()}vr(e){this._instance._send_request({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback(t){e(t.json)}})}load(){try{if(this.remoteConfig)return iC.info("Using preloaded remote config",this.remoteConfig),this.pr(this.remoteConfig),void this.gr();if(this._instance.mr())return void iC.warn("Remote config is disabled. Falling back to local config.");this.cr(e=>{e?(this.pr(e),this.gr()):(iC.info("No config found after loading remote JS config. Falling back to JSON."),this.vr(e=>{this.pr(e),this.gr()}))})}catch(e){iC.error("Error loading remote config",e)}}stop(){this.yr&&(clearInterval(this.yr),this.yr=void 0)}
185refresh(){!this._instance.mr()&&o&&"hidden"!==o.visibilityState&&this._instance.reloadFeatureFlags()}gr(){var e;if(!this.yr){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.yr=setInterval(()=>{this.refresh()},t))}}pr(e){var t;e||iC.error("Failed to fetch remote config from PostHog."),this._instance.pr(null!=e?e:{}),!1!==(null==e?void 0:e.hasFeatureFlags)&&(this._instance.config.advanced_disable_feature_flags_on_first_load||null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded())}}var iR="gzip-js",iP="base64",iD=Uint8Array,iO=Uint16Array,iN=Uint32Array,iM=new iD([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),iF=new iD([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),iL=new iD([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),iU=function(e,t){for(var r=new iO(31),n=0;31>n;++n)r[n]=t+=1<<e[n-1];var i=new iN(r[30]);for(n=1;30>n;++n)for(var s=r[n];r[n+1]>s;++s)i[s]=s-r[n]<<5|n;return[r,i]},ij=iU(iM,2),i$=ij[1];ij[0][28]=258,i$[258]=28;for(var iV=iU(iF,0)[1],iB=new iO(32768),iW=0;32768>iW;++iW){var iz=(43690&iW)>>>1|(21845&iW)<<1;iB[iW]=((65280&(iz=(61680&(iz=(52428&iz)>>>2|(13107&iz)<<2))>>>4|(3855&iz)<<4))>>>8|(255&iz)<<8)>>>1}var iq=function(e,t,r){for(var n=e.length,i=0,s=new iO(t);n>i;++i)++s[e[i]-1];var a,o=new iO(t);for(i=0;t>i;++i)o[i]=o[i-1]+s[i-1]<<1;if(r){a=new iO(1<<t);var l=15-t;for(i=0;n>i;++i)if(e[i])for(var u=i<<4|e[i],c=t-e[i],h=o[e[i]-1]++<<c,d=h|(1<<c)-1;d>=h;++h)a[iB[h]>>>l]=u}else for(a=new iO(n),i=0;n>i;++i)a[i]=iB[o[e[i]-1]++]>>>15-e[i];return a},iH=new iD(288);for(iW=0;144>iW;++iW)iH[iW]=8;for(iW=144;256>iW;++iW)iH[iW]=9;for(iW=256;280>iW;++iW)iH[iW]=7;for(iW=280;288>iW;++iW)iH[iW]=8;var iG=new iD(32);for(iW=0;32>iW;++iW)iG[iW]=5;var iK=iq(iH,9,0),iY=iq(iG,5,0),iJ=function(e){return(e/8|0)+(7&e&&1)},iQ=function(e,t,r){(null==r||r>e.length)&&(r=e.length);var n=new(e instanceof iO?iO:e instanceof iN?iN:iD)(r-t);return n.set(e.subarray(t,r)),n},iX=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8},iZ=function(e,t,r){var n=t/8|0;e[n]|=r<<=7&t,e[n+1]|=r>>>8,e[n+2]|=r>>>16},i0=function(e,t){for(var r=[],n=0;e.length>n;++n)e[n]&&r.push({s:n,f:e[n]});var i=r.length,s=r.slice();if(!i)return[new iD(0),0];if(1==i){var a=new iD(r[0].s+1);return a[r[0].s]=1,[a,1]}r.sort(function(e,t){return e.f-t.f}),r.push({s:-1,f:25001});var o=r[0],l=r[1],u=0,c=1,h=2;for(r[0]={s:-1,f:o.f+l.f,l:o,r:l};c!=i-1;)o=r[r[h].f>r[u].f?u++:h++],l=r[u!=c&&r[h].f>r[u].f?u++:h++],r[c++]={s:-1,f:o.f+l.f,l:o,r:l};var d=s[0].s;for(n=1;i>n;++n)s[n].s>d&&(d=s[n].s);var f=new iO(d+1),p=i1(r[c-1],f,0);if(p>t){n=0;var g=0,m=p-t,v=1<<m;for(s.sort(function(e,t){return f[t.s]-f[e.s]||e.f-t.f});i>n;++n){var y=s[n].s;if(t>=f[y])break;g+=v-(1<<p-f[y]),f[y]=t}for(g>>>=m;g>0;){var _=s[n].s;t>f[_]?g-=1<<t-f[_]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;f[b]==t&&(--f[b],++g)}p=t}return[new iD(f),p]},i1=function(e,t,r){return -1==e.s?Math.max(i1(e.l,t,r+1),i1(e.r,t,r+1)):t[e.s]=r},i2=function(e){for(var t=e.length;t&&!e[--t];);for(var r=new iO(++t),n=0,i=e[0],s=1,a=function(e){r[n++]=e},o=1;t>=o;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return[r.subarray(0,n),t]},i3=function(e,t){for(var r=0,n=0;t.length>n;++n)r+=e[n]*t[n];return r},i5=function(e,t,r){var n=r.length,i=iJ(t+2);e[i]=255&n,e[i+1]=n>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;n>s;++s)e[i+s+4]=r[s];return 8*(i+4+n)},i6=function(e,t,r,n,i,s,a,o,l,u,c){iX(t,c++,r),++i[256];for(var h=i0(i,15),d=h[0],f=h[1],p=i0(s,15),g=p[0],m=p[1],v=i2(d),y=v[0],_=v[1],b=i2(g),w=b[0],E=b[1],S=new iO(19),I=0;y.length>I;++I)S[31&y[I]]++;for(I=0;w.length>I;++I)S[31&w[I]]++;for(var k=i0(S,7),T=k[0],A=k[1],C=19;C>4&&!T[iL[C-1]];--C);var x,R,P,D,O=u+5<<3,N=i3(i,iH)+i3(s,iG)+a,M=i3(i,d)+i3(s,g)+a+14+3*C+i3(S,T)+(2*S[16]+3*S[17]+7*S[18]);if(N>=O&&M>=O)return i5(t,c,e.subarray(l,l+u));if(iX(t,c,1+(N>M)),c+=2,N>M){x=iq(d,f,0),R=d,P=iq(g,m,0),D=g;var F=iq(T,A,0);for(iX(t,c,_-257),iX(t,c+5,E-1),iX(t,c+10,C-4),c+=14,I=0;C>I;++I)iX(t,c+3*I,T[iL[I]]);c+=3*C;for(var L=[y,w],U=0;2>U;++U){var j=L[U];for(I=0;j.length>I;++I)iX(t,c,F[$=31&j[I]]),c+=T[$],$>15&&(iX(t,c,j[I]>>>5&127),c+=j[I]>>>12)}}else x=iK,R=iH,P=iY,D=iG;for(I=0;o>I;++I)if(n[I]>255){iZ(t,c,x[257+($=n[I]>>>18&31)]),c+=R[$+257],$>7&&(iX(t,c,n[I]>>>23&31),c+=iM[$]);var $,V=31&n[I];iZ(t,c,P[V]),c+=D[V],V>3&&(iZ(t,c,n[I]>>>5&8191),c+=iF[V])}else iZ(t,c,x[n[I]]),c+=R[n[I]];return iZ(t,c,x[256]),c+R[256]},i4=new iN([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),i8=function(){for(var e=new iN(256),t=0;256>t;++t){for(var r=t,n=9;--n;)r=(1&r&&0xedb88320)^r>>>1;e[t]=r}return e}(),i9=function(e,t,r){for(;r;++t)e[t]=r,r>>>=8},i7=!!c||!!u,se="text/plain",st=!1,sr=function(e,t,r){void 0===r&&(r=!0);var n,i,s,a,o,[l,u]=e.split("?"),c=_({},t),h=null!=(o=null==u?void 0:u.split("&").map(e=>{var t,[n,i]=e.split("="),s=r&&null!=(t=c[n])?t:i;return delete c[n],n+"="+s}))?o:[],d=(void 0===n&&(n="&"),a=[],rG(c,function(e,t){G(e)||G(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),s=encodeURIComponent(t),a[a.length]=s+"="+i)}),a.join(n));return d&&h.push(d),l+"?"+h.join("&")},sn=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),si=e=>{if(e.xt)return e.xt;var{data:t,compression:r}=e;if(t){if(r===iR){var n,i,s,a,o,l,u,c,h=(n=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var r=new iD(e.length+(e.length>>>1)),n=0,i=function(e){r[n++]=e},s=0;t>s;++s){if(n+5>r.length){var a=new iD(n+8+(t-s<<1));a.set(r),r=a}var o=e.charCodeAt(s);128>o?i(o):(2048>o?i(192|o>>>6):(o>55295&&57344>o?(i(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++s))>>>18),i(128|o>>>12&63)):i(224|o>>>12),i(128|o>>>6&63)),i(128|63&o))}return iQ(r,0,n)}(sn(t)),i={mtime:0},s=0xffffffff,a={p(e){for(var t=s,r=0;e.length>r;++r)t=i8[255&t^e[r]]^t>>>8;s=t},d:()=>0xffffffff^s},o=n.length,a.p(n),c=(l=10+(i.filename&&i.filename.length+1||0),u=function(e,t,r,n){var i=e.length,s=new iD(n+i+5*(1+Math.floor(i/7e3))+8),a=s.subarray(n,s.length-8),o=0;if(!t||8>i)for(var l=0;i>=l;l+=65535){var u=l+65535;i>u?o=i5(a,o,e.subarray(l,u)):(a[l]=!0,o=i5(a,o,e.subarray(l,i)))}else{for(var c=i4[t-1],h=c>>>13,d=8191&c,f=(1<<r)-1,p=new iO(32768),g=new iO(f+1),m=Math.ceil(r/3),v=2*m,y=function(t){return(e[t]^e[t+1]<<m^e[t+2]<<v)&f},_=new iN(25e3),b=new iO(288),w=new iO(32),E=0,S=0,I=(l=0,0),k=0,T=0;i>l;++l){var A=y(l),C=32767&l,x=g[A];
185if(p[C]=x,g[A]=C,l>=k){var R=i-l;if((E>7e3||I>24576)&&R>423){o=i6(e,a,0,_,b,w,S,I,T,l-T,o),I=E=S=0,T=l;for(var P=0;286>P;++P)b[P]=0;for(P=0;30>P;++P)w[P]=0}var D=2,O=0,N=d,M=C-x&32767;if(R>2&&A==y(l-M))for(var F=Math.min(h,R)-1,L=Math.min(32767,l),U=Math.min(258,R);L>=M&&--N&&C!=x;){if(e[l+D]==e[l+D-M]){for(var j=0;U>j&&e[l+j]==e[l+j-M];++j);if(j>D){if(D=j,O=M,j>F)break;var $=Math.min(M,j-2),V=0;for(P=0;$>P;++P){var B=l-M+P+32768&32767,W=B-p[B]+32768&32767;W>V&&(V=W,x=B)}}}M+=(C=x)-(x=p[C])+32768&32767}if(O){_[I++]=0x10000000|i$[D]<<18|iV[O];var z=31&i$[D],q=31&iV[O];S+=iM[z]+iF[q],++b[257+z],++w[q],k=l+D,++E}else _[I++]=e[l],++b[e[l]]}}o=i6(e,a,!0,_,b,w,S,I,T,l-T,o)}return iQ(s,0,n+iJ(o)+8)}(n,null==i.level?6:i.level,null==i.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(n.length)))):12+i.mem,l)).length,function(e,t){var r=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&i9(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),r){e[3]=8;for(var n=0;r.length>=n;++n)e[n+10]=r.charCodeAt(n)}}(u,i),i9(u,c-8,a.d()),i9(u,c-4,o),u);return{contentType:se,body:h.buffer.slice(h.byteOffset,h.byteOffset+h.byteLength),estimatedSize:h.byteLength}}if(r===iP){let e;var d,f="data="+encodeURIComponent("string"==typeof(e=(d=sn(t))?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):d)?e:sn(e));return{contentType:"application/x-www-form-urlencoded",body:f,estimatedSize:new Blob([f]).size}}var p=sn(t);return{contentType:"application/json",body:p,estimatedSize:new Blob([p]).size}}},ss=e=>{var t,r,n,i=si(e);return!i||(r=e.compression,n=n8(e.url,"compression"),r!==T.GZipJS&&n!==T.GZipJS&&"gzip"!==n)||((t=i.body)instanceof ArrayBuffer?R(new Uint8Array(t)):ArrayBuffer.isView(t)&&R(new Uint8Array(t.buffer,t.byteOffset,t.byteLength)))?{url:e.url,encodedBody:i}:(st=!0,{url:((e,t)=>{var[r,n]=e.split("#"),[i,s]=r.split("?");if(!s)return e;var a=s.split("&").filter(e=>e.split("=")[0]!==t).join("&");return i+(a?"?"+a:"")+(n?"#"+n:"")})(e.url,"compression"),encodedBody:si(_({},e,{compression:void 0,xt:void 0}))})},sa=(sM=y(function*(e){var t=sn(e.data),r=yield function(e,t,r){return N.apply(this,arguments)}(t,m.DEBUG,{rethrow:!0});if(!r)return e;var n=yield r.arrayBuffer();return _({},e,{xt:{contentType:se,body:n,estimatedSize:n.byteLength}})}),function(e){return sM.apply(this,arguments)}),so=(e,t)=>sr(e,{_:(new Date).getTime().toString(),ver:m.JS_SDK_VERSION,compression:t}),sl=[];u&&sl.push({transport:"fetch",method(e){var t,{url:r,encodedBody:n}=ss(e),{contentType:i,body:s,estimatedSize:a}=null!=n?n:{},o=new Headers;rG(e.headers,function(e,t){o.append(t,e)}),i&&o.append("Content-Type",i);var l=null,c=null;if(h){var d=new h;l={signal:d.signal,timeout:setTimeout(()=>{var t,r;(r=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",d.abort(c=r)},e.timeout)}}u(r,_({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&52428.8>(a||0),body:s,signal:null==(t=l)?void 0:t.signal},e.fetchOptions)).then(t=>t.text().then(r=>{var n={statusCode:t.status,text:r};if(200===t.status)try{n.json=JSON.parse(r)}catch(e){tW.error(e)}null==e.callback||e.callback(n)})).catch(t=>{t===c?tW.warn(t):tW.error(t),null==e.callback||e.callback({statusCode:0,error:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),c&&sl.push({transport:"XHR",method(e){var t=new c,{url:r,encodedBody:n}=ss(e);t.open(e.method||"GET",r,!0);var{contentType:i,body:s}=null!=n?n:{};rG(e.headers,function(e,r){t.setRequestHeader(r,e)}),i&&t.setRequestHeader("Content-Type",i),e.timeout&&(t.timeout=e.timeout),t.onreadystatechange=()=>{if(4===t.readyState){var r={statusCode:t.status,text:t.responseText};if(200===t.status)try{r.json=JSON.parse(t.responseText)}catch(e){}null==e.callback||e.callback(r)}},t.send(s)}}),null!=a&&a.sendBeacon&&sl.push({transport:"sendBeacon",method(e){try{var{url:t,encodedBody:r}=ss(e),{contentType:n,body:i}=null!=r?r:{};if(!i)return;var s=i instanceof Blob?i:new Blob([i],{type:n});a.sendBeacon(t,s)}catch(e){}}});class su{constructor(e,t){this.br=!0,this._r=[],this.wr=el((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,tW.createLogger("flush interval"),3e3),this.kr=e}enqueue(e){this._r.push(e),this.Sr||this.Cr()}unload(){this.Ir();var e=Object.values(this._r.length>0?this.Tr():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.kr(_({},e,{transport:"sendBeacon"}))})}enable(){this.br=!1,this.Cr()}Cr(){var e=this;this.br||(this.Sr=setTimeout(()=>{if(this.Ir(),this._r.length>0){var t=this.Tr();for(var r in t)!function(){var n=t[r],i=(new Date).getTime();n.data&&W(n.data)&&rG(n.data,e=>{e.offset=Math.abs(e.timestamp-i),delete e.timestamp}),e.kr(n)}()}},this.wr))}Ir(){clearTimeout(this.Sr),this.Sr=void 0}Tr(){var e={};return rG(this._r,t=>{var r,n=(t?t.batchKey:null)||t.url;G(e[n])&&(e[n]=_({},t,{data:[]})),null==(r=e[n].data)||r.push(t.data)}),this._r=[],e}}var sc=["retriesPerformedSoFar"];class sh{constructor(e){this.Er=!1,this.Mr=3e3,this._r=[],this._instance=e,this._r=[],this.Pr=!0,!G(i)&&"onLine"in i.navigator&&(this.Pr=i.navigator.onLine,this.Rr=()=>{this.Pr=!0,this.Or()},this.Lr=()=>{this.Pr=!1},r0(i,"online",this.Rr),r0(i,"offline",this.Lr))}get length(){return this._r.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,r=b(e,sc);Z(t)&&(r.url=sr(r.url,{retry_count:t})),this._instance._send_request(_({},r,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.st(_({retriesPerformedSoFar:t},r));0===e.statusCode&&tW.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==r.callback||r.callback(e)}}))}st(e){var t,r,n=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=n+1;var i=Math.ceil((r=Math.min(18e5,t=3e3*Math.pow(2,n)))+(Math.random()-.5)*(r-t/2)),s=Date.now()+i;this._r.push({retryAt:s,requestOptions:e});var a="Enqueued failed request for retry in "+i;navigator.onLine||(a+=" (Browser is offline)"),tW.warn(a),this.Er||(this.Er=!0,this.Fr())}Fr(){(this.Ar&&clearTimeout(this.Ar),0===this._r.length)?(this.Er=!1,this.Ar=void 0):this.Ar=setTimeout(()=>{this.Pr&&this._r.length>0&&this.Or(),this.Fr()},this.Mr)}Or(){var e=Date.now(),t=[],r=this._r.filter(r=>e>r.retryAt||(t.push(r),!1));if(this._r=t,r.length>0)for(var{requestOptions:n}of r)this.retriableRequest(n)}unload(){for(var{requestOptions:e}of(this.Ar&&(clearTimeout(this.Ar),this.Ar=void 0),this.Er=!1,G(i)||(this.Rr&&(i.removeEventListener("online",this.Rr),this.Rr=void 0),this.Lr&&(i.removeEventListener("offline",this.Lr),this.Lr=void 0)),this._r))try{this._instance._send_request(_({},e,{transport:"sendBeacon"}))}catch(e){tW.error(e)}this._r=[]}}class sd{constructor(e){this.$r=()=>{this.Dr||(this.Dr={});var e,t,r,n,i=this.scrollElement(),s=this.scrollY(),a=i?Math.max(0,i.scrollHeight-i.clientHeight):0,o=s+((null==i?void 0:i.clientHeight)||0),l=(null==i?void 0:i.scrollHeight)||0;this.Dr.lastScrollY=Math.ceil(s),this.Dr.maxScrollY=Math.max(s,null!=(e=this.Dr.maxScrollY)?e:0),this.Dr.maxScrollHeight=Math.max(a,null!=(t=this.Dr.maxScrollHeight)?t:0),this.Dr.lastContentY=o,this.Dr.maxContentY=Math.max(o,null!=(r=this.Dr.maxContentY)?r:0),this.Dr.maxContentHeight=Math.max(l,null!=(n=this.Dr.maxContentHeight)?n:0)},this._instance=e}get Nr(){return this._instance.config.scroll_root_selector}getContext(){return this.Dr}resetContext(){var e=this.Dr;return setTimeout(this.$r,0),e}startMeasuringScrollPosition(){r0(i,"scroll",this.$r,{capture:!0}),r0(i,"scrollend",this.$r,{capture:!0}),r0(i,"resize",this.$r)}scrollElement(){if(!this.Nr)return null==i?void 0:i.document.documentElement;for(var e of W(this.Nr)?this.Nr:[this.Nr]){var t=null==i?void 0:i.document.querySelector(e);
185if(t)return t}}qr(e){if(this.Nr){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return i?"y"===e?i.scrollY||i.pageYOffset||i.document.documentElement.scrollTop||0:i.scrollX||i.pageXOffset||i.document.documentElement.scrollLeft||0:0}scrollY(){return this.qr("y")}scrollX(){return this.qr("x")}}var sf=e=>id(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes);class sp{constructor(e,t,r,n){this.Br=e=>{var t=this.jr();if(!t||t.sessionId!==e){var r={sessionId:e,props:this.Hr(this._instance)};this.Ur.register({[rS]:r})}},this._instance=e,this.zr=t,this.Ur=r,this.Hr=n||sf,this.zr.onSessionId(this.Br)}jr(){return this.Ur.props[rS]}getSetOnceProps(){var e,t=null==(e=this.jr())?void 0:e.props;return t?"r"in t?ip(t,this._instance.config.disable_capture_url_hashes):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return rG(rX(this.getSetOnceProps()),(t,r)=>{"$current_url"===r&&(r="url"),e["$session_entry_"+j(r)]=t}),e}}class sg{constructor(){this.Vr={}}on(e,t){return this.Vr[e]||(this.Vr[e]=[]),this.Vr[e].push(t),()=>{this.Vr[e]=this.Vr[e].filter(e=>e!==t)}}emit(e,t){for(var r of this.Vr[e]||[])r(t);for(var n of this.Vr["*"]||[])n(e,t)}}var sm=tz("[SessionId]");class sv{on(e,t){return this.Wr.on(e,t)}constructor(e,t,r){if(this.Gr=null,this.Zr=[],this.Qr=void 0,this.Jr=!1,this.Wr=new sg,this.Yr=(e,t)=>!(!Z(e)||!Z(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===rF)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Se=e.config,this.Ur=e.persistence,this.Kr=void 0,this.Xr=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.ei=t||ne,this.ti=r||ne;var n,i=this.Se.persistence_name||this.Se.token;if(this._sessionTimeoutMs=1e3*el(this.Se.session_idle_timeout_seconds||1800,60,36e3,sm.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.ri(),this.ii="ph_"+i+"_window_id",this.ni="ph_"+i+"_primary_window_exists",this.si()){var s=nh.F(this.ii),a=nh.F(this.ni);s&&!a?this.Kr=s:nh.A(this.ii),nh.q(this.ni,!0)}if(null!=(n=this.Se.bootstrap)&&n.sessionID)try{var o=(()=>{var e=this.Se.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw Error("Not a valid UUID");if("7"!==e[12])throw Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.oi(this.Se.bootstrap.sessionID,(new Date).getTime(),o)}catch(e){sm.error("Invalid sessionID in bootstrap",e)}this.ai()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return G(this.Zr)&&(this.Zr=[]),this.Zr.push(e),this.Xr&&e(this.Xr,this.Kr),()=>{this.Zr=this.Zr.filter(t=>t!==e)}}si(){return"memory"!==this.Se.persistence&&!this.Ur.Vt&&nh.N()}li(e){e!==this.Kr&&(this.Kr=e,this.si()&&nh.q(this.ii,e))}ui(){return this.Kr?this.Kr:this.si()?nh.F(this.ii):null}hi(e){var t=this.Gr;return!J(t)&&!J(e)&&5e3>Math.abs(e-t)}oi(e,t,r){var n=t!==this._sessionActivityTimestamp,i=e===this.Xr&&r===this._sessionStartTimestamp;this._sessionStartTimestamp=r,this._sessionActivityTimestamp=t,this.Xr=e,i&&!n||i&&this.hi(t)||(this.Gr=t,this.Ur.register({[rr]:[t,e,r]}))}di(){var e,t=null==(e=this.Se)?void 0:e.persistence_save_debounce_ms;return Z(t)&&t>0}ci(){this.di()?this.Ur.refreshKey(rr):(this.Ur.flush(),this.Ur.load())}vi(){var e;if(!J(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Gr){this.ci();var[,t,r]=this.fi();t===this.Xr&&r===this._sessionStartTimestamp&&(this.Gr=this._sessionActivityTimestamp,this.Ur.register({[rr]:[this._sessionActivityTimestamp,null!=(e=this.Xr)?e:null,this._sessionStartTimestamp]}),this.Ur.flush())}}pi(){var[e]=this.fi();return Math.max(Z(e)?e:0,Z(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}gi(e){return this.ci(),this.Yr(e,this.pi())}fi(){var e=this.Ur.props[rr];return W(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Gr=null,clearTimeout(this.mi),this.mi=void 0,this.oi(null,null,null)}destroy(){this.Jr=!0,this.vi(),clearTimeout(this.mi),this.mi=void 0,this.Qr&&i&&(i.removeEventListener(rV,this.Qr,{capture:!1}),this.Qr=void 0),this.Zr=[]}ai(){this.Qr=()=>{this.vi(),this.si()&&nh.A(this.ni)},r0(i,rV,this.Qr,{capture:!1})}
185checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Se.cookieless_mode===rF)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var r=t||(new Date).getTime(),[,n,i]=this.fi(),s=this.pi(),a=this.ui(),o=Z(i)&&Math.abs(r-i)>864e5,l=!1,u=!1,c=!n,h=n,d=!c&&!e&&this.Yr(r,s);d&&((d=this.gi(r))||sm.info("cross-tab refresh kept the session alive",{sessionId:n}),[,n,i]=this.fi()),c||d||o?(n=this.ei(),a=this.ti(),sm.info("new session ID generated",{sessionId:n,windowId:a,changeReason:{noSessionId:c,activityTimeout:d,sessionPastMaximumLength:o}}),i=r,l=!0):(a||(a=this.ti(),l=!0),(u=n!==h)&&(sm.info("adopted cross-tab session id",{sessionId:n,windowId:a}),l=!0));var f=Z(s)&&e&&!o?s:r,p=Z(i)?i:(new Date).getTime();this.li(a),this.oi(n,f,p),e||this.ri();var g={noSessionId:c,activityTimeout:d,sessionPastMaximumLength:o,crossTabAdoption:u};return l&&this.Zr.forEach(e=>e(n,a,g)),{sessionId:n,windowId:a,sessionStartTimestamp:p,changeReason:l?g:void 0,lastActivityTimestamp:s}}ri(){this.Jr||(clearTimeout(this.mi),this.mi=setTimeout(()=>{if(!this.Jr)if(this.gi((new Date).getTime())){var e=this.Xr;this.resetSessionId(),this.Wr.emit("forcedIdleReset",{idleSessionId:e})}else this.ri()},1.1*this.sessionTimeoutMs))}}var sy=function(e,t){if(!e)return!1;var r=e.userAgent;if(r&&F(r,t))return!0;try{var n=null==e?void 0:e.userAgentData;if(null!=n&&n.brands&&n.brands.some(e=>F(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver},s_=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function sb(e,t,r){return sn({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:r})}var sw={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>s_(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!s_(t,e))),icontains:(e,t)=>t.map(sE).some(t=>e.map(sE).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(sE).every(t=>e.map(sE).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var r=parseFloat(t);return!isNaN(r)&&e.some(e=>r<parseFloat(e))})},sE=e=>e.toLowerCase();function sS(e,t){return!e||Object.entries(e).every(e=>{var[r,n]=e,i=null==t?void 0:t[r];if(G(i)||J(i))return!1;var s=[String(i)],a=sw[n.operator];return!!a&&a(n.values,s)})}var sI="custom",sk="i.posthog.com",sT=/^\/static\//;class sA{constructor(e){this.yi={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+sk,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.yi[this.apiHost]||(this.yi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":sI),this.yi[this.apiHost]}bi(e){if(sT.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var r=this.bi(t);if(r)return""+r+t}if(this.region===sI)return this.apiHost+t;var n=sk+t;switch(e){case"assets":return"https://"+this.region+"-assets."+n;case"api":return"https://"+this.region+"."+n}}}var sC=tz("[Surveys]"),sx="seenSurvey_",sR=["popover","widget","api"],sP={ignoreConditions:!1,ignoreDelay:!1,displayType:ik},sD=tz("[PostHog ExternalIntegrations]"),sO={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class sN{constructor(e){this._instance=e}Mt(e,t){var r;null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,e,e=>{if(e)return sD.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this,r=function(e){var r,n,s;!i||null!=(r=p.__PosthogExtensions__)&&null!=(r=r.integrations)&&r[e]||t.Mt(sO[e],()=>{var r;null==(r=p.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[e])||r.start(t._instance)}),!i&&null!=(n=p.__PosthogExtensions__)&&null!=(n=n.integrations)&&n[e]&&(null==(s=p.__PosthogExtensions__)||null==(s=s.integrations)||null==(s=s[e])||s.stop())};for(var[n,i]of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))r(n)}}var sM,sF,sL={},sU=0,sj=()=>{}
185,s$='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',sV="Surveys module not available",sB="sanitize_properties is deprecated. Use before_send instead",sW="Invalid value for property_denylist config: ",sz="posthog",sq=!i7&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla")),sH=e=>{var t;return _({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!K(t))return!1;var r=t.split(".").slice(-2).join(".");for(var n of rZ)if(r===n)return!1;return!0}(null==o?void 0:o.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:sj,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:l&&K(null==l?void 0:l.search)&&-1!==l.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_conversations:!1,disable_product_tours:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==i||null==(t=i.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_feature_flags_dedup_per_session:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error(e){tW.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:rj,before_send:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:sj},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:nx,ignore_text_selection:!0}
185:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)})},sG=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],sK=e=>{var t={};for(var[r,n]of sG)G(e[r])||(t[n]=e[r]);var i=rK({},t,e),s=e.__preview_external_dependency_versioned_paths;return G(s)||(G(e.strict_script_versioning)&&(i.strict_script_versioning=!!s),K(s)&&G(e.asset_host)&&(i.asset_host=s)),W(e.property_blacklist)&&(G(e.property_denylist)?i.property_denylist=e.property_blacklist:W(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:tW.error(sW+e.property_denylist)),i};class sY{constructor(){this.__forceAllowLocalhost=!1}get wi(){return this.__forceAllowLocalhost}set wi(e){tW.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class sJ{xi(e,t){if(e){var r=this.ki.indexOf(e);-1!==r&&this.ki.splice(r,1)}return this.ki.push(t),null==t.initialize||t.initialize(),t}Si(){return this.config.cookieless_mode===rF||this.config.cookieless_mode===rM&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new sY,this.Ci=!1,this.version=m.LIB_VERSION,this.Ii=new sg,this.ki=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=sH(),this.SentryIntegration=n0,this.sentryIntegration=e=>{var t;return t=nZ(this,e),{name:nX,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.Ti=!1,this.Ei=null,this.Mi=null,this.Pi=null,this.scrollManager=new sd(this),this.pageViewManager=new n1(this),this.rateLimiter=new iA(this),this.requestRouter=new sA(this),this.consent=new nd(this),this.externalIntegrations=new sN(this);var e,t=null!=(e=sJ.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,r)=>{var n=K(e)?{[e]:t}:e;this.setPersonProperties(n),null==r||r({})},set_once:(e,t,r)=>{var n=K(e)?{[e]:t}:e;this.setPersonProperties(void 0,n),null==r||r({})}},this.on("eventCaptured",e=>tW.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,r){if(r&&r!==sz){var n,i=null!=(n=sL[r])?n:new sJ;return i._init(e,t,r),sL[r]=i,sL[sz][r]=i,i}return this._init(e,t,r)}_init(e,t,r){void 0===t&&(t={});var n,s,a=K(e)?e.trim():"";if(!a)return tW.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Ri(t.debug),this.Oi=t,this.Li=[],t.person_profiles?this.Mi=t.person_profiles:t.process_person&&(this.Mi=t.process_person);var o=sH(t.defaults),l=sK(t),u=rK({},o,l,{name:r,token:a});q(o.rageclick)&&q(l.rageclick)&&(u.rageclick=rK({},o.rageclick,l.rageclick)),q(o.session_recording)&&q(l.session_recording)&&(u.session_recording=rK({},o.session_recording,l.session_recording)),this.set_config(u),this.config.on_xhr_error&&tW.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:iR;var c=this.Fi();this.persistence=new i_(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i_(_({},this.config,{persistence:"sessionStorage"}),c,!1);var h=_({},this.persistence.props),d=_({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Ai=new su(e=>this.$i(e),this.config.request_queue_config),this.Di=new sh(this),this.__request_queue=[];var f=this.Si();if(f||(this.sessionManager=new sv(this),this.sessionPropsManager=new sp(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(tW.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Ni(f)},0)):(tW.info("Initializing extensions synchronously"),this.Ni(f)),m.DEBUG=m.DEBUG||this.config.debug,m.DEBUG&&tW.info("Starting in debug mode",{this:this,config:t,thisC:_({},this.config),p:h,s:d}),!this.config.identity_distinct_id||null!=(n=t.bootstrap)&&n.distinctID||(t.bootstrap=_({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
185)),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var p=t.bootstrap.distinctID,g=this.get_distinct_id(),v=this.persistence.get_property(rE);if(t.bootstrap.isIdentifiedID&&null!=g&&g!==p&&v===rL)this.identify(p);else if(t.bootstrap.isIdentifiedID&&null!=g&&g!==p&&v===rU)tW.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var y=this.config.get_device_id(ne()),b=t.bootstrap.isIdentifiedID?y:p;this.persistence.set_property(rE,t.bootstrap.isIdentifiedID?rU:rL),this.register({distinct_id:p,$device_id:b})}}if(f)this.register_once({distinct_id:rR,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(ne());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(rE,rL)}return r0(i,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),t.segment?function(e,t){var r=e.config.segment;if(!r)return t();!function(e,t){var r=e.config.segment;if(!r)return t();var n=r=>{var n=()=>r.anonymousId()||ne();e.config.get_device_id=n,r.id()&&(e.register({distinct_id:r.id(),$device_id:n()}),e.persistence.set_property(rE,rU)),t()},i=r.user();"then"in i&&z(i.then)?i.then(n):n(i)}(e,()=>{var n;r.register((Promise&&Promise.resolve||nQ.warn("This browser does not have Promise support, and can not use the segment integration"),n=(t,r)=>{if(!r)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(nQ.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(nQ.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var n=e.calculateEventProperties(r,t.event.properties);return t.event.properties=Object.assign({},n,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>n(e,e.event.event),page:e=>n(e,rB),identify:e=>n(e,rz),screen:e=>n(e,"$screen")})).then(()=>{t()})})}(this,()=>this.qi()):this.qi(),z(this.config._onCapture)&&this.config._onCapture!==sj&&(tW.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&tW.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}Ni(e){var t,r,n,i,s,a,o,l=performance.now(),u=_({},sJ.__defaultExtensionClasses,this.config.__extensionClasses),c=[];u.featureFlags&&this.ki.push(this.featureFlags=null!=(t=this.featureFlags)?t:new u.featureFlags(this)),u.exceptions&&this.ki.push(this.exceptions=null!=(r=this.exceptions)?r:new u.exceptions(this)),u.historyAutocapture&&this.ki.push(this.historyAutocapture=new u.historyAutocapture(this)),u.tracingHeaders&&this.ki.push(this.tracingHeaders=new u.tracingHeaders(this)),u.siteApps&&this.ki.push(this.siteApps=new u.siteApps(this)),u.sessionRecording&&!e&&this.ki.push(this.sessionRecording=new u.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),u.autocapture&&this.ki.push(this.autocapture=new u.autocapture(this)),u.surveys&&this.ki.push(this.surveys=null!=(n=this.surveys)?n:new u.surveys(this)),u.logs&&this.ki.push(this.logs=null!=(i=this.logs)?i:new u.logs(this)),u.conversations&&this.ki.push(this.conversations=null!=(s=this.conversations)?s:new u.conversations(this)),u.productTours&&this.ki.push(this.productTours=new u.productTours(this)),u.heatmaps&&this.ki.push(this.heatmaps=new u.heatmaps(this)),u.webVitalsAutocapture&&this.ki.push(this.webVitalsAutocapture=new u.webVitalsAutocapture(this)),u.exceptionObserver&&this.ki.push(this.exceptionObserver=new u.exceptionObserver(this)),u.deadClicksAutocapture&&this.ki.push(this.deadClicksAutocapture=new u.deadClicksAutocapture(this,nY)),u.toolbar&&this.ki.push(this.toolbar=null!=(a=this.toolbar)?a:new u.toolbar(this)),u.experiments&&this.ki.push(this.experiments=null!=(o=this.experiments)?o:new u.experiments(this)),this.ki.forEach(e
185=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.Bi){var e=this.Bi;this.Bi=void 0,this.pr(e)}}),this.ji(c,l)}ji(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.ji(e,t)},0);var r=e.shift();if(r)try{r()}catch(e){tW.error("Error initializing extension:",e)}}var n=Math.round(performance.now()-t);this.register_for_session({[rP]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[rD]:n}),this.config.__preview_deferred_init_extensions&&tW.info("PostHog extensions initialized ("+n+"ms)")}pr(e){var t;o&&o.body?(this.config.__preview_deferred_init_extensions&&(this.Bi=e),this.Hi=e,this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=L(e.supportedCompression,iR)?iR:L(e.supportedCompression,iP)?iP:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.Mi?this.Mi:rj}),this.ki.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))):(tW.info("document not ready yet, trying again in 500 milliseconds..."),setTimeout(()=>{this.pr(e)},500))}qi(){try{this.config.loaded(this)}catch(e){tW.critical("`loaded` function failed",e)}if(this.Ui(),this.config.internal_or_test_user_hostname&&null!=l&&l.hostname){var e=l.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.Si())&&this.zi()},1),this.Vi=new ix(this),this.Vi.load()}Ui(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Ai)||e.enable())}_dom_loaded(){this.is_capturing()&&rH(this.__request_queue,e=>this.$i(e)),this.__request_queue=[],this.Ui()}_handle_unload(){var e,t,r,n;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),this.config.request_batching?(this.Wi()&&this.capture(rW),null==(t=this.logs)||t.flushLogs("sendBeacon"),null==(r=this.Ai)||r.unload(),null==(n=this.Di)||n.unload()):this.Wi()&&this.capture(rW,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?sq?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=_({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(G(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,r,n,i=_({},e);i.timeout=i.timeout||6e4,i.url=so(i.url,i.compression);var s=null!=(t=i.transport)?t:"fetch",a=sl.filter(e=>!i.disableTransport||!e.transport||!i.disableTransport.includes(e.transport)),o=null!=(r=null==(n=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===s)return e[t]}(a))?void 0:n.method)?r:a[0].method;if(!o)throw Error("No available transport method");"sendBeacon"!==s&&i.data&&i.compression===iR&&d&&!st?sa(i).then(e=>{o(e)}).catch(t=>{P(t)?(st=!0,o(_({},i,{compression:void 0,url:so(e.url,void 0)}))):((e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return P(e)||t===x})(t)&&(st=!0),o(i))}):o(i)})(_({},e,{callback:t=>{var r,n;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(r=(n=this.config).on_request_error)||r.call(n,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}$i(e){this.Di?this.Di.retriableRequest(e):this._send_request(e)}_execute_array(e){sU++;try{var t,r=[],n=[],i=[];rH(e,e=>{if(e)if(W(t=e[0]))i.push(e);else if(z(e))try{e.call(this)}catch(t){tW.error("Error executing queued PostHog call",e,t)}else W(e)&&"alias"===t?r.push(e):W(e)&&-1!==t.indexOf("capture")&&z(this[t])?i.push(e):n.push(e)});var s=function(e,t){rH(e,function(e){try{if(W(e[0])){var r=t;rG(e,function(e){r=r[e[0]].apply(r,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){tW.error("Error executing queued PostHog call",e,t)}})};s(r,this),s(n,this),s(i,this)}finally{sU--}}push(e){if(sU>0&&W(e)&&K(e[0])){var t=sJ.prototype[e[0]];z(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,r){var n,i,s,a,o;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Ai){if(this.is_capturing())if(!G(e)&&K(e)){var l=!this.config.opt_out_useragent_filter&&this._is_bot();if(!l||this.config.__preview_capture_bot_pageviews){var u=null!=r&&r.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==u||!u.isRateLimited){null!=t&&t.$current_url&&!K(null==t?void 0:t.$current_url)&&(tW.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),"$exception"!==e||null!=r&&r.Gi||tW.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var c=new Date,h=(null==r?void 0:r.timestamp)||c,d=ti(null==r?void 0:r.uuid,ne),f={uuid:d,event:e,properties:this.calculateEventProperties(e,t||{},h,d)};e===rB&&this.config.__preview_capture_bot_pageviews&&l&&(f.event="$bot_pageview",f.properties.$browser_type="bot"),u&&(f.properties.$lib_rate_limit_remaining_tokens=u.remainingTokens),(null==r?void 0:r.$set)&&(f.$set=null==r?void 0:r.$set);var p=null==r?void 0:r.$unset;p&&(f.$unset=p);var g,m,v,y=this.Zi(null==r?void 0:r.$set_once,e!==rq,e===rz);
185if(y&&(f.$set_once=y),null!=r&&r._noTruncate||(i=this.config.properties_string_max_length,s=f,a=e=>K(e)?e.slice(0,i):e,o=new Set,f=function e(t,r){var n;return t!==Object(t)?a?a(t):t:o.has(t)?void 0:(o.add(t),W(t)?(n=[],rH(t,t=>{n.push(e(t))})):(n={},rG(t,(t,r)=>{o.has(t)||(n[r]=e(t,r))})),n)}(s)),f.timestamp=h,G(null==r?void 0:r.timestamp)||(f.properties.$event_time_override_provided=!0,f.properties.$event_time_override_system_time=c),e===iS||e===iI){var b=null==t?void 0:t.$survey_id,w=null==t?void 0:t.$survey_iteration;(e=>{try{var t,r=(t=""+sx+e.id,e.current_iteration&&e.current_iteration>0&&(t=""+sx+e.id+"_"+e.current_iteration),t);if(localStorage.getItem(r))return;localStorage.setItem(r,"true")}catch(e){sC.error("Failed to persist survey seen state",e)}})({id:b,current_iteration:w}),f.$set=_({},f.$set,{[(g={id:b,current_iteration:w},v="$survey_"+(m=e===iI?"responded":"dismissed")+"/"+g.id,g.current_iteration&&g.current_iteration>0&&(v="$survey_"+m+"/"+g.id+"/"+g.current_iteration),v)]:!0})}else e===iE&&(f.$set=_({},f.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var E=null==t?void 0:t.$product_tour_type;E&&(f.$set=_({},f.$set,{["$product_tour_last_seen_date/"+E]:(new Date).toISOString()}))}var S=_({},f.properties.$set,f.$set);if(H(S)||this.setPersonPropertiesForFlags(S),!Q(this.config.before_send)){var I=this.it(f);if(!I)return;(f=I).uuid=ti(f.uuid,ne)}this.Ii.emit("eventCaptured",f);var k={method:"POST",url:null!=(n=null==r?void 0:r._url)?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:f,compression:"best-available",batchKey:null==r?void 0:r._batchKey,transport:null==r?void 0:r.transport};return!this.config.request_batching||r&&(null==r||!r._batchKey)||null!=r&&r.send_instantly?this.$i(k):this.Ai.enqueue(k),f}tW.critical("This capture call is ignored due to client rate limiting.")}}else tW.error("No event name provided to posthog.capture")}else tW.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,r,n,s){if(r=r||new Date,!this.persistence||!this.sessionPersistence)return t;var a,u=s?void 0:this.persistence.remove_event_timer(e),c=_({},t);if(c.token=this.config.token,c.$config_defaults=this.config.defaults,this.Si()&&(c.$cookieless_mode=!0),"$snapshot"===e){var h=_({},this.persistence.properties(),this.sessionPersistence.properties());return c.distinct_id=h.distinct_id,(!K(c.distinct_id)&&!X(c.distinct_id)||Y(c.distinct_id))&&tW.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),c}var d,p=function(e,t,r,n){if(void 0===n&&(n=!1),!f)return{};var s,a,o,u,c,h,d,p,g,v,y,_,b=e?[...it,...t||[]]:[],[w,E]=function(e){for(var t=0;tt.length>t;t++){var[r,n]=tt[t],i=r.exec(e),s=i&&(z(n)?n(i,e):n);if(s)return s}return["",""]}(f),S=null!=(c="u">typeof navigator?navigator:void 0)&&c.brave?{brave:!0}:{},I={detectGoogleSearchApp:r},k=rK(rX({$os:w,$os_version:E,$browser:e9(f,navigator.vendor,S,I),$device:tr(f),$device_type:(d={userAgentDataPlatform:null==(s=navigator)||null==(s=s.userAgentData)?void 0:s.platform,maxTouchPoints:null==(a=navigator)?void 0:a.maxTouchPoints,screenWidth:null==i||null==(o=i.screen)?void 0:o.width,screenHeight:null==i||null==(u=i.screen)?void 0:u.height,devicePixelRatio:null==i?void 0:i.devicePixelRatio},(_=tr(f))===ep||_===ef||"Kobo"===_||"Kindle Fire"===_||_===ez?ed:_===eO||_===eM||_===eN||_===eV?"Console":_===em?"Wearable":_?ec:"Android"===(null==d?void 0:d.userAgentDataPlatform)&&(null!=(p=null==d?void 0:d.maxTouchPoints)?p:0)>0?600>Math.min(null!=(g=null==d?void 0:d.screenWidth)?g:0,null!=(v=null==d?void 0:d.screenHeight)?v:0)/(null!=(y=null==d?void 0:d.devicePixelRatio)?y:1)?ec:ed:"Desktop"),$timezone:ig(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:n9(n?ts(null==l?void 0:l.href):null==l?void 0:l.href,b,ii),$host:null==l?void 0:l.host,$pathname:null==l?void 0:l.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:te(f,navigator.vendor,S,I),$browser_language:iu(),$browser_language_prefix:"string"==typeof(h=iu())?h.split("-")[0]:void 0,$screen_height:null==i?void 0:i.screen.height,$screen_width:null==i?void 0:i.screen.width,$viewport_height:null==i?void 0:i.innerHeight,$viewport_width:null==i?void 0:i.innerWidth,$lib:m.LIB_NAME,$lib_version:m.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3});return m.SDK_DIST_CHANNEL&&(k.$sdk_dist_channel=m.SDK_DIST_CHANNEL),k}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes
185);if(this.sessionManager){var{sessionId:g,windowId:v}=this.sessionManager.checkAndGetSessionAndWindowId(s,r.getTime());c.$session_id=g,c.$window_id=v}this.sessionPropsManager&&rK(c,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&rK(c,this.sessionRecording.sdkDebugProperties),c.$sdk_debug_retry_queue_size=null==(a=this.Di)?void 0:a.length}catch(e){c.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===sI&&(c.$lib_custom_api_host=this.config.api_host),d=e!==rB||s?e!==rW||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(r):this.pageViewManager.doPageView(r,n),c=rK(c,d),e===rB&&o&&(c.title=o.title),!G(u)){var y=r.getTime()-u;c.$duration=parseFloat((y/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(c.$browser_type=this._is_bot()?"bot":"browser"),(c=rK({},p,this.persistence.properties(),this.sessionPersistence.properties(),c)).$is_identified=this._isIdentified(),W(this.config.property_denylist)?rG(this.config.property_denylist,function(e){delete c[e]}):tW.error(sW+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var b=this.config.sanitize_properties;b&&(tW.error(sB),c=b(c,e));var w=this.Qi();return c.$process_person_profile=w,w&&!s&&this.Ji("_calculate_event_properties"),c}Zi(e,t,r){if(void 0===t&&(t=!0),void 0===r&&(r=!1),!this.persistence||!this.Qi()||this.Ci&&!r)return e;var n,i=rK({},this.persistence.get_initial_props(),(null==(n=this.sessionPropsManager)?void 0:n.getSetOnceProps())||{},e||{}),s=this.config.sanitize_properties;return s&&(tW.error(sB),i=s(i,"$set_once")),t&&(this.Ci=!0),H(i)?void 0:i}register(e,t){var r;null==(r=this.persistence)||r.register(e,t)}register_once(e,t,r){var n;null==(n=this.persistence)||n.register_once(e,t,r)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Yi(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var r;return null==(r=this.featureFlags)?void 0:r.getFeatureFlagResult(e,t)}isFeatureEnabled(e,t){var r;return null==(r=this.featureFlags)?void 0:r.isFeatureEnabled(e,t)}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,r){var n;null==(n=this.featureFlags)||n.updateFlags(e,t,r)}updateEarlyAccessFeatureEnrollment(e,t,r){var n;null==(n=this.featureFlags)||n.updateEarlyAccessFeatureEnrollment(e,t,r)}getEarlyAccessFeatures(e,t,r){var n;return void 0===t&&(t=!1),null==(n=this.featureFlags)?void 0:n.getEarlyAccessFeatures(e,t,r)}on(e,t){return this.Ii.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:sV}),()=>{})}onSessionId(e){var t,r;return null!=(t=null==(r=this.sessionManager)?void 0:r.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:sV})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:sV})}renderSurvey(e,t){var r;null==(r=this.surveys)||r.renderSurvey(e,t)}displaySurvey(e,t){var r;void 0===t&&(t=sP),null==(r=this.surveys)||r.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,r;return null!=(t=null==(r=this.surveys)?void 0:r.canRenderSurvey(e))?t:{visible:!1,disabledReason:sV}}canRenderSurveyAsync(e,t){var r,n;return void 0===t&&(t=!1),null!=(r=null==(n=this.surveys)?void 0:n.canRenderSurveyAsync(e,t))?r:Promise.resolve({visible:!1,disabledReason:sV})}Ki(e){return!e||Y(e)?(tW.critical("Unique user id has not been set in posthog.identify"),!1):e===rR?(tW.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(tW.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
185ot a hardcoded string.'),!1)}identify(e,t,r){if(!this.__loaded||!this.persistence)return tW.uninitializedWarning("posthog.identify");if(X(e)&&(e=e.toString(),tW.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.Ki(e)&&this.Ji("posthog.identify")){var n=this.get_distinct_id();this.register({$user_id:e}),this.get_property(tK)||this.register_once({$had_persisted_distinct_id:!0,$device_id:n},""),e!==n&&e!==this.get_property(tY)&&(this.unregister(tY),this.register({distinct_id:e}));var i,s=(this.persistence.get_property(rE)||rL)===rL;e!==n&&s?(this.persistence.set_property(rE,rU),this.setPersonPropertiesForFlags({$set:t||{},$set_once:r||{}},!1),this.capture(rz,{distinct_id:e,$anon_distinct_id:n},{$set:t||{},$set_once:r||{}}),this.Pi=sb(e,t,r),null==(i=this.featureFlags)||i.setAnonymousDistinctId(n)):(t||r)&&this.setPersonProperties(t,r),e!==n&&(this.reloadFeatureFlags(),this.unregister(ry))}}setPersonProperties(e,t){if((e||t)&&this.Ji("posthog.setPersonProperties")){var r=sb(this.get_distinct_id(),e,t);this.Pi!==r?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.Pi=r):tW.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,r=(W(e)?e:[e]).filter(e=>K(e)&&e.length>0);0!==r.length&&this.Ji("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(r,!0),this.capture("$set",{$unset:r}),this.Pi=null)}group(e,t,r){if(e&&t){var n=this.getGroups(),i=n[e]!==t;if(i&&this.resetGroupPropertiesForFlags(e),this.register({$groups:_({},n,{[e]:t})}),i||r){var s={$group_type:e,$group_key:t};r&&(s.$group_set=r),this.capture(rq,s)}r&&this.setGroupPropertiesForFlags({[e]:r}),i&&!r&&this.reloadFeatureFlags()}else tW.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),null==(r=this.featureFlags)||r.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var r;void 0===t&&(t=!0),this.Ji("posthog.setGroupPropertiesForFlags")&&(null==(r=this.featureFlags)||r.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(tW.info("reset"),!this.__loaded)return tW.uninitializedWarning("posthog.reset");var t,r,n,i,s,a,o,l,u,c,h=this.get_property(tK),d=this.get_property(t4);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(r=this.sessionPersistence)||r.clear(),G(d)||null==(c=this.persistence)||c.register({[t4]:d}),null==(n=this.surveys)||n.reset(),null==(i=this.Vi)||i.stop(),null==(s=this.featureFlags)||s.reset(),null==(a=this.conversations)||a.reset(),null==(o=this.logs)||o.reset(),null==(l=this.persistence)||l.set_property(rE,rL),null==(u=this.sessionManager)||u.resetSessionId(),this.Pi=null,this.config.cookieless_mode===rF)this.register_once({distinct_id:rR,$device_id:null},"");else{var f=this.config.get_device_id(ne());this.register_once({distinct_id:f,$device_id:e?f:h},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}setIdentity(e,t){var r;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(r=this.conversations)||r.Xi()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.en()}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!=(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:r}=this.sessionManager.checkAndGetSessionAndWindowId(!0),n=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&r){var i,s=null!=(i=e.timestampLookBack)?i:10;if(!r)return n;n+="?t="+Math.max(Math.floor(((new Date).getTime()-r)/1e3)-s,0)}return n}alias(e,t){return e===this.get_property(tG)?(tW.critical("Attempting to create alias for existing People user - aborting."),-2):this.Ji("posthog.alias")?(G(t)&&(t=this.get_distinct_id()),e!==t?(this.Yi(tY,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(tW.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=_({},this.config);if(q(e)){rK(this.config,sK(e));var r,n,i,s,a,o,l,u,c,h,d,f=this.Fi();null==(r=this.persistence)||r.update_config(this.config,t,f),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new i_(_({},this.config,{persistence:"sessionStorage"}),f,!1);var p=this.Ri(this.config.debug);ee(p)&&(this.config.debug=p),ee(this.config.debug)&&(this.config.debug?(m.DEBUG=!0,na.N()&&na.q("ph_debug",!0),tW.info("set_config",{config:e,oldConfig:t,newConfig:_({},this.config)})):(m.DEBUG=!1,na.N()&&na.A("ph_debug"))),null==(n=this.exceptionObserver)||n.onConfigChange(),null==(i=this.exceptions)||i.onConfigChange(),null==(s=this.sessionRecording)||s.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(c=this.deadClicksAutocapture)||
185c.startIfEnabledOrStop(),null==(h=this.surveys)||h.loadIfEnabled(),this.tn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){m.LIB_NAME=e,m.LIB_VERSION=t}startSessionRecording(e){var t,r,n,i,s,a=!0===e,o={sampling:a||!(null==e||!e.sampling),linked_flag:a||!(null==e||!e.linked_flag),url_trigger:a||!(null==e||!e.url_trigger),event_trigger:a||!(null==e||!e.event_trigger)};Object.values(o).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),o.sampling&&(null==(r=this.sessionRecording)||r.overrideSampling()),o.linked_flag&&(null==(n=this.sessionRecording)||n.overrideLinkedFlag()),o.url_trigger&&(null==(i=this.sessionRecording)||i.overrideTrigger("url")),o.event_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){if(this.exceptions){var r=Error("PostHog syntheticException"),n=this.exceptions.buildProperties(e,{handled:!0,syntheticException:r});return this.exceptions.sendExceptionEvent(_({},n,t))}}addExceptionStep(e,t){var r;null==(r=this.exceptions)||r.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:sJ.rn}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,r;return null!=(t=null==(r=this.toolbar)?void 0:r.loadToolbar(e))&&t}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!=(e=this.config.name)?e:sz;return t!==sz&&(t=sz+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(rE))===rU||(null==(t=this.sessionPersistence)?void 0:t.get_property(rE))===rU}Qi(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===rj&&!this._isIdentified()&&H(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[tY])&&(null==(t=this.persistence)||null==(t=t.props)||!t[rC]))}Wi(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.Qi()||this.Ji("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Ji("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Ji(e){return"never"===this.config.person_profiles?(tW.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Yi(rC,!0),!0)}Fi(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==rM)}tn(){var e,t,r,n,i=this.Fi();return(null==(e=this.persistence)?void 0:e.Vt)!==i&&(null==(r=this.persistence)||r.set_disabled(i)),(null==(t=this.sessionPersistence)?void 0:t.Vt)!==i&&(null==(n=this.sessionPersistence)||n.set_disabled(i)),i}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==rF){if(this.Si()){this.reset(!0),null==(i=this.sessionManager)||i.destroy(),null==(s=this.pageViewManager)||s.destroy(),this.sessionManager=new sv(this),this.pageViewManager=new n1(this),this.persistence&&(this.sessionPropsManager=new sp(this,this.sessionManager,this.persistence));var r,n,i,s,a,o,l,u,c=null!=(a=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)?a:null==(l=sJ.__defaultExtensionClasses)?void 0:l.sessionRecording;c&&(this.sessionRecording=this.xi(this.sessionRecording,new c(this)),this.Hi&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.Hi)))}this.consent.optInOut(!0),this.tn(),this.Ui(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==rM&&(null==(r=this.surveys)||r.loadIfEnabled()),(G(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(n=null==e?void 0:e.captureEventName)?n:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.zi()}else tW.warn(s$)}opt_out_capturing(){var e,t,r;this.config.cookieless_mode!==rF?(this.config.cookieless_mode===rM&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.tn(),this.config.cookieless_mode===rM&&(this.register({distinct_id:rR,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(r=this.pageViewM
185anager)||r.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.zi(),this.Ui())):tW.warn(s$)}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===rF||(this.config.cookieless_mode===rM?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.tn()}_is_bot(){return a?sy(a,this.config.custom_blocked_useragents):void 0}zi(){o&&("visible"===o.visibilityState?this.Ti||(this.Ti=!0,this.capture(rB,{title:o.title},{send_instantly:!0}),this.Ei&&(o.removeEventListener(r$,this.Ei),this.Ei=null)):this.Ei||(this.Ei=this.zi.bind(this),r0(o,r$,this.Ei)))}debug(e){!1===e?(null==i||i.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==i||i.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}mr(){var e,t,r,n,i=this.Oi||{};return"advanced_disable_flags"in i?!!i.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(tW.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(t="advanced_disable_decide",r=(e="advanced_disable_flags")in i&&!Q(i[e]),n=t in i&&!Q(i[t]),r?i[e]:!!n&&(tW&&tW.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),i[t]))}it(e){if(Q(this.config.before_send))return e;var t,r=Object.keys(null!=(t=e.properties)?t:{}).filter(er),n=W(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var s of n){if(Q(i=s(i))){var a="Event '"+e.event+"' was rejected in beforeSend function";return et(e.event)?tW.warn(a+". This can cause unexpected behavior."):tW.info(a),null}i.properties&&!H(i.properties)||tW.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var o of r)if(i.properties&&Q(i.properties[o]))return tW.warn("Event '"+e.event+"' had its '"+o+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Ot)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,r){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(r)})}Ri(e){var t=ee(e)&&!e,r=na.N()&&"true"===na.P("ph_debug");return!t&&(!!r||e)}}sJ.__defaultExtensionClasses={},sJ.rn={trace:sF=()=>{},debug:sF,info:sF,warn:sF,error:sF,fatal:sF},function(e,t){for(var r=0;t.length>r;r++)e.prototype[t[r]]=rQ(e.prototype[t[r]])}(sJ,["identify"]);class sQ{constructor(e){this.disabled=!1===e;var t=q(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,r){if(this.disabled)return!1;var n=this.clicks[this.clicks.length-1];if(n&&Math.abs(e-n.x)+Math.abs(t-n.y)<this.thresholdPx&&this.timeoutMs>r-n.timestamp){if(this.clicks.push({x:e,y:t,timestamp:r}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:r}];return!1}}var sX="$copy_autocapture",sZ=tz("[AutoCapture]");function s0(e,t){return t.length>e?t.slice(0,e)+"...":t}var s1=tz("[ExceptionAutocapture]"),s2=tz("[TracingHeaders]"),s3=tz("[Web Vitals]"),s5="disabled",s6="lazy_loading",s4="awaiting_config",s8="missing_config";tz("[SessionRecording]"),tz("[SessionRecording]");var s9="[SessionRecording]",s7=tz(s9),ae=tz("[Heatmaps]");function at(e){return q(e)&&"clientX"in e&&"clientY"in e&&X(e.clientX)&&X(e.clientY)}var ar=tz("[Product Tours]"),an=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(t5))},ai=["$set_once","$set"],as=tz("[SiteApps]"),aa="Error while initializing PostHog app with config id ";function ao(e,t,r){if(Q(e))return!1;switch(r){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class al{constructor(e){this.nn=new sg,this.sn=(e,t)=>this.an(e,t)&&this.ln(e,t)&&this.un(e,t)&&this.hn(e,t),this.an=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.dn=new Set,this.cn=new Set}init(){var e,t;G(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,r;if(!G(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e
185=>{var t,r;null==(t=this.cn)||t.add(e),null==(r=e.steps)||r.forEach(e=>{var t;null==(t=this.dn)||t.add((null==e?void 0:e.event)||"")})}),null!=(r=this._instance)&&r.autocapture)){var n,i=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&i.add(null==e?void 0:e.selector)})}),null==(n=this._instance)||n.autocapture.setElementSelectors(i)}}on(e,t){var r;null!=t&&0!=e.length&&(this.dn.has(e)||this.dn.has(null==t?void 0:t.event))&&this.cn&&(null==(r=this.cn)?void 0:r.size)>0&&this.cn.forEach(e=>{this.vn(t,e)&&this.nn.emit("actionCaptured",e.name)})}fn(e){this.onAction("actionCaptured",t=>e(t))}vn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var r of t.steps)if(this.sn(e,r))return!0;return!1}onAction(e,t){return this.nn.on(e,t)}ln(e,t){if(null!=t&&t.url){var r,n=null==e||null==(r=e.properties)?void 0:r.$current_url;if(!n||"string"!=typeof n||!ao(n,t.url,t.url_matching||"contains"))return!1}return!0}un(e,t){return!!this.pn(e,t)&&!!this.gn(e,t)&&!!this.mn(e,t)}pn(e,t){if(null==t||!t.href)return!0;var r=this.yn(e);if(r.length>0)return r.some(e=>ao(e.href,t.href,t.href_matching||"exact"));var n,i,s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!s&&ao((i=s.match(/(?::|")href="(.*?)"/))?i[1]:"",t.href,t.href_matching||"exact")}gn(e,t){if(null==t||!t.text)return!0;var r=this.yn(e);if(r.length>0)return r.some(e=>ao(e.text,t.text,t.text_matching||"exact")||ao(e.$el_text,t.text,t.text_matching||"exact"));var n,i,s,a,o=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";return!!o&&(i=function(e){for(var t,r=[],n=/(?::|")text="(.*?)"/g;!Q(t=n.exec(e));)r.includes(t[1])||r.push(t[1]);return r}(o),s=t.text,a=t.text_matching||"exact",i.some(e=>ao(e,s,a)))}mn(e,t){if(null==t||!t.selector)return!0;var r,n,i=null==e||null==(r=e.properties)?void 0:r.$element_selectors;if(null!=i&&i.includes(t.selector))return!0;var s=(null==e||null==(n=e.properties)?void 0:n.$elements_chain)||"";if(t.selector_regex&&s)try{return new RegExp(t.selector_regex).test(s)}catch(e){}return!1}yn(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}hn(e,t){return null==t||!t.properties||0===t.properties.length||sS(t.properties.reduce((e,t)=>{var r=W(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:r,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class au{constructor(e){this.bn=[],this._instance=e,this._n=new Map,this.wn=new Map,this.xn=new Map}kn(e,t){return!!e&&sS(e.propertyFilters,null==t?void 0:t.properties)}Sn(e,t){var r=new Map;return e.forEach(e=>{var n;null==(n=e.conditions)||null==(n=n[t])||null==(n=n.values)||n.forEach(t=>{if(null!=t&&t.name){var n=r.get(t.name)||[];n.push(e.id),r.set(t.name,n)}})}),r}Cn(e,t,r){var n=(r===ib?this._n:this.wn).get(e),i=[];return this.In(e=>{i=e.filter(e=>null==n?void 0:n.includes(e.id))}),i.filter(n=>{var i,s=null==(i=n.conditions)||null==(i=i[r])||null==(i=i.values)?void 0:i.find(t=>t.name===e);return this.kn(s,t)})}register(e){var t;G(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.Tn(e),this.En(e))}En(e){var t=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0});0!==t.length&&(null==this.Mn&&(this.Mn=new al(this._instance),this.Mn.init(),this.Mn.fn(e=>{this.onAction(e)})),t.forEach(e=>{var t,r,n,i,s;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(r=e.conditions)&&null!=(r=r.actions)&&r.values&&(null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)?void 0:n.length)>0&&(null==(i=this.Mn)||i.register(e.conditions.actions.values),null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)||s.forEach(t=>{if(t&&t.name){var r=this.xn.get(t.name);r&&r.push(e.id),this.xn.set(t.name,r||[e.id])}}))}))}Tn(e){var t,r=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.events)&&(null==(r=e.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.length)>0}),n=e.filter(e=>{var t,r;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(r=e.conditions)||null==(r=r.cancelEvents)||null==(r=r.values)?void 0:r.length)>0});0===r.length&&0===n.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this._n=this.Sn(e,ib),this.wn=this.Sn(e,iw))}onEvent(e,t){var r,n,i=this.Pn(),s=(null==t||null==(r=t.properties)?void 0:r.$survey_id)||(null==t||null==(n=t.properties)?void 0:n.$product_tour_id);if(s&&this.getActivatedIds().includes(s)){var a=this.Rn(e,s);if("consume"===a)return i.info("event consumed activated item, remov
185ing it",{event:e,itemId:s}),void this.On([s]);if("persist"===a)return i.info("shown item promoted to persisted activation",{event:e,itemId:s}),void this.Ln(s)}if(this.wn.has(e)){var o=this.Cn(e,t,iw);o.length>0&&(i.info("cancel event matched, cancelling items",{event:e,itemsToCancel:o.map(e=>e.id)}),this.On(o.map(e=>e.id)),o.forEach(e=>this.Fn(e.id)))}if(this._n.has(e)){i.info("event name matched",{event:e,eventPayload:t,items:this._n.get(e)});var l=this.Cn(e,t,ib);this.An(l.map(e=>e.id))}}onAction(e){this.xn.has(e)&&this.An(this.xn.get(e)||[])}An(e){0!==e.length&&(this.bn=[...new Set([...this.bn,...e])],this.Pn().info("updating activated items",{activatedItems:this.getActivatedIds()}))}Ln(e){this.bn=this.bn.filter(t=>t!==e);var t=this.$n();t.includes(e)||this.Dn([...t,e])}On(e){var t=new Set(e);this.bn=this.bn.filter(e=>!t.has(e));var r=this.$n(),n=r.filter(e=>!t.has(e));n.length!==r.length&&this.Dn(n)}$n(){var e,t=this.Nn();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}getActivatedIds(){return[...new Set([...this.$n(),...this.bn])].filter(e=>!this.qn(e))}reset(){this.bn=[],this.$n().length>0&&this.Dn([])}getEventToItemsMap(){return this._n}Bn(){return this.Mn}}class ac extends au{constructor(e){super(e)}Nn(){return rm}jn(){return iE}In(e){var t;null==(t=this._instance)||t.getSurveys(e)}Fn(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}Pn(){return sC}Dn(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[rm]:e})}qn(){return!1}Rn(e,t){var r,n,i,s,a,o;return this.In(e=>{o=e.find(e=>e.id===t)}),!o||(a=(null!=(n=null==(i=(r=o).conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)?n:0)>0,"always"===r.schedule||null!=(s=r.conditions)&&null!=(s=s.events)&&s.repeatedActivation&&a)?e===iE?"consume":"ignore":e===iE?"persist":e===iS||e===iI?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var ah="SDK is not enabled or survey functionality is not yet loaded",ad="Disabled. Not loading surveys.",af=null!=i&&i.location?n7(i.location.hash,"__posthog")||n7(location.hash,"state"):null,ap="_postHogToolbarParams",ag=tz("[Toolbar]"),am=tz("[FeatureFlags]"),av=tz("[FeatureFlags]",{debugEnabled:!0}),ay="\" failed. Feature flags didn't load in time.",a_=e=>{for(var t={},r=0;e.length>r;r++)t[e[r]]=!0;return t},ab=e=>{var t={};for(var[r,n]of rY(e||{}))n&&(t[r]=n);return t},aw=tz("[Error tracking]"),aE="Refusing to render web experiment since the viewer is a likely bot",aS={icontains:(e,t)=>!!i&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!i&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!i&&s_(t.href,e),not_regex:(e,t)=>!!i&&!s_(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class aI{get Se(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{aI.Hn("retrieved web experiments from the server"),t.Un=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Un&&(aI.Hn("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(r=t.Un)||r.set(e.feature_flag_key,e));var r,n=t._instance.getFeatureFlag(e.feature_flag_key);K(n)&&e.variants[n]&&t.zn(e.name,n,e.variants[n].transforms)}else if(e.variants)for(var i in e.variants){var s=e.variants[i];aI.Vn(s)&&t.zn(e.name,i,s.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())aI.Hn(aE);else if(!this.Se.disable_web_experiments){if(Q(this.Un))return this.Un=new Map,this.loadIfEnabled(),void this.previewWebExperiment();aI.Hn("applying feature flags",e),e.forEach(e=>{var t;if(this.Un&&null!=(t=this.Un)&&t.has(e)){var r,n=this._instance.getFeatureFlag(e),i=null==(r=this.Un)?void 0:r.get(e);n&&null!=i&&i.variants[n]&&this.zn(i.name,n,i.variants[n].transforms)}})}}previewWebExperiment(){var e=aI.getWindowLocation();if(null!=e&&e.search){var t=n8(null==e?void 0:e.search,"__experiment_id"),r=n8(null==e?void 0:e.search,"__experiment_variant");t&&r&&(aI.Hn("previewing web experiments "+t+" && "+r),this.getWebExperiments(e=>{this.Wn(parseInt(t),r,e)},!1,!0))}}loadIfEnabled(){this.Se.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,r){if(this.Se.disable_web_experiments&&!r)return e([]);var n=this._instance.get_property("$web_experiments");if(n&&!t)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Se.token),method:"GET",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Wn(e,t,r){var n=r.filter(t=>t.id===e);n&&n.length>0&&(aI.Hn("Previewing web experiment ["+n[0].name+"] with variant ["+t+"]"),this.zn(n[0].name,t,n[0].variants[t].transforms))}static Vn(e){return!Q(e.conditions)&&aI.Gn(e)&&aI.Zn(e)}static Gn(e){if(Q(e.conditions)||Q(null==(t=e.conditions)?void 0:t.url))return!0;var t,r,n,i,s=aI.getWindowLocation();return!!s&&(null==(r=e.conditions)||!r.url||aS[null!=(n=null==(i=e.conditions)?void 0:i.urlMatchType)?n:"icontains"](e.conditions.url,s))}
185static getWindowLocation(){return null==i?void 0:i.location}static Zn(e){if(Q(e.conditions)||Q(null==(r=e.conditions)?void 0:r.utm))return!0;var t=ia();if(t.utm_source){var r,n,i,s,a,o,l,u,c,h=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_campaign||(null==(i=e.conditions)||null==(i=i.utm)?void 0:i.utm_campaign)==t.utm_campaign,d=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_source||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_source)==t.utm_source,f=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,p=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(c=e.conditions)||null==(c=c.utm)?void 0:c.utm_term)==t.utm_term;return h&&f&&p&&d}return!1}static Hn(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];tW.info("[WebExperiments] "+e,r)}zn(e,t,r){this._is_bot()?aI.Hn(aE):"control"!==t?r.forEach(r=>{if(r.selector){aI.Hn("applying transform of variant "+t+" for experiment "+e+" ",r);var n,i=null==(n=document)?void 0:n.querySelectorAll(r.selector);null==i||i.forEach(e=>{r.html&&(e.innerHTML=r.html),r.css&&e.setAttribute("style",r.css)})}}):aI.Hn("Control variants leave the page unmodified.")}_is_bot(){return a&&this._instance?sy(a,this.Se.custom_blocked_useragents):void 0}}var ak=tz("[Conversations]"),aT="Conversations not available yet.",aA="console",aC={featureFlags:class{constructor(e){this.Qn=!1,this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.ts=!1,this.rs=!1,this._instance=e,this.featureFlagEventHandlers=[]}get Se(){return this._instance.config}get Ur(){return this._instance.persistence}ns(e){return this._instance.get_property(e)}ss(){var e,t;return null!=(e=null==(t=this.Ur)?void 0:t.Gt(this.Se.feature_flag_cache_ttl_ms))&&e}os(){return!!this.ss()&&(this.rs||this.Yn||(this.rs=!0,am.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}ls(){var e,t=null!=(e=this.Se.evaluation_contexts)?e:this.Se.evaluation_environments;return!this.Se.evaluation_environments||this.Se.evaluation_contexts||this.ts||(am.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.ts=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||am.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}us(){return this.ls().length>0}hs(){var e=this.Se.flag_keys;if(!G(e)){if(W(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||am.error("Invalid flag key found:",e,"Expected non-empty string"),t});am.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,{config:r}=this._instance,n=null!=(e=null==(t=r.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(n).length){var i,s,a=null!=(i=null==(s=r.bootstrap)?void 0:s.featureFlagPayloads)?i:{},o=Object.keys(n).filter(e=>!!n[e]).reduce((e,t)=>(e[t]=n[t]||!1,e),{}),l=Object.keys(a).filter(e=>o[e]).reduce((e,t)=>(a[t]&&(e[t]=a[t]),e),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,r){var n,i,s=null!=r&&r.merge&&null!=(n=this.ns(ri))?n:{},a=null!=r&&r.merge&&null!=(i=this.ns(rl))?i:{},o=_({},s,e),l=_({},a,t),u={};for(var[c,h]of Object.entries(o))u[c]={key:c,enabled:"string"==typeof h||h,variant:"string"==typeof h?h:void 0,reason:void 0,metadata:G(null==l?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}};this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Jn}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ns(ro),t=this.ns(rc),r=this.ns(rh);if(!r&&!t)return e||{};var n=rK({},e||{});for(var i of[...new Set([...Object.keys(r||{}),...Object.keys(t||{})])]){var s,a,o=n[i],l=null==t?void 0:t[i],u=G(l)?null!=(s=null==o?void 0:o.enabled)&&s:!!l,c=G(l)?o.variant:"string"==typeof l?l:void 0,h=null==r?void 0:r[i],d=_({},o,{enabled:u,variant:u?null!=c?c:null==o?void 0:o.variant:void 0});u!==(null==o?void 0:o.enabled)&&(d.original_enabled=null==o?void 0:o.enabled),c!==(null==o?void 0:o.variant)&&(
185d.original_variant=null==o?void 0:o.variant),h&&(d.metadata=_({},null==o?void 0:o.metadata,{payload:h,original_payload:null==o||null==(a=o.metadata)?void 0:a.payload})),n[i]=d}return this.Qn||(am.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:r,finalDetails:n}),this.Qn=!0),n}getFlagVariants(){var e=this.ns(ri),t=this.ns(rc);if(!t)return e||{};for(var r=rK({},e),n=Object.keys(t),i=0;n.length>i;i++)r[n[i]]=t[n[i]];return this.Qn||(am.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:r}),this.Qn=!0),r}getFlagPayloads(){var e=this.ns(rl),t=this.ns(rh);if(!t)return e||{};for(var r=rK({},e||{}),n=Object.keys(t),i=0;n.length>i;i++)r[n[i]]=t[n[i]];return this.Qn||(am.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:r}),this.Qn=!0),r}reloadFeatureFlags(){this.Kn||this.Se.advanced_disable_feature_flags||this.ds||(this._instance.Ii.emit("featureFlagsReloading",!0),this.ds=setTimeout(()=>{this.cs()},5))}vs(){clearTimeout(this.ds),this.ds=void 0}ensureFlagsLoaded(){this.Jn||this.Yn||this.ds||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Kn=e}cs(e){var t;if(this.vs(),!this._instance.mr())if(this.Yn)this.Xn=!0;else{var r=this.Se.token,n=this.ns(tK),i={token:r,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:_({},(null==(t=this.Ur)?void 0:t.get_initial_props())||{},this.ns(rd)||{}),group_properties:this.ns(rf),timezone:ig()};J(n)||G(n)||(i.$device_id=n),(null!=e&&e.disableFlags||this.Se.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.us()&&(i.evaluation_contexts=this.ls());var s=this.hs();G(s)||(i.flag_keys=s);var a=!!this.Se.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Se.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Yn=!0,this._instance._send_request({method:"POST",url:o,data:i,compression:this.Se.disable_compression?void 0:iP,timeout:this.Se.feature_flag_request_timeout_ms,callback:e=>{var t,r,n,s=!0;if(200===e.statusCode&&(this.Xn||(this.$anon_distinct_id=void 0),s=!1),this.Yn=!1,!i.disable_flags||this.Xn){this.es=!s;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var l,u=!(null==(r=e.json)||null==(r=r.quotaLimited)||!r.includes("feature_flags"));(u&&o.push("quota_limited"),null==(n=this.Ur)||n.register({[rb]:o}),u)?am.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(i.disable_flags||this.receivedFeatureFlags(null!=(l=e.json)?l:{},s,{partialResponse:a}),this.Xn&&(this.Xn=!1,this.cs()))}}})}}getFeatureFlag(e,t){var r;if(void 0===t&&(t={}),!t.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var n=this.getFeatureFlagResult(e,t);return null!=(r=null==n?void 0:n.variant)?r:null==n?void 0:n.enabled}}else am.warn('getFeatureFlag for key "'+e+ay)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.es)if(this.Jn||this.getFlags()&&this.getFlags().length>0){if(!this.os()){var r=this.getFlagVariants(),n=e in r,i=r[e],s=this.getFlagPayloads()[e],a=String(i),o=this.ns(ru)||void 0,l=this.ns(rw)||void 0,u=this.ns(ry)||{};if(this.Se.advanced_feature_flags_dedup_per_session){var c,h=this._instance.get_session_id(),d=this.ns(r_);h&&h!==d&&(u={},null==(c=this.Ur)||c.register({[ry]:u,[r_]:h}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){W(u[e])?u[e].push(a):u[e]=[a],null==(m
185=this.Ur)||m.register({[ry]:u});var f=this.getFeatureFlagDetails(e),p=[...null!=(v=this.ns(rb))?v:[]];G(i)&&p.push("flag_missing");var g={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:s||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(y=this.Se.bootstrap)||null==(y=y.featureFlags)?void 0:y[e])||null,$feature_flag_bootstrapped_payload:(null==(_=this.Se.bootstrap)||null==(_=_.featureFlagPayloads)?void 0:_[e])||null,$used_bootstrap_value:!this.es};G(null==f||null==(b=f.metadata)?void 0:b.version)||(g.$feature_flag_version=f.metadata.version);var m,v,y,_,b,w,E,S,I,k,T,A=null!=(w=null==f||null==(E=f.reason)?void 0:E.description)?w:null==f||null==(S=f.reason)?void 0:S.code;A&&(g.$feature_flag_reason=A),null!=f&&null!=(I=f.metadata)&&I.id&&(g.$feature_flag_id=f.metadata.id),G(null==f?void 0:f.original_variant)&&G(null==f?void 0:f.original_enabled)||(g.$feature_flag_original_response=G(f.original_variant)?f.original_enabled:f.original_variant),null!=f&&null!=(k=f.metadata)&&k.original_payload&&(g.$feature_flag_original_payload=null==f||null==(T=f.metadata)?void 0:T.original_payload),p.length&&(g.$feature_flag_error=p.join(",")),this._instance.capture("$feature_flag_called",g)}if(n)return{key:e,enabled:!!i,variant:"string"==typeof i?i:void 0,payload:(e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}})(s)}}}else am.warn('getFeatureFlagResult for key "'+e+ay)}getRemoteConfigPayload(e,t){var r=this.Se.token,n={distinct_id:this._instance.get_distinct_id(),token:r};this.us()&&(n.evaluation_contexts=this.ls());var i=this.hs();G(i)||(n.flag_keys=i),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:n,compression:this.Se.disable_compression?void 0:iP,timeout:this.Se.feature_flag_request_timeout_ms,callback(r){var n,i=null==(n=r.json)?void 0:n.featureFlagPayloads;t((null==i?void 0:i[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),!t.fresh||this.es){if(this.Jn||this.getFlags()&&this.getFlags().length>0){var r=this.getFeatureFlag(e,t);return G(r)?void 0:!!r}am.warn('isFeatureEnabled for key "'+e+ay)}}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,r){if(this.Ur){this.Jn=!0;var n=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,r,n,i,s){void 0===r&&(r={}),void 0===n&&(n={}),void 0===i&&(i={});var a,o=((a=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!=(t=a[e].variant)?t:a[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):e.featureFlags&&am.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=o.flags,u=o.featureFlags,c=o.featureFlagPayloads;if(u){var h=e.requestId,d=e.evaluatedAt;if(W(u)){am.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var f={};if(u)for(var p=0;u.length>p;p++)f[u[p]]=!0;t&&t.register({[rs]:u,[ri]:f})}else{var g=u,m=c,v=l;if(null!=s&&s.partialResponse)g=_({},r,g),m=_({},n,m),v=_({},i,v);else if(e.errorsWhileComputingFlags)if(l){var y=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=_({},r,Object.fromEntries(Object.entries(g).filter(e=>{var[t]=e;return y.has(t)}))),m=_({},n,Object.fromEntries(Object.entries(m||{}).filter(e=>{var[t]=e;return y.has(t)}))),v=_({},i,Object.fromEntries(Object.entries(v||{}).filter(e=>{var[t]=e;return y.has(t)})))}else g=_({},r,g),m=_({},n,m),v=_({},i,v);t&&t.register(_({[rs]:Object.keys(ab(g)),[ri]:g||{},[rl]:m||{},[ro]:v||{}},h?{[ru]:h}:{},d?{[rw]:d}:{}))}}}(e,this.Ur,n,i,s,r),t||(this.rs=!1),this.fs(t)}}override(e,t){void 0===t&&(t=!1),am.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.Ur)return am.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.Ur.unregister(rc),this.Ur.unregister(rh),this.fs(),av.info("All overrides cleared");if(W(e)){var t,r=a_(e);return this.Ur.register({[rc]:r}),this.fs(),av.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.Qn=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.Ur.unregister(rc),av.info("Flag overrides cleared");else if(e.flags){if(W(e.flags)){var n=a_(e.flags);this.Ur.register({[rc]:n})}else this.Ur.register({[rc]:e.flags});av.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.Ur.unregister(rh),av.info("Payload overrides cleared")):e.payloads&&(this.Ur.register({[rh]:e.payloads}),av.info("Payload overrides set",{payloads:e.payloads}))),void this.fs()}if(e&&"object"==typeof e)return this.Ur.register({[rc]:e}),this.fs(),av.info("Flag overrides set",{flags:e});am.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Jn){var{flags:t,flagVariants:r}=this.ps();e(t,r)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,r){var n,i=(this.ns(ra)||[]).find(t=>t.flagKey===e),s={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:s};i&&(a.$early_access_feature_name=i.name),r&&(a.$feature_enrollment_stage=r),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var o=_({},this.getFlagVariants(),{[e]:t});null==(n=this.Ur)||n.register({[rs]:Object.keys(ab(o)),[ri]:o}),this.fs()}getEarlyAccessFeatures(e,t,r){void 0===t&&(t=!1);var n=this.ns(ra),i=r?"&"+r.map(e=>"stage="+e).join("&"):"";if(n&&!t)return e(n);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Se.token+i),method:"GET",callback:t=>{var r,n;if(t.json){var i=t.json.earlyAccessFeatures;return null==(r=this.Ur)||r.unregister(ra),null==(n=this.Ur)||n.register({[ra]:i}
185),e(i)}}})}ps(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,r)=>(e[r]=t[r],e),{})}}fs(e){var{flags:t,flagVariants:r}=this.ps();this.featureFlagEventHandlers.forEach(n=>n(t,r,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.ns(rd)||{},n=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),i=null==e?void 0:e.$set_once,s={};if(i)for(var a in i)({}).hasOwnProperty.call(i,a)&&(a in r||(s[a]=i[a]));this._instance.register({[rd]:_({},r,s,n)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=_({},this.ns(rd)||{});e.forEach(e=>{delete r[e]}),this._instance.register({[rd]:r}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(rd),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var r=this.ns(rf)||{};0!==Object.keys(r).length&&Object.keys(r).forEach(t=>{r[t]=_({},r[t],e[t]),delete e[t]}),this._instance.register({[rf]:_({},r,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ns(rf)||{};this._instance.register({[rf]:_({},t,{[e]:{}})})}else this._instance.unregister(rf)}reset(){this.Jn=!1,this.Yn=!1,this.Kn=!1,this.Xn=!1,this.es=!1,this.$anon_distinct_id=void 0,this.vs(),this.Qn=!1}}},ax=_({productTours:class{get Ur(){return this._instance.persistence}constructor(e){this.Mo=null,this.Po=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if("productTours"in e){var t,r;if(this.Ur&&this.Ur.register({[t5]:!!e.productTours}),!an(this._instance))return!this.Mo&&Q(null==(t=this.Ur)?void 0:t.props[rv])||ar.info("product tours disabled; stopping and clearing cached tours"),null==(r=this.Mo)||r.stop(),this.Mo=null,void this.clearCache();this.loadIfEnabled()}}loadIfEnabled(){!this.Mo&&an(this._instance)&&this.Mt(()=>this.Ro())}Mt(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.generateProductTours?e():null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"product-tours",t=>{t?ar.error("Could not load product tours script",t):e()})}Ro(){var e;!this.Mo&&null!=(e=p.__PosthogExtensions__)&&e.generateProductTours&&(this.Mo=p.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!W(this.Po)||t){var r=this.Ur;if(r){var n=r.props[rv];if(W(n)&&!t)return this.Po=n,void e(n,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",callback:t=>{if(an(this._instance)){var n=t.statusCode;if(200!==n||!t.json){var i="Product Tours API could not be loaded, status: "+n;return ar.error(i),void e([],{isLoaded:!1,error:i})}var s=W(t.json.product_tours)?t.json.product_tours:[];this.Po=s,r&&r.register({[rv]:s}),e(s,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Po,{isLoaded:!0})}getActiveProductTours(e){Q(this.Mo)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Mo.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Mo)||t.showTourById(e)}previewTour(e){this.Mo?this.Mo.previewTour(e):this.Mt(()=>{var t;this.Ro(),null==(t=this.Mo)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Mo)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Mo)||e.nextStep()}previousStep(){var e;null==(e=this.Mo)||e.previousStep()}clearCache(){var e;this.Po=null,null==(e=this.Ur)||e.unregister(rv)}resetTour(e){var t;null==(t=this.Mo)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Mo)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Mo)||t.cancelPendingTour(e)}}},aC),aR=_({surveys:class{get Se(){return this._instance.config}constructor(e){this.Zo=void 0,this._surveyManager=null,this.Qo=!1,this.Jo=[],this.Yo=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Se.disable_surveys){var t=e.surveys;if(Q(t))return sC.warn("Flags not loaded yet. Not loading surveys.");var r=W(t);this.Zo=r?t.length>0:t,sC.info("flags response received, isSurveysEnabled: "+this.Zo),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],r=0;r<localStorage.length;r++){var n=localStorage.key(r);(null!=n&&n.startsWith(sx)||null!=n&&n.startsWith("inProgressSurvey_"))&&t.push(n)}
185t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this.Qo)sC.info("Already initializing surveys, skipping...");else if(this.Se.disable_surveys)sC.info(ad);else if(this.Se.cookieless_mode&&this._instance.consent.isOptedOut())sC.info("Not loading surveys in cookieless mode without consent.");else{var e=null==p?void 0:p.__PosthogExtensions__;if(e){if(!G(this.Zo)||this.Se.advanced_enable_surveys){var t=this.Zo||this.Se.advanced_enable_surveys;this.Qo=!0;try{var r=e.generateSurveys;if(r)return void this.Ko(r,t);var n=e.loadExternalDependency;if(!n)return void this.Xo(rN);n(this._instance,"surveys",r=>{r||!e.generateSurveys?this.Xo("Could not load surveys script",r):this.Ko(e.generateSurveys,t)})}catch(e){throw this.Xo("Error initializing surveys",e),e}finally{this.Qo=!1}}}else sC.error("PostHog Extensions not found.")}}Ko(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new ac(this._instance),sC.info("Surveys loaded successfully"),this.ea({isLoaded:!0})}Xo(e,t){sC.error(e,t),this.ea({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Jo.push(e),this._surveyManager&&this.ea({isLoaded:!0}),()=>{this.Jo=this.Jo.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Se.disable_surveys)return sC.info(ad),e([]);var r,n=this._instance.get_property(rp);if(n&&!t)return e(n,{isLoaded:!0});"u">typeof Promise&&this.Yo?this.Yo.then(t=>{var{surveys:r,context:n}=t;return e(r,n)}):("u">typeof Promise&&(this.Yo=new Promise(e=>{r=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Se.token),method:"GET",timeout:this.Se.surveys_request_timeout_ms,callback:t=>{this.Yo=null;var n=t.statusCode;if(200!==n||!t.json){var i="Surveys API could not be loaded, status: "+n;sC.error(i);var s={isLoaded:!1,error:i};return e([],s),void(null==r||r({surveys:[],context:s}))}var a,o,l=t.json.surveys||[],u=l.filter(e=>{var t,r;return!(!e.start_date||e.end_date)&&(!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)||!(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)||!r.length))});u.length>0&&(null==(o=this._surveyEventReceiver)||o.register(u)),null==(a=this._instance.persistence)||a.register({[rp]:l,[rg]:Date.now()});var c={isLoaded:!0};e(l,c),null==r||r({surveys:l,context:c})}}))}ea(e){for(var t of this.Jo)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){sC.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!Q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);sC.warn("init was not called")}ta(e){var t=null;return this.getSurveys(r=>{var n;t=null!=(n=r.find(t=>t.id===e))?n:null}),t}ra(e){if(Q(this._surveyManager))return{eligible:!1,reason:ah};var t="string"==typeof e?this.ta(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(Q(this._surveyManager))return sC.warn("init was not called"),{visible:!1,disabledReason:ah};var t=this.ra(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return Q(this._surveyManager)?(sC.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:ah})):new Promise(r=>{this.getSurveys(t=>{var n,i=null!=(n=t.find(t=>t.id===e))?n:null;if(i){var s=this.ra(i);r({visible:s.eligible,disabledReason:s.reason})}else r({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,r){var n;if(Q(this._surveyManager))sC.warn("init was not called");else{var i="string"==typeof e?this.ta(e):e;if(null!=i&&i.id)if(sR.includes(i.type)){var s=null==o?void 0:o.querySelector(t);if(s)return null!=(n=i.appearance)&&n.surveyPopupDelaySeconds?(sC.info("Rendering survey "+i.id+" with delay of "+i.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;sC.info("Rendering survey "+i.id+" with delay of "+(null==(e=i.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(i,s,r),sC.info("Survey "+i.id+" rendered")},1e3*i.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(i,s,r);sC.warn("Survey element not found")}else sC.warn("Surveys of type "+i.type+" cannot be rendered in the app");else sC.warn("Survey not found")}}displaySurvey(e,t){var r;if(Q(this._surveyManager))sC.warn("init was not called");else{var n=this.ta(e);if(n){var i=n;
185if(null!=(r=n.appearance)&&r.surveyPopupDelaySeconds&&t.ignoreDelay&&(i=_({},n,{appearance:_({},n.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==ik&&t.initialResponses&&sC.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var s=this.canRenderSurvey(n);if(!s.visible)return void sC.warn("Survey is not eligible to be displayed: ",s.disabledReason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(i,t):this.renderSurvey(i,t.selector,t.properties)}else sC.warn("Survey not found")}}cancelPendingSurvey(e){Q(this._surveyManager)?sC.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||e.handlePageUnload()}}},aC),aP=_({experiments:aI},aC),aD=_({},aC,{sessionRecording:class{get Se(){return this._instance.config}get Ur(){return this._instance.persistence}get started(){var e;return!(null==(e=this.gs)||!e.isStarted)}get status(){var e,t;return this.ys===s4||this.ys===s8?this.ys:null!=(e=null==(t=this.gs
185)?void 0:t.status)?e:this.ys}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.ys=s5,this.bs=void 0,this._instance=e,!this._instance.sessionManager)throw s7.error("started without valid sessionManager"),Error(s9+" started without valid sessionManager. This is a bug.");if(this.Se.cookieless_mode===rF)throw Error(s9+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get _s(){var e,t=!(null==(e=this._instance.get_property(t4))||!e.enabled),r=!this.Se.disable_session_recording,n=this.Se.disable_session_recording||this._instance.consent.isOptedOut();return i&&t&&r&&!n}startIfEnabledOrStop(e){var t;if(!this._s||null==(t=this.gs)||!t.isStarted){var r=!G(Object.assign)&&!G(Array.from);this._s&&r?(this.ws(e),s7.info("starting")):(this.ys=s5,this.stopRecording())}}ws(e){var t,r,n;this._s&&(this.ys!==s4&&this.ys!==s8&&(this.ys=s6),null!=p&&null!=(t=p.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(r=p.__PosthogExtensions__)&&r.initSessionRecording?this.xs(e):null==(n=p.__PosthogExtensions__)||null==n.loadExternalDependency||n.loadExternalDependency(this._instance,this.ks,t=>{if(t)return s7.error("could not load recorder",t);this.xs(e)}))}stopRecording(){var e,t;
185null==(e=this.bs)||e.call(this),this.bs=void 0,null==(t=this.gs)||t.stop()}Ss(){var e,t;null==(e=this.bs)||e.call(this),this.bs=void 0,null==(t=this.gs)||t.discard()}Cs(){var e,t;null==(e=this.Ur)||e.unregister(rn),null==(t=this.Ur)||t.unregister(t8)}Is(e,t){if(Q(e))return null;var r=X(e)?e:parseFloat(e);return"number"!=typeof r||!Number.isFinite(r)||0>r||r>1?(s7.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):r}Ts(e){if(this.Ur){var t,r,n=this.Ur,i=()=>{var t,r=!1===e.sessionRecording?void 0:e.sessionRecording,i=this.Is(null==(t=this.Se.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),s=this.Is(null==r?void 0:r.sampleRate,"remote config sampleRate"),a=null!=i?i:s;Q(a)&&this.Cs();var o=null==r?void 0:r.minimumDurationMilliseconds;n.register({[t4]:_({cache_timestamp:Date.now(),enabled:!!r},r,{networkPayloadCapture:_({capturePerformance:e.capturePerformance},null==r?void 0:r.networkPayloadCapture),canvasRecording:{enabled:null==r?void 0:r.recordCanvas,fps:null==r?void 0:r.canvasFps,quality:null==r?void 0:r.canvasQuality},sampleRate:a,minimumDurationMilliseconds:G(o)?null:o,endpoint:null==r?void 0:r.endpoint,triggerMatchType:null==r?void 0:r.triggerMatchType,masking:null==r?void 0:r.masking,urlTriggers:null==r?void 0:r.urlTriggers,version:null==r?void 0:r.version,triggerGroups:null==r?void 0:r.triggerGroups})})};i(),null==(t=this.bs)||t.call(this),this.bs=null==(r=this._instance.sessionManager)?void 0:r.onSessionId(i)}}onRemoteConfig(e){return"sessionRecording"in e?!1===e.sessionRecording?(this.Ts(e),void this.Ss()):(this.Ts(e),void this.startIfEnabledOrStop()):(this.ys===s4&&(this.ys=s8,s7.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var r;void 0===t&&(t="log"),null!=(r=this.gs)&&r.log?this.gs.log(e,t):s7.warn("log called before recorder was ready")}get ks(){var e,t,r=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(t4);return(null==r||null==(t=r.scriptConfig)?void 0:t.script)||"lazy-recorder"}Es(){var e,t,r=this._instance.get_property(t4);if(!r)return!1;try{t="object"==typeof r?r:JSON.parse(r)}catch(e){return s7.warn("persisted remote config for session recording is invalid and will be ignored",e),!1}var n=null!=(e=t.cache_timestamp)?e:Date.now();return 36e5>=Date.now()-n}xs(e){var t,r;if(null==(t=p.__PosthogExtensions__)||!t.initSessionRecording)return s7.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[rO]:!0});if(this.gs||(this.gs=null==(r=p.__PosthogExtensions__)?void 0:r.initSessionRecording(this._instance),this.gs._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Es()){if(this.ys===s8||this.ys===s4)return;return this.ys=s4,s7.info("persisted remote config is stale, requesting fresh config before starting"),void new ix(this._instance).load()}this.ys=s6,this.gs.start(e)}onRRwebEmit(e){var t;
185null==(t=this.gs)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.gs||null==(t=this.Ur)||t.register({[t7]:!0}),null==(e=this.gs)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.gs||null==(t=this.Ur)||t.register({[t9]:!0}),null==(e=this.gs)||e.overrideSampling()}overrideTrigger(e){var t,r;this.gs||null==(r=this.Ur)||r.register({["url"===e?re:rt]:!0}),null==(t=this.gs)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.gs)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var r;return!(null==(r=this.gs)||!r.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.Ms=!1,this.Ps=null,this.Rs=!1,this.instance=e,this.rageclicks=new sQ(e.config.rageclick),this.Os=null}initialize(){this.startIfEnabled()}get Se(){var e,t,r=q(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=null==(e=r.url_allowlist)?void 0:e.map(e=>new RegExp(e)),r.url_ignorelist=null==(t=r.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),r}Ls(){if(this.isBrowserSupported()){if(i&&o){var e=e=>{e=e||(null==i?void 0:i.event);try{this.Fs(e)}catch(e){sZ.error("Failed to capture event",e)}};if(r0(o,"submit",e,{capture:!0}),r0(o,"change",e,{capture:!0}),r0(o,"click",e,{capture:!0}),this.Se.capture_copied_text){var t=e=>{e=e||(null==i?void 0:i.event);try{this.Fs(e,sX)}catch(e){sZ.error("Failed to capture copy/cut event",e)}};r0(o,"copy",t,{capture:!0}),r0(o,"cut",t,{capture:!0})}}}else sZ.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Ms&&(this.Ls(),this.Ms=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.Rs=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[tQ]:!!e.autocapture_opt_out}),this.Ps=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.Os=e}getElementSelectors(e){var t,r=[];return null==(t=this.Os)||t.forEach(t=>{var n=null==o?void 0:o.querySelectorAll(t);null==n||n.forEach(n=>{e===n&&r.push(t)})}),r}get isEnabled(){var e,t,r=null==(e=this.instance.persistence)?void 0:e.props[tQ];if(J(this.Ps)&&!ee(r)&&!this.instance.mr())return!1;var n=null!=(t=this.Ps)?t:!!r;return!!this.instance.config.autocapture&&!n}Fs(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var r,n=nS(e);nm(n)&&(n=n.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&nO(n,this.instance.config.rageclick)&&this.Fs(e,"$rageclick");var s=t===sX;if(n&&function(e,t,r,n,s){if(void 0===r&&(r=void 0),!i||nN(e)||null!=(a=r)&&a.url_allowlist&&!n_(r.url_allowlist)||null!=(o=r)&&o.url_ignorelist&&n_(r.url_ignorelist))return!1;if(null!=(l=r)&&l.dom_event_allowlist){var a,o,l,u,c,h,d=r.dom_event_allowlist;if(d&&!d.some(e=>t.type===e))return!1}var{parentIsUsefulElement:f,targetElementList:p}=nM(e,n);if(!function(e,t){var r=null==t?void 0:t.element_allowlist;if(G(r))return!0;var n,i=function(e){if(r.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var s of e)if(n=i(s))return n.v;return!1}(p,r)||!nk(p,null==(u=r)?void 0:u.css_selector_allowlist)||nk(p,null!=(c=null==(h=r)?void 0:h.css_selector_ignorelist)?c:nA))return!1;var g=i.getComputedStyle(e);if(g&&"pointer"===g.getPropertyValue("cursor")&&"click"===t.type)return!0;var m=e.tagName.toLowerCase();switch(m){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return f?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(nI.indexOf(m)>-1||"true"===e.getAttribute("contenteditable"))}}(n,e,this.Se,s,s?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=function(e,t){var r,n,{e:s,maskAllElementAttributes:a,maskAllText:o,elementAttributeIgnoreList:l,elementsChainAsString:u,disableCaptureUrlHashes:c}=t;if(!np(e))return{props:{}};for(var h=[e],d=e;d.parentNode&&!ng(d,"body");)if(nv(d.parentNode))h.push(d.parentNode.host),d=d.parentNode.host;else{if(!np(d.parentNode))break;h.push(d.parentNode),d=d.parentNode}var f,p=[],g={},m=!1,v=!1;if(rG(h,e=>{var t=nF(e);if(ng(e,"a")){var r=e.getAttribute("href");m=!!(t&&r&&nz(r))&&(c?ts(r):r)}L(nb(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,r,n,i){void 0===i&&(i=!1);var s=e.tagName.toLowerCase(),a={tag_name:s};nI.indexOf(s)>-1&&!r&&(a.$el_text="a"===s.toLowerCase()||"button"===s.toLowerCase()?s0(1024,nq(e)):s0(1024,nE(e)));var o=nb(e);o.length>0&&(a.classes=o.filter(function(e){return""!==e})),rG(e.attributes,function(r){var s;if((!nL(e)||-1!==["name","id","class","aria-label"].indexOf(r.name))&&(null==n||!n.includes(r.name))&&
185!t&&nz(r.value)&&(!K(s=r.name)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=r.value;"class"===r.name&&(o=ny(o).join(" ")),a["attr__"+r.name]=s0(1024,"href"===r.name&&i?ts(o):o)}});for(var l=1,u=1,c=e;c=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!np(t));return t}(c);)l++,c.tagName===e.tagName&&u++;return a.nth_child=l,a.nth_of_type=u,a}(e,a,o,l,c)),rK(g,function(e){if(!nF(e))return{};var t={};return rG(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var r=e.name.replace("data-ph-capture-attribute-",""),n=e.value;r&&n&&nz(n)&&(t[r]=n)}}),t}(e))}),v)return{props:{},explicitNoCapture:v};if(o||(p[0].$el_text=ng(e,"a")||ng(e,"button")?nq(e):nE(e)),m){p[0].attr__href=m;var y,b,w=null==(y=n4(m))?void 0:y.host,E=null==i||null==(b=i.location)?void 0:b.host;w&&E&&w!==E&&(f=m)}return{props:rK({$event_type:s.type,$ce_version:1},u?{}:{$elements:p},{$elements_chain:p.map(e=>{var t,r,n,i={text:null==(r=e.$el_text)?void 0:r.slice(0,400),tag_name:e.tag_name,href:null==(n=e.attr__href)?void 0:n.slice(0,2048),attr_class:(t=e.attr__class)?W(t)?t:ny(t):void 0,attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return rY(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,r]=e;return i.attributes[t]=r}),i}).map(e=>{var t,r,n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class)for(var i of(e.attr_class.sort(),e.attr_class))n+="."+i.replace(/"/g,"");var s=_({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(r=e.nth_of_type)?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return rY(s).sort((e,t)=>{var[r]=e,[n]=t;return r.localeCompare(n)}).forEach(e=>{var[t,r]=e;return a[nH(t.toString())]=nH(r.toString())}),(n+=":")+rY(a).map(e=>{var[t,r]=e;return t+'="'+r+'"'}).join("")}).join(";")},null!=(r=p[0])&&r.$el_text?{$el_text:null==(n=p[0])?void 0:n.$el_text}:{},f&&"click"===s.type?{$external_click_url:f}:{},g)}}(n,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Se.element_attribute_ignorelist,elementsChainAsString:this.Rs,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes});if(o)return!1;var l=this.getElementSelectors(n);if(l&&l.length>0&&(a.$element_selectors=l),t===sX){var u,c=nw(null==i||null==(u=i.getSelection())?void 0:u.toString()),h=e.type||"clipboard";if(!c)return!1;a.$selected_content=c,a.$copy_type=h}return this.instance.capture(t,a),!0}}}isBrowserSupported(){return z(null==o?void 0:o.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.As=(null==i||null==(t=i.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(tW.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$s&&this.$s(),this.$s=void 0,tW.info("History API monitoring stopped")}monitorHistoryChanges(){i&&i.history&&(this.Ds("pushState"),this.Ds("replaceState"),this.Ns())}Ds(e){var t;if(i&&(null==(t=i.history[e])||!t.__posthog_wrapped__)){var r=this;!function(e,t,r){try{if(!(t in e))return()=>{};var n=e[t],i=r(n);z(i)&&(i.prototype=i.prototype||{},Object.defineProperties(i,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=i}catch(e){return()=>{}}}(i.history,e,t=>function(n,i,s){t.call(this,n,i,s),r.qs(e)})}}qs(e){try{var t,r=null==i||null==(t=i.location)?void 0:t.pathname;if(!r)return;r!==this.As&&this.isEnabled&&this._instance.capture(rB,{navigation_type:e}),this.As=r}catch(t){tW.error("Error capturing "+e+" pageview",t)}}Ns(){if(!this.$s){var e=()=>{this.qs("popstate")};r0(i,"popstate",e),this.$s=()=>{i&&i.removeEventListener("popstate",e)}}}},heatmaps:class{get Se(){return this.instance.config}constructor(e){var t;this.Bs=!1,this.Ms=!1,this.js=null,this.instance=e,this.Bs=!(null==(t=this.instance.persistence)||!t.props[tX]),this.rageclicks=new sQ(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return q(this.Se.capture_heatmaps)&&this.Se.capture_heatmaps.flush_interval_milliseconds&&(e=this.Se.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return Q(this.Se.capture_heatmaps)?Q(this.Se.enable_heatmaps)?this.Bs:this.Se.enable_heatmaps:!1!==this.Se.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.Ms||(ae.info("starting..."),this.Hs(),this.ke());else{var e;clearInterval(null!=(e=this.js)?e:void 0),this.Us(),this.getAndClearBuffer()}}onRemoteConfig(e){if("heatmaps"in e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[tX]:t}),this.Bs=t,this.startIfEnabled()}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}zs(e){this.fe(e.originalEvent,"deadclick")}ke(){this.js&&clearInterval(this.js),this.js="visible"===(null==o?void 0:o.visibilityState)?setInterval(this.Or.bind(this),this.flushIntervalMilliseconds):null}Hs(){i&&o&&(this.Vs=this.Or.bind(this),r0(i,rV,this.Vs),this.Ws=e=>this.fe(e||(null==i?void 0:i.event)),r0(o,"click",this.Ws,{capture:!0}),this.Gs=e=>this.Zs(e||(null==i?void 0:i.event)),r0(o,"mousemove",this.Gs,{capture:!0}),this.Qs=new nJ(this.instance,nK,this.zs.bind(this)),this.Qs.startIfEnabledOrStop(),this.Js=this.ke.bind(this),r0(o,r$,this.Js),this.Ms=!0)}Us(){var e;i&&o&&(this.Vs&&i.removeEventListener(rV,this.Vs),this.Ws&&o.removeEventListener("click",this.Ws,{capture:!0}),this.Gs&&o.removeEventListener("mousemove",this.Gs,{capture:!0}),this.Js&&o.removeEventListener(r$,this.Js),clearTimeout(this.Ys),null==(e=this.Qs)||e.stop(),this.Ms=!1)}Ks(e,t){var r=this.instance.scrollManager.scrollY(),n=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),a=function(e,t,r){for(var n=e;n&&np(n)&&!ng(n,"body")&&n!==r;){if(L(t,null==i?void 0:i.getComputedStyle(n).position))return!0;n=nT(n)}return!1}(nS(e),["fixed","sticky"],s);return{x:e.clientX+(a?0:n),y:e.clientY+(a?0:r),target_fixed:a,type:t}}fe(e,t){var r;if(void 0===t&&(t="click"),!nf(e.target)&&at(e)){var n=this.Ks(e,t);null!=(r=this.rageclicks)&&r.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&nO(nS(e),this.instance.config.rageclick)&&this.Xs(_({}
185,n,{type:"rageclick"})),this.Xs(n)}}Zs(e){!nf(e.target)&&at(e)&&(clearTimeout(this.Ys),this.Ys=setTimeout(()=>{this.Xs(this.Ks(e,"mousemove"))},500))}Xs(e){if(i){var t=this.Se.disable_capture_url_hashes?ts(i.location.href):i.location.href,r=this.Se.custom_personal_data_properties,n=n9(t,this.Se.mask_personal_data_properties?[...it,...r||[]]:[],ii);this.R=this.R||{},this.R[n]||(this.R[n]=[]),this.R[n].push(e)}}Or(){this.R&&!H(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:nJ,webVitalsAutocapture:class{constructor(e){var t;this.Bs=!1,this.Ms=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.eo=()=>{clearTimeout(this.ro),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((e,t)=>_({},e,{["$web_vitals_"+t.name+"_event"]:_({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.io=e=>{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t,r=this.no();if(!G(r))if(Q(null==e?void 0:e.name)||Q(null==e?void 0:e.value))s3.error("Invalid metric received",e);else if(!this.so||this.so>e.value){this.R.url!==r&&(this.eo(),this.ro=setTimeout(this.eo,this.flushToCaptureTimeoutMs)),G(this.R.url)&&(this.R.url=r),this.R.firstMetricTimestamp=G(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var n=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),i=_({},e,{$current_url:r,timestamp:Date.now()});G(n)||(i.$session_id=n.sessionId,i.$window_id=n.windowId),this.R.metrics.push(i),this.R.metrics.length===this.allowedMetrics.length&&this.eo()}else s3.error("Ignoring metric with value >= "+this.so,e)},this.oo=()=>{if(!this.Ms){var e,t,r,n,i=p.__PosthogExtensions__;G(i)||G(i.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:r,onINP:n}=i.postHogWebVitalsCallbacks),e&&t&&r&&n?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.io.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.io.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&r(this.io.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&n(this.io.bind(this)),this.Ms=!0):s3.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.Bs=!(null==(t=this._instance.persistence)||!t.props[t2]),this.startIfEnabled()}get ao(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,r=q(this.ao)?null==(e=this.ao)?void 0:e.web_vitals_allowed_metrics:void 0;return Q(r)?(null==(t=this._instance.persistence)?void 0:t.props[t6])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(q(this.ao)?this.ao.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=q(this.ao)?this.ao.web_vitals_attribution:void 0;return null!=e&&e}get so(){var e=q(this.ao)&&X(this.ao.__web_vitals_max_value)?this.ao.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==l?void 0:l.protocol;if("http:"!==e&&"https:"!==e)return s3.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=q(this.ao)?this.ao.web_vitals:ee(this.ao)?this.ao:void 0;return ee(t)?t:this.Bs}startIfEnabled(){this.isEnabled&&!this.Ms&&(s3.info("enabled, starting..."),this.Mt(this.oo))}onRemoteConfig(e){if("capturePerformance"in e){var t=q(e.capturePerformance)&&!!e.capturePerformance.web_vitals,r=q(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[t2]:t}),this._instance.persistence.register({[t6]:r})),this.Bs=t,this.startIfEnabled()}}Mt(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?s3.error("failed to load script",t):e()})}no(){var e=i?this._instance.config.disable_capture_url_hashes?ts(i.location.href):i.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return n9(e,this._instance.config.mask_personal_data_properties?[...it,...t||[]]:[],ii)}s3.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t,r,n;this.oo=()=>{var e;if(i&&this.isEnabled&&null!=(e=p.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=p.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,r=p.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,n=p.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.lo&&this.Se.capture_unhandled_errors&&(this.lo=t(this.captureException.bind(this))),!this.uo&&this.Se.capture_unhandled_rejections&&(this.uo=r(this.captureException.bind(this))),!this.ho&&this.Se.capture_console_errors&&(this.ho=n(this.captureException.bind(this)))}catch(e){s1.error("failed to start",e),this.do()}}},this._instance=e,this.co=!(null==(t=this._instance.persistence)||!t.props[tZ]),this.vo=new eu({refillRate:null!=(r=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)?r:1,bucketSize:null!=(n=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)?n:10,refillInterval:1e4,Ae:s1}),this.Se=this.fo(),this.startIfEnabledOrStop()}fo(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return q(e)?t=_({},t,e):(G(e)?this.co:e)&&(t=_({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Se.capture_console_errors||this.Se.capture_unhandled_errors||this.Se.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(s1.info("enabled"),this.do(),this.Mt(this.oo)):this.do()}Mt(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.errorWrappingFunctions?e():null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return s1.error("failed to load script",t);e()})}do(){var e,t,r;null==(e=this.lo)||e.call(this),this.lo=void 0,null==(t=this.uo)||t.call(this),this.uo=void 0,null==(r=this.ho)||r.call(this),this.ho=void 0}onRemoteConfig(e){"autocaptureExceptions"in e&&(this.co=!!e.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[tZ]:this.co}),this.Se=this.fo(),this.startIfEnabledOrStop())}onConfigChange(){this.Se=this.fo()}captureException(e){var t,r,n,i=null!=(t=null==e||null==(r=e.$exception_list)||null==(r=r[0])?void 0:r.type)?t:"Exception";this.vo.consumeRateLimit(i)?s1.info("Skipping exception capture because of client rate limiting.",{exception:i}):null==(n=this._instance.exceptions)||n.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,r;this.po=[],this.mo=new tp([new tk,new tM,new tA,new tT,new tO,new tD,new tx,new tN],function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;t>n;n++)r[n-1]=arguments[n];return function(t,n){void 0===n&&(n=0);for(var i=[],s=t.split("\n"),a=n;s.length>a;a++){var o=s[a];if(1024>=o.length){var l=tI.test(o)?o.replace(tI,"$1"):o;if(!l.match(/\S*Error: /)){for(var u of r){var c=u(l,e);if(c){i.push(c);break}}if(i.length>=50)break}}}if(!i.length)return[];var h=Array.from(i);return h.reverse(),h.slice(0,50).map(e=>_({},e,{filename:e.filename||(h[h.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",tb,tS)),this._instance=e,this.po=null!=(t=null==(r=this._instance.persistence)?void 0:r.get_property(t0))?t:[],this.yo=t$(this.bo()),this._o=new tV(this.yo)}onConfigChange(){this.yo=t$(this.bo()),this._o.setConfig(this.yo)}onRemoteConfig(e){var t,r,n;if("errorTracking"in e){var i=null!=(t=null==(r=e.errorTracking)?void 0:r.suppressionRules)?t:[],s=null==(n=e.errorTracking)?void 0:n.captureExtensionExceptions;this.po=i,this._instance.persistence&&this._instance.persistence.register({[t0]:this.po,[t1]:s})}}get wo(){var e,t=!!this._instance.get_property(t1),r=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=r?r:t)&&e}buildProperties(e,t){return this.mo.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.yo.enabled)try{if(!K(e)||0===e.trim().length)return void aw.warn("Ignoring exception step because message must be a non-empty string");var r=this.xo(t),{sanitizedProperties:n,droppedKeys:i}=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((r,n)=>(tU.has(n)?t.push(n):r[n]=e[n],r),{}),droppedKeys:t}}(r);i.length>0&&aw.warn("Ignoring reserved exception step fields",{droppedKeys:i}),this._o.add(_({[tF]:e,[tL]:(new Date).toISOString()},n))}catch(e){aw.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){try{var t=e.$exception_list;if(this.ko(t)){if(this.So(t))return this.Co("Exception dropped: matched a suppression rule"),void aw.info("Skipping exception capture because a suppression rule matched");if(!this.wo&&this.Io(t))return this.Co("Exception dropped: thrown by a browser extension"),void aw.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.To(t))return this.Co("Exception dropped: thrown by the PostHog SDK"),void aw.info("Skipping exception capture because it was thrown by the PostHog SDK")}var r=this.yo.enabled&&Q(e.$exception_steps)?this.Eo(e):e;try{var n=this._instance.capture("$exception",r,{_noTruncate:!0,_batchKey:"exceptionEvent",Gi:!0});return n&&this._o.clear(),n}catch(e){return aw.error("Failed to capture exception event. Dropping this exception.",e),void this._o.clear()}}catch(e){return void aw.error("Failed to process exception event. Ignoring this exception.",e)}}Eo(e){try{var t=this._o.getAttachable();return 0===t.length?e:_({},e,{$exception_steps:t})}catch(t){return aw.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}Co(e){this.yo.enabled&&this._o.add({[tF]:e,[tL]:(new Date).toISOString()})}xo(e){return q(e)?_({},e):{}}bo(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}So(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>
185{var{type:r,value:n}=t;return K(r)&&r.length>0&&e.$exception_types.push(r),K(n)&&n.length>0&&e.$exception_values.push(n),e},{$exception_types:[],$exception_values:[]});return this.po.some(e=>{var r=e.values.map(e=>{var r,n=sw[e.operator],i=W(e.value)?e.value:[e.value],s=null!=(r=t[e.key])?r:[];return i.length>0&&n(i,s)});return"OR"===e.type?r.some(Boolean):r.every(Boolean)})}Io(e){return e.flatMap(e=>{var t,r;return null!=(t=null==(r=e.stacktrace)?void 0:r.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}To(e){if(e.length>0){var t,r,n,i,s=null!=(t=null==(r=e[0].stacktrace)?void 0:r.frames)?t:[],a=s[s.length-1];return null!=(n=null==a||null==(i=a.filename)?void 0:i.includes("posthog.com/static"))&&n}return!1}ko(e){return!Q(e)&&W(e)}}},ax,{siteApps:class{constructor(e){this.Oo=0,this._instance=e,this.Lo=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Fo(e,t){if(t){var r=this.globalsForEvent(t);this.Lo.push(r),this.Lo.length>1e3&&(this.Lo=this.Lo.slice(10))}}get siteAppLoaders(){var e;return null==(e=p._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Fo.bind(this));this.Ao=()=>{e(),this.Lo=[],this.Ao=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,r,n,i,s,a,o,l={},u=this._instance.get_property("$groups")||[];for(var[c,h]of Object.entries(this._instance.get_property("$stored_group_properties")||{}))l[c]={id:u[c],type:c,properties:h};var{$set_once:d,$set:f}=e;return{event:_({},b(e,ai),{properties:_({},e.properties,f?{$set:_({},null!=(t=null==(r=e.properties)?void 0:r.$set)?t:{},f)}:{},d?{$set_once:_({},null!=(n=null==(i=e.properties)?void 0:i.$set_once)?n:{},d)}:{}),elements_chain:null!=(s=null==(a=e.properties)?void 0:a.$elements_chain)?s:"",distinct_id:null==(o=e.properties)?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}$o(e){var t,r=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===r&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(as.error("prepare_external_dependency_stylesheet returned null"),null):"script"===r&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(as.error("prepare_external_dependency_script returned null"),null):e}Do(){if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var e,t,r,n,i,s,a,l,u=null==o?void 0:o.defaultView,c=null==u||null==(e=u.Node)?void 0:e.prototype;if(!u||!c)return()=>{};if(this.Oo++,this.No)return this.qo();var h=[],d=this,f=new WeakSet,p=(e,t,r)=>{if(null!=e&&e[t]){var n=e[t];e[t]=r(n),h.push(()=>{e[t]=n})}},g=e=>{if(f.has(e))return e;var t=d.$o(e);return t&&f.add(t),t},m=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!J(e));return p(c,"appendChild",e=>function(t){var r=g(t);return r?e.call(this,r):t}),p(c,"insertBefore",e=>function(t,r){var n=g(t);return n?e.call(this,n,r):t}),p(c,"replaceChild",e=>function(t,r){var n=g(t);return n?e.call(this,n,r):r}),[null==(t=u.Element)?void 0:t.prototype,null==(r=u.Document)?void 0:r.prototype,null==(n=u.DocumentFragment)?void 0:n.prototype].forEach(e=>{p(e,"append",e=>function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];return e.apply(this,m(r))}),p(e,"prepend",e=>function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];return e.apply(this,m(r))})}),[null==(i=u.Element)?void 0:i.prototype,null==(s=u.CharacterData)?void 0:s.prototype,null==(a=u.DocumentType)?void 0:a.prototype].forEach(e=>{p(e,"before",e=>function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];return e.apply(this,m(r))}),p(e,"after",e=>function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];return e.apply(this,m(r))}),p(e,"replaceWith",e=>function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];var i=m(r);return r.length&&!i.length?void 0:e.apply(this,i)})}),p(null==(l=u.Element)?void 0:l.prototype,"insertAdjacentElement",e=>function(t,r){var n=g(r);return n?e.call(this,t,n):null}),this.No=()=>
185{h.forEach(e=>e()),this.No=void 0},this.qo()}qo(){var e=!1;return()=>{var t;e||(e=!0,this.Oo--,0===this.Oo&&(null==(t=this.No)||t.call(this)))}}Bo(e,t){void 0===t&&(t=!0);var r=this.Do();try{var n=e(r);return t&&r(),n}catch(e){throw r(),e}}setupSiteApp(e){var t=this.apps[e.id],r=()=>{var r;!t.errored&&this.Lo.length&&(as.info("Processing "+this.Lo.length+" events for site app with id "+e.id),this.Lo.forEach(e=>this.Bo(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(r=this.Ao)||r.call(this))},n=!1,i=i=>{t.errored=!i,t.loaded=!0,as.info("Site app with id "+e.id+" "+(i?"loaded":"errored")),n&&r()};try{var{processEvent:s}=this.Bo(t=>e.init({posthog:this._instance,callback(e){t(),i(e)}}),!1);s&&(t.processEvent=s),n=!0}catch(t){as.error(aa+e.id,t),i(!1)}if(n&&t.loaded)try{r()}catch(r){as.error("Error while processing buffered events PostHog app with config id "+e.id,r),t.errored=!0}}jo(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var r of e)this.setupSiteApp(r)}Ho(e){var t=this;if(0!==Object.keys(this.apps).length){var r=this.globalsForEvent(e),n=function(n){try{t.Bo(()=>null==n.processEvent?void 0:n.processEvent(r))}catch(t){as.error("Error while processing event "+e.event+" for site app "+n.id,t)}};for(var i of Object.values(this.apps))n(i)}}onRemoteConfig(e){var t,r,n,i=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.jo(),void this._instance.on("eventCaptured",e=>this.Ho(e))):void as.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(r=this.Ao)||r.call(this),null!=(n=e.siteApps)&&n.length)if(this.isEnabled){var s=function(e){var t;p["__$$ph_site_app_"+e]=i._instance,null==(t=p.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(i._instance,o,t=>{if(t)return as.error(aa+e,t)})};for(var{id:a,url:o}of e.siteApps)s(a)}else as.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}},aR,{tracingHeaders:class{constructor(e){this.Uo=void 0,this.zo=void 0,this.Vo=void 0,this.oo=()=>{var e,t,r=this.Wo();r?(G(this.Uo)&&(this.Uo=null==(e=p.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),G(this.zo)&&(this.zo=null==(t=p.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(r,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.do()},this._instance=e}initialize(){this.startIfEnabledOrStop()}Mt(e){var t,r;null!=(t=p.__PosthogExtensions__)&&t.tracingHeadersPatchFns?e():null==(r=p.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return s2.error("failed to load script",t);e()})}Go(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}Wo(){var e=this.Go();return W(e)?(W(this.Vo)?this.Vo.splice(0,this.Vo.length,...e):this.Vo=[...e],e.length>0?this.Vo:void 0):(W(this.Vo)&&this.Vo.splice(0),this.Vo=e||void 0,this.Vo)}do(){var e,t;null==(e=this.Uo)||e.call(this),null==(t=this.zo)||t.call(this),this.Uo=void 0,this.zo=void 0}startIfEnabledOrStop(){this.Wo()?this.Mt(this.oo):this.do()}}},{toolbar:class{constructor(e){this.instance=e}ia(e){p.ph_toolbar_state=e}na(){var e;return null!=(e=p.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,r){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),r1(this.instance.config)||!i||!o)return!1;e=null!=e?e:i.location,r=null!=r?r:i.history;try{if(!t){try{i.localStorage.setItem("test","test"),i.localStorage.removeItem("test")}catch(e){return!1}t=null==i?void 0:i.localStorage}var n,s=af||n7(e.hash,"__posthog")||n7(e.hash,"state"),a=s?rJ(()=>JSON.parse(atob(decodeURIComponent(s))))||rJ(()=>JSON.parse(decodeURIComponent(s))):null;return a&&"ph_authorize"===a.action?((n=a).source="url",n&&Object.keys(n).length>0&&(a.desiredHash?e.hash=a.desiredHash:r?r.replaceState(r.state,"",e.pathname+e.search):e.hash="")):((n=JSON.parse(t.getItem(ap)||"{}")).source="localstorage",delete n.userIntent),!(!n.token||this.instance.config.token!==n.token||(this.loadToolbar(n),0))}catch(e){return!1}}sa(e){var t=p.ph_load_toolbar||p.ph_load_editor;!Q(t)&&z(t)?t(e,this.instance):ag.warn("No toolbar load function found")}loadToolbar(e){var t,r=!(null==o||!o.getElementById(rx));if(!i||r)return!1;var n="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,s=_({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},n?{instrument:!1}:{});return(i.localStorage.setItem(ap,JSON.stringify(_({},s,{source:void 0}))),2===this.na())?this.sa(s):0===this.na()&&(this.ia(1),null==(t=p.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{e?(ag.error("[Toolbar] Failed to load",e),this.ia(0)):(this.ia(2),this.sa(s))}),r0(i,"turbolinks:load",()=>{this.ia(0),this.loadToolbar(s)})),!0}oa(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,r){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===r&&(r=void 0),this.maybeLoadToolbar(e,t,r)}}},aP,{conversations:class{constructor(e){this.aa=void 0,this._conversationsManager=null,this.la=!1,this.ua=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations){var t=e.conversations;Q(t)||(ee(t)?this.aa=t:(this.aa=t.enabled,this.ua=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.aa=void 0,this.ua=null}loadIfEnabled(){if(!(this._conversationsManager||this.la||this._instance.config.disable_conversations||r1(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==p?void 0:p.__PosthogExtensions__;if(e&&!G(this.aa)&&this.aa)if(this.ua&&this.ua.token){this.la=!0;try{var t=e.initConversations;if(t)return this.ha(t),void(this.la=!1);var r=e.loadExternalDependency;if(!r)return void this.da(rN);r(this._instance,"conversations",t=>{t||!e.initConversations?this.da("Could not load conversations script",t):this.ha(e.initConversations),this.la=!1})}catch(e){this.da("Error initializing conversations",e),this.la=!1}}else ak.error("Conversations enabled but missing token in remote config.")}}ha(e){if(this.ua)try{this._conversationsManager=e(this.ua,this._instance),ak.info("Conversations loaded successfully")}catch(e){this.da("Error completing conversations initialization",e)}else ak.error("Cannot complete initialization: remote config is null")}da(e,t){ak.error(e,t),this._conversationsManager=null,this.la=!1}show(){this._conversationsManager?this._conversationsManager.show():ak.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}
185isAvailable(){return!0===this.aa&&!J(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,r){var n=this;return y(function*(){return n._conversationsManager?n._conversationsManager.sendMessage(e,t,r):(ak.warn(aT),null)})()}getMessages(e,t){var r=this;return y(function*(){return r._conversationsManager?r._conversationsManager.getMessages(e,t):(ak.warn(aT),null)})()}markAsRead(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(ak.warn(aT),null)})()}getTickets(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(ak.warn(aT),null)})()}requestRestoreLink(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(ak.warn(aT),null)})()}restoreFromToken(e){var t=this;return y(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(ak.warn(aT),null)})()}restoreFromUrlToken(){var e=this;return y(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(ak.warn(aT),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}Xi(){var e;null==(e=this._conversationsManager)||e.setIdentity()}en(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.ca=!1,this.va=!1,this.Ae=tz("[logs]"),this._r=[],this.fa=[],this.pa=()=>{var e,t;null==(e=this.ga)||e.onReconnect(),null==(t=this.ma)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.ca=!0),i&&r0(i,"online",this.pa)}ya(e,t,r,n){var i,s,a,o,l,u,c,h,d,f,p,g,m,v,y=(i=null==(v=this._instance)||null==(v=v.config)?void 0:v.logs,d=null!=(s=null==i?void 0:i.flushIntervalMs)?s:3e3,f=null!=(a=null==i?void 0:i.maxBufferSize)?a:100,g=G(p=null!=r&&r.consoleCapture?void 0:null!=(o=null==i?void 0:i.maxLogsPerInterval)?o:1e3)?Math.max(f,2048):Math.max(f,p),{serviceName:null!=(l=null!=(u=null==(m=null==i?void 0:i.resourceAttributes)?void 0:m["service.name"])?u:null==i?void 0:i.serviceName)?l:null==r?void 0:r.serviceNameDefault,serviceVersion:null!=(c=null==m?void 0:m["service.version"])?c:null==i?void 0:i.serviceVersion,environment:null!=(h=null==m?void 0:m["deployment.environment"])?h:null==i?void 0:i.environment,resourceAttributes:m,beforeSend:null==i?void 0:i.beforeSend,flushIntervalMs:d,maxBufferSize:f,maxQueueSize:g,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:p,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new tf(this.ba(e,t),y,this.Ae,()=>this._a(),e=>e(),void 0,n),y]}wa(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.ga&&this.xa===r||(null==(t=this.ga)||t.reset(),this.xa=r,[this.ga,this.ka]=this.ya(()=>this._r,e=>{this._r=e})),this.ga}Sa(){var e,t,r=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;return this.ma&&this.Ca===r||(null==(t=this.ma)||t.reset(),this.Ca=r,[this.ma,this.Ia]=this.ya(()=>this.fa,e=>{this.fa=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},aA)),this.ma}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t,r=null==(t=e.logs)?void 0:t.captureConsoleLogs;!Q(r)&&r&&(this.ca=!0,this.loadIfEnabled())}reset(){var e,t;this._r=[],null==(e=this.ga)||e.reset(),this.fa=[],null==(t=this.ma)||t.reset()}captureLog(e){this.wa().captureLog(e)}le(e){this.Sa().captureLog(e)}get logger(){return this.Ta||(this.Ta={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Ta}flushLogs(e){e?this.Ea(e):(this.ga&&this.ga.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)),this.ma&&this.ma.flush().catch(e=>this.Ae.error("PostHog logs flush failed:",e)))}loadIfEnabled(){if(this.ca&&!this.va){var e=null==p?void 0:p.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var r;t||null==(r=e.logs)||!r.initializeLogs?this.Ae.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.va=!0)}):this.Ae.error(rN)}else this.Ae.error("PostHog Extensions not found.")}}ba(e,t){var r=this._instance;return{get isDisabled(){return!1},get optedOut(){return!r.is_capturing()},getPersistedProperty:t=>t===k.LogsQueue?e():void 0,setPersistedProperty(e,r){e===k.LogsQueue&&t(null!=r?r:[])},ht:e=>this.ht(e),getLibraryId:()=>m.LIB_NAME,getLibraryVersion:()=>m.LIB_VERSION}}ht(e){return new Promise(t=>{var r=!1,n=e=>{r||(r=!0,clearTimeout(i),t(e))},i=setTimeout(()=>n({kind:"retry-later",error:Error("logs request timed out")}),9e4);this._instance._send_request({method:"POST",url:this.Ma(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback(e){var t,r=e.statusCode;r>=200&&300>r?n({kind:"ok"}):413===r?n({kind:"too-large"}):0!==r&&429!==r&&500>r?n({kind:"fatal",error:Error("logs request failed with status "+r)}):n({kind:"retry-later",error:null!=(t=e.error)?t:Error("logs request failed with status "+r)})}})})}Ea(e){this._r.length>0&&this.Pa(e,this._r,this.ka,m.LIB_NAME,e=>{this._r=e}),this.fa.length>0&&this.Pa(e,this.fa,this.Ia,aA,e=>{this.fa=e})}Pa(e,t,r,n,i){if(0!==t.length){var s=t.map(e=>e.record);i([]);var a=td(s,th(r,m.LIB_NAME,m.LIB_VERSION),n,m.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Ma(),data:a,compression:"best-available",batchKey:"logs",transport:e})}}Ma(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}_a(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var{sessionId:r,windowId:n,sessionStartTimestamp:i,lastActivityTimestamp:s}=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0);t.sessionId=r,t.windowId=n,Q(i)||(t.sessionStartTimestamp=i),Q(s)||(t.lastActivityTimestamp=s)}if(null!=p&&null!=(e=p.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?ts(p.location.href):p.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(t.activeFeatureFlags=a)}return t}}});sJ.__defaultExtensionClasses=_({},aD);var aO=(m.SDK_DIST_CHANNEL="npm",n=sL[sz]=new sJ,function(){function e(){e.done||(e.done=!0,sq=!1,rG(sL,function(e){e._dom_loaded()}))}null!=o&&o.addEventListener?"complete"===o.readyState?e():r0(o,"DOMContentLoaded",e,{capture:!1}):i&&tW.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),n)},64233:(e,t,r)=>{"use strict";r.d(t,{q:()=>n});
185class n extends Error{code="internal";constructor(e,t){super(e),t&&(this.code=t),Object.setPrototypeOf(this,n.prototype)}}},65756:(e,t,r)=>{"use strict";function n(e){return(t,r)=>{let n;if("formatting"===(r?.context?String(r.context):"standalone")&&e.formattingValues){let t=e.defaultFormattingWidth||e.defaultWidth,i=r?.width?String(r.width):t;n=e.formattingValues[i]||e.formattingValues[t]}else{let t=e.defaultWidth,i=r?.width?String(r.width):e.defaultWidth;n=e.values[i]||e.values[t]}return n[e.argumentCallback?e.argumentCallback(t):t]}}r.d(t,{o:()=>n})},70805:e=>{"use strict";e.exports=JSON.parse('{"id":"google-analytics","description":"Install a Google Analytics tag on your website","website":"https://analytics.google.com/analytics/web/","scripts":[{"url":"https://www.googletagmanager.com/gtag/js","params":["id"],"strategy":"worker","location":"head","action":"append"},{"code":"window.dataLayer=window.dataLayer||[];window.gtag=function gtag(){window.dataLayer.push(arguments);};gtag(\'js\',new Date());gtag(\'config\',\'${args.id}\')","strategy":"worker","location":"head","action":"append"}]}')},71295:(e,t,r)=>{"use strict";r.d(t,{G:()=>i});var n=r(6792);function i(e){let t=(0,n.a)(e),r=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return r.setUTCFullYear(t.getFullYear()),e-r}},71562:e=>{var t={872:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),a=s[0],o=s[1],u=new i((a+o)*3/4-o),c=0,h=o>0?a-4:a;for(r=0;r<h;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],u[c++]=t>>16&255,u[c++]=t>>8&255,u[c++]=255&t;return 2===o&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,u[c++]=255&t),1===o&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,u[c++]=t>>8&255,u[c++]=255&t),u},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(function(e,t,n){for(var i,s=[],a=t;a<n;a+=3)i=(e[a]<<16&0xff0000)+(e[a+1]<<8&65280)+(255&e[a+2]),s.push(r[i>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,a,a+16383>o?o:a+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="u">typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0,o=s.length;a<o;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n[45]=62,n[95]=63},230:function(e,t,r){"use strict";var n=r(872),i=r(321),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function a(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return c(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e){var n=e,i=t;if(("string"!=typeof i||""===i)&&(i="utf8"),!o.isEncoding(i))throw TypeError("Unknown encoding: "+i);var s=0|f(n,i),l=a(s),u=l.write(n,i);return u!==s&&(l=l.slice(0,u)),l}if(ArrayBuffer.isView(e))return h(e);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(x(e,ArrayBuffer)||e&&x(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(x(e,SharedArrayBuffer)||e&&x(e.buffer,SharedArrayBuffer)))return function(e,t,r){var n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),o.prototype),n}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var c=e.valueOf&&e.valueOf();if(null!=c&&c!==e)return o.from(c,t,r);var p=function(e){if(o.isBuffer(e)){var t=0|d(e.length),r=a(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?a(0):h(e):"Buffer"===e.type&&Array.isArray(e.data)?h(e.data):void 0}(e);if(p)return p;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);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');
vendor: 16,509 bytes, line 185
185if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return u(e),a(e<0?0:0|d(e))}function h(e){for(var t=e.length<0?0:0|d(e.length),r=a(t),n=0;n<t;n+=1)r[n]=255&e[n];return r}t.Buffer=o,t.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,o.TYPED_ARRAY_SUPPORT=function(){try{var 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}}(),!o.TYPED_ARRAY_SUPPORT&&"u">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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return(u(e),e<=0)?a(e):void 0!==t?"string"==typeof r?a(e).fill(t,r):a(e).fill(t):a(e)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)};function d(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function f(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||x(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);var r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;for(var i=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return k(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return A(e).length;default:if(i)return n?-1:k(e).length;t=(""+t).toLowerCase(),i=!0}}function p(e,t,r){var i,s,a,o=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);for(var i="",s=t;s<r;++s)i+=R[e[s]];return i}(this,t,r);case"utf8":case"utf-8":return y(this,t,r);case"ascii":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}(this,t,r);case"latin1":case"binary":return function(e,t,r){var n="";r=Math.min(e.length,r);for(var i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}(this,t,r);case"base64":return i=this,s=t,a=r,0===s&&a===i.length?n.fromByteArray(i):n.fromByteArray(i.slice(s,a));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var n=e.slice(t,r),i="",s=0;s<n.length;s+=2)i+=String.fromCharCode(n[s]+256*n[s+1]);return i}(this,t,r);default:if(o)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}function g(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(s=r*=1)!=s&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(i)return -1;else r=e.length-1;else if(r<0)if(!i)return -1;else r=0;if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:v(e,t,r,n,i);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(i)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return v(e,[t],r,n,i)}throw TypeError("val must be string, number or Buffer")}function v(e,t,r,n,i){var s,a=1,o=e.length,l=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return -1;a=2,o/=2,l/=2,r/=2}function u(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var c=-1;for(s=r;s<o;s++)if(u(e,s)===u(t,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===l)return c*a}else -1!==c&&(s-=s-c),c=-1}else for(r+l>o&&(r=o-l),s=r;s>=0;s--){for(var h=!0,d=0;d<l;d++)if(u(e,s+d)!==u(t,d)){h=!1;break}if(h)return s}return -1}o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(x(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),x(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,n=t.length,i=0,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:+(n<r)},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){var s=e[r];if(x(s,Uint8Array)&&(s=o.from(s)),!o.isBuffer(s))throw TypeError('"list" argument must be an Array of Buffers');s.copy(n,i),i+=s.length}return n},o.byteLength=f,o.prototype._isBuffer=!0,o.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},o.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},o.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var 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},o.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):p.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(o.prototype[s]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(x(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.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===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;for(var s=i-n,a=r-t,l=Math.min(s,a),u=this.slice(n,i),c=e.slice(t,r),h=0;h<l;++h)if(u[h]!==c[h]){s=u[h],a=c[h];break}return s<a?-1:+(a<s)},o.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)};function y(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i<r;){var s,a,o,l,u=e[i],c=null,h=u>239?4:u>223?3:u>191?2:1;if(i+h<=r)switch(h){case 1:u<128&&(c=u);break;case 2:(192&(s=e[i+1]))==128&&(l=(31&u)<<6|63&s)>127&&(c=l);break;case 3:s=e[i+1],a=e[i+2],(192&s)==128&&(192&a)==128&&(l=(15&u)<<12|(63&s)<<6|63&a)>2047&&(l<55296||l>57343)&&(c=l);break;case 4:s=e[i+1],a=e[i+2],o=e[i+3],(192&s)==128&&(192&a)==128&&(192&o)==128&&(l=(15&u)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&l<1114112&&(c=l)}null===c?(c=65533,h=1):c>65535&&(c-=65536,n.push(c>>>10&1023|55296),c=56320|1023&c),n.push(c),i+=h}var d=n,f=d.length;if(f<=4096)return String.fromCharCode.apply(String,d);for(var p="",g=0;g<f;)p+=String.fromCharCode.apply(String,d.slice(g,g+=4096));return p}function _(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function b(e,t,r,n,i,s){if(!o.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(r+n>e.length)throw RangeError("Index out of range")}function w(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function E(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function S(e,t,r,n,s){return t*=1,r>>>=0,s||w(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,s,a,o,l,u,c,h,d=this.length-t;if((void 0===r||r>d)&&(r=d),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var f=!1;;)switch(n){case"hex":return function(e,t,r,n){r=Number(r)||0;var i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;var s=t.length;n>s/2&&(n=s/2);for(var a=0;a<n;++a){var o,l=parseInt(t.substr(2*a,2),16);if((o=l)!=o)break;e[r+a]=l}return a}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,C(k(e,this.length-i),this,i,s);case"ascii":return a=t,o=r,C(T(e),this,a,o);case"latin1":case"binary":return function(e,t,r,n){return C(T(t),e,r,n)}(this,e,t,r);case"base64":return l=t,u=r,C(A(e),this,l,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return c=t,h=r,C(function(e,t){for(var r,n,i=[],s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-c),this,c,h);default:if(f)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),f=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},o.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n},o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e+--t],i=1;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUInt8=function(e,t){return e>>>=0,t||_(e,1,this.length),this[e]},o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||_(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=this[e],i=1,s=0;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||_(e,t,this.length);for(var n=t,i=1,s=this[e+--n];n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},o.prototype.readInt8=function(e,t){return(e>>>=0,t||_(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||_(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readFloatLE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||_(e,4,this.length),i.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||_(e,8,this.length),i.read(this,e,!1,52,8)},o.prototype.writeUIntLE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=1,a=0;for(this[t]=255&e;++a<r&&(s*=256);)this[t+a]=e/s&255;return t+r},o.prototype.writeUIntBE=function(e,t,r,n){if(e*=1,t>>>=0,r>>>=0,!n){var i=Math.pow(2,8*r)-1;b(this,e,t,r,i,0)}var s=r-1,a=1;for(this[t+s]=255&e;--s>=0&&(a*=256);)this[t+s]=e/a&255;return t+r},o.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||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},o.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||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},o.prototype.writeIntLE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=0,a=1,o=0;for(this[t]=255&e;++s<r&&(a*=256);)e<0&&0===o&&0!==this[t+s-1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e*=1,t>>>=0,!n){var i=Math.pow(2,8*r-1);b(this,e,t,r,i-1,-i)}var s=r-1,a=1,o=0;for(this[t+s]=255&e;--s>=0&&(a*=256);)e<0&&0===o&&0!==this[t+s+1]&&(o=1),this[t+s]=(e/a|0)-o&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||b(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||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},o.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||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},o.prototype.writeFloatLE=function(e,t,r){return E(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return E(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return S(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return S(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);var i=n-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,n);else if(this===e&&r<t&&t<n)for(var s=i-1;s>=0;--s)e[s+t]=this[s+r];else Uint8Array.prototype.set.call(e,this.subarray(r,n),t);return i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw TypeError("Unknown encoding: "+n);if(1===e.length){var i,s=e.charCodeAt(0);("utf8"===n&&s<128||"latin1"===n)&&(e=s)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{var a=o.isBuffer(e)?e:o.from(e,n),l=a.length;
185if(0===l)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%l]}return this};var I=/[^+/0-9A-Za-z-_]/g;function k(e,t){t=t||1/0;for(var r,n=e.length,i=null,s=[],a=0;a<n;++a){if((r=e.charCodeAt(a))>55295&&r<57344){if(!i){if(r>56319||a+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function T(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function A(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(I,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function C(e,t,r,n){for(var i=0;i<n&&!(i+r>=t.length)&&!(i>=e.length);++i)t[i+r]=e[i];return i}function x(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var R=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var n=16*r,i=0;i<16;++i)t[n+i]=e[r]+e[i];return t}()},321:function(e,t){t.read=function(e,t,r,n,i){var s,a,o=8*i-n-1,l=(1<<o)-1,u=l>>1,c=-7,h=r?i-1:0,d=r?-1:1,f=e[t+h];for(h+=d,s=f&(1<<-c)-1,f>>=-c,c+=o;c>0;s=256*s+e[t+h],h+=d,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=256*a+e[t+h],h+=d,c-=8);if(0===s)s=1-u;else{if(s===l)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),s-=u}return(f?-1:1)*a*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var a,o,l,u=8*s-i-1,c=(1<<u)-1,h=c>>1,d=5960464477539062e-23*(23===i),f=n?0:s-1,p=n?1:-1,g=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(o=+!!isNaN(t),a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-a))<1&&(a--,l*=2),a+h>=1?t+=d/l:t+=d*Math.pow(2,1-h),t*l>=2&&(a++,l/=2),a+h>=c?(o=0,a=c):a+h>=1?(o=(t*l-1)*Math.pow(2,i),a+=h):(o=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&o,f+=p,o/=256,i-=8);for(a=a<<i|o,u+=i;u>0;e[r+f]=255&a,f+=p,a/=256,u-=8);e[r+f-p]|=128*g}}},r={};function n(e){var i=r[e];if(void 0!==i)return i.exports;var s=r[e]={exports:{}},a=!0;try{t[e](s,s.exports,n),a=!1}finally{a&&delete r[e]}return s.exports}n.ab="//",e.exports=n(230)},72457:(e,t,r)=>{"use strict";var n,i;r.d(t,{$b:()=>n,Vy:()=>c});let s=[];(i=n||(n={}))[i.DEBUG=0]="DEBUG",i[i.VERBOSE=1]="VERBOSE",i[i.INFO=2]="INFO",i[i.WARN=3]="WARN",i[i.ERROR=4]="ERROR",i[i.SILENT=5]="SILENT";let a={debug:n.DEBUG,verbose:n.VERBOSE,info:n.INFO,warn:n.WARN,error:n.ERROR,silent:n.SILENT},o=n.INFO,l={[n.DEBUG]:"log",[n.VERBOSE]:"log",[n.INFO]:"info",[n.WARN]:"warn",[n.ERROR]:"error"},u=(e,t,...r)=>{if(t<e.logLevel)return;let n=new Date().toISOString(),i=l[t];if(i)console[i](`[${n}] ${e.name}:`,...r);else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`)};class c{constructor(e){this.name=e,this._logLevel=o,this._logHandler=u,this._userLogHandler=null,s.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n))throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?a[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,n.DEBUG,...e),this._logHandler(this,n.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.VERBOSE,...e),this._logHandler(this,n.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.INFO,...e),this._logHandler(this,n.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.WARN,...e),this._logHandler(this,n.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.ERROR,...e),this._logHandler(this,n.ERROR,...e)}}},73874:(e,t,r)=>{"use strict";r.d(t,{b:()=>i,l:()=>n});let n=["/home","/projects","/time-tracking","/cost-tracking","/payout-applications","/settings","/company"];function i(e){return n.some(t=>e.startsWith(t))}},74226:(e,t,r)=>{"use strict";r.d(t,{Cg:()=>s,F6:()=>u,Nw:()=>l,_P:()=>c,_m:()=>
185o,my:()=>n,s0:()=>a,w4:()=>i});let n=6048e5,i=864e5,s=6e4,a=36e5,o=1e3,l=43200,u=1440,c=Symbol.for("constructDateFrom")},75030:(e,t,r)=>{"use strict";function n(e){return (t={})=>{let r=t.width?String(t.width):e.defaultWidth;return e.formats[r]||e.formats[e.defaultWidth]}}r.d(t,{k:()=>n})},76012:(e,t,r)=>{"use strict";r.d(t,{m:()=>o});var n=r(71295),i=r(7822),s=r(74226),a=r(35292);function o(e,t,r){let[o,l]=(0,i.x)(r?.in,e,t),u=(0,a.o)(o),c=(0,a.o)(l);return Math.round((u-(0,n.G)(u)-(c-(0,n.G)(c)))/s.w4)}},76055:(e,t,r)=>{"use strict";r.d(t,{BR:()=>o,gG:()=>a});var n,i,s,a=((n=a||{}).Contributor="contributor",n.Admin="admin",n.Super="super",n),o=((i=o||{}).SalaryData="salary_data",i),l=((s=l||{}).InitialAdminUser="initial_admin_user",s.AdditionalAdminUser="additional_admin_user",s.ReactivateAccount="reactivate_account",s)},76090:(e,t,r)=>{"use strict";r.d(t,{x:()=>i});var n,i=((n=i||{}).FZulG="fzulg",n)},77331:(e,t,r)=>{"use strict";r.d(t,{Z4:()=>i,eP:()=>o,sM:()=>s,zj:()=>a});let n=["goals","innovation","differentiation","uncertainty","startDate","goToMarketHorizon","workPackages","personMonths","internalRnDCost","internalInvestmentsRnD","contractors","hasOtherFunding","otherFundingPrograms","fundingAssessmentBasis","hasAssociatedCompanies","associatedCompanies","foundingDate","endPastFiscalYear","hasAcceptedProposal"],i="fiscalYears_";function s(e){return e.startsWith(i)}function a(e){return n.includes(e)||s(e)}function o(e){if(!a(e))return"\xdcberblick";if("goals"===e)return"Ziele eures R&D Projekts";if("innovation"===e)return"Technische Neuheiten eures R&D Projekts";if("differentiation"===e)return"Wie unterscheidet sich euer R&D Projekt von Produkten, die euer Unternehmen bereits anbietet?";if("uncertainty"===e)return"Technologische H\xfcrden in eurem R&D Projekt";if("startDate"===e)return"Anfangs- und (voraussichtliches) Enddatum eures Projekts";else if("goToMarketHorizon"===e)return"In welchem Zeitraum plant ihr die Markteinf\xfchrung eures R&D Projekts (ab Projektstart)?";else if("workPackages"===e)return"Arbeitspakete eures R&D Projekts";else if("personMonths"===e)return"(Voraussichtliche) Personenmonate f\xfcr euer R&D Projekt";else if("internalRnDCost"===e)return"(Voraussichtliche) Personalkosten f\xfcr Arbeitnehmer:innen im R&D Projekt";else if("internalInvestmentsRnD"===e)return"(Voraussichtliche) Sachaufwendungen & Investitionen f\xfcr das R&D Projekt";else if("contractors"===e)return"Auftragnehmer eures Projekts und deren (voraussichtliche) Nettokosten";else if("hasOtherFunding"===e)return"Habt ihr bereits andere F\xf6rderungen oder staatliche Beihilfen f\xfcr dieses Projekt genehmigt bekommen?";else if("otherFundingPrograms"===e)return"Welche F\xf6rderungen sind das?";else if("fundingAssessmentBasis"===e)return"Wie hoch ist die Bemessungsgrundlage der genehmigten F\xf6rderungen?";else if("hasAssociatedCompanies"===e)return"Ist euer Unternehmen mit anderen in Deutschland ans\xe4ssigen Unternehmen verbunden?";else if("associatedCompanies"===e)return"Unternehmen, die mit euch verbunden sind";else if("foundingDate"===e)return"An welchem Tag wurde eure Firma gegr\xfcndet?";else if("endPastFiscalYear"===e)return"An welchem Tag endete euer letztes Wirtschaftsjahr?";else if(s(e)){if(e.endsWith("revenue"))return"Wie hoch war der Jahresumsatz im genannten Wirtschaftsjahr?";else if(e.endsWith("ftes"))return"Wie viele FTEs waren am Ende des Wirtschaftsjahres bei euch besch\xe4ftigt?";else if(e.endsWith("costRnD"))return"Wie hoch waren eure gesamten R&D Kosten?";else if(e.endsWith("fundingRnD"))return"In welcher H\xf6he habt ihr F\xf6rderungen f\xfcr R&D erhalten?";else if(e.endsWith("reportingCompleted"))return"Wurde der Jahresabschluss f\xfcr dieses Wirtschaftsjahr schon erstellt und vom Finanzamt gepr\xfcft?"}else if("hasAcceptedProposal"===e)return"Stimmst du der Einreichung des F\xf6rderantrags zu?";return""}},79390:function(e,t,r){"use strict";let n;var i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleAnalytics=function(e){let{gaId:t,debugMode:r,dataLayerName:i="dataLayer",nonce:l}=e;return void 0===n&&(n=i),(0,a.useEffect)(()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-ga"}})},[]),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(o.default,{id:"_next-ga-init",dangerouslySetInnerHTML:{__html:` 186 window['${i}'] = window['${i}'] || []; 187 function gtag(){window['${i}'].push(arguments);} 188 gtag('js', new Date()); 189 190 gtag('config', '${t}' ${r?",{ 'debug_mode': true }":""});`},nonce:l}),(0,s.jsx)(o.default,{id:"_next-ga",src:`https://www.googletagmanager.com/gtag/js?i
190d=${t}`,nonce:l})]})},t.sendGAEvent=function(){void 0===n?console.warn("@next/third-parties: GA has not been initialized"):window[n]?window[n].push(arguments):console.warn(`@next/third-parties: GA dataLayer ${n} does not exist`)};let s=r(26514),a=r(75834),o=i(r(83191))},80036:(e,t,r)=>{"use strict";function n(e,t){let r=[];if(e>t)return r;let n=e.getFullYear();for(;n<=t.getFullYear();)r.push(n.toString()),n++;return r}r.d(t,{R:()=>n})},82430:(e,t,r)=>{"use strict";r.d(t,{k:()=>s});var n=r(59231),i=r(6792);function s(e,t){let r=(0,n.q)(),s=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,a=(0,i.a)(e,t?.in),o=a.getDay();return a.setDate(a.getDate()-(7*(o<s)+o-s)),a.setHours(0,0,0,0),a}},83151:function(e,t,r){"use strict";var n=this&&this.__rest||function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.GoogleAnalytics=void 0;let s=i(r(70805)),a=r(28323);t.GoogleAnalytics=e=>{var t=n(e,[]);return(0,a.formatData)(s.default,t)}},83191:(e,t,r)=>{e.exports=r(68403)},83246:(e,t,r)=>{"use strict";r.d(t,{e:()=>i});var n=r(15735);function i(e,t,r){return(0,n.P)(e,12*t,r)}},83813:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var n=r(95498),i=r(49943),s=r(6792);function a(e,t){let r=(0,s.a)(e,t?.in),a=r.getFullYear(),o=(0,n.w)(r,0);o.setFullYear(a+1,0,4),o.setHours(0,0,0,0);let l=(0,i.b)(o),u=(0,n.w)(r,0);u.setFullYear(a,0,4),u.setHours(0,0,0,0);let c=(0,i.b)(u);return r.getTime()>=l.getTime()?a+1:r.getTime()>=c.getTime()?a:a-1}},85203:(e,t,r)=>{"use strict";r.d(t,{f:()=>s});var n=r(95498),i=r(6792);function s(e,t,r){let s=(0,i.a)(e,r?.in);return isNaN(t)?(0,n.w)(r?.in||e,NaN):(t&&s.setDate(s.getDate()+t),s)}},86281:(e,t,r)=>{"use strict";function n(e,t){return void 0!==t?{[e]:t}:{}}r.d(t,{M:()=>n})},88115:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let{html:t,scripts:r,stylesheets:n}=(0,a.YouTubeEmbed)(e);return(0,i.jsx)(o.default,{height:e.height||null,width:e.width||null,html:t,dataNtpc:"YouTubeEmbed",children:null==r?void 0:r.map(e=>(0,i.jsx)(s.default,{src:e.url,strategy:l[e.strategy],stylesheets:n},e.url))})};let i=r(26514),s=n(r(83191)),a=r(46485),o=n(r(923)),l={server:"beforeInteractive",client:"afterInteractive",idle:"lazyOnload",worker:"worker"}},89797:(e,t,r)=>{"use strict";r.d(t,{Q:()=>i});var n,i=((n=i||{}).PayoutApplication="payout_application",n)},90035:(e,t,r)=>{"use strict";r.d(t,{IX:()=>eX,p7:()=>rS,R4:()=>tc,Wq:()=>eD,xI:()=>rD,vZ:()=>tb,VO:()=>tI,hg:()=>tm,kZ:()=>tn,p:()=>ts,x9:()=>tf,CI:()=>tv,f3:()=>tp,RE:()=>td});var n,i=r(91790),s=r(19519),a=r(72457),o=r(27456);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 s.FA("auth","Firebase",l()),c=new a.Vy("@firebase/auth");function h(e,...t){c.logLevel<=a.$b.ERROR&&c.error(`Auth (${i.MF}): ${e}`,...t)}function d(e,...t){throw m(e,...t)}function f(e,...t){return m(e,...t)}function p(e,t,r){let n={...l(),[t]:r};return new s.FA("auth","Firebase",n).create(t,{appName:e.name})}function g(e){return p(e,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function m(e,...t){if("string"!=typeof e){let r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return u.create(e,...t)}function v(e,t,...r){if(!e)throw m(t,...r)}function y(e){let t="INTERNAL ASSERTION FAILED: "+e;throw h(t),Error(t)}function _(){return"u">typeof self&&self.location?.href||""}function b(){return"u">typeof self&&self.location?.protocol||null}class w{constructor(e,t){this.shortDelay=e,this.longDelay=t,function(e,t){e||y(t)}(t>
190e,"Short delay should be less than long delay!"),this.isMobile=(0,s.jZ)()||(0,s.lV)()}get(){return!("u">typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===b()||"https:"===b()||(0,s.sr)()||"connection"in navigator))||navigator.onLine?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function E(e,t){var r,n;r=e.emulator,n="Emulator should always be set here",r||y(n);let{url:i}=e.emulator;return t?`${i}${t.startsWith("/")?t.slice(1):t}`:i}class S{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl?this.fetchImpl:"u">typeof self&&"fetch"in self?self.fetch:"u">typeof globalThis&&globalThis.fetch?globalThis.fetch:"u">typeof fetch?fetch:void y("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"u">typeof self&&"Headers"in self?self.Headers:"u">typeof globalThis&&globalThis.Headers?globalThis.Headers:"u">typeof Headers?Headers:void y("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"u">typeof self&&"Response"in self?self.Response:"u">typeof globalThis&&globalThis.Response?globalThis.Response:"u">typeof Response?Response:void y("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}let I={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"missing-password",INVALID_LOGIN_CREDENTIALS:"invalid-credential",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},k=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],T=new w(3e4,6e4);function A(e,t){return e.tenantId&&!t.tenantId?{...t,tenantId:e.tenantId}:t}async function C(e,t,r,n,i={}){return x(e,i,async()=>{let i={},a={};n&&("GET"===t?a=n:i={body:JSON.stringify(n)});let o=(0,s.Am)({key:e.config.apiKey,...a}
190).slice(1),l=await e._getAdditionalHeaders();l["Content-Type"]="application/json",e.languageCode&&(l["X-Firebase-Locale"]=e.languageCode);let u={method:t,headers:l,...i};return(0,s.c1)()||(u.referrerPolicy="no-referrer"),e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(u.credentials="include"),S.fetch()(await P(e,e.config.apiHost,r,o),u)})}async function x(e,t,r){e._canInitEmulator=!1;let n={...I,...t};try{let t=new D(e),i=await Promise.race([r(),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,r]=(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 a=n[t]||t.toLowerCase().replace(/[_\s]+/g,"-");if(r)throw p(e,a,r);d(e,a)}}catch(t){if(t instanceof s.g)throw t;d(e,"network-request-failed",{message:String(t)})}}async function R(e,t,r,n,i={}){let s=await C(e,t,r,n,i);return"mfaPendingCredential"in s&&d(e,"multi-factor-auth-required",{_serverResponse:s}),s}async function P(e,t,r,n){let i=`${t}${r}?${n}`,s=e.config.emulator?E(e.config,i):`${e.config.apiScheme}://${i}`;return k.includes(r)&&(await e._persistenceManagerAvailable,"COOKIE"===e._getPersistenceType())?e._getPersistence()._getFinalTarget(s).toString():s}class D{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((e,t)=>{this.timer=setTimeout(()=>t(f(this.auth,"network-request-failed")),T.get())})}}function O(e,t,r){let n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);let i=f(e,t,n);return i.customData._tokenResponse=r,i}function N(e){return void 0!==e&&void 0!==e.enterprise}class M{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 F(e,t){return C(e,"GET","/v2/recaptchaConfig",A(e,t))}async function L(e,t){return C(e,"POST","/v1/accounts:delete",t)}async function U(e,t){return C(e,"POST","/v1/accounts:lookup",t)}function j(e){if(e)try{let t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}async function $(e,t=!1){let r=(0,s.Ku)(e),n=await r.getIdToken(t),i=B(n);v(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");let a="object"==typeof i.firebase?i.firebase:void 0,o=a?.sign_in_provider;return{claims:i,token:n,authTime:j(V(i.auth_time)),issuedAtTime:j(V(i.iat)),expirationTime:j(V(i.exp)),signInProvider:o||null,signInSecondFactor:a?.sign_in_second_factor||null}}function V(e){return 1e3*Number(e)}function B(e){let[t,r,n]=e.split(".");if(void 0===t||void 0===r||void 0===n)return h("JWT malformed, contained fewer than 3 sections"),null;try{let e=(0,s.u)(r);if(!e)return h("Failed to decode base64 JWT payload"),null;return JSON.parse(e)}catch(e){return h("Caught error parsing JWT payload as JSON",e?.toString()),null}}function W(e){let t=B(e);return v(t,"internal-error"),v(void 0!==t.exp,"internal-error"),v(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}async function z(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof s.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 q{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){if(!e)return this.errorBackoff=3e4,Math.max(0,(this.user.stsTokenManager.expirationTime??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){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=j(this.lastLoginAt),this.creationTime=j(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,r;let n=e.auth,i=await e.getIdToken(),s=await z(e,U(n,{idToken:i}));v(s?.users.length,n,"internal-error");let a=s.users[0];e._notifyReloadListener(a);let o=a.providerUserInfo?.length?Y(a.providerUserInfo):[],l=(t=e.providerData,r=o,[...t.filter(e=>!r.some(t=>t.providerId===e.providerId)),...r]),u=e.isAnonymous,c=!(e.email&&a.passwordHash)&&!l?.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:l,metadata:new H(a.createdAt,a.lastLoginAt),isAnonymous:!!u&&c})}async function K(e){let t=(0,s.Ku)(e);await G(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}function Y(e){return e.map(({providerId:e,...t})=>
190({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function J(e,t){let r=await x(e,{},async()=>{let r=(0,s.Am)({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:i}=e.config,a=await P(e,n,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();o["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:o,body:r};return e.emulatorConfig&&(0,s.zJ)(e.emulatorConfig.host)&&(l.credentials="include"),S.fetch()(a,l)});return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}async function Q(e,t){return C(e,"POST","/v2/accounts:revokeToken",A(e,t))}class X{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){v(e.idToken,"internal-error"),v(void 0!==e.idToken,"internal-error"),v(void 0!==e.refreshToken,"internal-error");let t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):W(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){v(0!==e.length,"internal-error");let t=W(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return t||!this.accessToken||this.isExpired?(v(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:r,refreshToken:n,expiresIn:i}=await J(e,t);this.updateTokensAndExpiration(r,n,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){let{refreshToken:r,accessToken:n,expirationTime:i}=t,s=new X;return r&&(v("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),n&&(v("string"==typeof n,"internal-error",{appName:e}),s.accessToken=n),i&&(v("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 X,this.toJSON())}_performRefresh(){return y("not implemented")}}function Z(e,t){v("string"==typeof e||void 0===e,"internal-error",{appName:t})}class ee{constructor({uid:e,auth:t,stsTokenManager:r,...n}){this.providerId="firebase",this.proactiveRefresh=new q(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=r,this.accessToken=r.accessToken,this.displayName=n.displayName||null,this.email=n.email||null,this.emailVerified=n.emailVerified||!1,this.phoneNumber=n.phoneNumber||null,this.photoURL=n.photoURL||null,this.isAnonymous=n.isAnonymous||!1,this.tenantId=n.tenantId||null,this.providerData=n.providerData?[...n.providerData]:[],this.metadata=new H(n.createdAt||void 0,n.lastLoginAt||void 0)}async getIdToken(e){let t=await z(this,this.stsTokenManager.getToken(this.auth,e));return v(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return $(this,e)}reload(){return K(this)}_assign(e){this!==e&&(v(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=>({...e})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new ee({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_onReload(e){v(!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 r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await G(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if((0,i.xZ)(this.auth.app))return Promise.reject(g(this.auth));let e=await this.getIdToken();return await z(this,L(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isA
190nonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map(e=>({...e})),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId,...this.metadata.toJSON(),apiKey:this.auth.config.apiKey,appName:this.auth.name}}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){let r=t.displayName??void 0,n=t.email??void 0,i=t.phoneNumber??void 0,s=t.photoURL??void 0,a=t.tenantId??void 0,o=t._redirectEventId??void 0,l=t.createdAt??void 0,u=t.lastLoginAt??void 0,{uid:c,emailVerified:h,isAnonymous:d,providerData:f,stsTokenManager:p}=t;v(c&&p,e,"internal-error");let g=X.fromJSON(this.name,p);v("string"==typeof c,e,"internal-error"),Z(r,e.name),Z(n,e.name),v("boolean"==typeof h,e,"internal-error"),v("boolean"==typeof d,e,"internal-error"),Z(i,e.name),Z(s,e.name),Z(a,e.name),Z(o,e.name),Z(l,e.name),Z(u,e.name);let m=new ee({uid:c,auth:e,email:n,emailVerified:h,displayName:r,isAnonymous:d,photoURL:s,phoneNumber:i,tenantId:a,stsTokenManager:g,createdAt:l,lastLoginAt:u});return f&&Array.isArray(f)&&(m.providerData=f.map(e=>({...e}))),o&&(m._redirectEventId=o),m}static async _fromIdTokenResponse(e,t,r=!1){let n=new X;n.updateFromServerResponse(t);let i=new ee({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await G(i),i}static async _fromGetAccountInfoResponse(e,t,r){let n=t.users[0];v(void 0!==n.localId,"internal-error");let i=void 0!==n.providerUserInfo?Y(n.providerUserInfo):[],s=!(n.email&&n.passwordHash)&&!i?.length,a=new X;a.updateFromIdToken(r);let o=new ee({uid:n.localId,auth:e,stsTokenManager:a,isAnonymous:s});return Object.assign(o,{uid:n.localId,displayName:n.displayName||null,photoURL:n.photoUrl||null,email:n.email||null,emailVerified:n.emailVerified||!1,phoneNumber:n.phoneNumber||null,tenantId:n.tenantId||null,providerData:i,metadata:new H(n.createdAt,n.lastLoginAt),isAnonymous:!(n.email&&n.passwordHash)&&!i?.length}),o}}let et=new Map;function er(e){var t,r;t="Expected a class definition",e instanceof Function||y(t);let n=et.get(e);return n?(r="Instance stored in cache mismatched with class",n instanceof e||y(r)):(n=new e,et.set(e,n)),n}class en{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,r){return`firebase:${e}:${t}:${r}`}en.type="NONE";class es{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:i}=this.auth;this.fullUserKey=ei(this.userKey,n.apiKey,i),this.fullPersistenceKey=ei("persistence",n.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 U(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,r="authUser"){if(!t.length)return new es(er(en),e,r);let n=(await Promise.all(t.map(async e=>{if(await e._isAvailable())return e}))).filter(e=>e),i=n[0]||er(en),s=ei(r,e.config.apiKey,e.name),a=null;for(let r of t)try{let t=await r._get(s);if(t){let n;if("string"==typeof t){let r=await U(e,{idToken:t}).catch(()=>void 0);if(!r)break;n=await ee._fromGetAccountInfoResponse(e,r,t)}else n=ee._fromJSON(e,t);r!==i&&(a=n),i=r;break}}catch{}let o=n.filter(e=>e._shouldAllowMigration);return i._shouldAllowMigration&&o.length&&(i=o[0],a&&await i._set(s,a.toJSON()),await Promise.all(t.map(async e=>{if(e!==i)try{await e._remove(s)}catch{}}))),new es(i,e,r)}}function ea(e){let t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";{if(ec(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(eo(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ed(t))return"Blackberry";if(ef(t))return"Webos";if(el(t))return"Safari";
190if((t.includes("chrome/")||eu(t))&&!t.includes("edge/"))return"Chrome";if(eh(t))return"Android";let r=e.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/);if(r?.length===2)return r[1]}return"Other"}function eo(e=(0,s.ZQ)()){return/firefox\//i.test(e)}function el(e=(0,s.ZQ)()){let t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function eu(e=(0,s.ZQ)()){return/crios\//i.test(e)}function ec(e=(0,s.ZQ)()){return/iemobile/i.test(e)}function eh(e=(0,s.ZQ)()){return/android/i.test(e)}function ed(e=(0,s.ZQ)()){return/blackberry/i.test(e)}function ef(e=(0,s.ZQ)()){return/webos/i.test(e)}function ep(e=(0,s.ZQ)()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function eg(e=(0,s.ZQ)()){return ep(e)||eh(e)||ef(e)||ed(e)||/windows phone/i.test(e)||ec(e)}function em(e,t=[]){let r;switch(e){case"Browser":r=ea((0,s.ZQ)());break;case"Worker":r=`${ea((0,s.ZQ)())}-${e}`;break;default:r=e}let n=t.length?t.join(","):"FirebaseCore-web";return`${r}/JsCore/${i.MF}/${n}`}class ev{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let r=t=>new Promise((r,n)=>{try{let n=e(t);r(n)}catch(e){n(e)}});r.onAbort=t,this.queue.push(r);let n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(e){for(let e of(t.reverse(),t))try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:e?.message})}}}async function ey(e,t={}){return C(e,"GET","/v2/passwordPolicy",A(e,t))}class e_{constructor(e){const t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??6,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),void 0!==t.containsLowercaseCharacter&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),void 0!==t.containsUppercaseCharacter&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),void 0!==t.containsNumericCharacter&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),void 0!==t.containsNonAlphanumericCharacter&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,"ENFORCEMENT_STATE_UNSPECIFIED"===this.enforcementState&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let r=this.customStrengthOptions.minPasswordLength,n=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),n&&(t.meetsMaxPasswordLength=e.length<=n)}validatePasswordCharacterOptions(e,t){let r;this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);for(let n=0;n<e.length;n++)r=e.charAt(n),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,n,i){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=n)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=i))}}class eb{constructor(e,t,r,n){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=n,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new eE(this),this.idTokenSubscription=new eE(this),this.beforeStateQueue=new ev(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=n.sdkClientVersion,this._persistenceManagerAvailable=new Promise(e=>this._resolvePersistenceManagerAvailable=e)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=er(t)),this._initializationPromise=this.queue(async()=>
190{if(!this._deleted){if(this.persistenceManager=await es.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=this.currentUser?.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 U(this,{idToken:e}),r=await ee._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(r)}catch(e){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",e),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if((0,i.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 t=await this.assertedPersistence.getCurrentUser(),r=t,n=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let t=this.redirectUser?._redirectEventId,i=r?._redirectEventId,s=await this.tryRedirectSignIn(e);(!t||t===i)&&s?.user&&(r=s.user,n=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(n)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(e))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return(v(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId)?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}async tryRedirectSignIn(e){let 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(e?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("u"<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,i.xZ)(this.app))return Promise.reject(g(this));let t=e?(0,s.Ku)(e):null;return t&&v(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&&v(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,i.xZ)(this.app)?Promise.reject(g(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return(0,i.xZ)(this.app)?Promise.reject(g(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(er(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 ey(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 s.FA("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}authStateReady(){return new Promise((e,t)=>
190{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),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 Q(this,t)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&er(e)||this._popupRedirectResolver;v(t,this,"argument-error"),this.redirectPersistenceManager=await es.create(this,[er(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return(this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e)?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};let i="function"==typeof t?t:t.next.bind(t),s=!1,a=this._isInitialized?Promise.resolve():this._initializationPromise;if(v(a,this,"internal-error"),a.then(()=>{s||i(this.currentUser)}),"function"==typeof t){let i=e.addObserver(t,r,n);return()=>{s=!0,i()}}{let r=e.addObserver(t);return()=>{s=!0,r()}}}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 v(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=em(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if((0,i.xZ)(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&function(e,...t){c.logLevel<=a.$b.WARN&&c.warn(`Auth (${i.MF}): ${e}`,...t)}(`Error while retrieving App Check token: ${e.error}`),e?.token}}function ew(e){return(0,s.Ku)(e)}class eE{constructor(e){this.auth=e,this.observer=null,this.addObserver=(0,s.tD)(e=>this.observer=e)}get next(){return v(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}let eS={async loadJS(){throw Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};function eI(e){return`__${e}${Math.floor(1e6*Math.random())}`}class ek{constructor(){this.enterprise=new eT}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}class eT{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}}let eA="NO_RECAPTCHA";class eC{constructor(e){this.type="recaptcha-enterprise",this.auth=ew(e)}async verify(e="verify",t=!1){async function r(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,r)=>
190{F(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(n=>{if(void 0===n.recaptchaKey)r(Error("recaptcha Enterprise site key undefined"));else{let r=new M(n);return null==e.tenantId?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,t(r.siteKey)}}).catch(e=>{r(e)})})}function n(t,r,n){let i=window.grecaptcha;N(i)?i.enterprise.ready(()=>{i.enterprise.execute(t,{action:e}).then(e=>{r(e)}).catch(()=>{r(eA)})}):n(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new ek().execute("siteKey",{action:"verify"}):new Promise((e,i)=>{r(this.auth).then(r=>{if(!t&&N(window.grecaptcha))n(r,e,i);else{var s;if("u"<typeof window)return void i(Error("RecaptchaVerifier is only supported in browser"));let t=eS.recaptchaEnterpriseScript;0!==t.length&&(t+=r),(s=t,eS.loadJS(s)).then(()=>{n(r,e,i)}).catch(e=>{i(e)})}}).catch(e=>{i(e)})})}}async function ex(e,t,r,n=!1,i=!1){let s,a=new eC(e);if(i)s=eA;else try{s=await a.verify(r)}catch(e){s=await a.verify(r,!0)}let o={...t};if("mfaSmsEnrollment"===r||"mfaSmsSignIn"===r){if("phoneEnrollmentInfo"in o){let e=o.phoneEnrollmentInfo.phoneNumber,t=o.phoneEnrollmentInfo.recaptchaToken;Object.assign(o,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:t,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in o){let e=o.phoneSignInInfo.recaptchaToken;Object.assign(o,{phoneSignInInfo:{recaptchaToken:e,captchaResponse:s,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return o}return n?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}async function eR(e,t,r,n,i){if("EMAIL_PASSWORD_PROVIDER"===i)if(!e._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER"))return n(e,t).catch(async i=>{if("auth/missing-recaptcha-token"!==i.code)return Promise.reject(i);{console.log(`${r} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let i=await ex(e,t,r,"getOobCode"===r);return n(e,i)}});else{let i=await ex(e,t,r,"getOobCode"===r);return n(e,i)}if("PHONE_PROVIDER"!==i)return Promise.reject(i+" provider is not supported.");if(e._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let i=await ex(e,t,r);return n(e,i).catch(async i=>{if(e._getRecaptchaConfig()?.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 ${r} flow.`);let i=await ex(e,t,r,!1,!0);return n(e,i)}return Promise.reject(i)})}{let i=await ex(e,t,r,!1,!0);return n(e,i)}}async function eP(e){let t=ew(e),r=new M(await F(t,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}));null==t.tenantId?t._agentRecaptchaConfig=r:t._tenantRecaptchaConfigs[t.tenantId]=r,r.isAnyProviderEnabled()&&new eC(t).verify()}function eD(e,t,r){let n=ew(e);v(/^https?:\/\//.test(t),n,"invalid-emulator-scheme");let i=!!r?.disableWarnings,a=eO(t),{host:o,port:l}=function(e){let t=eO(e),r=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!r)return{host:"",port:null};let n=r[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(n);if(i){let e=i[1];return{host:e,port:eN(n.substr(e.length+1))}}{let[e,t]=n.split(":");return{host:e,port:eN(t)}}}(t),u=null===l?"":`:${l}`,c={url:`${a}//${o}${u}/`},h=Object.freeze({host:o,port:l,protocol:a.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!n._canInitEmulator){v(n.config.emulator&&n.emulatorConfig,n,"emulator-config-failed"),v((0,s.bD)(c,n.config.emulator)&&(0,s.bD)(h,n.emulatorConfig),n,"emulator-config-failed");return}n.config.emulator=c,n.emulatorConfig=h,n.settings.appVerificationDisabledForTesting=!0,(0,s.zJ)(o)?(0,s.gE)(`${a}//${o}${u}`):i||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)}"u">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."),"u">typeof window&&"u">typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}function eO(e){let t=e.indexOf(":");
190return t<0?"":e.substr(0,t+1)}function eN(e){if(!e)return null;let t=Number(e);return isNaN(t)?null:t}class eM{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return y("not implemented")}_getIdTokenResponse(e){return y("not implemented")}_linkToIdToken(e,t){return y("not implemented")}_getReauthenticationResolver(e){return y("not implemented")}}async function eF(e,t){return C(e,"POST","/v1/accounts:resetPassword",A(e,t))}async function eL(e,t){return C(e,"POST","/v1/accounts:update",t)}async function eU(e,t){return C(e,"POST","/v1/accounts:signUp",t)}async function ej(e,t){return R(e,"POST","/v1/accounts:signInWithPassword",A(e,t))}async function e$(e,t){return R(e,"POST","/v1/accounts:signInWithEmailLink",A(e,t))}async function eV(e,t){return R(e,"POST","/v1/accounts:signInWithEmailLink",A(e,t))}class eB extends eM{constructor(e,t,r,n=null){super("password",r),this._email=e,this._password=t,this._tenantId=n}static _fromEmailAndPassword(e,t){return new eB(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new eB(e,t,"emailLink",r)}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(t?.email&&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",ej,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return e$(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",eU,"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 eW(e,t){return R(e,"POST","/v1/accounts:signInWithIdp",A(e,t))}class ez extends eM{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new ez(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&&(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,n
190once:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let{providerId:t,signInMethod:r,...n}="string"==typeof e?JSON.parse(e):e;if(!t||!r)return null;let i=new ez(t,r);return i.idToken=n.idToken||void 0,i.accessToken=n.accessToken||void 0,i.secret=n.secret,i.nonce=n.nonce,i.pendingToken=n.pendingToken||null,i}_getIdTokenResponse(e){return eW(e,this.buildRequest())}_linkToIdToken(e,t){let r=this.buildRequest();return r.idToken=t,eW(e,r)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,eW(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,s.Am)(t)}return e}}async function eq(e,t){return C(e,"POST","/v1/accounts:sendVerificationCode",A(e,t))}async function eH(e,t){return R(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,t))}async function eG(e,t){let r=await R(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,t));if(r.temporaryProof)throw O(e,"account-exists-with-different-credential",r);return r}let eK={USER_NOT_FOUND:"user-not-found"};async function eY(e,t){return R(e,"POST","/v1/accounts:signInWithPhoneNumber",A(e,{...t,operation:"REAUTH"}),eK)}class eJ extends eM{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new eJ({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new eJ({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return eH(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return eG(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return eY(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:n}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:n}}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:r,phoneNumber:n,temporaryProof:i}=e;return r||t||n||i?new eJ({verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}):null}}class eQ{constructor(e){const t=(0,s.I9)((0,s.hp)(e)),r=t.apiKey??null,n=t.oobCode??null,i=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}}(t.mode??null);v(r&&n&&i,"argument-error"),this.apiKey=r,this.operation=i,this.code=n,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t,r,n,i=(r=(t=(0,s.I9)((0,s.hp)(e)).link)?(0,s.I9)((0,s.hp)(t)).deep_link_id:null,((n=(0,s.I9)((0,s.hp)(e)).deep_link_id)?(0,s.I9)((0,s.hp)(n)).link:null)||n||r||t||e);try{return new eQ(i)}catch{return null}}}class eX{constructor(){this.providerId=eX.PROVIDER_ID}static credential(e,t){return eB._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let r=eQ.parseLink(t);return v(r,"argument-error"),eB._fromEmailAndCode(e,r.code,r.tenantId)}}eX.PROVIDER_ID="password",eX.EMAIL_PASSWORD_SIGN_IN_METHOD="password",eX.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class eZ{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 e0 extends eZ{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class e1 extends e0{constructor(){super("facebook.com")}static credential(e){return ez._fromParams({providerId:e1.PROVIDER_ID,signInMethod:e1.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e1.credentialFromTaggedObject(e)}static credentialFromError(e){return e1.credentialFromTaggedObject(e.customData||{})}
190static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e1.credential(e.oauthAccessToken)}catch{return null}}}e1.FACEBOOK_SIGN_IN_METHOD="facebook.com",e1.PROVIDER_ID="facebook.com";class e2 extends e0{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ez._fromParams({providerId:e2.PROVIDER_ID,signInMethod:e2.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return e2.credentialFromTaggedObject(e)}static credentialFromError(e){return e2.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return e2.credential(t,r)}catch{return null}}}e2.GOOGLE_SIGN_IN_METHOD="google.com",e2.PROVIDER_ID="google.com";class e3 extends e0{constructor(){super("github.com")}static credential(e){return ez._fromParams({providerId:e3.PROVIDER_ID,signInMethod:e3.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return e3.credentialFromTaggedObject(e)}static credentialFromError(e){return e3.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return e3.credential(e.oauthAccessToken)}catch{return null}}}e3.GITHUB_SIGN_IN_METHOD="github.com",e3.PROVIDER_ID="github.com";class e5 extends e0{constructor(){super("twitter.com")}static credential(e,t){return ez._fromParams({providerId:e5.PROVIDER_ID,signInMethod:e5.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return e5.credentialFromTaggedObject(e)}static credentialFromError(e){return e5.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return e5.credential(t,r)}catch{return null}}}e5.TWITTER_SIGN_IN_METHOD="twitter.com",e5.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,r,n=!1){return new e6({user:await ee._fromIdTokenResponse(e,r,n),providerId:e4(r),_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){return await e._updateTokensIfNecessary(r,!0),new e6({user:e,providerId:e4(r),_tokenResponse:r,operationType:t})}}function e4(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class e8 extends s.g{constructor(e,t,r,n){super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,e8.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new e8(e,t,r,n)}}function e9(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch(r=>{if("auth/multi-factor-auth-required"===r.code)throw e8._fromErrorAndOperation(e,r,t,n);throw r})}async function e7(e,t,r=!1){let n=await z(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return e6._forOperation(e,"link",n)}async function te(e,t,r=!1){let{auth:n}=e;if((0,i.xZ)(n.app))return Promise.reject(g(n));let s="reauthenticate";try{let i=await z(e,e9(n,s,t,e),r);v(i.idToken,n,"internal-error");let a=B(i.idToken);v(a,n,"internal-error");let{sub:o}=a;return v(e.uid===o,n,"user-mismatch"),e6._forOperation(e,s,i)}catch(e){throw e?.code==="auth/user-not-found"&&d(n,"user-mismatch"),e}}async function tt(e,t,r=!1){if((0,i.xZ)(e.app))return Promise.reject(g(e));let n="signIn",s=await e9(e,n,t),a=await e6._fromIdTokenResponse(e,n,s);return r||await e._updateCurrentUser(a.user),a}async function tr(e,t){return tt(ew(e),t)}async function tn(e,t){return te((0,s.Ku)(e),t)}async function ti(e,t){return R(e,"POST","/v1/accounts:signInWithCustomToken",A(e,t))}async function ts(e,t){if((0,i.xZ)(e.app))return Promise.reject(g(e));let r=ew(e),n=await ti(r,{token:t,returnSecureToken:!0}),s=await e6._fromIdTokenResponse(r,"signIn",n);return await r._updateCurrentUser(s.user),s}class ta{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?to._fromServerResponse(e,t):"totpInfo"in t?tl._fromServerResponse(e,t):d(e,"internal-error")}}class to extends ta{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new to(t)}}class tl extends ta{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new tl(t)}}async function tu(e){let t=ew(e);t._getPasswordPolicyInternal()&&await t._updatePasswordPolicy()}async function tc(e,t,r){await eF((0,s.Ku)(e),{oobCode:t,newPassword:r}).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&tu(e),t})}async function th(e,t){let r=(0,s.Ku)(e),n=await eF(r,{oobCode:t}),i=n.requestType;switch(v(i,r,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":v(n.newEmail,r,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":v(n.mfaInfo,r,"internal-error");default:v(n.email,r,"internal-error")}let a=null;return n.mfaInfo&&(a=ta._fromServerResponse(ew(r),n.mfaInfo)),{data:{email:("VERIFY_AND_CHANGE_EMAIL"===n.requestType?n.newEmail:n.email)||null,previousEmail:("VERIFY_AND_CHANGE_EMAIL"===n.requestType?n.email:n.newEmail)||null,multiFactorInfo:a},operation:i}}async function td(e,t){let{data:r}=await th((0,s.Ku)(e),t);return r.email}function tf(e,t,r){return(0,i.xZ)(e.app)?Promise.reject(g(e)):tr((0,s.Ku)(e),eX.credential(t,r)).catch(async t=>{throw"auth/password-does-not-meet-requirements"===t.code&&tu(e),t})}function tp(e,t){return tg((0,s.Ku)(e),null,t)}async function tg(e,t,r){let{auth:n}=e,i={idToken:await e.getIdToken(),returnSecureToken:!0};t&&(i.email=t),r&&(i.password=r);let s=await z(e,eL(n,i));await e._updateTokensIfNecessary(s,!0)}function tm(e,t,r,n){return(0,s.Ku)(e).onAuthStateChanged(t,r,n)}function tv(e){return(0,s.Ku)(e).signOut()}class ty{constructor(e,t,r){this.type=e,this.credential=t,this.user=r}static _fromIdtoken(e,t){return new ty("enroll",e,t)}static _fromMfaPendingCredential(e){return new ty("signin",e)}toJSON(){return{multiFactorSession:{["enroll"===this.type?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return ty._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);else if(e.multiFactorSession?.idToken)return ty._fromIdtoken(e.multiFactorSession.idToken)}return null}}class t_{constructor(e,t,r){this.session=e,this.hints=t,this.signInResolver=r}static _fromError(e,t){let r=ew(e),n=t.customData._serverResponse,i=(n.mfaInfo||[]).map(e=>ta._fromServerResponse(r,e));v(n.mfaPendingCredential,r,"internal-error");let s=ty._fromMfaPendingCredential(n.mfaPendingCredential);return new t_(s,i,async e=>{let i=await e._process(r,s);delete n.mfaInfo,delete n.mfaPendingCredential;let a={...n,idToken:i.idToken,refreshToken:i.refreshToken};switch(t.operationType){case"signIn":let o=await e6._fromIdTokenResponse(r,t.operationType,a);return await r._updateCurrentUser(o.user),o;case"reauthenticate":return v(t.user,r,"internal-error"),e6._forOperation(t.user,t.operationType,a);default:d(r,"internal-error")}})}async resolveSignIn(e){return this.signInResolver(e)}}function tb(e,t){let r=(0,s.Ku)(e);return v(t.customData.operationType,r,"argument-error"),v(t.customData._serverResponse?.mfaPendingCredential,r,"argument-error"),t_._fromError(r,t)}function tw(e,t){return C(e,"POST","/v2/accounts/mfaEnrollment:start",A(e,t))}class tE{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(t=>ta._fromServerResponse(e.auth,t)))})}static _fromUser(e){return new tE(e)}async getSession(){return ty._fromIdtoken(await this.user.getIdToken(),this.user)}
190async enroll(e,t){let r=await this.getSession(),n=await z(this.user,e._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(n),this.user.reload()}async unenroll(e){let t="string"==typeof e?e:e.uid,r=await this.user.getIdToken();try{var n,i;let e=await z(this.user,(n=this.user.auth,i={idToken:r,mfaEnrollmentId:t},C(n,"POST","/v2/accounts/mfaEnrollment:withdraw",A(n,i))));this.enrolledFactors=this.enrolledFactors.filter(({uid:e})=>e!==t),await this.user._updateTokensIfNecessary(e),await this.user.reload()}catch(e){throw e}}}let tS=new WeakMap;function tI(e){let t=(0,s.Ku)(e);return tS.has(t)||tS.set(t,tE._fromUser(t)),tS.get(t)}let tk="__sak";class tT{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{if(!this.storage)return Promise.resolve(!1);return this.storage.setItem(tk,"1"),this.storage.removeItem(tk),Promise.resolve(!0)}catch{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 tA extends tT{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=eg(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys((e,t,r)=>{this.notifyListeners(e,r)});let r=e.key;t?this.detachListener():this.stopPolling();let n=()=>{let e=this.storage.getItem(r);(t||this.localCache[r]!==e)&&this.notifyListeners(r,e)},i=this.storage.getItem(r);(0,s.lT)()&&10===document.documentMode&&i!==e.newValue&&e.newValue!==e.oldValue?setTimeout(n,10):n()}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!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 tC(e){let t=e.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),r=RegExp(`${t}=([^;]+)`);return document.cookie.match(r)?.[1]??null}function tx(e){let t="http:"===window.location.protocol;return`${t?"__dev_":"__HOST-"}FIREBASE_${e.split(":")[3]}`}tA.type="LOCAL";class tR{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(){return!("boolean"==typeof isSecureContext&&!isSecureContext||"u"<typeof navigator||"u"<typeof document)&&(navigator.cookieEnabled??!0)}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=tx(e);if(window.cookieStore){let e=await window.cookieStore.get(t);return e?.value}return tC(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let t=tx(e);document.cookie=`${t}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;
190Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>void 0)}_addListener(e,t){if(!this._isAvailable())return;let r=tx(e);if(window.cookieStore){let e=e=>{let n=e.changed.find(e=>e.name===r);n&&t(n.value),e.deleted.find(e=>e.name===r)&&t(null)};return this.listenerUnsubscribes.set(t,()=>window.cookieStore.removeEventListener("change",e)),window.cookieStore.addEventListener("change",e)}let n=tC(r),i=setInterval(()=>{let e=tC(r);e!==n&&(t(e),n=e)},1e3);this.listenerUnsubscribes.set(t,()=>clearInterval(i))}_removeListener(e,t){let r=this.listenerUnsubscribes.get(t);r&&(r(),this.listenerUnsubscribes.delete(t))}}tR.type="COOKIE";class tP extends tT{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}tP.type="SESSION";class tD{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 r=new tD(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let{eventId:t,eventType:r,data:n}=e.data,i=this.handlersMap[r];if(!i?.size)return;e.ports[0].postMessage({status:"ack",eventId:t,eventType:r});let s=Array.from(i).map(async t=>t(e.origin,n)),a=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:r,response:a})}_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 tO(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}tD.receivers=[];class tN{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,r=50){let n,i,s="u">typeof MessageChannel?new MessageChannel:null;if(!s)throw Error("connection_unavailable");return new Promise((a,o)=>{let l=tO("",20);s.port1.start();let u=setTimeout(()=>{o(Error("unsupported_event"))},r);i={messageChannel:s,onMessage(e){if(e.data.eventId===l)switch(e.data.status){case"ack":clearTimeout(u),n=setTimeout(()=>{o(Error("timeout"))},3e3);break;case"done":clearTimeout(n),a(e.data.response);break;default:clearTimeout(u),clearTimeout(n),o(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 tM(){return window}function tF(){return void 0!==tM().WorkerGlobalScope&&"function"==typeof tM().importScripts}async function tL(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}let tU="firebaseLocalStorageDb",tj="firebaseLocalStorage",t$="fbase_key";class tV{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 tB(e,t){return e.transaction([tj],t?"readwrite":"readonly").objectStore(tj)}async function tW(e,t,r){return new tV(tB(e,!0).put({[t$]:t,value:r})).toPromise()}async function tz(e,t){let r=tB(e,!1).get(t),n=await new tV(r).toPromise();return void 0===n?null:n.value}function tq(e,t){return new tV(tB(e,!0).delete(t)).toPromise()}class tH{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise||(this.dbPromise=function e(){let t=indexedDB.open(tU,1
190);return new Promise((r,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let e=t.result;try{e.createObjectStore(tj,{keyPath:t$})}catch(e){n(e)}}),t.addEventListener("success",async()=>{let n=t.result;n.objectStoreNames.contains(tj)?r(n):(n.close(),await new tV(indexedDB.deleteDatabase(tU)).toPromise(),r(await e()))})})}(),this.dbPromise.catch(()=>{this.dbPromise=null})),this.dbPromise}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.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return tF()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=tD._getInstance(tF()?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(){if(this.activeServiceWorker=await tL(),!this.activeServiceWorker)return;this.sender=new tN(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(this.sender&&this.activeServiceWorker&&(navigator?.serviceWorker?.controller||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;return await this._withRetries(async e=>{await tW(e,tk,"1"),await tq(e,tk)}),!0}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(r=>tW(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(t=>tz(t,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>tq(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(e=>new tV(tB(e,!1).getAll()).toPromise());if(!e||0!==this.pendingWrites)return[];let t=[],r=new Set;if(0!==e.length)for(let{fbase_key:n,value:i}of e)r.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),t.push(n));for(let e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;let r=this.listeners[e];if(r)for(let e of Array.from(r))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 tG(e,t){return C(e,"POST","/v2/accounts/mfaSignIn:start",A(e,t))}tH.type="LOCAL",eI("rcb"),new w(3e4,6e4);let tK="recaptcha";async function tY(e,t,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 n;if(n="string"==typeof t?{phoneNumber:t}:t,"session"in n){let t=n.session;if("phoneNumber"in n){v("enroll"===t.type,e,"internal-error");let i={idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"}},s=async(e,t)=>{if(t.phoneEnrollmentInfo.captchaResponse===eA){v(r?.type===tK,e,"argument-error");let n=await tJ(e,t,r);return tw(e,n)}return tw(e,t)},a=eR(e,i,"mfaSmsEnrollment",s,"PHONE_PROVIDER");return(await a.catch(e=>Promise.reject(e))).phoneSessionInfo.sessionInfo}{v("signin"===t.type,e,"internal-error");let i=n.multiFactorHint?.uid||n.multiFactorUid;v(i,e,"missing-multi-factor-info");let s={mfaPendingCredential:t.credential,mfaEnrollmentId:i,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}},a=async(e,t)=>{if(t.phoneSignInInfo.captchaResponse===eA){v(r?.type===tK,e,"argument-error");let n=await tJ(e,t,r);return tG(e,n)}return tG(e,t)}
190,o=eR(e,s,"mfaSmsSignIn",a,"PHONE_PROVIDER");return(await o.catch(e=>Promise.reject(e))).phoneResponseInfo.sessionInfo}}{let t={phoneNumber:n.phoneNumber,clientType:"CLIENT_TYPE_WEB"},i=async(e,t)=>{if(t.captchaResponse===eA){v(r?.type===tK,e,"argument-error");let n=await tJ(e,t,r);return eq(e,n)}return eq(e,t)},s=eR(e,t,"sendVerificationCode",i,"PHONE_PROVIDER");return(await s.catch(e=>Promise.reject(e))).sessionInfo}}finally{r?._reset()}}async function tJ(e,t,r){v(r.type===tK,e,"argument-error");let n=await r.verify();v("string"==typeof n,e,"argument-error");let i={...t};if("phoneEnrollmentInfo"in i){let e=i.phoneEnrollmentInfo.phoneNumber,t=i.phoneEnrollmentInfo.captchaResponse,r=i.phoneEnrollmentInfo.clientType,s=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:e,recaptchaToken:n,captchaResponse:t,clientType:r,recaptchaVersion:s}}),i}if(!("phoneSignInInfo"in i))return Object.assign(i,{recaptchaToken:n}),i;{let e=i.phoneSignInInfo.captchaResponse,t=i.phoneSignInInfo.clientType,r=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:n,captchaResponse:e,clientType:t,recaptchaVersion:r}}),i}}class tQ{constructor(e){this.providerId=tQ.PROVIDER_ID,this.auth=ew(e)}verifyPhoneNumber(e,t){return tY(this.auth,e,(0,s.Ku)(t))}static credential(e,t){return eJ._fromVerification(e,t)}static credentialFromResult(e){return tQ.credentialFromTaggedObject(e)}static credentialFromError(e){return tQ.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:r}=e;return t&&r?eJ._fromTokenResponse(t,r):null}}tQ.PROVIDER_ID="phone",tQ.PHONE_SIGN_IN_METHOD="phone";class tX extends eM{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return eW(e,this._buildIdpRequest())}_linkToIdToken(e,t){return eW(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return eW(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 tZ(e){return tt(e.auth,new tX(e),e.bypassAuthState)}function t0(e){let{auth:t,user:r}=e;return v(r,t,"internal-error"),te(r,new tX(e),e.bypassAuthState)}async function t1(e){let{auth:t,user:r}=e;return v(r,t,"internal-error"),e7(r,new tX(e),e.bypassAuthState)}class t2{constructor(e,t,r,n,i=!1){this.auth=e,this.resolver=r,this.user=n,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:r,postBody:n,tenantId:i,error:s,type:a}=e;if(s)return void this.reject(s);let o={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(a)(o))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return tZ;case"linkViaPopup":case"linkViaRedirect":return t1;case"reauthViaPopup":case"reauthViaRedirect":return t0;default:d(this.auth,"internal-error")}}resolve(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||y(r),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){var t,r;t=this.pendingPromise,r="Pending promise was never set",t||y(r),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}let t3=new w(2e3,1e4);class t5 extends t2{constructor(e,t,r,n,i){super(e,t,n,i),this.provider=r,this.authWindow=null,this.pollId=null,t5.currentPopupAction&&t5.currentPopupAction.cancel(),t5.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return v(e,this.auth,"internal-error"),e}async onExecution(){var e,t;e=1===this.filter.length,t="Popup operations only handle one event",e||y(t);let r=tO();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],r),this.authWindow.associatedEvent=r,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(){return this.authWindow?.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,t5.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(f(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,t3.get())};e()}}t5.currentPopupAction=null;let t6=new Map;class t4 extends t2{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=t6.get(this.auth._key());if(!e){try{let t=await t8(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}t6.set(this.auth._key(),e)}return this.bypassAuthState||t6.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);
190if("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 t8(e,t){var r;let n=ei("pendingRedirect",(r=t).config.apiKey,r.name),i=er(e._redirectPersistence);if(!await i._isAvailable())return!1;let s=await i._get(n)==="true";return await i._remove(n),s}function t9(e,t){t6.set(e._key(),t)}async function t7(e,t,r=!1){if((0,i.xZ)(e.app))return Promise.reject(g(e));let n=ew(e),s=t?er(t):(v(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver),a=new t4(n,s,r),o=await a.execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}class re{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(r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return rr(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!rr(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";t.onError(f(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(rt(e))}saveEventToCache(e){this.cachedEventUids.add(rt(e)),this.lastProcessedEventTime=Date.now()}}function rt(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter(e=>e).join("-")}function rr({type:e,error:t}){return"unknown"===e&&t?.code==="auth/no-auth-event"}async function rn(e,t={}){return C(e,"GET","/v1/projects",t)}let ri=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,rs=/^https?/;async function ra(e){if(e.config.emulator)return;let{authorizedDomains:t}=await rn(e);for(let e of t)try{if(function(e){let t=_(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){let i=new URL(e);return""===i.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&i.hostname===n}if(!rs.test(r))return!1;if(ri.test(e))return n===e;let i=e.replace(/\./g,"\\.");return RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}(e))return}catch{}d(e,"unauthorized-domain")}let ro=new w(3e4,6e4);function rl(){let e=tM().___jsl;if(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 ru=null,rc=new w(5e3,15e3),rh={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},rd=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);async function rf(e){let t,r,n,a,o,l=await (ru=ru||new Promise((t,r)=>{function n(){rl(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{rl(),r(f(e,"network-request-failed"))},timeout:ro.get()})}if(tM().gapi?.iframes?.Iframe)t(gapi.iframes.getContext());else if(tM().gapi?.load)n();else{var i;let t=eI("iframefcb");return tM()[t]=()=>{gapi.load?n():r(f(e,"network-request-failed"))},(i=`${eS.gapiScript}?onload=${t}`,eS.loadJS(i)).catch(e=>r(e))}}).catch(e=>{throw ru=null,e})),u=tM().gapi;return v(u,e,"internal-error"),l.open({where:document.body,url:(v((t=e.config).authDomain,e,"auth-domain-config-required"),r=t.emulator?E(t,"emulator/auth/iframe"):`https://${e.config.authDomain}
190/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:i.MF},(a=rd.get(e.config.apiHost))&&(n.eid=a),(o=e._getFrameworks()).length&&(n.fw=o.join(",")),`${r}?${(0,s.Am)(n).slice(1)}`),messageHandlersFilter:u.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:rh,dontclear:!0},t=>new Promise(async(r,n)=>{await t.restyle({setHideOnLeave:!1});let i=f(e,"network-request-failed"),s=tM().setTimeout(()=>{n(i)},rc.get());function a(){tM().clearTimeout(s),r(t)}t.ping(a).then(a,()=>{n(i)})}))}let rp={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class rg{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}let rm=encodeURIComponent("fac");async function rv(e,t,r,n,a,o){v(e.config.authDomain,e,"auth-domain-config-required"),v(e.config.apiKey,e,"invalid-api-key");let l={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:i.MF,eventId:a};if(t instanceof eZ)for(let[r,n]of(t.setDefaultLanguage(e.languageCode),l.providerId=t.providerId||"",(0,s.Im)(t.getCustomParameters())||(l.customParameters=JSON.stringify(t.getCustomParameters())),Object.entries(o||{})))l[r]=n;if(t instanceof e0){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(),c=u?`#${rm}=${encodeURIComponent(u)}`:"";return`${function({config:e}){return e.emulator?E(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${(0,s.Am)(l).slice(1)}${c}`}let ry="webStorageSupport";class r_{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=tP,this._completeRedirectFn=t7,this._overrideRedirectResult=t9}async _openPopup(e,t,r,n){var i,a;i=this.eventManagers[e._key()]?.manager,a="_initialize() not called before _openPopup()",i||y(a);let o=await rv(e,t,r,_(),n);return function(e,t,r,n=500,i=600){let a=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-n)/2,0).toString(),l="",u={...rp,width:n.toString(),height:i.toString(),top:a,left:o},c=(0,s.ZQ)().toLowerCase();r&&(l=eu(c)?"_blank":r),eo(c)&&(t=t||"http://localhost",u.scrollbars="yes");let h=Object.entries(u).reduce((e,[t,r])=>`${e}${t}=${r},`,"");if(function(e=(0,s.ZQ)()){return ep(e)&&!!window.navigator?.standalone}(c)&&"_self"!==l){var d,f;let e,r;return d=t||"",f=l,(e=document.createElement("a")).href=d,e.target=f,(r=document.createEvent("MouseEvent")).initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),e.dispatchEvent(r),new rg(null)}let p=window.open(t||"",l,h);v(p,e,"popup-blocked");try{p.focus()}catch(e){}return new rg(p)}(e,o,tO())}async _openRedirect(e,t,r,n){var i;return await this._originValidation(e),i=await rv(e,t,r,_(),n),tM().location.href=i,new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){var r;let{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(r="If manager is not set, promise should be",n||y(r),n)}let n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch(()=>{delete this.eventManagers[t]}),n}async initAndGetManager(e){let t=await rf(e),r=new re(e);return t.register("authEvent",t=>(v(t?.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(ry,{type:ry},r=>{let n=r?.[0]?.[ry];void 0!==n&&t(!!n),d(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=ra(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return eg()||el()||ep()}}class rb{constructor(e){this.factorId=e}_process(e,t,r){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,r);case"signin":return this._finalizeSignIn(e,t.credential);default:return y("unexpected MultiFactorSessionType")}}}class rw extends rb{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new rw(e)}_finalizeEnroll(e,t,r){return C(e,"POST","/v2/accounts/mfaEnrollment:finalize",A(e,{idToken:t,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}_finalizeSignIn(e,t){return C(e,"POST","/v2/accounts/mfaSignIn:finalize",A(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()}))}}class rE{static assertion(e){return rw._fromCredential(e)}}rE.FACTOR_ID="phone";class rS{static assertionForEnrollment(e,t){return rI._fromSecret(e,t)}static assertionForSignIn(e,t){return rI._fromEnrollmentId(e,t)}static async generateSecret(e){var t;v(void 0!==e.user?.auth,"internal-error");let r=await C(t=e.user.auth,"POST","/v2/accounts/mfaEnrollment:start",A(t,{idToken:e.credential,totpEnrollmentInfo:{}}));return rk._fromStartTotpMfaEnrollmentResponse(r,e.user.auth)}}rS.FACTOR_ID="totp";class rI extends rb{constructor(e,t,r){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=r}static _fromSecret(e,t){return new rI(t,void 0,e)}static _fromEnrollmentId(e,t){return new rI(t,e)}async _finalizeEnroll(e,t,r){return v(void 0!==this.secret,e,"argument-error"),C(e,"POST","/v2/accounts/mfaEnrollment:finalize",A(e,{idToken:t,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)}))}async _finalizeSignIn(e,t){v(void 0!==this.enrollmentId&&void 0!==this.otp,e,"argument-error");let r={verificationCode:this.otp};return C(e,"POST","/v2/accounts/mfaSignIn:finalize",A(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r}))}}class rk{constructor(e,t,r,n,i,s,a){this.sessionInfo=s,this.auth=a,this.secretKey=e,this.hashingAlgorithm=t,this.co
190deLength=r,this.codeIntervalSeconds=n,this.enrollmentCompletionDeadline=i}static _fromStartTotpMfaEnrollmentResponse(e,t){return new rk(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){let r=!1;return(rT(e)||rT(t))&&(r=!0),r&&(rT(e)&&(e=this.auth.currentUser?.email||"unknownuser"),rT(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}}function rT(e){return void 0===e||e?.length===0}var rA="@firebase/auth",rC="1.13.2";class rx{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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(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(){v(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}let rR=(0,s.XA)("authIdTokenMaxAge")||300,rP=null;function rD(e=(0,i.Sx)()){let t=(0,i.j6)(e,"auth");if(t.isInitialized())return t.getImmediate();let r=function(e,t){let r=(0,i.j6)(e,"auth");if(r.isInitialized()){let e=r.getImmediate(),n=r.getOptions();if((0,s.bD)(n,t??{}))return e;d(e,"already-initialized")}return r.initialize({options:t})}(e,{popupRedirectResolver:r_,persistence:[tH,tA,tP]}),n=(0,s.XA)("authTokenSyncURL");if(n&&"boolean"==typeof isSecureContext&&isSecureContext){let e=new URL(n,location.origin);if(location.origin===e.origin){let t,n=(t=e.toString(),async e=>{let r=e&&await e.getIdTokenResult(),n=r&&(new Date().getTime()-Date.parse(r.issuedAtTime))/1e3;if(n&&n>rR)return;let i=r?.token;rP!==i&&(rP=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))});(0,s.Ku)(r).beforeAuthStateChanged(n,()=>n(r.currentUser)),(0,s.Ku)(r).onIdTokenChanged(e=>n(e),void 0,void 0)}}let a=(0,s.Tj)("auth");return a&&eD(r,`http://${a}`),r}eS={loadJS:e=>new Promise((t,r)=>{let n=document.createElement("script");n.setAttribute("src",e),n.onload=t,n.onerror=e=>{let t=f("internal-error");t.customData=e,r(t)},n.type="text/javascript",n.charset="UTF-8",(document.getElementsByTagName("head")?.[0]??document).appendChild(n)}),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="},n="Browser",(0,i.om)(new o.uA("auth",(e,{options:t})=>{let r,i,s=e.getProvider("app").getImmediate(),a=e.getProvider("heartbeat"),o=e.getProvider("app-check-internal"),{apiKey:l,authDomain:u}=s.options;v(l&&!l.includes(":"),"invalid-api-key",{appName:s.name});let c=new eb(s,a,o,{apiKey:l,authDomain:u,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:em(n)});return i=(Array.isArray(r=t?.persistence||[])?r:[r]).map(er),t?.errorMap&&c._updateErrorMap(t.errorMap),c._initializeWithPersistence(i,t?.popupRedirectResolver),c},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),(0,i.om)(new o.uA("auth-internal",e=>new rx(ew(e.getProvider("auth").getImmediate())),"PRIVATE").setInstantiationMode("EXPLICIT")),(0,i.KO)(rA,rC,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}}(n)),(0,i.KO)(rA,rC,"esm2020")},91790:(e,t,r)=>{"use strict";let n,i,s;r.d(t,{MF:()=>F,j6:()=>D,xZ:()=>O,om:()=>P,Sx:()=>U,Wp:()=>L,KO:()=>j});var a=r(27456),o=r(72457),l=r(19519);let u=new WeakMap,c=new WeakMap,h=new WeakMap,d=new WeakMap,f=new WeakMap,p={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return c.get(e);if("objectStoreNames"===t)return e.objectStoreNames||h.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return g(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function g(e){if(e instanceof IDBRequest){let t;return(t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(g(e.result)),n()},s=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",s)})).then(t=>{t instanceof IDBCursor&&u.set(t,e)}).catch(()=>{}),f.set(t,e),t}if(d.has(e))return d.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),g(u.get(this))}:function(...t){return g(e.apply(m(this),t))}:function(t,...r){let n=e.call(m(this),t,...r);return h.set(n,t.sort?t.sort():[t]),g(n)};return e instanceof IDBTransaction&&function(e){if(c.has(e))return;let t=new Promise((t,r)=>{let n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)});c.set(e,t)}(e),(n||(n=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(t=>e instanceof t)?new Proxy(e,p):e}(e);return t!==e&&(d.set(e,t),f.set(t,e)),t}let m=e=>f.get(e),v=["get","getKey","getAll","getAllKeys","count"],y=["put","add","delete","clear"],_=new Map;function b(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(_.get(t))return _.get(t);let r=t.replace(/FromIndex$/,""),n=t!==r,i=y.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!(i||v.includes(r)))return;let s=async function(e,...t){let s=this.transaction(e,i?"readwrite":"readonly"),a=s.store;
190return n&&(a=a.index(t.shift())),(await Promise.all([a[r](...t),i&&s.done]))[0]};return _.set(t,s),s}p={...s=p,get:(e,t,r)=>b(e,t)||s.get(e,t,r),has:(e,t)=>!!b(e,t)||s.has(e,t)};class w{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{let t;if(t=e.getComponent(),t?.type!=="VERSION")return null;{let t=e.getImmediate();return`${t.library}/${t.version}`}}).filter(e=>e).join(" ")}}let E="@firebase/app",S="0.14.13",I=new o.Vy("@firebase/app"),k="[DEFAULT]",T={[E]:"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"},A=new Map,C=new Map,x=new Map;function R(e,t){try{e.container.addComponent(t)}catch(r){I.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function P(e){let t=e.name;if(x.has(t))return I.debug(`There were multiple attempts to register component ${t}.`),!1;
190for(let r of(x.set(t,e),A.values()))R(r,e);for(let t of C.values())R(t,e);return!0}function D(e,t){let r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function O(e){return null!=e&&void 0!==e.settings}let N=new l.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.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class M{constructor(e,t,r){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new a.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 N.create("app-deleted",{appName:this._name})}}let F="12.14.0";function L(e,t={}){let r=e;"object"!=typeof t&&(t={name:t});let n={name:k,automaticDataCollectionEnabled:!0,...t},i=n.name;if("string"!=typeof i||!i)throw N.create("bad-app-name",{appName:String(i)});if(r||(r=(0,l.T9)()),!r)throw N.create("no-options");let s=A.get(i);if(s)if((0,l.bD)(r,s.options)&&(0,l.bD)(n,s.config))return s;else throw N.create("duplicate-app",{appName:i});let o=new a.h1(i);for(let e of x.values())o.addComponent(e);let u=new M(r,n,o);return A.set(i,u),u}function U(e=k){let t=A.get(e);if(!t&&e===k&&(0,l.T9)())return L();if(!t)throw N.create("no-app",{appName:e});return t}function j(e,t,r){let n=T[e]??e;r&&(n+=`-${r}`);let i=n.match(/\s|\//),s=t.match(/\s|\//);if(i||s){let e=[`Unable to register library "${n}" with version "${t}":`];i&&e.push(`library name "${n}" contains illegal characters (whitespace or "/")`),i&&s&&e.push("and"),s&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),I.warn(e.join(" "));return}P(new a.uA(`${n}-version`,()=>({library:n,version:t}),"VERSION"))}let $="firebase-heartbeat-store",V=null;function B(){return V||(V=(function(e,{blocked:t,upgrade:r,blocking:n,terminated:i}={}){let s=indexedDB.open(e,1),a=g(s);return r&&s.addEventListener("upgradeneeded",e=>{r(g(s.result),e.oldVersion,e.newVersion,g(s.transaction),e)}),t&&s.addEventListener("blocked",e=>t(e.oldVersion,e.newVersion,e)),a.then(e=>{i&&e.addEventListener("close",()=>i()),n&&e.addEventListener("versionchange",e=>n(e.oldVersion,e.newVersion,e))}).catch(()=>{}),a})("firebase-heartbeat-database",{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore($)}catch(e){console.warn(e)}}}).catch(e=>{throw N.create("idb-open",{originalErrorMessage:e.message})})),V}async function W(e){try{let t=(await B()).transaction($),r=await t.objectStore($).get(q(e));return await t.done,r}catch(e){if(e instanceof l.g)I.warn(e.message);else{let t=N.create("idb-get",{originalErrorMessage:e?.message});I.warn(t.message)}}}async function z(e,t){try{let r=(await B()).transaction($,"readwrite"),n=r.objectStore($);await n.put(t,q(e)),await r.done}catch(e){if(e instanceof l.g)I.warn(e.message);else{let t=N.create("idb-set",{originalErrorMessage:e?.message});I.warn(t.message)}}}function q(e){return`${e.name}!${e.options.appId}`}class H{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new K(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){try{let e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=G();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===t||this._heartbeatsCache.heartbeats.some(e=>e.date===t))return;if(this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats.length>30){let e=function(e){if(0===e.length)return -1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){I.warn(e)}}async getHeartbeatsHeader(){try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||0===this._heartbeatsCache.heartbeats.length)return"";let e=G(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){let r=[],n=e.slice();for(let i of e){let e=r.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),Y(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),Y(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=(0,l.Uj)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}catch(e){return I.warn(e),""}}}function G(){return new Date().toISOString().substring(0,10)}class K{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!(0,l.zW)()&&(0,l.eX)().then(()=>!0).catch(()=>!1)}async read(){if(!await this._canUseIndexedDBPromise)return{heartbeats:[]};{let e=await W(this.app);return e?.heartbeats?e:{heartbeats:[]}}}async overwrite(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return z(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){if(await this._canUseIndexedDBPromise){let t=await this.read();return z(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??t.lastSentHeartbeatDate,heartbeats:[...t.heartbeats,...e.heartbeats]})}}}function Y(e){return(0,l.Uj)(JSON.stringify({version:2,heartbeats:e})).length}P(new a.uA("platform-logger",e=>new w(e),"PRIVATE")),P(new a.uA("heartbeat",e=>new H(e),"PRIVATE")),j(E,S,""),j(E,S,"esm2020"),j("fire-js","")},91932:(e,t,r)=>{"use strict";function n(e){if(window.localStorage)return window.localStorage.getItem(e)}function i(e,t){window.localStorage&&localStorage.setItem(e,t)}function s(e){window.localStorage&&localStorage.removeItem(e)}r.d(t,{n5:()=>s,w6:()=>i,zM:()=>n})},92204:(e,t,r)=>{"use strict";r.d(t,{v:()=>a});var n=r(75834);let i=e=>{let t,r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(n,i,s);return s},s=e=>{let t=e?i(e):i,r=e=>(function(e,t=e=>e){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},a=e=>e?s(e):s},92674:(e,t,r)=>{"use strict";r.d(t,{Re:()=>u,_n:()=>o,cD:()=>c,ks:()=>l});var n=r(18389),i=r(7798),s=r(13002),a=r(39655);function o(e,t){let r={id:(0,n.Ak)(12)};for(let n in e)"id"!==n&&(!(n in t)||(0,i.bD)(e[n],t[n]))&&(r[n]=e[n]);for(let n in t)"id"!==n&&(!(n in e)||(0,i.bD)(t[n],e[n]))&&(r[n]=t[n]);return r}function l(e,t){let r={name:e.name};return"country"in e&&e.country&&(r.country=e.country),"zipCode"in e&&e.zipCode&&(r.zipCode=e.zipCode),"city"in e&&e.city&&(r.city=e.city),"streetAddress"in e&&e.streetAddress&&(r.streetAddress=e.streetAddress),"steuernummer"in e&&e.steuernummer&&(r.steuernummer=e.steuernummer),"hasRequestedFZulGFunding"in e&&(r.hasRequestedFZulGFunding=e.hasRequestedFZulGFunding??!1),"registerId"in e&&e.registerId&&(r.registerId=e.registerId),(0,s._Y)({...r,...t})}function u(e){let t=(0,a.j5)({id:(0,n.Ak)(12),name:e.name});return"federalState"in e&&e.federalState&&(t.federalState=e.federalState),"country"in e&&e.country&&(t.country=e.country),"steuernummer"in e&&e.steuernummer&&(t.steuernummer=e.steuernummer),"zipCode"in e&&e.zipCode&&(t.zipCode=e.zipCode),"city"in e&&e.city&&(t.city=e.city),"streetAddress"in e&&e.streetAddress&&(t.streetAddress=e.streetAddress),"registerId"in e&&e.registerId&&(t.registerId=e.registerId),t}function c(e){let t=(0,a.Oh)({id:(0,n.Ak)(12),name:e.name});return"federalState"in e&&e.federalState&&(t.federalState=e.federalState),"hasRequestedFZulGFunding"in e&&e.hasRequestedFZulGFunding&&(t.hasRequestedFZulGFunding=e.hasRequestedFZulGFunding),"steuernummer"in e&&e.steuernummer&&(t.steuernummer=e.steuernummer),"fundingAssessmentBasis"in e&&(t.fundingAssessmentBasis=e.fundingAssessmentBasis),"payoutApplicationDate"in e&&(t.payoutApplicationDate=e.payoutApplicationDate),"payoutApprovalDate"in e&&(t.payoutApprovalDate=e.payoutApprovalDate),"registerId"in e&&e.registerId&&(t.registerId=e.registerId),t}},93810:(e,t,r)=>{"use strict";r.d(t,{K5:()=>g,ZL:()=>c,Zn:()=>l,aF:()=>f,iJ:()=>p,kV:()=>u,kg:()=>d,u5:()=>h});var n,i,s,a=r(45964),o=r(34029),l=((n=l||{}).InCreation="in_creation",n.AccessGranted="access_granted",n.Active="active",n.Ended="ended",n),u=((i=u||{}).NoRDFit="no_rd_fit",i.InsufficientCost="insufficient_cost",i.CustomerInsolvent="customer_insolvent",i.IncompatibleCorporateStructure="incompatible_corporate_structure",i.BSFZRejection="bsfz_rejection",i.ProjectDiscontinued="project_discontinued",i.ProjectCompleted="project_completed",i.AlternativeFundingUsed="alternative_funding_used",i.Declined="declined",i);let c={no_rd_fit:"No R&D Fit",insufficient_cost:"Insufficient Cost",customer_insolvent:"Customer insolvent",incompatible_corporate_structure:"Incompatible Corporate Structure",bsfz_rejection:"BSFZ Rejection",project_discontinued:"Project Discontinued",project_completed:"Project Completed",alternative_funding_used:"Alternative Funding Used",declined:"Declined"};var h=((s=h||{}).Personio="personio",s);
190function d(e,t){let{contactUser:r}=e,n={id:r?.id||t.createdBy,displayName:r?.displayName||t.createdByDisplayName,email:r?.email||t.createdByEmail};return r?.preferredLanguage&&(n.preferredLanguage=r.preferredLanguage),n}function f(e){let t=(0,o.wL)(e.acceptedCoupToSAt);return null!==t&&t.validFrom>=new Date("2025-05-26")}function p(e,t){return e.excludedFiscalYears?.[t]}function g(e,t){let{year:r}=(0,a.Ue)(t);return void 0!==p(e,r)}},95498:(e,t,r)=>{"use strict";r.d(t,{w:()=>i});var n=r(74226);function i(e,t){return"function"==typeof e?e(t):e&&"object"==typeof e&&n._P in e?e[n._P](t):e instanceof Date?new e.constructor(t):new Date(t)}},95926:e=>{"use strict";e.exports=JSON.parse('{"id":"google-maps-embed","description":"Embed a Google Maps embed on your webpage","website":"https://developers.google.com/maps/documentation/embed/get-started","html":{"element":"iframe","attributes":{"loading":"lazy","src":{"url":"https://www.google.com/maps/embed/v1/place","slugParam":"mode","params":["key","q","center","zoom","maptype","language","region"]},"referrerpolicy":"no-referrer-when-downgrade","frameborder":"0","style":"border:0","allowfullscreen":true,"width":null,"height":null}}}')},96986:(e,t,r)=>{"use strict";r.d(t,{Ss:()=>l,ef:()=>a,xM:()=>o});let n=/^D+$/,i=/^Y+$/,s=["D","DD","YY","YYYY"];function a(e){return n.test(e)}function o(e){return i.test(e)}function l(e,t,r){var n,i,a;let o,l=(n=e,i=t,a=r,o="Y"===n[0]?"years":"days of the month",`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${i}\`) for formatting ${o} to the input \`${a}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`);if(console.warn(l),s.includes(e))throw RangeError(l)}},98273:(e,t,r)=>{"use strict";r.d(t,{f:()=>s});var n=r(34001),i=r(6792);function s(e){return!(!(0,n.$)(e)&&"number"!=typeof e||isNaN(+(0,i.a)(e)))}},98381:(e,t,r)=>{"use strict";r.d(t,{d:()=>i});var n=r(6792);function i(e,t){return+(0,n.a)(e)>+(0,n.a)(t)}},99046:()=>{},99132:function(e,t,r){"use strict";var n=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.sendGTMEvent=void 0,t.GoogleTagManager=function(e){let{gtmId:t,gtmScriptUrl:r,dataLayerName:n="dataLayer",auth:l,preview:u,dataLayer:c,nonce:h}=e;o=n;let d=new URL(r||"https://www.googletagmanager.com/gtm.js");return t&&d.searchParams.set("id",t),"dataLayer"!==n&&d.searchParams.set("l",n),l&&d.searchParams.set("gtm_auth",l),u&&(d.searchParams.set("gtm_preview",u),d.searchParams.set("gtm_cookies_win","x")),(0,s.useEffect)(()=>{performance.mark("mark_feature_usage",{detail:{feature:"next-third-parties-gtm"}})},[]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.default,{id:"_next-gtm-init",dangerouslySetInnerHTML:{__html:` 191 (function(w,l){ 192 w[l]=w[l]||[]; 193 w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'}); 194 ${c?`w[l].push(${JSON.stringify(c)})`:""} 195 })(window,'${n}');`},nonce:h}),(0,i.jsx)(a.default,{id:"_next-gtm","data-ntpc":"GTM",src:d.href,nonce:h})]})};let i=r(26514),s=r(75834),a=n(r(83191)),o="dataLayer";t.sendGTMEvent=(e,t)=>{let r=t||o;window[r]=window[r]||[],window[r].push(e)}},99582:(e,t,r)=>{"use strict";function n(e){return[...new Set(e)].length===e.length}function i(e,t){return 0===e&&0===t?0:(t-e)/e}function s(e,t){return"number"==typeof e&&"number"==typeof t?e+t:"number"==typeof e?e:"number"==typeof t?t:""}function a(e){return"number"==typeof e}r.d(t,{Et:()=>a,_t:()=>s,pW:()=>n,sq:()=>i})}},e=>{var t=t=>e(e.s=t);e.O(0,[6593,8792],()=>(t(20446),t(77269))),_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.